Skip to content

Instantly share code, notes, and snippets.

/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs
@jnslxndr
jnslxndr / BaseProject.pde
Created December 14, 2010 12:36
Simple Sketch Base for Processing
/**********************************************
* Simple Sketch Base for interactive Projects
* done in Processing http://processing.org
*********************************************/
/**
* Declare your variables here:
*/
int var; // For example
@jnslxndr
jnslxndr / Array.unique.js
Created January 6, 2011 17:58
Make an Array with unique members in javascript
/* Make an Array with unique members */
Array.prototype.unique = function(){
return this.filter(function(){return arguments[2].indexOf(arguments[0],arguments[1]+1)<0})
}
@jnslxndr
jnslxndr / SED-renamer
Created January 7, 2011 13:55
Using sed to rename files in more or less one line ;)
# for example ".bak"
TOKEN=.bak
ETOKEN=`echo $TOKEN |sed 's/\./\\\./'`
# any suggestions how to get rid of this "bash" at the end are appreciated
# also: alternatively there is a NOT opperator on sed's regex - not used here
find . -path "*$TOKEN" -d 1 |sed 's/^\.\(.*\)\($ETOKEN\)$/mv `pwd`\1\2 `pwd`\1/'|bash
@lehni
lehni / animframe.js
Created March 13, 2011 21:37
Paul Irish's requestAnimFrame shim improved with suport for element visibility and window blur detection
// requestAnimFrame shim layer by Paul Irish
// Support for element visibility and window blur detection by Juerg Lehni
(function() {
// Chrome shipped without the time arg in m10
var webkitRequest = window.webkitRequestAnimationFrame;
if (webkitRequest) {
webkitRequest(function(time) {
if (time == undefined)
webkitRequest = null;
@danielres
danielres / sass.xml
Created March 24, 2011 15:22
Jedit modes
<?xml version="1.0"?>
<!DOCTYPE MODE SYSTEM "xmode.dtd">
<MODE>
<PROPS>
<PROPERTY NAME="wrap" VALUE="none"/>
@micahbrich
micahbrich / flac-to-mp3.rb
Created May 21, 2011 23:40
Batch convert flac to mp3, with metadata, using ffmpeg
Dir.glob("*.flac").each do |f|
flac = "./#{f.gsub(' ', '\ ')}"
mp3 = "./#{f.gsub(' ', '\ ').chomp('.flac')}.mp3"
system("ffmpeg -i #{flac} -map_meta_data #{mp3}:#{flac} #{mp3}")
end
@maccman
maccman / gist:1232164
Created September 21, 2011 14:23 — forked from tvandervossen/gist:1231476
Mobile Safari viewport sizes on iOS 4.3 and 5
iPad
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3
@henry0312
henry0312 / mingw.sh
Created November 27, 2011 06:19
Build MinGW Cross Compiler on Mac OS X Lion
#!/bin/sh
# 初期設定
WORK=$HOME/Builds/GCC
PREFIX=$HOME/mingw
export PATH="$HOME/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
# ソースコードのダウンロード
if [ ! -d $WORK/src ] ; then
mkdir src
@mattbaker
mattbaker / README
Created December 22, 2011 06:02
SVG to PNG render with Node and D3.js
This example expects to have d3.min.js and d3.layout.min.js in the same directory as pie.js and pie_serv.js.
Run with node pie_serv.js