Skip to content

Instantly share code, notes, and snippets.

View kirbysayshi's full-sized avatar

Drew Petersen kirbysayshi

View GitHub Profile
<ul id="mealSelection" class="open">
<li>
<a href="#" class="selectItem item0">
<img src="" alt="" />
<p>1 in 6 families won't be sitting down to dinner tonight.</p>
</a>
</li>
<li>
<a href="#" class="selectItem item1">
<img src="" alt="" />
//Crazy Haversine formula for getting locations within 25 miles of searched location.
//Don't touch this or it will explode!
function hvs1(results, Rga){
var R = 6371; // Radius of the earth in km
var dLat = (results[0].geometry.location.b - Rga.FoodBankData[0].Latitude).toRad(); // Javascript functions in radians
var dLon = (results[0].geometry.location.c - Rga.FoodBankData[0].Longitude).toRad();
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(Rga.FoodBankData[0].Latitude.toRad()) * Math.cos(results[0].geometry.location.b.toRad()) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
/**
* Smokescreen v0.1.2 - Chris Smoak <chris.smoak@gmail.com>
* A Flash player written in JavaScript.
*
* Copyright 2010, RevShock
*
* Date: 2010-05-27
*/
var Smokescreen = function (url, element, width, height, name, params) {
goog = {};
/*
* def.js: Simple Ruby-style inheritance for JavaScript
*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(global) {
// used to defer setup of superclass and plugins
var deferred;
function(){
alert("awesome");
}
@kirbysayshi
kirbysayshi / primal.js
Created December 9, 2010 00:11
test for primeness in JS
(function(prime){
var i = 2;
while(i <= Math.sqrt( prime ) ){
if(prime % i ==0){
return false;
}
i++;
}
@kirbysayshi
kirbysayshi / moarJSFiddle.js
Created January 30, 2011 00:17
Want some more space for JSFiddle? Use this bookmarklet!
// javascript:(function(){if(typeof(MOAR)%20===%20%27undefined%27)%20{MOAR%20=%20{%20backPocket:%20{},%20tastedGood:%20false%20};}MOAR.dontBlameMe%20=%20function%20undo(){var%20prop,%20style;for(prop%20in%20MOAR.backPocket){for(style%20in%20MOAR.backPocket[prop]){$(prop).style[style]%20=%20MOAR.backPocket[prop][style];}}MOAR.tastedGood%20=%20false;};MOAR.nomNom%20=%20function%20moar(){MOAR.backPocket.header%20=%20{display:%20$(%27header%27).style.display};MOAR.backPocket.sidebar%20=%20{display:%20$(%27sidebar%27).style.display};MOAR.backPocket.content%20=%20{marginLeft:%20$(%27content%27).style.marginLeft%20=%20%27%27};$(%27header%27).style.display%20=%20%27none%27;$(%27sidebar%27).style.display%20=%20%27none%27;$(%27content%27).style.marginLeft%20=%20%2715px%27;MOAR.tastedGood%20=%20true;};if(MOAR.tastedGood%20===%20false){MOAR.nomNom();}%20else%20{MOAR.dontBlameMe();}})();
(function(){
if(typeof(MOAR) === 'undefined') {
MOAR = { backPocket: {}, tastedGood: false };
}
MOAR.dontBlameMe = function undo(){
var input = 'FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethat
(function(){
function F(){};
function inherits(child, parent) {
F.prototype = parent.prototype;
//child.superClass_ = parent.prototype;
child.prototype = new F();
child.prototype.constructor = child;
}
@kirbysayshi
kirbysayshi / CGLM.example.js
Created March 21, 2011 17:16
My attempt at two methods of a constant game-loop in JavaScript
// Example CGLM usage:
ZAP.CGLM
.setMode('custom')
.mode
.setFPS(30)
.setTimeStep(10)
.setSpeedX(1);
function priorityOne(dt, stats){