This file contains hidden or 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
$.fn.keypressCensor = function(match) { | |
var regex = match ? match : /[^0-9]/; | |
$(this).keypress(function(e){ | |
var keyCode = e.keyCode || e.charCode; | |
var key = String.fromCharCode(keyCode); | |
if (key.match(regex) && ! (e.ctrlKey || e.metaKey)) { | |
e.preventDefault(); | |
} | |
}); |
This file contains hidden or 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
$.fn.linkHeight = function(target) { | |
var el = $(this); | |
target = $(target); | |
var padding = parseInt(el.css('padding-top'), 10) + parseInt(el.css('padding-bottom'), 10); | |
function updateHeight() { | |
el.height('auto'); | |
var targetHeight = target.outerHeight() - padding; | |
if (targetHeight > el.height()) { | |
el.height(targetHeight); |
This file contains hidden or 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 viddlerVideoSwitch(objectElement, newId) { | |
viddlerVideoInterface(objectElement, function(movie){ | |
movie.setMovie(videoId, true); | |
}, function(video){ | |
video = $(video); | |
var src = video.attr('src'); | |
var poster = video.attr('poster'); | |
var oldId = src.match(/file\/([^\/]+)\/html5/)[1]; | |
var oldIdRegexp = new RegExp(oldId); | |
video.attr('src', src.replace(oldIdRegexp, newId)); |
This file contains hidden or 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 'time' | |
name = "Andrew" | |
wake_up_time = "5:30am" | |
tomorrow = Time.now | |
tomorrow -= tomorrow.hour * 60 * 60 | |
tomorrow -= tomorrow.min * 60 | |
tomorrow += 60 * 60 * 24 |
This file contains hidden or 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
Vjsp.getStyle = function(element, property, toInt) { | |
var result = element.style[property]; | |
if (! result) { | |
if (element.currentStyle) { | |
result = element.currentStyle[property]; | |
} else if (window.getComputedStyle) { | |
// Convert to dash-case | |
property = property.replace(/([A-Z])/g,"-$1").toLowerCase(); | |
result = document.defaultView.getComputedStyle(element, null).getPropertyValue(property); |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>WebKit Bug</title> | |
<style type="text/css"> | |
#container { position: relative; width: 800px; } | |
#controls { position: absolute; bottom: 0; left: 0; width: 100%; } | |
#controls, #controls * { height: 30px; } | |
#bar-outer { background: black; } | |
#bar-inner { position: absolute; background: red; width: 20px; } |
This file contains hidden or 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
class NameNotUnique < StandardError; end | |
class Name | |
attr_reader :name | |
def initialize(name) | |
set_name(name) | |
end | |
def ==(another_name) | |
name == another_name.to_s |
This file contains hidden or 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
class Me | |
include Parent | |
def use_swimming_pool | |
puts "This pool is so refreshing!" | |
end | |
def go_on_vacation | |
expose :use_swimming_pool | |
end |
This file contains hidden or 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
Copyright (c) 2010, Andrew Smith | |
This software is a copy of software that I wrote, but it is not "my" | |
software, it is your software, because it resides on your computer. | |
Therefore, you may do what you want with it, not because I said so, | |
but because you own your computer. | |
I have no right to dictate to you what you may or may not do with | |
your computer, therefore I have no right to dictate to you what you | |
may or may not do with a copy of software that I wrote which is on |
This file contains hidden or 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
********************************************************************** | |
APERTURE SCIENCE | |
ASSET PACKAGING AND CAKE DELIVERY SYSTEM | |
"We Do What We Must, Because We Can"™ | |
********************************************************************** | |
Copying /source to /public | |
Compiling compass | |
exists css | |
unchanged style.sass |