This file contains 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
# Returns only the objects that the callback returns true to | |
# replaces the underscore _.select method | |
filter = (obj, callback) -> | |
element for element in obj when callback(element) | |
# Deep clones an object, replaces underscores _.clone method | |
clone = (obj) -> | |
if not obj? or typeof obj isnt 'object' | |
return obj | |
newInstance = new obj.constructor() |
This file contains 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
# Module Dependencies | |
express = require 'express' | |
app = module.exports = express.createServer(); | |
# Configuration | |
app.configure () -> | |
app.set 'views', "#{__dirname}/views" | |
app.set 'view engine', 'jade' |
This file contains 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
// main app.js | |
var client = require('ranger').createClient('ROOM', | |
'SECRET'); | |
var timestamp = require('./timestamp').timestamp; | |
var getWeatherWrapper = require('./weather').getWeatherWrapper; | |
var showMap = require('./map').showMap; | |
var getTweets = require('./tweets').getTweets; | |
client.room(ROOMID, function(room) { |
This file contains 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
<?php | |
/** | |
Set Constants | |
*/ | |
define('VENDOR' , __DIR__.'/../vendor/'); | |
define('CORE' , __DIR__.'/../Core/'); | |
define('MODULES' , __DIR__.'/../modules/'); | |
/** | |
Require Silex Framework http://silex.sensiolabs.org/ | |
*/ |
This file contains 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 :admin do | |
constraints CanAccessResque do | |
require 'resque_scheduler' | |
mount Resque::Server, :at => '/resque' | |
end | |
end |
This file contains 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
# PUT /auto/claims/1/notes | |
def update_all | |
ids = [*params[:ids]] + [0] # makes sure it works when no navbars are selected | |
note= Auto::Note.update_all(params[:note], {:id => ids}) | |
if not note.errors | |
respond_with note, notice: 'Notes were successfully updated.' | |
else | |
respond_with note.errors, status: :unprocessable_entity | |
end |
This file contains 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 CreateAsnCccLogs < ActiveRecord::Migration | |
ActiveRecord::Base.establish_connection(:asn) | |
def up | |
create_table :ccc_logs do |t| | |
t.string :url | |
t.text :body | |
t.column :direction, "ENUM('inbound', 'outbound')" | |
t.boolean :success | |
t.integer :ccc_assignment_head_id |
This file contains 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
ActiveRecord::Base.class_eval do | |
def self.set_table_name(value = nil, &block) | |
db_nick, table = self.name.downcase.split('::') | |
new_value = "#{ ActiveRecord::Base.configurations[db_nick]['database']}.#{value}" | |
define_attr_method :table_name, new_value, &block | |
end | |
end |
This file contains 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
module Padrino | |
module Liquid | |
module Helpers | |
def render(engine, data=nil, options={}, locals={}, &block) | |
ignored_ivs = [ | |
'@default_layout', | |
'@app', | |
'@template_cache', | |
'@env', | |
'@request', |
This file contains 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
module Padrino | |
module Routing | |
module ClassMethods | |
private | |
def provides(*args) | |
super *args if Padrino.env != :test | |
end | |
end | |
end | |
end |