Skip to content

Instantly share code, notes, and snippets.

var pauseId;
// What the existing players c
window.permitMainAudio = function(event) {
if (!player.isPlaying()) {
return true;
}
// event.location is info from source, ie YouTube
if (event.source == 'video') {
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var box, docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, top, left,
test "should import GitHub organizations after saving" do
organization = Hashie::Mash.new(:id => 1991, :login => 'twitter')
User.any_instance.stubs(:github_organizations).returns([organization])
user = User.make!
assert_equal user.github_organizations.count, user.organizations.count
end
@dewski
dewski / index.html
Created May 1, 2012 23:14 — forked from atypical/index.html
The PHP now controls a switch. The HTML uses: http://jsfiddle.net/ThomasBurleson/3SXtf/embedded/result/
<!DOCTYPE html>
<html>
<head>
<title>Dope</title>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script>
var timeout;
$(function() {
$('#fireButton').click(function(){
if (typeof timeout !== 'undefined')
@dewski
dewski / ad.html
Created April 27, 2012 20:38 — forked from atypical/ad
ad
<!DOCTYPE html>
<html>
<head>
<title>Dope</title>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function() {
var getPositions = function () {
return {
servo: $('#servo').val(),
@dewski
dewski / ad
Created April 27, 2012 20:31 — forked from atypical/ad
ad
<form action="url/servo.php?servo=0&position=<? echo $position; ?>" method="post">
<input type="range" min="0" max="180" value="0" step="1" onchange="showValue(this.value)" / style="width:75%; margin:100px auto;">
<input type="submit" name="button" />
</form>
<span id="range">0</span>
<script type="text/javascript">
function showValue(newValue)
{
@dewski
dewski / teleduino.php
Created April 27, 2012 20:13 — forked from atypical/teleduino.php
teleduino
<?php
include_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'_config.php');
include_once(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'teleduino328_php.php');
if(isset($_SERVER['HTTP_HOST']))
{
echo "<pre>";
}
$Teleduino328PHP = new Teleduino328PHP();
@dewski
dewski / multiple.sh
Created March 6, 2012 06:46
Convert m4a to mp3
for i in *.m4a; do
y=`echo "$i"|sed -e 's/.m4a/.mp3/'`
ffmpeg -i "$i" -acodec libmp3lame -ab 192 -ac 2 "$y"
done
@dewski
dewski / dependencies.rb
Created January 31, 2012 05:34
Snippet from Gem Garage
# Public: Take the gem's runtime dependencies and install them from their remote source
#
# Returns nothing.
# Raises GemGarage::MissingGemError if the gem file doesn't exist.
def install_dependencies
raise GemGarage::MissingGemError unless File.exists?(file_path)
with_gem do |spec|
spec.runtime_dependencies.each do |dependency|
Resque.enqueue(GemGarage::Jobs::InstallDependency, rubygem.account_id, dependency.name, dependency.requirement)