Skip to content

Instantly share code, notes, and snippets.

View makaroni4's full-sized avatar

Anatoli Makarevich makaroni4

View GitHub Profile
@jboner
jboner / latency.txt
Last active May 8, 2024 16:32
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@g3d
g3d / gist:2709563
Last active February 7, 2024 15:21 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan
@route
route / gist:2489600
Created April 25, 2012 13:11
Additions to rr stubbing
# Dynamic method stubbing
# user = Factory(:user)
# callbacks = User._create_callbacks.map(&:filter)
# stub_methods("user", callbacks)
def stub_methods(name, methods)
methods.each do |method|
eval "stub(#{name}).#{method}"
end
end
@jrochkind
jrochkind / gist:2161449
Created March 22, 2012 18:40
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@stevehodgkiss
stevehodgkiss / freeagent.rb
Created February 25, 2012 23:42
Script to download all your attachments on FreeAgent
require 'rubygems'
require 'freeagent'
require 'eventmachine'
require 'em-synchrony'
require 'em-http-request'
require 'em-synchrony/fiber_iterator'
require 'active_support'
ATTACHMENTS_DIR = '/Users/steve/Documents/freeagent_attachments'
@dblock
dblock / carrierwave.rb
Created January 31, 2012 13:55
Delayed image processing with CarrierWave
CarrierWave.configure do |config|
...
end
Mongoid::Document::ClassMethods.send(:include, DelayedImageProcessing)
module CarrierWave
# http://sleeplesscoding.blogspot.com/2011/09/recreate-single-version-of.html
# Note: is_processing_delayed should be set before calling recreate_version! if the version depends on it.
@aemkei
aemkei / LICENSE.txt
Last active April 12, 2024 21:27 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@gmcintire
gmcintire / deploy.rb
Created December 16, 2011 02:21 — forked from stympy/deploy.rb
Skip asset pre-compilation when deploying if the assets didn't change
namespace :deploy do
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end