Skip to content

Instantly share code, notes, and snippets.

View shawnbot's full-sized avatar
🎹

Shawn Allen shawnbot

🎹
View GitHub Profile
@malsup
malsup / jsonp
Created March 20, 2009 02:58
$.getJSONP
// fn to handle jsonp with timeouts and errors
// hat tip to Ricardo Tomasi for the timeout logic
$.getJSONP = function(s) {
s.dataType = 'jsonp';
$.ajax(s);
// figure out what the callback fn is
var $script = $(document.getElementsByTagName('head')[0].firstChild);
var url = $script.attr('src') || '';
var cb = (url.match(/callback=(\w+)/)||[])[1];
/**
* @preserve
* Adamia 3D Engine v0.1
* Copyright (c) 2010 Adam R. Smith
* Licensed under the new BSD License:
* http://www.opensource.org/licenses/bsd-license.php
*
* Project home: http://code.google.com/p/adamia-3d/
*
* Date: 01/12/2010
tmpdir=tmp
if [ -d "$tmpdir" ]; then
rm -rf $tmpdir
fi
mkdir $tmpdir
height=2592
width=10
n=0
for f in *.jpg
do
@think49
think49 / cssstyledeclaration-removeproperty.js
Last active June 7, 2017 04:05
cssstyledeclaration-removeproperty.js, cssstyledeclaration-setproperty.js : IE8- で動作する CSSStyleDeclaration#removeProperty, CSSStyleDeclaration#setProperty
/**
* cssstyledeclaration-removeproperty.js
* define CSSStyleDeclaration.prototype.removeProperty for IE.
*
* @version 1.0.4
* @author think49
* @url https://gist.github.com/953107
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
* @see <a href="http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface">5.5.1. The CSSStyleDeclaration Interface - CSSOM</a>
* @see <a href="http://msdn.microsoft.com/en-us/library/dd347052%28v=vs.85%29.aspx">CSSStyleDeclaration Prototype (attribute) - MSDN</a>
@eliperelman
eliperelman / LICENSE.txt
Created June 17, 2011 15:37 — forked from 140bytes/LICENSE.txt
140byt.es polyfill for Array.filter
DO WHAT THE **** YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Eli Perelman http://eliperelman.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE **** YOU WANT TO PUBLIC LICENSE
@Gozala
Gozala / weak-map.js
Created October 7, 2011 10:34
Harmony WeakMap shim for ES5
/* vim:set ts=2 sw=2 sts=2 expandtab */
/*jshint asi: true undef: true es5: true node: true devel: true
forin: false latedef: false */
/*global define: true */
if (typeof(WeakMap) === 'undefined') WeakMap = (function(global) {
"use strict";
function defineNamespace(object, namespace) {
@geemus
geemus / heroku.md
Created October 12, 2011 22:17
heroku style guide

TODO empty arrays and/or nil values (see apps:info)

General Guidelines

  • Use full sentences, including punctuation.
  • Labels should be provided where needed in the form of 'Labels labels:'.
  • Commands should have one newline between the header and body and another after the body.
  • Alpha-sort arrays before display and display labeled data in alpha-sorted key order.
@shawnbot
shawnbot / google.js
Created March 6, 2012 01:00
Stamen tiles in popular map engines
// replace "toner" here with "terrain" or "watercolor"
var layer = "toner";
var map = new google.maps.Map(document.getElementById("element_id"), {
center: new google.maps.LatLng(37.7, -122.4),
zoom: 12,
mapTypeId: layer,
mapTypeControlOptions: {
mapTypeIds: [layer]
}
});
@ariya
ariya / license.txt
Created April 8, 2012 16:24
Malicious PHP masqueraded as WordPress license.txt
<?php
$GLOBALS['_1660021129_'] = Array(
'sprintf',
'ip2long',
'substr_count',
'sleep',
'strpos',
'preg_replace',
'stripos',
'gethostbyaddr',
@migurski
migurski / polygonize.py
Created April 25, 2012 22:16
Polygonize a bag of lines
from sys import argv
from shapely.ops import polygonize
from shapely.geometry import asShape, LineString
import json
if __name__ == '__main__':
input = argv[1]
input = json.load(open(input))