This file contains hidden or 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
| Shoes.app :width => 600, :height => 400 do | |
| flow :width => 400, :height => 400, :margin => 20 do | |
| fill '#dfd' | |
| stroke '#ddd' | |
| rect 0, 0, 200, 200 | |
| background white | |
| end | |
| background black |
This file contains hidden or 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
| class String | |
| def -@ | |
| 'unary minus redefined' | |
| end | |
| end | |
| -"foobar" # => 'unary minus redefined' |
This file contains hidden or 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 'forwardable' | |
| module SingletonCollection | |
| module Methods | |
| extend Forwardable | |
| def_delegators :@storage, *Array.instance_methods(inherited=false) | |
| attr_accessor :current_index | |
| def current |
This file contains hidden or 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
| # based on http://www.ruby-doc.org/stdlib/libdoc/delegate/rdoc/index.html | |
| require 'delegate' | |
| class SimpleDelegator < Delegator | |
| def initialize(obj) | |
| super # pass obj to Delegator constructor, required | |
| @_sd_obj = obj # store obj for future use | |
| end | |
| def __getobj__ |
This file contains hidden or 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
| # Initialize git | |
| git :init | |
| git :submodule => "init" | |
| # Link to local copy of edge rails | |
| inside('vendor') { run 'ln -s ~/code/rails/rails rails' } | |
| # Generate Simple controller | |
| generate :controller, :simple | |
| route "map.site '/:action/:id', :controller => 'simple'" |
This file contains hidden or 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 'digest/sha1' | |
| class String | |
| def hash | |
| Digest::SHA1.hexdigest self | |
| end | |
| def bit | |
| "%0160b" % to_i(16) | |
| end |
This file contains hidden or 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
| namespace 'sync' do | |
| desc "Sync data from server with client" | |
| task :client do | |
| host, user = credentials | |
| puts `rsync -rlpgtvz --delete #{user}@#{host}:#{remote_project}/public/system/ public/system` | |
| puts 'Transfering data.yml' | |
| Net::SSH.start host, user do |cmd| | |
| cmd.exec! 'rake RAILS_ENV=production db:data:dump' | |
| cmd.scp.download! "#{remote_project}/db/data.yml", 'db/data.yml' |
This file contains hidden or 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
| application_name = root.split('/').last | |
| initializer 'session_store.rb', <<-END | |
| ActionController::Base.session = { | |
| :key => '_#{application_name}_session', | |
| :secret => '#{ActiveSupport::SecureRandom.hex(64)}' | |
| } | |
| # ActionController::Base.session_store = :active_record_store | |
| END |
This file contains hidden or 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
| diff -ur old/src-ILU/ilur/ilur.c new/src-ILU/ilur/ilur.c | |
| --- old/src-ILU/ilur/ilur.c 2009-09-08 05:31:29.000000000 +0400 | |
| +++ new/src-ILU/ilur/ilur.c 2009-09-07 07:32:33.000000000 +0400 | |
| @@ -1,6 +1,6 @@ | |
| #include <string.h> | |
| #include <stdio.h> | |
| -#include <malloc.h> | |
| +#include <malloc/malloc.h> | |
| #include <IL/il.h> |
OlderNewer