Skip to content

Instantly share code, notes, and snippets.

@petros
petros / gist:2063527
Created March 17, 2012 17:56
Nice git aware bash prompt

Here is a nice addition to your .bash_profile, so as to have a cool git aware prompt:

export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
source ~/.git-completion.sh
PS1='\[\033[34m\]\W\[\033[0m\]$(__git_ps1 " (\[\033[35m\]%s\[\033[0m\])") \$ '
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
@joshsusser
joshsusser / silence_assets.rb
Created April 17, 2012 22:34
put in config/initializers to silence asset logging in Rails development mode
if Rails.env.development?
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
call_without_quiet_assets(env)
ensure

A daily glance at what's happening in a high velocity codebase, thanks to @defunkt:

https://github.com/your/repo/compare/master@{yesterday}...master

Bookmark, share, and enjoy.

@chendo
chendo / 0-readme.md
Created November 13, 2012 03:33
Fast require patch for 1.9.3-p327
@garybernhardt
garybernhardt / gist:3180009
Created July 26, 2012 03:05
An excerpt from GCC's reload.c
static int
find_reusable_reload (rtx *p_in, rtx out, enum reg_class rclass,
enum reload_type type, int opnum, int dont_share)
{
rtx in = *p_in;
int i;
/* We can't merge two reloads if the output of either one is
earlyclobbered. */
if (earlyclobber_operand_p (out))
@jimweirich
jimweirich / output
Created December 27, 2012 14:55
Experimental version of RSpec/Given that handles should-less assertions (i.e. plain Ruby conditions).
1) Natural Assertions
Failure/Error: Then { foo + bar == 2 }
Then expression failed at /Users/jim/working/git/rspec-given/examples/failing/sample_spec.rb:6
expected: 3
to equal: 2
false <- foo + bar == 2
3 <- foo + bar
1 <- foo
2 <- bar
# ./lib/rspec/given/extensions.rb:64:in `_rg_evaluate'
@tmm1
tmm1 / 0-sequential.txt
Created April 24, 2013 04:14
test-queue on github.com test suite
Finished tests in 827.814339s, 10.2281 tests/s, 34.2094 assertions/s.
8467 tests, 28319 assertions, 0 failures, 0 errors, 15 skips
real 14m21.424s
user 11m54.777s
sys 0m28.030s
@headius
headius / gist:5783237
Created June 14, 2013 16:19
Example of nondeterministic insertion order in MRI
xt-jruby-local ~/projects/jruby $ cat blah.rb
expected = (0...100000).to_a * 50
array = []
50.times.map do
Thread.new do
100000.times do |i|
array << i
end
#!/usr/bin/env ruby
gem "parser", "~> 1.4"
require "parser"
require "parser/ruby19"
require "set"
class ConstantDeclarationAndUseProcessor < Parser::AST::Processor
attr_reader :declared, :used
def initialize
@caius
caius / installation.sh
Last active December 23, 2015 23:39
ruby-1.9.3-p327 with falcon gc patch using ruby-install
# install patched ruby-install that works with falcon patches
cd ~/sources
git clone git://github.com/caius/ruby-install
cd ruby-install
git checkout origin/autoconf-when-patching
brew install --HEAD homebrew/ruby-install.rb
# Install ruby-1.9.3-p327-perf
mkdir -p ~/src/perf