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
/^[0]?[789]\d{9}$/ | |
Matches | |
09878767656 | |
or | |
9878767656 | |
or | |
7898987656 |
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
# 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 |
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
# 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 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 'fileutils' | |
Dir.glob("#{Dir.pwd}/path/to/folder/*.html.erb").map{|f| FileUtils.mv f, f.gsub('.erb', '') + '.haml'} |
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
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 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
//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 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
# /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 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
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 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
(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? |