Skip to content

Instantly share code, notes, and snippets.

# Licensed to libcloud.org under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# libcloud.org licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@jmoe
jmoe / erb2haml.sh
Created March 24, 2012 02:09
Convert erb to haml
for i in `find app/views -name '*.erb'` ; do html2haml -e $i ${i%erb}haml ; rm $i ; done
@jmoe
jmoe / rabl_init.rb
Created August 21, 2012 18:36
Pretty print JSON from RABL
class PrettyJson
def self.dump(object)
JSON.pretty_generate(object, {:indent => " "})
end
end
# config/initializers/rabl_init.rb
Rabl.configure do |config|
# Commented as these are defaults
# config.cache_all_output = false
@jmoe
jmoe / download_kickstarted
Created August 14, 2013 18:49
download kickstarter
var getVidDetails = document.querySelector('#video-section>.video-player');
if(getVidDetails){
var getShareUl = document.querySelector('#about ul');
var downButtLi = document.createElement('li');
downButtLi.setAttribute('style','margin:6px -9px !important;width: 80px;');
var downButtA = document.createElement('a');
@jmoe
jmoe / index.html
Last active August 29, 2015 14:03
Earthquakes from Maptime
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.marker-properties {
border-collapse:collapse;
font-size:11px;
@jmoe
jmoe / database.yaml
Created July 22, 2014 22:10
Venture Scanner
development:
adapter: postgresql
encoding: unicode
database: vsondemand_dev
host: localhost
port: 5432
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
@jmoe
jmoe / areas.geojson
Last active August 29, 2015 14:04
OpenTrails Embed
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmoe
jmoe / areas.geojson
Last active August 29, 2015 14:04
Metro Parks Serving Summit County
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmoe
jmoe / fastly.rake
Last active August 29, 2015 14:06
Quick rake task to automate setting CORS headers on fastly
namespace :fastly do
desc "set fastly cors headers to fix chrome/firefox font loading issues"
task allow_cors: :environment do
# check for the Cors Allow header
versions = Yajl.load(Excon.get("https://api.fastly.com/service/#{ENV['FASTLY_SERVICE_ID']}/version",
:headers => {'Fastly-Key'=>ENV['FASTLY_API_KEY']}).body)
last_version = versions.last['number']
@jmoe
jmoe / multi_json.rb
Created September 11, 2014 17:52
Default MultiJson to pretty
require 'multi_json'
MultiJson.use :yajl
unless Rails.env.production?
MultiJson.dump_options = {:pretty=>true}
end