Skip to content

Instantly share code, notes, and snippets.

@roc
roc / mini.jGeoCodeList.js
Created May 2, 2011 18:17
Super quick, slightly dumb ajax geoCoding script.
//BAM - it's dependent on jquery atm
//<script src="ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js">
//</script>
var $someDivForOutput = $("section#divYeahExactly");
var cityList =
{
geoCodeLocation : function(loc)
{
@roc
roc / timj-player-controls.js
Created March 7, 2012 09:57
Key Controls for thisismyjam.com
(function(){
window.playerKeyControls = window.playerKeyControls || (function(){
var keys = { left: 37, up: 38, right: 39, down: 40, enter : 13, escape : 27, space : 32, L : 76 },
elements = {
playerBar : $("#player-bar"),
back : $("#backwards"),
forward : $("#forwards"),
playPause : $("#playPause"),
@roc
roc / timj-player-controls.min.js
Created March 7, 2012 09:58
Bookmarklet for http://thisismyjam.com player controls
<a href="javascript:(function(){window.playerKeyControls=window.playerKeyControls||function(){var keys={left:37,up:38,right:39,down:40,enter:13,escape:27,space:32,L:76},elements={playerBar:$("#player-bar"),back:$("#backwards"),forward:$("#forwards"),playPause:$("#playPause"),like:$("#controlLike"),linker:$("#playerJamLink")}; $(document).on("keydown",function(e){var keyCode=e.keyCode||e.which;if(!elements.playerBar.is(":visible"))return;if(e.metaKey){console.log("got meta key");return true;}switch(keyCode){case keys.up:case keys.down:return true;case keys.left:elements.back.click();break;case keys.right:elements.forward.click();break;case keys.L:elements.like.click();break;case keys.enter:elements.linker.click();break;case keys.space:elements.playPause.click();break;}return false;});}();})();">Keyboard Controls</a>
@roc
roc / dabblet.css
Created April 27, 2012 14:52
Semi-transparent color masking
/**
* Semi-transparent color masking
* (answer to question)
*/
.img-wrapper {
position: relative;
float:left;
overflow: hidden;
}
@roc
roc / dabblet.css
Created April 27, 2012 14:52
Semi-transparent color masking
/**
* Semi-transparent color masking
* (answer to question)
*/
.img-wrapper {
position: relative;
float:left;
overflow: hidden;
}
@roc
roc / dabblet.css
Created June 21, 2012 18:11
Artist Song Dick Docs
/**
* Artist Song Dick Docs
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
// You could do it with n
opacity()
opacity arguments
-moz-opacity arguments
filter: unquote('alpha(opacity=' + round(arguments * 100) + ')')
-ms-filter unquote('progid:DXImageTransform.Microsoft.Alpha(Opacity=' + round(arguments * 100) + ')')
@roc
roc / stylus
Created February 6, 2013 12:59
You want stylus -w my/dir to watch files and recursively build when an @imported file is modified. This doesn't happen by default so I'm writing this as a reference to the fix listed here: https://github.com/LearnBoost/stylus/issues/486 Thanks @jonnywonny!
#!/usr/bin/env node
/**
* Module dependencies.
*/
var fs = require('fs')
, stylus = require('../lib/stylus')
, basename = require('path').basename
, dirname = require('path').dirname
@roc
roc / .profile
Created February 7, 2013 10:36
Pushups and Pullups for your bash, because gym metaphors work really well with git wrangling.
# should return current branch
function current_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
alias pullup='git pull origin $(current_branch)'
alias pushup='git push origin $(current_branch)'
@roc
roc / youHaveToDoThisOnAPerChannelBasis.txt
Created April 5, 2013 11:35
Just fucking enable inline images in irccloud.com
// CB stands for either common bollocks or cock block or both at the same time
cb().enableInlineImages();