This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# some git aliases to help out | |
[alias] | |
# fetch and merge main/master branch without the need for checkout | |
fnm = "!f() { WANTED_BRANCH="${1:-master}"; echo "Fetching and merging ${WANTED_BRANCH}";git fetch origin "${WANTED_BRANCH}:${WANTED_BRANCH}"; }; f" | |
# same as above expect that it fetches from an upstream remote (fork scenario) | |
fnmu = "!f() { WANTED_BRANCH="${1:-master}"; echo "Fetching and merging ${WANTED_BRANCH}";git fetch upstream "${WANTED_BRANCH}:${WANTED_BRANCH}";git push origin ${WANTED_BRANCH}:${WANTED_BRANCH};}; f" | |
reset-date = commit --amend --date=now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nestedOriginalObject = { | |
firstLevel: { | |
secondLevel: { | |
key1: 'value1', | |
key2: 'value2' | |
} | |
} | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "ubuntu13.04" | |
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box" | |
config.vm.provider "virtualbox" do |v| | |
v.memory = 2048 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var npm = require('npm'); | |
npm.load('./package.json', function () { | |
npm.outdated(function (err, outdated) { | |
if (outdated.length > 0) { | |
outdated.forEach(function (p) { | |
console.log(p[1] + '\t' + p[2] + ' => ' + p[3]); | |
}); | |
process.exit(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsorted = {1, 59, 12, 43, 4, 58, 5, 13, 46, 3, 6} | |
sorted_list = sorted(unsorted) | |
list_length = len(sorted_list) | |
if list_length < 2: | |
print sorted_list | |
current = [sorted_list[0]] | |
for index in xrange(1, list_length): | |
if sorted_list[index - 1] + 1 == sorted_list[index]: | |
current += [sorted_list[index]] | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
#NOTE: | |
# This is a terrible hack, but it works ;) | |
# The version and description from the setup.py are fetched and parsed | |
# here.. | |
import pkg_resources # part of setuptools | |
ver = pkg_resources.require("YOUR_PACKAGE_NAME")[0] | |
thetitle = [line for line in ver.get_metadata('PKG-INFO').split("\n") \ | |
if line.startswith("Summary")][0].split(":")[1].strip() | |
version = ver.version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var auth_token = $("input[name='authenticity_token']")[0].value; | |
$("a.repo-name[href^='/THEORG']").each(function($elem){ | |
$.post("/notifications/subscribe", { | |
authenticity_token : auth_token, | |
do : 'included', | |
'repository_id' : $("form.js-unsubscribe-form #repository_id", $(this).parent("li")).val() | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest import TestCase | |
class BaseTestClass(TestCase): | |
""" | |
Base test class for the two components. | |
""" | |
__test__ = False #important, makes sure tests are not run on base class | |
component = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#everyone loves a __init__ file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.tmuxinator/someproject.yml | |
# you can make as many tabs as you wish... | |
project_name: SomeProject | |
project_root: /path/to/someproject | |
pre: find . -name "*.pyc" -exec rm -rf {} \# | |
tabs: | |
- editor: PYTHONPATH=$PYTHONPATH:$PWD vim | |
- testAndIShell: | |
layout: even-horizontal |
NewerOlder