Skip to content

Instantly share code, notes, and snippets.

View bbbrrriiiaaannn's full-sized avatar

Brian S bbbrrriiiaaannn

View GitHub Profile
@bbbrrriiiaaannn
bbbrrriiiaaannn / Auto Refresh CSS Bookmarklet
Created February 23, 2010 01:11
Bookmarklets for CSS authors: these will refresh your CSS without reloading the page.
javascript:(function(){setInterval(function(){var%20i,a,s;a=document.getElementsByTagName('link');for(i=0;%20i<a.length;%20i++){s=a[i];if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href){var%20h=s.href.replace(/(&|\?)forceReload\=\d+/,'');s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+(new%20Date().valueOf())}}},3000)})()
@bbbrrriiiaaannn
bbbrrriiiaaannn / toxic.css
Created April 29, 2011 01:07
Toxic HTML attributes - Find and quarantine inline styles and other worst-practices in your markup
@-webkit-keyframes toxic {
from { background-color: rgba(116,154,2,.6); -webkit-box-shadow: 0 0 6px 2px rgb(116,154,2); }
to { background-color: rgba(145,189,9,.6); -webkit-box-shadow: 0 0 12px 2px rgb(145, 189, 9); }
}
[style],
img[title] {
-webkit-animation: toxic .8s cubic-bezier(.50, 0, .50, 1) 0 infinite alternate !important;
}
@bbbrrriiiaaannn
bbbrrriiiaaannn / facebook.com.js
Created October 26, 2011 18:42
dotjs plugin for Nate Bolt's "Get A Life" badges for Facebook
//Thanks to http://boltron.tumblr.com/post/11616794382/its-always-funny-finding-weird-shit-i-make-out-on I guess
if( $("#blueBarHolder").length ) { //Are we on a blue bar page? This gates this from running on billions of Like buttons.
$(".fbJewel").css({"position":"relative"}); //This normally only applies to .fbJewel.hasNew, but seemingly no harm in forcing it.
$(".jewelCount").css({"display":"block"}).each(function(i,ele) { //Likewise, .hasNew .jewelCount, but no harm.
$(ele).append("<span class='getThatLife'>" + ["GET","A","LIFE"][i] +"</span>");
}).children(".getThatLife").css({
"position": "absolute",
"top": 0,
"right": 0
});
@bbbrrriiiaaannn
bbbrrriiiaaannn / mopen
Created November 5, 2011 01:20
Pass in a filename fragment and TextMate will open all instances of that filename in the current directory. Thank you Spotlight, thank you TextMate.
#!/bin/bash
mdfind -onlyin . -name $1 | xargs mate
@bbbrrriiiaaannn
bbbrrriiiaaannn / stretcher.js
Created March 23, 2012 23:30
Lazy pre-Backstretch Backstretch
$(window).resize(function(evt){
var imgDim = [ $("img#homepage-image").width(), $("img#homepage-image").height() ];
var bodyDim = [ $(document.body).width(), $(document.body).height() ];
$("#homepage-image-wrapper").width(bodyDim[0]).height(bodyDim[1]);
var widthRatio = imgDim[0]/bodyDim[0];
var heightRatio = imgDim[1]/bodyDim[1];
if( widthRatio > heightRatio ) {
$("img#homepage-image").height(bodyDim[1]).width(imgDim[0]/heightRatio);

Some updates to Angelina Fabbro's tremendous original reference document. The most notable additions are shadow pseudoclasses for scroller pseudoelements.

A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want: -webkit-appearance:none;

<video>

video::-webkit-media-controls-panel

@bbbrrriiiaaannn
bbbrrriiiaaannn / pluralize.ftl
Last active April 7, 2020 00:55
Pluralizer for Freemarker
[#-- Transform many singular English words to their plural English form.
Rules cribbed from http://kuwamoto.org/2007/12/17/improved-pluralizing-in-php-actionscript-and-ror/ which were cribbed from https://github.com/rails/rails/blob/9e0b3fc7cfba43af55377488f991348e2de24515/activesupport/lib/active_support/inflections.rb , so MIT License at http://b.mit-license.org/ applies --]
[#assign plurals = {
'(quiz)$': '$1zes',
'^(ox)$': '$1en',
'([m|l])ouse$': '$1ice',
'(matr|vert|ind)ix|ex$': '$1ices',
'(x|ch|ss|sh)$': '$1es',
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
font: 300 11px "Helvetica Neue", Helvetica, Arial, sans-serif;
fill: #bbb;
}
.node:hover {
@bbbrrriiiaaannn
bbbrrriiiaaannn / SassMeister-input.sass
Created April 18, 2014 22:15
Generated by SassMeister.com.
// ----
// Sass (v3.3.5)
// Compass (v1.0.0.alpha.18)
// ----
$shopListCellWidth: 220px
$shopListCellMargin: 30px
@mixin browserLacks($prop)
.wsi-no-#{$prop} &
@bbbrrriiiaaannn
bbbrrriiiaaannn / SassMeister-input.sass
Created May 13, 2014 15:08
Generated by SassMeister.com.
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// ----
$hiDpiSuffix: '-2x' !default
=hidpi($backgroundImageUri, $backgroundProps)
$hiDpiBackgroundImageUri: str-insert($backgroundImageUri, $hiDpiSuffix, str-index($backgroundImageUri,'.'))
background: $backgroundProps