Skip to content

Instantly share code, notes, and snippets.

Avatar
🌍
Lower Your Eyelids To Die With The Sun

Tomas Carnecky wereHamster

🌍
Lower Your Eyelids To Die With The Sun
View GitHub Profile
View git-flush
#!/bin/sh
# The job of git-flush is to recompactify your repository to be as small
# as possible, by dropping all reflogs, stashes, and other cruft that may
# be bloating your pack files.
git for-each-ref --format="%(refname)" refs/original/ | \
xargs -n 1 git update-ref -d
git reflog expire --expire=0 --all
View 001-Properly-export-js_DateClass-and-js_RegExpClass.patch
From 2f17924139f7add5c66a30c91996f347160f2b2f Mon Sep 17 00:00:00 2001
From: Tomas Carnecky <tom@dbservice.com>
Date: Sat, 5 Jun 2010 11:23:26 +0200
Subject: [PATCH] Properly export js_DateClass and js_RegExpClass, they are needed by mongodb
---
js/src/jsdate.cpp | 2 +-
js/src/jsdate.h | 2 +-
js/src/jsregexp.cpp | 2 +-
js/src/jsregexp.h | 2 +-
View test.cc
#include <v8.h>
#include <node.h>
#include <iostream>
using namespace v8;
static void init (Handle<Object> target) {
int i;
for (i = 0; i < 10000000; ++i) {
@wereHamster
wereHamster / git-svn-cherry-pick
Created Nov 9, 2010
Cherry-pick a svn commit and add a 'Merged from rX' message at the bottom
View git-svn-cherry-pick
#!/bin/sh
# $1 commit to cherry-pick
# $2 branch to apply it to (optional)
#
# Example usage:
# git svn-cherry-pick HEAD release-5.4
# rake test:all && git svn dcommit
commit="$(git rev-parse "$1")"
View package-addon.sh
#!/bin/sh
#
# This relies on addons specifying the external dependencies in their toc file.
# Blizzard conveniently ignores everything after the first space in the
# OptionalDependency field so we can use something like this:
#
# ## OptionalDependency: FooLibrary git@github.com:you/FooLibrary.git deadbeef:Lib/
#
# Where deadbeef:Lib/ is the tree-ish we want to extract and put into Libs/FooLibrary.
#
@wereHamster
wereHamster / README.md
Created Jan 9, 2011
Script to upload files to github.
@wereHamster
wereHamster / bash-git-prompt
Created Jan 15, 2011
My old bash git prompt
View bash-git-prompt
__git_branch () {
local b
if ! b="$(git symbolic-ref HEAD 2>/dev/null)"; then
if ! b="$(git describe --exact-match HEAD 2>/dev/null)"; then
b="$(git rev-parse 2>/dev/null | cut -c1-7)..."
fi
fi
echo "$b"
@wereHamster
wereHamster / import-from-tumblr.js
Created Feb 27, 2011
Slightly modified script to import posts from tumblr into jekyll. Based on rsms' version from his rsms.github.com repo.
View import-from-tumblr.js
var HOSTNAME = 'blog.caurea.org'
var DST_DIR = '/Users/tomc/blog/_posts'
var POST_LAYOUT = 'post'
var DRY_RUN = false
var TAGS_FILTER = function (tag) { return true; }
var TAGS_MAPPER = function (tag) { return tag.toLowerCase(); }
var CUSTOM_FRONT_MATTER = function (post) {
return {
tumblr_id: post.id,
@wereHamster
wereHamster / gist:869686
Created Mar 14, 2011
mongoose behavior of pre/post-init middleware
View gist:869686
var mongoose = require('../lib/mongoose')
mongoose.connect('mongodb://localhost/test');
var Document = null, DocumentSchema = new mongoose.Schema({
data: { type: String },
});
DocumentSchema.pre('init', function(next) {
console.log('pre-init: ' + JSON.stringify(this));
View _curl-effect.scss
/* Stupid compass box-shadow mixin doesn't support multiple shadows... */
@mixin box-shadow-2($first, $second) {
$full: $first, $second;
@include experimental(box-shadow, $full, -moz, -webkit, -o, not -ms, not -khtml, official);
}
@mixin curl-effect-shadow($corner) {
z-index: -1;
position: absolute;