Skip to content

Instantly share code, notes, and snippets.

View noahpryor's full-sized avatar

Noah Pryor noahpryor

View GitHub Profile
require 'firebase'
#before
{"DAYS"=>"Sun,Mon,Tues,Wed,Thurs,Fri,Sat",
"special notes"=>
"[From 11/1 to 1/15]",
"Bourough"=>"Manhattan",
"End time"=>"20:00:00",
"RESTRICTED STREET"=>"Broadway",
@noahpryor
noahpryor / format_Data.rb
Last active August 29, 2015 14:01
updated
require 'json'
require 'rest'
require 'pry'
require 'firebase'
def to_dow_array(string)
string.downcase.split(",").map do |r|
case r
when "sun" then 1
when "mon" then 2
{"type":"FeatureCollection","totalFeatures":99,"features":[{"type":"Feature","id":"INTERSECTION_CLOSURE.fid-1953874f_1461de89881_57c8","geometry":{"type":"Point","coordinates":[1002099.00583238,199846.290294009]},"geometry_name":"SHAPE","properties":{"ONST":"MORGAN AVENUE","FROMST":"SHARON STREET","BORO":"B","DATE1":"2014-03-28T19:03:00Z","DATE2":"2014-06-28T03:59:00Z","WHY":"D.D.C. CONTRACTOR MAJOR RECONSTRUCTION"}},{"type":"Feature","id":"INTERSECTION_CLOSURE.fid-1953874f_1461de89881_57c9","geometry":{"type":"Point","coordinates":[1002189.30451767,199578.977944133]},"geometry_name":"SHAPE","properties":{"ONST":"METROPOLITAN AVENUE","FROMST":"MORGAN AVENUE","BORO":"B","DATE1":"2014-03-28T19:03:00Z","DATE2":"2014-06-28T03:59:00Z","WHY":"D.D.C. CONTRACTOR MAJOR RECONSTRUCTION"}},{"type":"Feature","id":"INTERSECTION_CLOSURE.fid-1953874f_1461de89881_57ca","geometry":{"type":"Point","coordinates":[1002280.72463175,199311.025472968]},"geometry_name":"SHAPE","properties":{"ONST":"DEVOE STREET","FROMST":"MORGAN AVEN
app = angular.module("myApp", [])
app.directive "liquidTemplate", ->
linker = (scope, element, attrs) ->
liquid_template = Liquid.parse(scope.templateSrc)
compiled_template = liquid_template.render(scope.templateData)
element.html(compiled_template).show()
return
restrict: "E"
replace: true
app = angular.module("myApp", [])
app.directive "liquidTemplate", ->
getTemplateFromDom =(selector) ->
$(selector).text()
linker = (scope, element, attrs) ->
template_text = getTemplateFromDom(scope.template)
liquid_template = Liquid.parse(template_text)
compiled_template = liquid_template.render(scope.templateData)
element.html(compiled_template).show()
class MinesweeperMap
def initialize(difficulty)
@difficulty = difficulty
case difficulty
when 1
grid_size = 4
when 2
grid_size = 7
when 3
@noahpryor
noahpryor / minesweeper
Created July 15, 2014 00:38
minesweeper
<%= num_rows = 10 %>
<%= num_cols = 10 %>
<%= [[[""]][false]]
<table>
<thead></thead>
<tbody>
<% (0...num_row).each do |row| %>
<tr>
<% (0...num_cols).each do |col| %>
@noahpryor
noahpryor / heroku_config.rb
Created July 22, 2014 04:13
heroku config settings
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
@noahpryor
noahpryor / assets.rake
Created August 1, 2014 21:52
rake task for assets
namespace :assets do
task :add_custom_css_placeholder do
puts 'adding placeholder'
`touch app/assets/stylesheets/custom_css.less`
end
task :remove_custom_css_placeholder do
puts 'removing placeholder'
`rm app/assets/stylesheets/custom_css.less`
end
@noahpryor
noahpryor / test_cookies.js
Created December 2, 2014 00:28
coookie test
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}