Skip to content

Instantly share code, notes, and snippets.

View danbeam's full-sized avatar
🚲

Dan Beam danbeam

🚲
  • Los Angeles, CA
View GitHub Profile
@danbeam
danbeam / clone-vs-original-style-test.js
Created April 12, 2011 02:30
Feature detecting styles on Mozilla's homepage
// 1) Go to - http://www.mozilla.com/en-US/firefox/fx/ in FF3-4, Chrome
// 2) Run this:
(function () {
var p = document.getElementsByTagName('p')[3];
p.style.boxShadow = '5px 5px red';
p.style.MozBoxShadow = '5px 5px yellow';
p.style.WebkitBoxShadow = '-5px -5px blue';
@danbeam
danbeam / reflow-on-css-transform.txt
Created April 12, 2011 19:02
See if a transform actually causes reflow
// Go to - https://developer.mozilla.org/en/css/-moz-transform
// Go to timeline view
// Copy/pasta into URL bar
javascript:(function(){var a=document.getElementsByTagName('pre')[1];a.style.WebkitTransform=a.style.WebkitTransform.replace('rotate(20deg)', 'rotate(90deg)');setTimeout(function(){a.style.position='absolute';},1000);}());
// Start timeline
({
'window' : this,
'position' : 'UI Engineer',
'location' : 'SmugMug',
'website' : 'http://smugmug.com/jobs',
'skills' : [ 'javascript', 'css', 'web standards', 'object oriented programming', 'php' ],
'benefits' : {
'awesomeTeam' : true,
'technicalCEO' : true,
'microManagement' : false,
@danbeam
danbeam / Bookmarlet to reverse today's Google doodle
Created May 11, 2011 18:09
google-dance-doodle-reverse.js
javascript:(function(w,d){var a=d.getElementById('hplogo'),b=w.setInterval(function(){if(a.childNodes.length>2){a.removeChild(a.childNodes[a.childNodes.length-1]);}else{w.clearInterval(b);}},83);}(this,this.document));
javascript:(function(){var x=encodeURIComponent('\'\';!--"<XSS>=&{()}'),u=[],n={},i=0,a=[].concat([].slice.call(document.getElementsByTagName('input')),[].slice.call(document.getElementsByTagName('select')),[].slice.call(document.getElementsByTagName('textarea'))),l=a.length;for(;i<l;++i){if(a[i].name&&!n[a[i].name]){n[a[i].name]=1;u.push(a[i].name);}}if(u.length){window.location.href+=(!~~window.location.href.indexOf('?')?'&':'?')+u.join('='+x+'&')+'='+x;}else{alert('No inputs!');}}());
javascript:(function(i){while(++i<70){localStorage['level_star_'+i]=3;}}(-1));
untiny() {
for U in $*; do
curl -I $U 2>/dev/null | grep ^Location | cut -d' ' -f2;
done;
}
nuke() {
local prompt="?";
until [[ "^[YyNn]" =~ "$prompt" ]]; do
echo -n "Are you really sure? (y/n) ";
read prompt;
done;
if [[ "^[Yy]" =~ "$prompt" ]]; then
prompt="?";
until [[ "^[YyNn]" =~ "$prompt" ]]; do
echo -n "Like REALLY sure? (y/n) ";
# find the root of the local svn checkout
svnroot() {
[ -d $1/.svn ] && svnroot $1/../ $1 || ( cd ${2:-$1} && echo $PWD );
}
# find the most popular author with svn blame
svnauthor() {
local FILE;
local AUTH;
local PERCENT;
local BIGGEST;
local WRITTEN;
local TOTAL;
for FILE in $*; do
SVN_ST=$(svn st $FILE 2>&1);