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 / 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>'),
@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));
# find the root of the local svn checkout
svnroot() {
[ -d $1/.svn ] && svnroot $1/../ $1 || ( cd ${2:-$1} && echo $PWD );
}
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} \.(?:list|of|file|types)$
RewriteCond %{HTTP_REFERER} !^https?://(?:(?:sub|doms|go|here)\.sites|go|here) [NC]
RewriteRule \.(?:list|of|file|types)$ - [F,L]
</IfModule>