This file contains hidden or 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
class Router | |
@people_path: -> "/people" | |
@person_path: (id)-> "/person/#{id}/" |
This file contains hidden or 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
# Wrapper around jQuery ajax methods that exposes | |
# returned data by publishing an event | |
# | |
class Ajax | |
@getJSON: (url, event)-> | |
$.getJSON url, (data)-> | |
Event.trigger(event, data) | |
window.Ajax = Ajax |
This file contains hidden or 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
class Event | |
@on: (event, fn)-> | |
$('body').bind event, (_, data) -> fn(data) | |
@trigger: (event, data)-> | |
$('body').trigger(event, [data]) | |
class Ajax | |
@getJSON: (url, event)-> | |
$.getJSON url, (data)-> |
This file contains hidden or 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
#= require dashboard/map_utils | |
# helper functions | |
asJson = (url, event)-> | |
$.getJSON url, (data)-> | |
$('body').trigger(event, [data]) | |
onEvent = (event, fn)-> | |
$('body').bind event, (_, data) -> fn(data) |
This file contains hidden or 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 manifest_to_hash() { | |
$path = APP_ROOT . "shared/assets/manifest.yml"; | |
$hash = array(); | |
$fp = fopen($path, "r"); | |
while (($line = fgets($fp)) != NULL) { | |
$line = rtrim($line); | |
if ($line === "---") continue; | |
list($key, $value) = explode(":", $line); | |
$hash[trim($key)] = trim($value); |
This file contains hidden or 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
namespace :deploy do | |
namespace :assets do | |
task :precompile, :roles => :web, :except => { :no_release => true } do | |
from = source.next_revision(current_revision) | |
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0 | |
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile} | |
else | |
logger.info "Skipping asset pre-compilation because there were no asset changes" | |
end | |
end |
This file contains hidden or 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
# /etc/init/project-web-reload.conf | |
pre-start script | |
initctl restart project-web | |
sleep 15 | |
end script | |
exec /usr/local/rvm/bin/default_bluepill restart |
This file contains hidden or 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
; a quick attempt at doing the same thing in clojure could for example something like | |
(defpartial input [name] | |
[:tr | |
[:td | |
[:input {:name name}]]]) | |
(defpartial edit-task-form [& inputs] | |
[:div.generic.lightbox | |
[:table |
This file contains hidden or 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
#chart | |
- content_for :bottom do | |
:javascript | |
$(function() { | |
chart: { renderTo: 'chart', | |
type: "column" }, | |
title: { text: "Errors per Site" }, | |
xAxis: { | |
title: { text: null }, |
This file contains hidden or 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
fill = (what, {with, of}) -> | |
container = what ?= "mug" | |
quantity = with ?= "500 mL" | |
liquid = of ?= "coffee" | |
alert("#{quantity} of #{liquid} on my #{container} plz") | |
fill "cup", with: "400ml", of: "cachaça" |