Skip to content

Instantly share code, notes, and snippets.

View danbeam's full-sized avatar
🚲

Dan Beam danbeam

🚲
  • Los Angeles, CA
View GitHub Profile
# screw with somebody (put in ~/.bashrc or ~/.bash_profile)
function uptime {
/usr/bin/uptime | sed -re 's/up[^,]+/up 99999 days/g';
}
( cat <<EOT
anonymize () {
[ ! -z \$PS1 ] && export PS2=\$PS1;
export PS1='user@host:~\$ ';
}
unanonymize () {
[ ! -z \$PS2 ] && export PS1=\$PS2;
unset PS2;
_______ _______ _ _________ _______
( ____ )( ___ )( ( /|\__ __/( ____ \
| ( )|| ( ) || \ ( | ) ( | ( \/
| (____)|| (___) || \ | | | | | |
| _____)| ___ || (\ \| | | | | |
| ( | ( ) || | \ | | | | |
| ) | ) ( || ) \ |___) (___| (____/\
|/ |/ \||/ )_)\_______/(_______/
YOUR TESTS FAILED
@danbeam
danbeam / CSS-micro-optimizations.md
Created January 22, 2011 00:48
A list of teeny-tiny optimizations you know of that you can do safely in CSS

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 March 9, 2011 17:57
the ppa I added to /etc/apt/sources.list is 404ing when using update manager to try to upgrade

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

// 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 March 29, 2011 23:41
seriously, though, wtf js?
(function (b) {
return 1<!--b;
}(1)); // what do I return?
@danbeam
danbeam / another wtf
Created March 29, 2011 23:53
seriously, you suck, JS
undefined === (function () {
return <!-- muhahah! you'll never evaluate me!
}()); // true
@danbeam
danbeam / text-overflow-ellipsis-feature-test.js
Created April 9, 2011 01:59
Feature test for text-overflow: ellipsis; with YUI3
YUI().use('gallery-ellipsis', function (Y) {
// must wait to append hidden node
Y.on('domready', function () {
// create a hidden node and try to style it
var cloned,
hidden = Y.Node.create('<div style="visibility:hidden;position:absolute;white-space:nowrap;overflow:hidden;"></div>'),
rules = ['textOverflow', 'OTextOverflow'];
@danbeam
danbeam / text-overflow-ellipsis-feature-test-jquery.js
Created April 9, 2011 02:07
A feature test to determine if text-overflow: ellipsis; works in the current browser (using jQuery)
(function ($) {
// innocent until proven guilty
$.extend({'ellipsis':{'nativeSupport' : false}});
// do a quick feature test to see if we're natively supported
$(function () {
// a hidden node we're testing and it's soon-to-be clone
var cloned, hidden = $('<div style="visibility:hidden;position:absolute;white-space:nowrap;overflow:hidden;"></div>'),