Skip to content

Instantly share code, notes, and snippets.

View wiserfirst's full-sized avatar
🎯
Focusing

Qing Wu wiserfirst

🎯
Focusing
  • Australia
View GitHub Profile
@wiserfirst
wiserfirst / rbenv-install-system-wide.sh
Created December 9, 2015 00:17 — forked from jnx/rbenv-install-system-wide.sh
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@wiserfirst
wiserfirst / base_controller.rb
Last active December 9, 2015 04:53 — forked from dhoelzgen/base_controller.rb
CORS in Rails 4 APIs
class Api::BaseController < ActionController::Base
protect_from_forgery with: :null_session
before_action :authenticate, :except => [:preflight_check]
after_action :cors_set_access_control_headers
def preflight_check
if request.method == 'OPTIONS'
render :text => '', :content_type => 'text/plain'
end
@wiserfirst
wiserfirst / introrx.md
Last active August 29, 2015 14:24 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@wiserfirst
wiserfirst / m4aconvert.rb
Last active August 29, 2015 14:03 — forked from danhigham/mp4convert.rb
Convert all m4a files in a directory into mp3
#!/usr/bin/env ruby
require 'rubygems'
require 'mp4info'
path = ARGV[0]
Dir.foreach(path) do |file|
file_path = File.join path, file