Skip to content

Instantly share code, notes, and snippets.

View evanleck's full-sized avatar

Evan Lecklider evanleck

View GitHub Profile
@evanleck
evanleck / gist:3183817
Created July 26, 2012 18:59
php53 failing build on Mountain Lion with Xcode 4.4
==> Downloading http://www.php.net/get/php-5.3.14.tar.bz2/from/this/mirror
Already downloaded: /Library/Caches/Homebrew/php53-5.3.14
==> ./configure --prefix=/usr/local/Cellar/php53/5.3.14 --disable-debug --localstatedir=/usr/local/var --sysco
creating cache ./config.cache
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for egrep... grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking host system type... i386-apple-darwin12.0.0
checking target system type... i386-apple-darwin12.0.0
@evanleck
evanleck / stack-dump
Created September 20, 2012 16:33
Stack trace trying to run Sinatra app with Sprockets, sprockets-sass and Susy.
I, [2012-09-20T09:29:17.392101 #15856] INFO -- : listening on addr=0.0.0.0:4567 fd=9
I, [2012-09-20T09:29:17.392574 #15856] INFO -- : Refreshing Gem list
/Users/evan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/sprockets-sass-0.9.0/lib/sprockets/sass/functions.rb:128:in `sprockets_context': undefined method `context' for #<Sass::Importers::Filesystem:0x007fdcdf5508c0> (NoMethodError)
(in /Users/evan/Code/b/spendsmart/app/assets/css/style.scss)
from /Users/evan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/sprockets-sass-0.9.0/lib/sprockets/sass/functions.rb:63:in `image_path'
from /Users/evan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/sprockets-sass-0.9.0/lib/sprockets/sass/functions.rb:85:in `image_url'
from /Users/evan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/sass-3.2.1/lib/sass/script/funcall.rb:106:in `_perform'
from /Users/evan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/sass-3.2.1/lib/sass/script/node.rb:40:in `perform'
from /Users/evan/.rbenv/versi
@evanleck
evanleck / gist:3783430
Created September 25, 2012 17:57
Undefined method 'image_path'
I, [2012-09-25T10:56:07.756021 #19344] INFO -- : listening on addr=0.0.0.0:4567 fd=10
I, [2012-09-25T10:56:07.757704 #19344] INFO -- : master process ready
I, [2012-09-25T10:56:07.758411 #19345] INFO -- : Refreshing Gem list
I, [2012-09-25T10:56:07.758597 #19346] INFO -- : Refreshing Gem list
I, [2012-09-25T10:56:09.282028 #19345] INFO -- : worker=0 ready
I, [2012-09-25T10:56:09.286339 #19346] INFO -- : worker=1 ready
NoMethodError - undefined method `image_path' for #<Sinatra::Application:0x007fb2be3e6750>:
./application/views/layout.erb:8:in `evaluate_source'
/Users/evan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/tilt-1.3.3/lib/tilt/template.rb:209:in `instance_eval'
/Users/evan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/tilt-1.3.3/lib/tilt/template.rb:209:in `evaluate_source'
@evanleck
evanleck / map.coffee
Created September 3, 2013 00:42
Array.prototype.map shim for non-compliant browsers. Converted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map.
# Production steps of ECMA-262, Edition 5, 15.4.4.19
# Reference: http://es5.github.com/#x15.4.4.19
# from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
unless Array::map
Array::map = (callback, thisArg) ->
T = undefined
A = undefined
k = undefined
throw new TypeError(" this is null or not defined") unless this?
@evanleck
evanleck / reduce.coffee
Created September 3, 2013 00:43
Array.prototype.reduce shim for non-compliant browsers. Converted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce.
# reduce from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
if "function" isnt typeof Array::reduce
Array::reduce = (callback, opt_initialValue) ->
"use strict"
# At the moment all modern browsers, that support strict mode, have
# native implementation of Array.prototype.reduce. For instance, IE8
# does not support strict mode, so this check is actually useless.
throw new TypeError("Array.prototype.reduce called on null or undefined") if null is this or "undefined" is typeof this
throw new TypeError(callback + " is not a function") if "function" isnt typeof callback
@evanleck
evanleck / stats.coffee
Created September 3, 2013 00:47
Shim for basic statistical analysis methods on Array. Includes max, min, median, sum, mean, variance, and standard deviation.
# max
if "function" isnt typeof Array::max
Array::max = ->
"use strict"
# throw on null
throw new TypeError("Array.prototype.max called on null or undefined") if null is this or "undefined" is typeof this
Math.max.apply null, this
@evanleck
evanleck / some.coffee
Created September 3, 2013 00:50
Array.prototype.some shim for non-compliant browsers. Converted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some.
# make sure we have some
unless Array::some
Array::some = (fun) -> #, thisp
"use strict"
throw new TypeError() unless this?
thisp = undefined
i = undefined
t = Object(this)
@evanleck
evanleck / include.coffee
Created September 3, 2013 00:51
A custom include function to shortcut around the rather robust verbiage required for the "some" method.
# include
# depends on some, a shim for which can be found at https://gist.github.com/l3ck/6418548
if "function" isnt typeof Array::include
Array::include = (sought_value) ->
"use strict"
# throw on null
throw new TypeError("Array.prototype.include called on null or undefined") if null is this or "undefined" is typeof this
@some (element, index, array) ->
@evanleck
evanleck / console.coffee
Created September 3, 2013 01:01
A console shim to avoid errors. Taken from the HTML5 Boilerplate https://github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js
# Avoid `console` errors in browsers that lack a console.
(->
method = undefined
noop = noop = ->
methods = ["assert", "clear", "count", "debug", "dir", "dirxml", "error", "exception", "group", "groupCollapsed", "groupEnd", "info", "log", "markTimeline", "profile", "profileEnd", "table", "time", "timeEnd", "timeStamp", "trace", "warn"]
length = methods.length
console = (window.console = window.console or {})
while length--
method = methods[length]
<!DOCTYPE html>
<html>
<head>
<title>Busines Profile</title>
<link rel='stylesheet' type='text/css' href='http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/css/bootstrap.min.css'>
</head>
<body>
<div class='container' ng-app='business-profile' ng-controller='main'>
<div class='row'>
<div class='col-sm-1'></div>