Skip to content

Instantly share code, notes, and snippets.

View jbueza's full-sized avatar

Jaime Bueza jbueza

View GitHub Profile
@jbueza
jbueza / prepare-commit-msg
Created March 4, 2014 18:30
Automatically add branch name and branch description to every commit message except merge commit.
#!/bin/sh
#
# Automatically add branch name and branch description to every commit message except merge commit.
#
COMMIT_EDITMSG=$1
addBranchName() {
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
fe60357 (HEAD, FEATURE-MAKE_CAT_FLUFFYLOL) [FEATURE-MAKE_CAT_FLUFFYLOL]: Integrating fluffy cats
@jbueza
jbueza / prepare-commit-msg
Last active August 29, 2015 13:57
Adding more cats and wolves to the commit messages
#!/bin/sh
#
# Automatically add branch name and branch description to every commit message except merge commit.
#
COMMIT_EDITMSG=$1
addBranchName() {
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
@jbueza
jbueza / gist:11002634
Created April 17, 2014 18:18
Calculate number of rounds in a losers bracket (double elimination)
Math.ceil( (Math.log(teams)/Math.log(2)) / Math.log(2)) / Math.log(2)) + Math.ceil(Math.log(teams)/Math.log(2))
var teams = 128;
var initialRounds = Math.ceil(Math.log(teams)/Math.log(2));
var surplus = Math.ceil( Math.log(initialRounds)/Math.log(2) );
console.log(initialRounds);
console.log(surplus);
dojo.provide("clubn.controller.CycleController");
dojo.declare("clubn.controller.CycleController", mojo.controller.Controller,
{
addObservers: function() {
this.addObserver(this, "onInit", "InitializeCycle", function(context, caller) {
return {
timeout: 6000
};
});
},
function MyAddon:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("NinjalistDB")
end
#!/usr/bin/env ruby
$: << ENV['TM_SUPPORT_PATH'] + '/lib'
require 'escape'
def esc(str)
e_sn(str).gsub(/\}/, '\\}') # escaping inside a placeholder
end
s = STDIN.read
if s.empty? then
print "<strike>$1</strike>"
for i,v in ipairs(self.db.global) do
print("Row: "..v)
end
table.insert(self.db.global, "my data goes here")
google.pacman ||
function () {
var a = true,
e = false,
g = {},
i = [1, 4, 2, 8],
l = {
0: {
axis: 0,
increment: 0