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
(asdf:operate 'asdf:load-op '#:restas) | |
(restas:define-module #:restas.hello-world | |
(:use :cl)) | |
(in-package #:restas.hello-world) | |
(restas:define-route main ("") | |
"<h1>Hello world!</h1>") |
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
$ rspec spec | |
/Users/foo/.rvm/gems/ruby-2.0.0-p353@bar/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require': cannot load such file -- active_support/base64 (LoadError) | |
from /Users/foo/.rvm/gems/ruby-2.0.0-p353@bar/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require' | |
from /Users/foo/.rvm/gems/ruby-2.0.0-p353@bar/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency' | |
from /Users/foo/.rvm/gems/ruby-2.0.0-p353@bar/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require' | |
from /Users/foo/.rvm/gems/ruby-2.0.0-p353@bar/bundler/gems/active_merchant-e555501cba35/lib/active_merchant.rb:33:in `<top (required)>' | |
from /Users/foo/.rvm/gems/ruby-2.0.0-p353@bar/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require' | |
from /Users/foo/.rvm/gems/ruby-2.0.0-p353@bar/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require' | |
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
(rdb:1) @filter | |
{:grid_id=>8, :from=>Mon, 16 Dec 2013 10:27:58 UTC +00:00, :to=>Tue, 24 Dec 2013 10:27:58 UTC +00:00, :completed=>false} | |
(rdb:1) @filter[:completed].present? | |
false | |
(rdb:1) @filter[:to].present? |
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
User.invite!({:email => "[email protected]", :name => "name one"}, User.first) | |
def headers_for(action) | |
headers = {} | |
case action | |
when :invitation_instructions | |
headers.merge!({ | |
:subject => self.invited_by ? self.invited_by.name.titleize + " invited you to MyApp" : "Invitation", | |
:reply_to => self.invited_by ? self.invited_by.to_e : "", | |
:from => self.invited_by ? "#{self.invited_by.name.gsub(/\W/, ' ').titleize} via MyApp <[email protected]>" : "MyApp <[email protected]>" |
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
# /initializers/redis.rb | |
uri = URI.parse(ENV["REDISTOGO_URL"] || "redis://localhost:6379/" ) | |
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) | |
# /initializers/resque.rb | |
Resque.redis = REDIS | |
# unicorn.rb |
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
//Written by: http://ondras.zarovi.cz/ | |
//http://jsfiddle.net/ondras/hYfN3/ | |
// <p>Inspired by <a href="http://thomasstreet.net/blog/spreadsheet.html">http://thomasstreet.net/blog/spreadsheet.html</a>. Features:</p> | |
// <ul> | |
// <li>Under 30 lines of vanilla JavaScript</li> | |
// <li>Libraries used: <strong>none</strong></li> | |
// <li>Excel-like syntax (formulas start with "=")</li> | |
// <li>Support for arbitrary expressions (=A1+B2*C3)</li> |
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
STOP_WORDS = ["the", "be", "and", "of", "a", "in", "to", "have", "to", "it", "I", "that", "for", "you", "he", "with", "on", "do", "say", "this", "they", "at", "but", "we", "his", "from", "that", "not", "n't", "n't", "by", "she", "or", "as", "what", "go", "their", "can", "who", "get", "if", "would", "her", "all", "my", "make", "about", "know", "will", "as", "up", "one", "time", "there", "year", "so", "think", "when", "which", "them", "some", "me", "people", "take", "out", "into", "just", "see", "him", "your", "come", "could", "now", "than", "like", "other", "how", "then", "its", "our", "two", "more", "these", "want", "way", "look", "first", "also", "new", "because", "day", "more", "use", "no", "man", "find", "here", "thing", "give", "many", "well", "only", "those", "tell", "one", "very", "her", "even", "back", "any", "good", "woman", "through", "us", "life", "child", "there", "work", "down", "may", "after", "should", "call", "world", "over", "school", "still", "try", "in", "as", "last", "ask", "need", "too", " |
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 'fileutils' | |
Dir.glob("#{Dir.pwd}/path/to/folder/*.html.erb").map{|f| FileUtils.mv f, f.gsub('.erb', '') + '.haml'} |
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
# server.rb | |
require 'socket' | |
require 'debugger' | |
# An event can be anything, rss feed, tweet, etc | |
class Event | |
attr_reader :event_attributes | |
def initialize(event = []) | |
@event_attributes = event | |
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
# server.rb | |
require 'eventmachine' | |
# An event can be anything, rss feed, tweet, etc | |
class Event | |
attr_reader :event_attributes | |
def initialize(event = []) | |
@event_attributes = event | |
end |