Skip to content

Instantly share code, notes, and snippets.

@eribeiro
eribeiro / gource-ffmpeg.sh
Last active February 11, 2022 16:23
Run Gource on a git repo, outputs as a movie (movie.mp4) and compresses it (output.mp4)
gource -s .06 -1280x720 --auto-skip-seconds .1 --multi-sampling --stop-at-end --key --highlight-users --hide mouse,progress,files,filenames,dirnames --file-idle-time 0 --max-files 0 --background-colour 000000 --font-size 22 --title "Lucene/Solr" --output-ppm-stream - --output-framerate 30 | avconv -y -r 30 -f image2pipe -vcodec ppm -i - -b 65536K movie.mp4
&& ffmpeg -i movie.mp4 -b:v 3048780 -vcodec libx264 -crf 24 output.mp4
@brianpetro
brianpetro / rails-4-new-options
Created April 28, 2015 18:11
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?'
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 February 24, 2013 17:34
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
source 'https://rubygems.org'
ruby "2.0.0"
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
...
@brianknapp
brianknapp / create_request.rb
Created February 12, 2013 01:44
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.
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 February 4, 2022 18:05
My implementation of Conway's Game of Life
# Run this:
# ruby < <(curl -s https://gist.githubusercontent.com/ambethia/1429621/raw/life.rb)
require 'curses'
class Life
extend Curses
CELL_CHAR = "*"
@mislav
mislav / gist:938183
Created April 23, 2011 02:28
Faraday SSL example
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 November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
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