A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
For Mac users, I highly recommend iTerm 2 + Solarized Dark
# Using applescript, sets the focus + foreground on a window by its title | |
# That works on OSX 10.7.5. | |
# @author Aurelien Scoubeau <aurelien.scoubeau@gmail.com> | |
import argparse | |
import subprocess | |
parser = argparse.ArgumentParser(description='Utility to activate a window by title, for OSX') | |
parser.add_argument('title', help='Title of the window to activate') | |
args = vars(parser.parse_args()) |
const groupZipObj = R.curry((keys, values) => { | |
const obj = R.pipe(R.take(keys.length), R.zipObj(keys)) | |
const remain = R.drop(keys.length) | |
return R.isEmpty(values) ? [] : R.prepend(obj(values), groupZipObj(keys, remain(values))) | |
}) | |
groupZipObj(['key', 'value'], ['K1', 'V1', 'K2', 'V2', 'K3', 'V3']) |
var fs = require('fs'); | |
var path = require('path'); | |
var jsdom = require('jsdom'); | |
function template (js) { | |
return ( | |
`<!DOCTYPE html> | |
<html> | |
<head> | |
<script>${fs.readFileSync(require.resolve('raphael'))}</script> |
[alias] | |
oldest-ancestor = !bash -c 'diff -u <(git rev-list --first-parent "${1:-master}") <(git rev-list --first-parent "${2:-HEAD}") | sed -ne \"s/^ //p\" | head -1' - | |
recently = !bash -c 'git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format=\"%(refname:short)\"' | |
branchdiff = !bash -c 'git diff `git oldest-ancestor "${1:-master}" "${2:-HEAD}"`..."${2:-HEAD}"' - | |
branchlog = !bash -c 'git log --oneline `git oldest-ancestor "${1:-master}" "${2:-HEAD}"`..."${2:-HEAD}"' - | |
thebranch = !bash -c 'git branch | sed -ne \"s/^\\* \\(.*\\)/\\1/p\"' |
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current git repository (handles detached head state) | |
# * the return value of the previous command | |
# * the fact you just came from Windows and are used to having newlines in | |
# your prompts. |
(function($) { | |
/** | |
* Helper function to update the spinner display. | |
* @param {jQuery} display The DOM element to update | |
* @param {String} val The value to display | |
*/ | |
function updateDisplay(display, val) { | |
display.text(val); | |
} |
import sublime, sublime_plugin, random | |
class ShuffleCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
regions = self.view.sel() | |
selections = [self.view.substr(s) for s in regions] | |
selections = [shuffle_string(s) for s in selections] | |
for i in range(len(selections)): | |
self.view.replace(edit, regions[i], selections[i]) |
<?php | |
/** | |
* Simple PHP class encapsulating file upload related functions. | |
* @author qur2 | |
*/ | |
class FileUpload { | |
private $name; | |
public $messages = array( | |
1 => 'Entry size exceeds upload_max_filesize limit : %s', | |
2 => 'Entry size exceeds max_file_size limit : %s', |
<xsl:call-template name="pagination"> | |
<xsl:with-param name="pagination" select="pagination" /> | |
<!-- build an url that holds every get params, except the page --> | |
<xsl:with-param name="pagination-url"> | |
<xsl:value-of select="/data/params/root" /> | |
<xsl:value-of select="/data/params/parent-path" /> | |
<xsl:text>?</xsl:text> | |
<xsl:for-each select="/data/params/*[contains(name(), 'url-')]"> | |
<xsl:if test="not(name(.) = 'url-page')"> | |
<xsl:value-of select="concat(substring-after(name(), 'url-'), '=', text())" /> |