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
# Based on: http://vikinghammer.com/2012/05/16/rake-task-mongoid-index/ | |
# Usage: rake mongoid:create_indexes[ENV_TYPE_HERE] | |
require 'mongoid' | |
require 'logger' | |
logger = Logger.new($stdout) | |
ROOT = File.expand_path('.', File.dirname(__FILE__)) | |
namespace :mongoid do |
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 'spec_helper' | |
require 'myapi' | |
describe API::MyAPI do | |
include Rack::Test::Methods | |
def app | |
API::MyAPI | |
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
// Service for checking the availability of a given word | |
Splitter.module('Checkers', function(Checkers, Splitter) { | |
var LocalChecker = { | |
comKeyFor: function(compound) { | |
return 'avail/.com/' + compound; | |
}, | |
check: function(compound) { |
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
namespace :app do | |
require 'rails/code_statistics' | |
APP_STATS_DIRECTORIES = STATS_DIRECTORIES + [ | |
['Javascripts', 'app/assets/javascripts', /.*\.(js|coffee)$/], | |
['Stylesheets', 'app/assets/stylesheets', /.*\.(css|scss|erb)$/], | |
].collect { |name, dir, pattern| [ name, "#{Rails.root}/#{dir}", pattern ] }.select { |name, dir| File.directory?(dir) } | |
class AppCodeStatistics < CodeStatistics | |
def initialize(*pairs) | |
@pairs = pairs |
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
module Sequel | |
class Database | |
def create_table_from_generator(name, generator, options) | |
sql = create_table_sql(name, generator, options) | |
if options.has_key? :inherits | |
sql = "#{ sql } INHERITS (#{ options[:inherits] })" | |
end | |
execute_ddl(sql) | |
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
name,alpha2,alpha3,latitude,longitude | |
Afghanistan,AF,AFG,33.93911,67.709953 | |
Albania,AL,ALB,41.153332,20.168331 | |
Algeria,DZ,DZA,28.033886,1.659626 | |
American Samoa,AS,ASM,-14.270972,-170.132217 | |
Andorra,AD,AND,42.546245,1.601554 | |
Angola,AO,AGO,-11.202692,17.873887 | |
Anguilla,AI,AIA,18.220554,-63.068615 | |
Antarctica,AQ,ATA,-75.250973,-0.071389 | |
Antigua and Barbuda,AG,ATG,17.060816,-61.796428 |
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
# encoding: UTF-8 | |
class Countries < ActiveRecord::Migration | |
def up | |
create_table :countries do |t| | |
t.column :alpha2, :string, :size => 2 | |
t.column :alpha3, :string, :size => 3 | |
t.column :name, :string, :size => 80 | |
t.column :latitude, :float | |
t.column :longitude, :float |
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
vagrant@precise64:/vagrant$ unicorn -c config/unicorn.rb # also tried rails server | |
I, [2013-09-19T18:04:00.253410 #10719] INFO -- : Refreshing Gem list | |
/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- devise/orm/sequel (LoadError) | |
from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `block in require' | |
from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:in `load_dependency' | |
from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require' | |
from /vagrant/config/initializers/devise.rb:22:in `block in <top (required)>' | |
from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/devise-3.1.0/lib/devise.rb:276:in `setup' | |
from /vagrant/config/initiali |
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
Key shortcuts: | |
ctl-a " - list all screens | |
ctl-a A - rename screen | |
ctl-a a - previous screen | |
ctl-a 0/1/2/3/4/etc - switch to that screen | |
ctl-a d - detaches from the screen | |
Screen command line shortcuts: | |
screen - creates a new screen | |
screen -ls - list all screens |
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
// Still a work in progress | |
// NOTE: Requires Rangy 1.3alpha to use the word options with expand | |
// NOTE: Must include the core and the text select libraries | |
// TODO: Update loop to use rangy node iterator | |
// TODO: Only return email addresses | |
function getEmailUnderCursor(elem, x, y) { | |
if(elem.nodeType == elem.TEXT_NODE) { | |
//var doc_range = elem.ownerDocument.createRange(); | |
var range = rangy.createRange(); |
OlderNewer