Skip to content

Instantly share code, notes, and snippets.

@tomdale
tomdale / gist:1856842
Created February 18, 2012 01:54
Ember documentation TODO

Documentation

TODO

  • API docs
  • How to bootstrap a project
  • Application structure (M/V/C layers and what they're for)
  • Getting started with Ember and Rails
  • Built-in controls
  • How events are handled and bubbled
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@jordanmaguire
jordanmaguire / rspec_attributes.rb
Created June 26, 2012 01:29
This is a helpful RSpec pattern I've been playing with lately with great success
let(:vehicle) { FactoryGirl.create(:vehicle, vehicle_attributes) }
let(:vehicle_attributes) { {} }
describe "#to_s"
subject { vehicle.to_s }
let(:vehicle_attributes) { {name: "Carzilla"} }
it { should == "Carzilla" }
end

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
  • NBC
@nfedyashev
nfedyashev / gist:3377341
Created August 17, 2012 09:20
Make strong_parameters work nice with rails_admin
class ApplicationController < ActionController::Base
before_filter :skip_strong_parameters, :if => :rails_admin_path?
def skip_strong_parameters
params.select { |key, value| params[key].kind_of?(ActionController::Parameters) }.map { |key, value| params[key].permit! }
end
privaate
def rails_admin_path?
@jameswomack
jameswomack / javascript_background_thread.js
Created September 11, 2012 06:41
Extend function prototype to run a function as a WebWorker
Function.prototype.runOnBackgroundThread = function (aCallback) {
var _blob = new Blob(['onmessage = '+this.toString()],{"type":"text/javascript"});
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob));
_worker.onmessage = aCallback;
_worker.postMessage();
}
var _test = function () {
postMessage((1+1).toString());
}
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 17, 2024 02:53
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@mattetti
mattetti / gist:5097178
Last active December 14, 2015 13:58
Rails 4 prod mod hello world (with AR) after warm up. (Ruby 2.0 TracePoint) 248 classes used, 739 methods used, 2490 methods dispatched
{
"ActionDispatch::Static": {
"call": 1
},
"ActionDispatch::FileHandler": {
"match?": 1,
"ext": 1
},
"ActiveSupport::Cache::Strategy::LocalCache::Middleware": {
"call": 1