Skip to content

Instantly share code, notes, and snippets.

== 1.2.4 Flaming Astroboy
== 1.2.2 I Find Your Lack of Sauce Disturbing
== 1.2.1 Asynctilicious Ultra Supreme
== 1.2.0 Asynctilicious Supreme
== 1.1.1 Super Disco Power Plus
== 1.1.0 Super Disco Power
== 1.0.0 That's What She Said
== 0.8.2 Double Margarita
== 0.8.1 Rebel Porpoise
== 0.8.0 Dodgy Dentist
@joshmcarthur
joshmcarthur / .vimrc.local
Created December 12, 2011 22:14
Add JBuiler syntax highlighting to VIM
" add jbuilder syntax highlighting
au BufNewFile,BufRead *.json.jbuilder set ft=ruby
@masak
masak / explanation.md
Last active July 9, 2024 17:07
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@john2x
john2x / 00_destructuring.md
Last active July 9, 2024 01:38
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@mlovic
mlovic / mocks_and_stubs.md
Last active June 1, 2020 16:24
Difference between mocks and stubs using ruby with mocha library

This gist aims to explain the difference between stubs and mocks and when each should be used. For an introduction to stubs and mocks, start somewhere else, like here.

 

  • Stub: used to isolate the object under test from its dependencies, preventing the test from being influenced by code outside the object. This way the test can't be made to fail or be broken by code which is not part of the specific functionality being tested. Stubs also lead to less code being run, which helps keep tests fast. A stub has no expectations. It doesn't care if it is called or how many times.

    For example, you might stub out a message sent to a database connection if all you are trying to test is the type of the method's return value.

 

@fideloper
fideloper / update_curl.sh
Last active January 11, 2024 15:23
Update curl on Ubuntu 14.04
#! /usr/bin/env bash
# Install any build dependencies needed for curl
sudo apt-get build-dep curl
# Get latest (as of Feb 25, 2016) libcurl
mkdir ~/curl
cd ~/curl
wget http://curl.haxx.se/download/curl-7.50.2.tar.bz2
tar -xvjf curl-7.50.2.tar.bz2
@garno
garno / open-pr
Last active September 19, 2022 21:18
Small bash script to automatically open Pull Request page with branches correctly selected
#!/bin/sh
# Retrieve branch name
branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
# Retrieve destination branch
destination_branch=${branch%--*}
# Determine the default origin branch
if [[ $branch == $destination_branch ]]; then