Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Beam danbeam

  • Los Angeles, CA
View GitHub Profile
View xmonad.hs
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
myManageHook = composeAll
[ className =? "Gimp" --> doFloat
, className =? "Xmag" --> doFloat
View inject-requestautocomplete-magento-extension.js
(function() {
var host = 'https://rawgit.com/chromium/requestautocomplete-magento-extension/master/';
var script = document.createElement('script');
script.src = host + 'js/requestautocomplete/checkout.js';
script.onload = function() { requestAutocomplete.enable(); };
document.documentElement.appendChild(script);
var link = document.createElement('link');
link.href = host + 'skin/frontend/base/default/css/requestautocomplete/checkout.css';
View gist:519507
# screw with somebody (put in ~/.bashrc or ~/.bash_profile)
function uptime {
/usr/bin/uptime | sed -re 's/up[^,]+/up 99999 days/g';
}
View gist:571284
( cat <<EOT
anonymize () {
[ ! -z \$PS1 ] && export PS2=\$PS1;
export PS1='user@host:~\$ ';
}
unanonymize () {
[ ! -z \$PS2 ] && export PS1=\$PS2;
unset PS2;
View gist:572951
_______ _______ _ _________ _______
( ____ )( ___ )( ( /|\__ __/( ____ \
| ( )|| ( ) || \ ( | ) ( | ( \/
| (____)|| (___) || \ | | | | | |
| _____)| ___ || (\ \| | | | | |
| ( | ( ) || | \ | | | | |
| ) | ) ( || ) \ |___) (___| (____/\
|/ |/ \||/ )_)\_______/(_______/
YOUR TESTS FAILED
@danbeam
danbeam / CSS-micro-optimizations.md
Created Jan 22, 2011
A list of teeny-tiny optimizations you know of that you can do safely in CSS
View CSS-micro-optimizations.md

Things you can safely do:

Unary terms with 0 measurements:

margin-left: 0em;                      -> margin-left:0;
margin-left: 0ex;                      -> margin-left:0;
margin-left: 0cm;                      -> margin-left:0;
margin-left: 0mm;                      -> margin-left:0;
@danbeam
danbeam / chromium_update_manager_failures.md
Created Mar 9, 2011
the ppa I added to /etc/apt/sources.list is 404ing when using update manager to try to upgrade
View chromium_update_manager_failures.md

from my /etc/apt/sources.list

 # Google chrome
 deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
 deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main

update manager's error output

View innerHTML faster than fast
// for everybody except IE
function replaceHtml(el, html) {
var oldEl = typeof el === "string" ? document.getElementById(el) : el;
var newEl = oldEl.cloneNode(false);
newEl.innerHTML = html;
oldEl.parentNode.replaceChild(newEl, oldEl);
/* Since we just removed the old element from the DOM, return a reference
to the new element, which can be used to restore variable references. */
return newEl;
};
@danbeam
danbeam / wtfjs
Created Mar 29, 2011
seriously, though, wtf js?
View wtfjs
(function (b) {
return 1<!--b;
}(1)); // what do I return?
@danbeam
danbeam / another wtf
Created Mar 29, 2011
seriously, you suck, JS
View another wtf
undefined === (function () {
return <!-- muhahah! you'll never evaluate me!
}()); // true