Skip to content

Instantly share code, notes, and snippets.

Mike Pence mikepence

  • Florida
View GitHub Profile
@brianpetro
brianpetro / rails-4-new-options
Created Apr 28, 2015
Command line options for ` rails new --help ` (Rails 4.2). Useful for planning new Ruby on Rails app. 'Where can I find options for “rails new” command?'
View rails-4-new-options
Because I couldn't find these with a quick Google search on 28 April 2015:
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /home/brian/.rvm/rubies/ruby-2.2.0/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
@litch
litch / Gemfile
Created Feb 24, 2013
Ruby 2.0.0 installation with RVM and running on heroku. RVM instructions sourced from: https://coderwall.com/p/tptocq A quick comparison of Ruby 2.0.0 performance loading rails can be found at my blog: www.superpumpup.com
View Gemfile
source 'https://rubygems.org'
ruby "2.0.0"
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
...
@brianknapp
brianknapp / create_request.rb
Created Feb 12, 2013
This is sample code for a CreateRequest object. I don't know exactly what this is supposed to do, so I'm going to make this up as I go. Hopefully it is helpful to show multiple jacks on one action.
View create_request.rb
class CreateRequest
def initialize request_jack, notification_jack, payment_jack
@request_jack = request_jack
@notification_jack = notification_jack
@payment_jack = payment_jack
end
def execute input
unless input.has_shape? user_id: Fixnum, text: String, amount: Float, who_to_notify: Fixnum
@ambethia
ambethia / life.rb
Last active Sep 28, 2015
My implementation of Conway's Game of Life
View life.rb
# Run this:
# ruby < <(curl -s https://gist.github.com/ambethia/1429621/raw/life.rb)
require 'curses'
class Life
extend Curses
CELL_CHAR = "*"
@mislav
mislav / gist:938183
Created Apr 23, 2011
Faraday SSL example
View gist:938183
connection = Faraday::Connection.new('http://example.com') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
end
# same as above, short form:
connection = Faraday.new 'http://example.com'
# GET
connection.get '/posts'
@igrigorik
igrigorik / webapp.rb
Created Nov 13, 2010
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
View webapp.rb
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
You can’t perform that action at this time.