Skip to content

Instantly share code, notes, and snippets.

View melvynhills's full-sized avatar

Melvyn Hills melvynhills

View GitHub Profile
@waynehoover
waynehoover / layout.haml
Created October 20, 2010 01:34
Sinatra S3 Direct Upload application
!!! 5
%html
%head
%title Sinatra AWS Upload Example
%link{:rel => "stylesheet", :href => "/css/swfupload.css", :type => "text/css", :media => "all"}
%link{:rel => "stylesheet", :href => "http://cachedcommons.org/cache/blueprint/0.9.1/stylesheets/screen-min.css", :type => "text/css", :media =>"all"}
%script{:src => "http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"}
%body
= yield
@mattmccray
mattmccray / render.js
Created November 1, 2010 19:44
Based on ICanHaz, this supports both Mustache.js and Handlebars.js
// Based on ICanHaz (http://github.com/andyet/ICanHaz.js/blob/master/ICanHaz.js)
// This version supports Mustache and Handlebars
// By M@ McCray
;var render = (function($, engine){
var cache = {},
methods = {};
$(function(){
$('script[type="text/html"]').each(function () {
var name = $(this).attr('id'),
// Records a local webcam feed and converts the recording to SWF.
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.Loader;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import flash.media.Camera;
import flash.media.Video;
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
class Singleton
@get: -> @instance ?= new @
class Test extends Singleton
constructor: -> alert "Test constructed"
run: -> alert "Test run"
class OtherTest extends Singleton
constructor: -> alert "OtherTest constructed"
run: -> alert "OtherTest run"
@javan
javan / gist:1168475
Created August 24, 2011 16:32
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@maccman
maccman / config.rb
Created August 28, 2011 12:15
Rails 3 Config
# Rails 3 Config
#
# In: config/application.yml
#
# development:
# github:
# key: test
# secret: verysecret-dev
# production:
# github:
@mrdoob
mrdoob / gist:1265705
Created October 5, 2011 20:58
yooouuutuuube.com effect in html5
<html>
<body>
<script>
var video = document.createElement( 'video' );
video.autoplay = true;
video.addEventListener( 'loadedmetadata', function ( event ) {
var scale = 0.5;
var width = video.videoWidth * scale;
@innotekservices
innotekservices / jquery.spin.js
Created October 16, 2011 02:39
jQuery Plugin for Spin.js
/*
You can now create a spinner using any of the variants below:
$("#el").spin(); // Produces default Spinner using the text color of #el.
$("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el.
$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
$("#el").spin({ ... }); // Produces a Spinner using your custom settings.
$("#el").spin(false); // Kills the spinner.
@bkeepers
bkeepers / gist:1901470
Created February 24, 2012 15:01
Spine Collections
class Message extends Spine.Model
@configure 'Message', 'text'
class Mentions extends Spine.Collection
@configure Message
@extend Spine.Model.Ajax
@url: '/messages/mentions'