It includes generic Rakefile for other projects
- Clone this gist
- Install + build V8: http://code.google.com/apis/v8/build.html
- Set V8 env variable to path of v8, e.g. V8=/Users/drnic/js/v8
- Run "rake" to build and run app
| export COLOR_NC='\e[0m' # No Color | |
| export COLOR_WHITE='\e[1;37m' | |
| export COLOR_BLACK='\e[0;30m' | |
| export COLOR_BLUE='\e[0;34m' | |
| export COLOR_LIGHT_BLUE='\e[1;34m' | |
| export COLOR_GREEN='\e[0;32m' | |
| export COLOR_LIGHT_GREEN='\e[1;32m' | |
| export COLOR_CYAN='\e[0;36m' | |
| export COLOR_LIGHT_CYAN='\e[1;36m' | |
| export COLOR_RED='\e[0;31m' |
| ## | |
| # Simple class that makes File.* class methods available on a | |
| # Filename object | |
| # | |
| # doctest: Can call File’s class methods on a Filename object | |
| # >> Filename.new ("/tmp/myfile.png").dirname | |
| # => "/tmp" | |
| # | |
| # doctest: Can create a Filename from another Filename object | |
| # >> path = "/tmp/myfile.png" |
It includes generic Rakefile for other projects
| class PonyList | |
| def initialize(ponies = []) | |
| @ponies = ponies | |
| end | |
| def empty? | |
| @ponies.empty? | |
| end | |
| def add(pony) |
| # from http://www.pixelbeat.org/settings/.inputrc | |
| # By default up/down are bound to previous-history | |
| # and next-history respectively. The following does the | |
| # same but gives the extra functionality where if you | |
| # type any text (or more accurately, if there is any text | |
| # between the start of the line and the cursor), | |
| # the subset of the history starting with that text | |
| # is searched (like 4dos for e.g.). |
| #!/usr/bin/env ruby | |
| $:.unshift(File.dirname(__FILE__) + "/../lib") | |
| require "rubygems" | |
| begin | |
| require "gist" | |
| rescue LoadError | |
| puts "Please install rubygem 'gist' to use this command" | |
| exit | |
| end |
| require "hpricot" | |
| Shoes.app do | |
| # Just a simple app, yes? | |
| @title = title "..." | |
| download "https://github.com/?login=drnic&token=mytoken", | |
| # download "https://github.com", :body => { "login" => 'drnic', "token" => '6c131adb79448cb80d166b448c446fb2' }, :method => "GET", | |
| :start => proc { |dl| para "starting..." }, | |
| :finish => proc { |dl| | |
| doc = Hpricot(dl.response.body) |
| # SUPER DARING APP TEMPLATE 1.0 | |
| # By Peter Cooper | |
| # Link to local copy of edge rails | |
| inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
| # Delete unnecessary files | |
| run "rm README" | |
| run "rm public/index.html" | |
| run "rm public/favicon.ico" |
| require 'hotcocoa' | |
| include HotCocoa | |
| class Application | |
| def start | |
| application :name => "Download And Scrape Html" do |app| | |
| app.delegate = self | |
| window :frame => [100, 100, 500, 500], :title => "Download And Scrape Html" do |win| | |
| win << label(:text => "Hello from HotCocoa", :layout => {:start => false}) |
| class SpeechController | |
| # from - (void)speechSynthesizer:(NSSpeechSynthesizer *)sender willSpeakWord:(NSRange)wordToSpeak ofString:(NSString *)text | |
| def speechSynthesizer(sender, willSpeakWord: wordToSpeak, ofString: text) | |
| end | |
| # from speechSynthesizer:willSpeakWord:ofString: | |
| def speechSynthesizer(speechSynthesizer, willSpeakWord: speakWord, ofString: string) | |
| end |