Skip to content

Instantly share code, notes, and snippets.

@gilligan
gilligan / vundle.sh
Last active August 29, 2015 13:57
vundle.sh: fast bundle updates hack from the shell with parallel
#!/bin/bash
VIM_DIR=~/.vim/
BUNDLE_DIR=$VIM_DIR/bundle
sanity_check() {
test -d $1 || { echo "Error: " $BUNDLE_DIR "directory does not exist."; exit 1; }
command -v git >/dev/null 2>&1 || { echo "Error: cannot find git executable"; exit 1; }
command -v parallel >/dev/null 2>&1 || { echo "Error: cannot find parallel executable"; exit 1; }
}
@apmckinlay
apmckinlay / hamcrest.go
Last active August 29, 2015 13:58
A prototype of a Go implementation of Hamcrest style matchers
/*
hamcrest implements very basic hamcrest style asserts
for example:
func TestStuff(t *testing.T) {
Assert(t).That(2 * 4, Equals(6))
}
*/
package hamcrest
import "fmt"
$ ARCHFLAGS="-arch i386 -arch x86_64" gem install -V mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
GET http://cdscm/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET http://gemcutter.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
@josevalim
josevalim / 1_README.md
Created December 13, 2011 09:30
FSSM based FileWatcher for Rails

Rails 3.2 ships with a simple FileWatcher that only reloads your app if any of the files changed.

Besides, it also provides a mechanism to hook up your own file watcher mechanism, so we can use tools like FSSM that hooks into Mac OS X fsevents. This is an example on how to hook your own mechanism (you need Rails master, soon to be Rails 3.2):

  1. Copy the 2_file_watcher.rb file below to lib/file_watcher.rb

  2. Add the following inside your Application in config/application.rb

if Rails.env.development?

@cloudhead
cloudhead / gist:1522576
Created December 27, 2011 02:41
Why I Don't Write Web Apps

Why I Don't Write Web Apps (if I can help it)

This is what happens when I try to pick a language.

Note: If I didn't think it was possible to create a development environment without any of these issues (which I consider "major" for the most part), I would not have written this list.

C/C++

  • NOTHNX.

Node.js

DEFAULT_RECEIVER = 'self'
DEFAULT_DEFINEE = '(x = (rand * 100000000).to_i ; eval "def _#{x};end" ; y = method(:"_#{x}").owner rescue instance_method(:"_#{x}").owner ; eval "undef _#{x}" ; y)'
CONTEXTS = "puts [#{DEFAULT_RECEIVER}, #{DEFAULT_DEFINEE}].inspect"
# TODO: Figure out some way to capture the Constant definition context (cref)
eval CONTEXTS # [main, Object]
class Foo ; eval CONTEXTS # [Foo, Foo]
def bar ; eval CONTEXTS # [#<Foo:0x007ff37188a790>, Foo]
yield
@wojtekmach
wojtekmach / account_test.rb
Created May 3, 2012 09:45
Writing MiniTest extensions
require 'minitest/autorun'
module MiniTest::Assertions
def assert_changes(obj, method, exp_diff)
before = obj.send method
yield
after = obj.send method
diff = after - before
assert_equal exp_diff, diff, "Expected #{obj.class.name}##{method} to change by #{exp_diff}, changed by #{diff}"
@tonymorris
tonymorris / Balance.scala
Created September 23, 2012 01:43
Balance Parentheses
// Missing support libraries
object MissingLibraries {
case class State[S, +A](run: S => (A, S)) {
def map[B](f: A => B): State[S, B] =
State(s => {
val (a, t) = run(s)
(f(a), t)
})
def flatMap[B](f: A => State[S, B]): State[S, B] =
begin;
/*
Problem: I don't want the application to really care about how the data is
structured in the database. The application / view code needs to work
with the data in a sane format, without worrying about normalization, joins,
eager fetching, etc.
DB Schema Overview:
orders