Skip to content

Instantly share code, notes, and snippets.

View brainopia's full-sized avatar

Ravil Bayramgalin brainopia

View GitHub Profile
We couldn’t find that file to show.
@brainopia
brainopia / gist:2431
Created July 25, 2008 12:32
unexpected behavior of background method (_why fixed this already)
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
class String
def -@
'unary minus redefined'
end
end
-"foobar" # => 'unary minus redefined'
require 'forwardable'
module SingletonCollection
module Methods
extend Forwardable
def_delegators :@storage, *Array.instance_methods(inherited=false)
attr_accessor :current_index
def current
# 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__
# 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'"
require 'digest/sha1'
class String
def hash
Digest::SHA1.hexdigest self
end
def bit
"%0160b" % to_i(16)
end
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'
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
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>