Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require "base64"
if ARGV[0].nil?
puts "Usage: #{$0} <name.css>"
exit 1
end
lines = File.readlines(ARGV[0])
font = {}
#!/usr/bin/env ruby
# Get the source for woff2sfnt from http://people.mozilla.org/~jkew/woff/woff-code-latest.zip
unless ARGV.empty?
ARGV.each do |filename|
if filename[-4..-1] == 'woff'
`woff2sfnt #{filename} > #{filename[0...-4]}otf`
end
end
#!/usr/bin/env ruby
require 'open-uri'
require 'rubygems'
require 'active_support'
account = 'thijs'
max_id = 18216684927
File.open("#{account}.txt", 'w') do |f|
loop do
<!DOCTYPE html>
<html>
<head>
<title>Spinner</title>
<meta charset="utf-8">
<style>
canvas, a { display: block; }
</style>
</head>
<body>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="zepto_original.js"></script>
</head>
<body>
<div id="canvas"><div id="slide1"><img></div></div>
<script>
var slide = $('#slide1');
© 1999 Bob. Anyone may use this work without restrictions as long
as this paragraph is included. The work is provided “as is”,
without warranty of any kind. 
#!/usr/bin/env ruby
unless ARGV.empty?
ARGV.each do |filename|
`pngcrush -rem gAMA -rem cHRM -rem iCCP -rem sRGB #{filename} #{filename}.stripped`
`mv #{filename}.stripped #{filename}`
`touch #{filename}`
end
else
p "Usage: #{$0} filename"
@tvandervossen
tvandervossen / .kick
Created October 12, 2010 20:18
Reload browser on save Kicker recipe
process do |files|
execute("osascript -e 'tell application \"WebKit\"
do JavaScript \"window.location.reload()\" in first document
end tell'")
end
@tvandervossen
tvandervossen / gist:660306
Created November 2, 2010 21:12
Add mouse events to your touch app
var start = 'touchstart', move = 'touchmove', end = 'touchend';
if (!device.hasTouch) { start = 'mousedown'; move = 'mousemove'; end = 'mouseup'; }
element.addEventListener(start, this.ontouchstart.bind(this), false);
element.addEventListener(move, this.ontouchmove.bind(this), false);
element.addEventListener(end, this.ontouchend.bind(this), false);
element.addEventListener('touchcancel', this.ontouchcancel.bind(this), false);
@tvandervossen
tvandervossen / collect.js
Created November 4, 2010 09:46
List comprehension for JavaScript
Object.prototype.collect = function(callback) {
var result = [];
for (var key in this) {
if (this.hasOwnProperty(key)) {
result.push(callback(this[key], key));
}
}
return result;
};