Skip to content

Instantly share code, notes, and snippets.

View safarista's full-sized avatar

Nelson Kelem safarista

View GitHub Profile
@peterhellberg
peterhellberg / Gemfile
Created April 10, 2012 11:51
Sinatra acceptance testing, using minitest/spec and capybara-webkit
source :rubygems
gem "sinatra", "~> 1.3.2"
group :test do
gem "minitest", "~> 2.10"
gem "rack-test", "~> 0.6.1"
gem "capybara", "~> 1.1"
gem "capybara-webkit", "~> 0.11"
gem "capybara_minitest_spec", "~> 0.2"
@peterhellberg
peterhellberg / kick.rb
Created September 3, 2012 20:49
Tiny File System Event kicker
#!/usr/bin/env ruby
require 'rubygems'
require 'rb-fsevent'
cmd, *paths = ARGV
if cmd && paths.any?
system cmd
fsevent = FSEvent.new
fsevent.watch(paths) { system cmd }
fsevent.run
@ryanb
ryanb / abilities.rb
Created September 15, 2012 19:23
How you can break up large Ability class in CanCan
module Abilities
def self.ability_for(user)
if user.admin?
AdminAbility.new(user)
else user
MemberAbility.new(user)
else
GuestAbility.new
end
end
@runemadsen
runemadsen / app.rb
Created September 28, 2012 01:09
Creating a blog in Sinatra and Datamapper
require 'sinatra'
require 'dm-core'
DataMapper::setup(:default, {:adapter => 'yaml', :path => 'db'})
class BlogPost
include DataMapper::Resource
property :id, Serial
property :title, String
property :body, Text
@ehoch
ehoch / Full Site SSL.md
Last active December 11, 2015 17:49
Full Site SSL in Spree

Curious how Alarm Grid went full site-wide SSL using Spree? Just create the one decorator below and you're good to go!

Note: This gist will not redirect .xml files so that our feeds do not error out on iPhones which do not support RSS feeds in https.

@siddharthbhagwan
siddharthbhagwan / Gemfile
Created February 4, 2014 11:02
Sample Implementation of Action Controller Live
source 'https://rubygems.org'
gem 'rails', '4.0.2'
gem "redis-rails", "~> 4.0.0"
gem 'puma'
gem 'unicorn'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'