a complete example project is forkable from https://github.com/rmoriz/hue_rubymotion_example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'websocket/driver' | |
require 'socket' | |
require 'forwardable' | |
require 'celluloid/io' | |
class WSDTester | |
include Celluloid::IO | |
include Celluloid::Logger | |
extend Forwardable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env macruby | |
# encoding: utf-8 | |
CALENDARS = ['Michal Cichra', 'Calendar'] # Set names of calendars to show | |
before = 3 # days to show before today | |
after = 10 # days to show after today | |
today = 'dnes' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Relevant Code::: | |
var Course = Backbone.Model.extend({ | |
url : function(){ | |
var base = 'courses' | |
if (this.isNew()) return base; | |
return base + (base.charAt(base.length-1) == '/'?'' : '/') + this.id; | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~ | |
# Install the required JDK | |
sudo apt-get install openjdk-6-jre-headless | |
# Download, extract and move ElasticSearch | |
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz | |
rm elasticsearch.tar.gz | |
sudo mv elasticsearch-* elasticsearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
read -s -r -d '' SCRIPT <<"EOF" | |
framework 'ScriptingBridge' | |
rating = ARGV.pop | |
itunes = SBApplication.applicationWithBundleIdentifier("com.apple.itunes") | |
track = itunes.currentTrack | |
track.rating = rating.to_f*20 | |
puts "#{track.artist} - #{track.name} rated #{rating} stars" | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
preload_app true | |
worker_processes 2 | |
listen 3000 | |
before_fork do |server, worker| | |
ActiveRecord::Base.connection.disconnect! | |
end | |
after_fork do |server, worker| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# 1. Drop this file into lib/capistrano/remote_cache_with_project_root_strategy.rb | |
# 2. Add the following to your Capfile: | |
# require 'capistrano/git' | |
# require './lib/capistrano/remote_cache_with_project_root_strategy' | |
# 3. Add the following to your config/deploy.rb | |
# set :git_strategy, RemoteCacheWithProjectRootStrategy | |
# set :project_root, 'subdir/path' | |
# Define a new SCM strategy, so we can deploy only a subdirectory of our repo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BARE_EDITOR="/home/rgrau/programmingStuff/emacs-snapshot/bin/emacsclient" | |
function elm { | |
last_mig=$(ls -tr db/migrate | tail -n1) | |
$BARE_EDITOR -n db/migrate/$last_mig | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias rt="ruby -Itest -I. -e \"alias rt="ruby -Itest -I. -e \"require'pathname';P=Pathname;ARGV.map{|a|p=P.new(a);next unless p.exist?;p.directory?? P.glob(p.join('**/*.rb')):p}.flatten.compact.uniq.each{|p|require p.expand_path}\""\"" |
OlderNewer