Skip to content

Instantly share code, notes, and snippets.

View atuttle's full-sized avatar

Adam Tuttle atuttle

View GitHub Profile
@atuttle
atuttle / nester.cfc
Last active December 24, 2015 22:09
ColdFusion 10 Closure Nesting example
component {
public string function publicMethod (String name, member=0) {
local.localVar = member + 5;
local.localVarOuter = local.localVar;
local.localVar2 = "outer: #name#";
return function() {
local.localVar = "zxcv";
return function() {
@atuttle
atuttle / _.md
Last active December 21, 2015 05:09
<cfscript>
original = fileRead(expandPath("./src.html"), "UTF-8");
encoded = encodeForHTML(original);
function htmlDecode(HTML){
return replaceList(arguments.HTML, "&lt;,&gt;,&amp;,&quot;", '<,>,&,"');
}
decoded = htmlDecode(encoded);
component {
this.contains = function(){
writeOutput("Hi from ScriptBased.contains()<br>");
};
}
@atuttle
atuttle / gist:5775766
Last active December 18, 2015 11:29
"28.4% of the top-100 grossing films of 2012 included speaking roles for women" #skeptic

According to this article, only 28.4% of the top-100 grossing films of 2012 included speaking roles for women. (Hat tip to @lindseybieda for the heads up!)

According to Wolfram Alpha (I'm happy to use a better or more complete source if one is available... Also I don't have a ton of time to put into this research at the moment...), the top 10 are:

  1. The Avengers (Scarlett Johansson, Gwyneth Paltrow)
  2. The Dark Knight Rises (Anne Hathaway, Marion Cotillard)
  3. The Hunger Games (Jennifer Lawrence, Elizabeth Banks)
  4. Skyfall (Dame Judy Dench
@atuttle
atuttle / .gitconfig
Last active December 16, 2015 02:59
my .gitconfig
[user]
name = Adam Tuttle
email = adam@fusiongrokker.com
[color]
ui = auto
[core]
autocrlf = input
excludesfile = /Users/adam/.gitignore_global
[push]
default = tracking
[11:33 AM] • jrichards|away is now known as jrichards.
[12:01 PM] • mikewallace is now known as mikewallace|away.
[12:20 PM] • dongshengcn is now known as ds|away.
[12:51 PM] • ds|away is now known as dongshengcn.
[1:01 PM] • robfraz is now known as robfraz_away.
[1:17 PM] • dongshengcn is now known as ds|away.
[1:19 PM] • kocolosk is now known as kocolosk|away.
[1:24 PM] • ds|away is now known as dongshengcn.
[1:38 PM] • dongshengcn is now known as ds|away.
[1:42 PM] • splsrvc is now known as splsrvc|food.
@atuttle
atuttle / sublime-keymap.json
Last active December 14, 2015 15:59
My personal sublime keymap
[
{ "keys": ["alt+up"], "command": "swap_line_up" }
,{ "keys": ["alt+down"], "command": "swap_line_down" }
,{ "keys": ["ctrl+alt+down"], "command": "duplicate_line" }
,{ "keys": ["alt+d"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }
,{
"keys": ["ctrl+alt+left"]
,"command": "set_layout"
,"args": {
@atuttle
atuttle / gist:4340972
Created December 19, 2012 22:04
Fuck Twitter's stupid date formatting in its goddamn ear. Worst idea ever.
<cffunction name="unfuckTwitterDateTime">
<cfargument name="fucked" />
<cfargument name="GMTOffset" default="0" />
<cfset fucked = trim(fucked) />
<cfset var d = right(fucked, 4) & '-' & monthAbrToNum(mid(fucked, 5, 3)) & '-' & mid(fucked, 9, 2) />
<cfset var t = mid(fucked, 12, 8) />
<cfreturn dateAdd("h", GMTOffset, ParseDateTime(d & ' ' & t)) />
</cffunction>
<cffunction name="monthAbrToNum">
<cfscript>
_ = new underscore();
fail = _.range(10);
writeDump(var=fail, label="_.range(10)");
customRange = [];