Skip to content

Instantly share code, notes, and snippets.

@thom4parisot
thom4parisot / convert-helpers.js
Last active August 29, 2015 13:58
XML Stream Update
'use strict';
var STYLE_ATTRIBUTE = 'text-style-name';
var styleMatches = function (item, styleName) {
if (!item || item.attributes === undefined || item.attributes[STYLE_ATTRIBUTE] === undefined) {
return false;
}
return item.attributes[STYLE_ATTRIBUTE].match(styleName);
@rwaldron
rwaldron / gist:1007531
Created June 4, 2011 03:16 — forked from voodootikigod/gist:1007426
BS ≈ BreakfastScript
Conditionals
( false :)
console.log "if"
:( true )
console.log "else if"
:()
console.log "else"
@naholyr
naholyr / gist:1048660
Created June 27, 2011 10:45
Quick 'n dirty Bash completion for "pman"
We couldn’t find that file to show.
@naholyr
naholyr / update-sublime-text.sh
Created September 6, 2011 15:27
Install or update Sublime Text from web site
#!/bin/bash
# Requirements: sed, grep, curl, pkill
# User configuration
LOCAL_INSTALL="/usr/lib/sublime-text-2" # Must be user-writable
REPO="dev" # "dev" for dev releases, or "2" for beta releases
TARGET_BUILD="Linux 32 bit" # can be one of "Windows", "Windows 64 bit", "OS X", "Linux 32 bit", "Linux 64 bit"
# Check if sublime text is running
@ratibus
ratibus / sfSearchTask.class.php
Created September 8, 2011 14:24
symfony search task
<?php
class sfSearchTask extends sfCommandApplicationTask
{
/**
* @see sfTask
*/
protected function configure()
{
$this->addArguments(array(
@havvg
havvg / bdd-experiment-guide.md
Created September 9, 2011 14:44
Behavior Driven Development in Symfony2 with Behat, Mink and Zombie.js
@marcw
marcw / sopa.vcl
Created January 17, 2012 20:43
Varnish vcl file in order for varnish to participate to the sopa blackout
# use with:
#
# varnishadm -T host:port -S /etc/varnish/secret "vcl.load sopa /path/to/your/sopa.vcl"
# varnishadm -T host:port -S /etc/varnish/secret "vcl.use sopa"
backend default {
.host = "127.0.0.1";
.port = "8080";
}
@indexzero
indexzero / include.js
Created January 22, 2012 09:03
Find the source of your `sys` deprecation warnings in node@0.6.x
//
// Place this at the beginning of your node.js program before
// **any and all** require statements.
//
var util = require('util');
var _warning = util._deprecationWarning;
util._deprecationWarning = function () {
console.trace();
_warning.apply(util, arguments);
@naholyr
naholyr / .bashrc.sh
Created March 23, 2012 11:44
Git bisect for SVN
function svn-bisect() {
local TEST="$1"
local TARGET="${2:-.}"
local LEFT=${3:-1}
local RIGHT=${4:-$(LANG=LC svn info | grep ^Revision | sed 's/Revision: //')}
if ! echo "$LEFT" | grep '^[0-9]\+$' > /dev/null; then
echo 'Starting revision must be a valid number' >&2
exit 1
fi
@naholyr
naholyr / git-pr.md
Created November 22, 2012 18:11
Using "hub" to automatically push & PR

git-pr

Part of my personal shortcuts for the usual pull-request-based workflow.

Setup

Given you have an "upstream" repository you need to work on:

  1. Fork it
  2. Clone your fork locally (repo "origin")