Skip to content

Instantly share code, notes, and snippets.

View endtwist's full-sized avatar

Joshua Gross endtwist

View GitHub Profile
@endtwist
endtwist / gist:1630899
Created January 18, 2012 04:12
Paste event in Internet Explorer
// We need a textarea for IE, too: <textarea id="pasteField"></textarea>
$( '#pasteField' ).bind( 'paste', function( evt ) {
// In true Microsoft form, the type to get plain text is Text with a captial T.
console.log( window.clipboardData.getData( 'Text' ) );
} );
@endtwist
endtwist / gist:1630921
Created January 18, 2012 04:17
Paste event in Safari
// Safe to say...textarea is a good idea: <textarea id="pasteField"></textarea>
$( '#pasteField' ).on( 'paste', function( evt ) {
// Safari has a weird "types" list that we need to loop through and no "items" array.
var i = 0, items = [], item, key = 'text/plain', kind = 'string';
while (i < evt.originalEvent.clipboardData.types.length) {
var key = evt.originalEvent.clipboardData.types[i];
if( !key.match( /(text\/)|(plain-text)/i ) ) {
kind = 'file';
}
@endtwist
endtwist / ios-test.css
Created January 28, 2012 21:03 — forked from tonywok/ios-test.css
iOS Media Queries
// iOS Media Queries
// Goal: capture styles for iPhone, iPhone 3G, iPhone 3GS, iPhone 4, iPhone 4S, iPad, and iPad 2
//
// Author: Tony Schneider (@tonywok)
// Please tell me where I fail. :)
// iPhone v(4,4S) portrait
// test: black text (overwritten by v* portrait) with blue background
@media all and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
a {
@endtwist
endtwist / server.js
Created February 4, 2012 03:40 — forked from esperia/server.js
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var util = require('util');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {
@endtwist
endtwist / gist:2775779
Created May 23, 2012 15:06
Animated Google Hangout Overlay
// Create a “marker” overlay.
var markerImage = gapi.hangout.av.effects.createImageResource( 'https://donuthorns.appspot.com/static/x.png' )
, marker = markerImage.createOverlay( {
scale: {
magnitude: 0.25
, reference: gapi.hangout.av.effects.ScaleReference.HEIGHT
}
} );
marker.setVisible( true );
@endtwist
endtwist / gist:3240894
Created August 2, 2012 21:41 — forked from dustinsenos/gist:3240838
LESS Mixin with String Interpolation, broken?
@cdn: "rons-house";
.add-bg(@url) {
background-image: url(@url);
}
.foo {
.add-bg("@{cdn}/bar.png"); // why not this?
}
@endtwist
endtwist / readability.js
Created August 12, 2012 04:38 — forked from jakedahn/readability.js
Readability.js
/*jslint undef: true, nomen: true, eqeqeq: true, plusplus: true, newcap: true, immed: true, browser: true, devel: true, passfail: false */
/*global window: false, readConvertLinksToFootnotes: false, readStyle: false, readSize: false, readMargin: false, Typekit: false, ActiveXObject: false */
var dbg = (typeof console !== 'undefined') ? function(s) {
console.log("Readability: " + s);
} : function() {};
/*
* Readability. An Arc90 Lab Experiment.
* Website: http://lab.arc90.com/experiments/readability
@endtwist
endtwist / gist:4692470
Created February 1, 2013 16:40
convert file to base64 and copy to clipboard
openssl base64 < file.png | tr -d '\n' | pbcopy
@import "compass/utilities/sprites";
@import "compass/css3/background-size";
// Define the sprites here. Notice that I've added an optional spacing.
$sprites: sprite-map("my-sprites/*.png", $spacing: 20px);
$sprites2x: sprite-map("my-sprites-retina/*.png", $spacing: 40px);
// Now let's define the sprite mixin.
// This delegates to the reusable retina-sprite mixin.
@mixin sprite($name){
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold