Skip to content

Instantly share code, notes, and snippets.

@henrik
henrik / .bashrc
Created December 3, 2008 17:56
Git branch and dirty state in Bash prompt.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@jezdez
jezdez / pip.conf
Created March 10, 2010 14:57
My ~/.pip/pip.conf. More information here: http://pip.openplans.org/configuration.html
[global]
default-timeout = 60
respect-virtualenv = true
download-cache = ~/.pip/cache
log-file = ~/.pip/pip.log
build = ~/.pip/build
[install]
use-mirrors = true
# cat create_mysql_symlinks.sh
PORT=$1
ln -s /usr/share/munin/plugins/mysql_ mysql_${PORT}_bin_relay_log
ln -s /usr/share/munin/plugins/mysql_ mysql_${PORT}_commands
ln -s /usr/share/munin/plugins/mysql_ mysql_${PORT}_connections
ln -s /usr/share/munin/plugins/mysql_ mysql_${PORT}_files_tables
ln -s /usr/share/munin/plugins/mysql_ mysql_${PORT}_innodb_bpool
ln -s /usr/share/munin/plugins/mysql_ mysql_${PORT}_innodb_bpool_act
ln -s /usr/share/munin/plugins/mysql_ mysql_${PORT}_innodb_checkpoint_age
@netzpirat
netzpirat / 0_README.md
Created November 12, 2010 10:42
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard
@phoet
phoet / rails_admin_without_devise.rb
Created December 17, 2010 15:35
Using RailsAdmin without devise
# add RailsAdmin to the Gemfile
# do NOT add devise
gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git"
# run Bundler
bundle
# run the generator for RailsAdmin
# looks like it's broken, but it just does not install devise
# you may also remove the app/config/locales/devise.en.yml
@indexzero
indexzero / helpers.js
Created June 22, 2011 03:05
A quick sample of how to use api-easy with `npm test`
/*
* helpers.js: Test macros for APIeasy.
*
* (C) 2011, Charlie Robbins
*
*/
var assert = require('assert'),
http = require('http'),
journey = require('journey');
@linnchord
linnchord / RedisSessionStore.py
Created August 18, 2011 16:34
Flask session by Redis with pickle
# -*- coding:utf-8 -*-
"""
lib/RedisSessionStore.py
~~~~~~~~~~~~~~
Flask 0.7, session store in redis
ref by https://gist.github.com/994937
@pamelafox
pamelafox / views.py
Created September 5, 2011 21:26
CORS on Python/Flask
from flask import request, make_response,
def any_response(data):
ALLOWED = ['http://localhost:8888']
response = make_response(data)
origin = request.headers['Origin']
if origin in ALLOWED:
response.headers['Access-Control-Allow-Origin'] = origin
return response
@grosser
grosser / rails_admin_without_devise.md
Last active July 27, 2016 06:25 — forked from huned/rails_admin_without_devise.md
Using RailsAdmin without devise

Using rails_admin without devise

Add RailsAdmin to your Gemfile

do NOT add devise

gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git"

Bundle

@engintekin
engintekin / Application.java
Created October 26, 2011 20:02
Gzip your response in Play framework
@With(Compress.class)
public class Application extends Controller {
public static void index() {
render();//response will be gzipped
}
}