This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is really silly | |
irb(main):035:0> hash = {:x => 'y'} | |
=> {:x=>"y"} | |
irb(main):036:0> hash() | |
=> 113830 | |
irb(main):037:0> hash { puts 'blah' } | |
=> 113830 | |
irb(main):038:0> hash{:x} | |
=> 113830 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rotatePages() { | |
if (navigator.appVersion.indexOf('iPhone OS ') < 0) { // Don't rotate on iPhone. | |
posts = document.getElementsByClassName('postRotationContainer'); | |
for (i = 0; i < posts.length; i++) { | |
// console.log("Post "+i+": Height: "+posts[i].clientHeight+" Current:"+posts[i].style.webkitTransform); | |
if (typeof posts[i].parentNode.className == 'string' // we can read the parent's classname | |
&& posts[i].parentNode.className.indexOf('noRotation') < 1 // - and it's not set to noRotation | |
&& ! posts[i].style.webkitTransform) // - and not already rotated | |
{ | |
posts[i].style.webkitTransform = 'rotate(' + ((Math.random() * maxRotationAngle * 2) - maxRotationAngle) + 'deg)'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logger = env['rack.errors'] | |
STDOUT.reopen(logger) | |
STDERR.reopen(logger) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken from http://reductivelabs.com/trac/puppet/wiki/Recipes/SimpleText | |
define ensure_key_value($file, $key, $value, $delimiter = " ") { | |
# append line if "$key" not in "$file" | |
exec { "echo '$key$delimiter$value' >> $file": | |
unless => "grep -qe '^$key[[:space:]]*$delimiter' -- $file", | |
path => "/bin:/usr/bin" | |
} | |
# update it if it already exists... | |
exec { "sed -i '' 's/^$key[[:space:]]*$delimiter.*$/$key$delimiter$value/g' $file": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* Secure Hash Algorithm (SHA256) | |
* http://www.webtoolkit.info/ | |
* | |
* Original code by Angel Marin, Paul Johnston. | |
* | |
**/ | |
function SHA256(s){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
dependencies = <<-EOS | |
rack 0.9.1 | |
activesupport >= 2.2.2 | |
daemons >= 1.0.10 | |
djanowski-workling | |
djanowski-collage >= 0.1.3 | |
faker >= 0.3.1 | |
fiveruns-memcache-client >= 1.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:%s/\e\[\%([01]\|3[0-7]\|4[0-7]\)\%(;\%([01]\|3[0-7]\|4[0-7]\)\)*m//g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---------------------------------------------------------------------------------------------------- | |
# Python / Skype4Py example that prints out chat messages | |
# Adapted from: http://github.com/pneff/SkypeBot | |
# | |
# Tested with Skype4Py version 0.9.28.5 and Skype verson 3.8.0.96 | |
import sys | |
import Skype4Py | |
CHAT_NAME = '#blah/$SHA1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This is a script that will automatically download the latest video from the | |
# Final Gear torrent feed. I don't write many shell scripts so please excuse | |
# any bad shell scripting. | |
# My setup is to have Transmission automatically open torrents that are in | |
# my $HOME/Downloads/Torrents directory. You can set this in: | |
# Transfers > Auto Add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env macruby | |
# from tomafro.net | |
framework 'Cocoa' | |
framework 'WebKit' | |
class Snapper | |
attr_accessor :options, :view, :window | |
def initialize(options = {}) |