Skip to content

Instantly share code, notes, and snippets.

View jacquescrocker's full-sized avatar

Jacques Crocker jacquescrocker

View GitHub Profile
require 'json'
require 'open-uri'
class DependencyChecker
def initialize(*gems)
@gems = gems.flatten
@dep_cache = {}
end
def all_dependencies
# Mongoid association matchers for RSpec 2.x and 1.x
#
# Save this file to your spec/support directory
#
# Usage:
#
# describe User do
# it { should reference_one :profile }
# end
#
#!/usr/bin/env sh
source "$HOME/.rvm/scripts/rvm"
rvm default
__rvm_load_rvmrc
cd .
export BUNDLE_PATH=$GEM_HOME
exec ruby "$@"
@timtyrrell
timtyrrell / gist:1903287
Created February 24, 2012 19:52
1.9.3 ruby debug install
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
gem install linecache19-0.5.13.gem
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rvm/src/ruby-1.9.3-p0
OR if Falcon the last one is use the one below (or whatever)
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rvm/src/ruby-1.9.3-p0-falcon
module GGeocode
### ref: http://code.google.com/apis/maps/documentation/geocoding/
GGeocode::Version = '0.0.3'
def GGeocode.version
GGeocode::Version
end
require 'net/http'
@jimsynz
jimsynz / why.md
Created June 25, 2012 23:12
Hamlbars nested conditions

You wrote:

= hb 'if content.condition1' do
  = hb 'if content.condition2' do
    %p Some paragraph
    = hb 'else'
      %p another paragraph
  = hb 'else'
 %p third paragraph
@remi
remi / natural_dates.rb
Created November 5, 2012 22:11
Natural Dates in Ruby
#!/usr/bin/env ruby
require "date"
class Fixnum
Date::MONTHNAMES[1..-1].each_with_index do |month, index|
define_method month.downcase do |year|
Date.new(year, index+1, self)
end
end
end
scope '/api' do
resources :users, except: [:edit]
end
root to: 'ember#index'
get '*path' => 'ember#index'
@ajsharp
ajsharp / rerun_migrations.rb
Created June 18, 2013 22:38
rake db:migrate:rerun VERSION=123
namespace :db do
namespace :migrate do
desc "Re-run a migration that's already been run"
task :rerun => [:environment, :load_config] do
class ActiveRecord::Migrator
def rerun
target = migrations.detect { |m| m.version == @target_version }
raise UnknownMigrationVersionError.new(@target_version) if target.nil?
target.migrate(:up)
end
@pizzarob
pizzarob / 01_DropZone.jsx
Last active November 14, 2017 08:28
HTML5 Drag and Drop File Upload React Component
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
const ANIMATION_DURATION = 1000;
class BatchDropZone extends React.Component {
static propTypes = {