Skip to content
View test.coffee
#= 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)
View gist:3852929
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);
View gist:3852695
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
View project-web-reload.conf
# /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
View clojure.clj
; 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
View gist:3167612
#chart
- content_for :bottom do
:javascript
$(function() {
chart: { renderTo: 'chart',
type: "column" },
title: { text: "Errors per Site" },
xAxis: {
title: { text: null },
View gist:3146336
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"
View gist:2898729
# So .. if I really need to have different behavior
# based on gender ...
class Male < Person
end
class Female < Person
end
FactoryGirl.define do
View Event.cs
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public class Event
{
private DateTime date;
[JsonProperty("name")]
public string Name { get; set; }
View gist:2323857
(function() {
Thing = {};
Thing.findAll = function(callback) {
$.getJSON('/things', function(data) {
if (data!=null) {
callback(data);
}
});
}
Something went wrong with that request. Please try again.