Skip to content

Instantly share code, notes, and snippets.

View smt's full-sized avatar

Stephen Tudor smt

View GitHub Profile
#!/bin/zsh
# Search for, select, and execute command from history DB using FZF
# Inspired by http://junegunn.kr/2015/04/browsing-chrome-history-with-fzf/
h(){
local sep query
sep='{::}'
query="SELECT cmd, count(*) as frequency
FROM hist
GROUP BY cmd
@smt
smt / dict_merge.py
Last active May 17, 2016 12:41 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python
def dict_merge(dct, merge_dct):
""" Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
``dct``.
:param dct: dict onto which the merge is executed
:param merge_dct: dct merged into dct
:return: None
"""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.07884746789932251</real>
<key>Green Component</key>
<real>0.081504985690116882</real>
@smt
smt / vim7.3_mac_install.rb
Created March 31, 2012 15:06 — forked from sirupsen/vim7.3_mac_install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end

A pure CSS bendy shadow:

I suspect that some trig calculations could make this very general.

bendy_shadow

@smt
smt / adapt.js
Created April 13, 2011 11:37 — forked from nathansmith/adapt.js
// Edit to suit your needs.
var ADAPT_CONFIG = {
// Where is your CSS?
path: 'assets/css/',
// false = Only run one time, when page first loads.
// true = Change for window resize or page tilt too.
dynamic: true,
// First range entry is the minimum.
(function() {
var eventMatchers = {
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/
};
var defaultOptions = {
pointerX: 0,
pointerY: 0,
button: 0,
ctrlKey: false,
@smt
smt / grid.sass
Created March 25, 2011 23:19 — forked from jcroft/grid.sass
jcroft's grid setup
// REQUIRED VARS. Defaults to a 950px wide, 24-column grid that has 30px wide units and 10px wide
// gutters. If you do the fluid grid, then this 950/24/30/10px size will become the maximum size.
$grid_type: fixed !default
$grid_columns: 24 !default
$grid_column_width: 30 !default
$grid_gutter_width: 10 !default
// GENERATED VARS. You can ignore these.
$grid_full_width: $grid_columns * $grid_column_width + $grid_columns * $grid_gutter_width - $grid_gutter_width
$grid_column_width_percent: ($grid_column_width / $grid_full_width * 100) * 1%
/*
Form Elements
-- Styled to look like native Safari on OS X.
-- Drop-down <select> menus are unaffected.
-- Buttons are unaffected. Native OS style.
*/
input,
button,
select,