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
#0 0x91745aa7 in CFStringGetLength () | |
#1 0x00297ea8 in rb_str_split_m () | |
#2 0x002be165 in call_cfunc () | |
#3 0x002cea93 in vm_call_method () | |
#4 0x002c432e in vm_eval () | |
#5 0x002ca8ab in vm_eval_body () | |
#6 0x002d386d in rb_yield () | |
#7 0x001cdfd5 in rb_ary_each () | |
#8 0x002cea93 in vm_call_method () | |
#9 0x002c432e in vm_eval () |
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
(defvar *emacs-load-start* (current-time)) | |
(add-to-list 'load-path "~/lib/slime-2.0/") ; your SLIME directory | |
(setq inferior-lisp-program "/usr/local/bin/sbcl") ; your Lisp system | |
(require 'slime) | |
(slime-setup) | |
(add-to-list 'load-path "/opt/local/share/emacs/site-lisp/") | |
;(require 'ecb) | |
(require 'ecb-autoloads) | |
(add-to-list 'load-path "~/.emacs.d/fuzzy-find-in-project") | |
(require 'fuzzy-find-in-project) |
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
= error_messages_for :grammar_rule, :id => "error" | |
- form_for(@grammar_rule) do |f| | |
%div | |
About Rule | |
= f.text_field :title | |
%div | |
About language | |
=f.select :language_id,@languages.map{|x| [t(x), x.id] } | |
- f.fields_for :explanations do |e| | |
%div |
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 ruby | |
unless ARGV[0] | |
puts 'Usage: newpost "the post title"' | |
exit(-1) | |
end | |
date_prefix = Time.now.strftime("%Y-%m-%d") | |
postname = ARGV[0].strip.downcase.gsub(/ /, '-') | |
post = "#{Dir.pwd}/_posts/#{date_prefix}-#{postname}.textile" |
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 'compass' | |
require 'ninesixty' | |
# If you have any compass plugins, require them here. | |
Sass::Plugin.on_updating_stylesheet do |template, css| | |
puts "Compiling #{template} to #{css}" | |
end | |
puts 'xxxx' | |
Compass.configuration do |config| | |
config.project_path = RAILS_ROOT | |
config.sass_dir = "app/stylesheets" |
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
class Foo | |
def self.create(options = {}) | |
if options[:queue] | |
self.instance_eval do | |
def queue | |
#{options[:queue].to_sym} | |
end | |
end | |
end |
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
extract_data = Proc.new {|x| "path/#{x['description'].gsub(/[\r\n]+/," ")}\n" } | |
json['lists'].each do |x| | |
s = extract_data(x).call | |
puts s | |
end |
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
class TwitterStream < EventMachine::Connection | |
def self.connect | |
EventMachine::HttpRequest.new("http://stream.twitter.com/1/statuses/filter.json").post({ | |
:body =>{'track' => 'hello,world,how,are,you'}, | |
:head => { 'Authorization' => [ 'user','pass' ] } | |
}) | |
end | |
def on_error &block | |
puts "reconnecting" | |
reconnect |
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 'em-http' | |
EM.run do | |
def dispatch(opts) | |
opts | |
puts opts | |
h = EM::HttpRequest.new(opts[:uri]).get | |
h.callback { |rep| opts[:cb].call(rep) if opts[:cb] } |
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 'redis' | |
require 'redis/connection/synchrony' | |
require "em-synchrony/fiber_iterator" | |
require 'bloomfilter-rb' | |
max = 10_000 | |
EM.synchrony do | |
LBF = BloomFilter::Redis.new(:size => max, :hashes => 2, :seed => 1,:namespace => "test") | |
process_queue = lambda do | |
Fiber.new{ | |
OlderNewer