Skip to content

Instantly share code, notes, and snippets.

View gist:2936374
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@Funfun
Funfun / index.html
Created Jun 29, 2012
nvd3 tooltip tests
View index.html
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8">
<link href="http://github.com/novus/nvd3/raw/master/src/d3.css" rel="stylesheet" type="text/css"/>
<style>
body {
@Funfun
Funfun / gist:3047383
Created Jul 4, 2012
cake with minify and coffee watcher
View gist:3047383
fs = require 'fs'
{print} = require 'sys'
{exec} = require 'child_process'
{spawn} = require 'child_process'
option '-o', '--output [DIR]', 'output dir'
task 'minify', 'Minify mongo production scripts', ->
exec 'uglifyjs --overwrite lib/mongo/lib/*.js', (err, stdout, stderr) ->
@Funfun
Funfun / gist:3052150
Created Jul 5, 2012
sum of elems in array
View gist:3052150
total = 0
$.each arr, ->
total += this
total
View index.html
#stats{style: "height: 500px;"}
%svg
View gist:3877724

Don't use MongoDB

I've kept quiet for awhile for various political reasons, but I now feel a kind of social responsibility to deter people from banking their business on MongoDB.

Our team did serious load on MongoDB on a large (10s of millions of users, high profile company) userbase, expecting, from early good experiences, that the long-term scalability benefits touted by 10gen

View xml_helper.rb
module Alfabank
module XmlHelper
class <<self
def tag(name, value, attribues = {})
attrs = attribues.map{|n, v| "#{n}=\"#{v}\""}.join(' ')
"<#{name} #{attrs}>#{value}</#{name}>"
end
end
end
View database.yml.example mysql2
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
View README.md

This variation of a simple bar chart adds sorting with staggered delay and translucency to improve readability during the transition. This technique is recommended by Heer & Robertson. Use the checkbox in the top right to turn sorting on or off.

@Funfun
Funfun / gist:5046400
Created Feb 27, 2013
some sort of examples 'how to use threads
View gist:5046400
require 'thread'
require 'net/http'
urls = ["http://slonweb.ru", "https://github.com", "http://www.ruby-doc.org/core-2.0/Thread.html"]
threads = []
responses = []
responses_mutex = Mutex.new
urls.each do |url|