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
ROOT_PATH = File.expand_path("#{File.dirname(__FILE__)}/..") unless defined?(ROOT_PATH) |
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
require "pp" | |
AppEnv = ENV["APP_ENV"] || "development" | |
DBConfig = YAML::load(open("config/database.yml"))[AppEnv] | |
def mysql_cmd cmd="mysql", *args | |
opts = { | |
:u => DBConfig["username"], | |
:h => DBConfig["host"], | |
:p => DBConfig["password"] | |
}.inject([]) { |c, o| o[1].nil? ? c : c << "-#{o[0]}#{o[1]}" }.join(" ") |
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
$: << File.join(RAILS_ROOT, "lib/bm_master/gen-rb") | |
require "master" | |
require "thrift" | |
require "thrift/transport/http_client_transport" | |
transport = Thrift::HTTPClientTransport.new("http://10.101.0.97:3000/bm_service") | |
protocol = Thrift::BinaryProtocol.new(transport) | |
BmClient = BmMaster::Master::Client.new(protocol) |
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
require 'rubygems' | |
require 'bson' | |
require 'string' | |
DIGITS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(//) | |
def dec2x(number, base=16) | |
number = Integer(number); |
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 AnotherClass | |
constructor: -> | |
console.warn("YEAH !") | |
exports.AnotherClass = AnotherClass |
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 BaseViewModel | |
constructor: (model, opts)-> | |
@model = model | |
mapping = {} | |
@collections = {} | |
for k,v of model.attributes | |
if v instanceof Backbone.Collection | |
@[k] = ko.observableArray([]) | |
vm_name = opts.viewModelName || k.singularize().camelize() + "ViewModel" |
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 KnockItObservables | |
constructor: -> | |
@reset({}) | |
make: (ref, attrs)-> | |
return false unless ref && attrs | |
@_viewModels[ref] ?= ko.mapping.fromJS(attrs) | |
@_viewModels[ref].ref = ref | |
@_viewModels[ref] |
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
Hull.widget('profile', { | |
templates: ['profile'], | |
refreshEvents: ['model.hull.me.change'], | |
fields: [ | |
{ name: 'name', type: 'text', placeholder: 'Name' }, | |
{ name: 'email', type: 'text', placeholder: 'Email' } | |
], |
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
require 'handlebars_assets' | |
Hull.configure do |config| | |
# == Hull App Config | |
# | |
config.app_id = ENV["HULL_APP_ID"] | |
# == Hull App secret | |
# This is required to enable all server side secure stuff. |
OlderNewer