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
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> |
// Thanks to http://www.aaron-powell.com/posts/2014-03-06-debugging-jquery-events.html | |
// If your're looking at submit events, check handlers attached to document. | |
// domEl has to be a native DOM element. | |
function findEvents(domEl, eventType) { | |
function targetedBy(el, eventData) { | |
if (el === domEl) { | |
return true; | |
} | |
if (eventData.selector) { | |
if ($(el).find(eventData.selector).is(domEl)) { |
For a small project, I wanted to display an author portrait in the bottom right corner of a page. Of course, I wanted the image to be responsive. The only technnique I was sort of familiar with is [Foundation interchange][foundation-interchange], but I wanted to see more. And in particular, I wanted to read about any new (or soon-to-be) HTML5 standard.
After a very quick googling, I stumbled on this [Smashing article][smashing-responsive-image] which very nicely exposes where we stood last year (in July 2013) on this topic. Although many things changed since then, it points out the[ picturefill library][scottjehl-picturefill], which is a polyfill for the fast moving [picture element][living-standard-embedded-content], a new HTML standard.
Aware of this polyfill, I searched for more explanations about how this srcset
and sizes
attributes work. A very good article explained it all to me, including where the specification comes from and with [a lot of peas][portis-srcset].
Now I get everything that's need
// TODO: complete the mapping | |
var combiningDiacriticMap = { | |
// combining grave accent | |
'\u0300': { | |
'A': '\u00c0', 'a': '\u00e0', | |
'E': '\u00c8', 'e': '\u00e8', | |
'I': '\u00cc', 'i': '\u00ec', | |
'O': '\u00d2', 'o': '\u00f2', | |
'U': '\u00d9', 'u': '\u00f9' | |
}, |
# Using applescript, sets the focus + foreground on a window by its title | |
# That works on OSX 10.7.5. | |
# @author Aurelien Scoubeau <[email protected]> | |
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()) |
[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); | |
} |