Skip to content

Instantly share code, notes, and snippets.

@dansimco
dansimco / gist:3067704
Created July 7, 2012 19:08
touchUpInside
isTouchInside = function(e){
var event = e.originalEvent;
touch_inside = false;
if (! event.touches[0] ) return touch_inside;
touchX = event.touches[0].pageX;
touchY = event.touches[0].pageY;
if(
touchX > element_coords.left &&
touchX < element_coords.right &&
touchY > element_coords.top &&
@dansimco
dansimco / gist:3106555
Created July 13, 2012 18:38
InstantFileUploader
/*global Element, IFrame, document, Button */
var InstantFileUploader;
InstantFileUploader = function (input, params) {
"use strict";
var self = this;
self.frameId = String.uniqueID();
self.loading = false;
self.onComplete = params.onComplete || function () {};
@dansimco
dansimco / uploadPhotoToFacebook.js
Created January 2, 2013 04:27
Posts a photo to a users profile, creating a gallery where needed.
/*global FB, alert, console */
//Usage
// uploadPhotoToFacebook({
// caption: 'A Picture',
// url: 'http://lorempixel.com/400/300/',
// album: 'JS API',
// album_description: "An album of pictures",
// onSuccess: function(){
@dansimco
dansimco / app.rb
Created May 29, 2012 15:09
Concise Sinatra Amazon S3 Upload Example
require "rubygems"
require 'sinatra'
require "aws/s3"
get '/' do
return %Q{
<form action="upload" method="post" accept-charset="utf-8" enctype="multipart/form-data">
<div>
<input type="file" name="file" value="" id="file">
</div>