View gist:2776908
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function map(val, a1, a2, b1, b2) { return ((val - a1) * (b2 -b1)/(a2 - a1)) + b1; } |
View perlin-noise-simplex.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/304522 | |
// Ported from Stefan Gustavson's java implementation | |
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf | |
// Read Stefan's excellent paper for details on how this code works. | |
// | |
// Sean McCullough banksean@gmail.com | |
/** | |
* You can pass in a random number generator object if you like. | |
* It is assumed to have a random() method. |
View Cherry Picking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout develop | |
git log -1 | |
git checkout translation | |
git cherry-pick [commit hash goes here] |
View Index of an item, given it's X and Y
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index = (y*rows)+x; |
View gist:2784493
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Export your Mint data to CSV. | |
Import to Excel or equivalent. | |
Trim the data down to just the date range you need (Mint doesn’t allow this out of the box). | |
Add a few columns to contain your totals and drop in these formulas: | |
=SUMIF(E:E,”debit”,D:D) | |
// Auto & Transport | |
=IF(E:E=”debit”,SUM(SUMIF(F:F,”Auto & Transport”,D:D),SUMIF(F:F,”Auto Insurance”,D:D),SUMIF(F:F,”Auto Payment”,D:D),SUMIF(F:F,”Gas & Fuel”,D:D),SUMIF(F:F,”Parking”,D:D),SUMIF(F:F,”Service & Parts”,D:D),SUMIF(F:F,”Public Transportation”,D:D)),0) |
View gist:2784498
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Because I always forget... | |
// Get the angle between two points | |
atan2(y2-y1,x2-x1); | |
// Get the x and y of an object around a radius, given an angle. | |
x = cos(radians(angle)) * radius |
View alphabet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = function() { | |
var b = function() { | |
var c = function() { | |
var d = function() { | |
var e = function() { | |
var f = function() { | |
var g = function() { | |
var h = function() { | |
var i = function() { | |
var j = function() { |
View gist:4113485
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function resizeImage($img,$w,$h) { | |
var maxWidth = $w; | |
var maxHeight = $h; | |
var w = $img.width; | |
var h = $img.height; | |
if(w > h) { | |
if(w > maxWidth) { | |
h *= maxWidth/w; |
View .bash_profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias ls='ls -GFh' | |
export CLICOLOR=1 | |
# From Andrzej Szelachowski's ~/.bash_profile: | |
# Note that a variable may require special treatment | |
#+ if it will be exported. | |
DARKGRAY='\[\e[1;30m\]' |
View gist:4359595
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSLog(@"%@", [NSNumber numberWithInt:i]); | |
/* | |
%@ Object | |
%d, %i signed int | |
%u unsigned int | |
%f float/double | |
%1.2f to controll number of decimals | |
%x, %X hexadecimal int |
OlderNewer