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
| def_dataset_method :remove! do | |
| update(:deleted => true) | |
| end | |
| def_dataset_method :remove! |
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
| SELECT r.created_dt as "date", sum(clicks) as "clicks", sum(impressions) as "impressions", | |
| sum(actions) as "actions", sum(spend)/1000000 as "spend", | |
| sum(spend)/1000000 / sum(actions) as CPA |
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 << self | |
| attr_accessor :cdn, :cdn_version, :root, :js_path, :write_path | |
| end | |
| if defined? Merb | |
| JSCompilation.root = Merb.root_path | |
| JSCompilation.js_path = File.join('public','javascripts') | |
| elsif defined? RAILS_ROOT | |
| JSCompilation.root = RAILS_ROOT | |
| JSCompilation.js_path = File.join('public','javascripts') |
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 'rubygems' | |
| require 'pp' | |
| require 'faster_csv' | |
| num = 0 | |
| file = "t.csv" | |
| data = [] | |
| columns = [] |
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
| def category=(cat) | |
| changed_columns << :meta | |
| self.meta ||= {} | |
| self.meta[:category] = cat | |
| 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
| user system total real | |
| json dump 0.090000 0.010000 0.100000 ( 0.099900) | |
| yajl parse 0.100000 0.000000 0.100000 ( 0.112986) | |
| json parse 0.130000 0.010000 0.140000 ( 0.160023) | |
| marshal dump 0.060000 0.000000 0.060000 ( 0.057489) | |
| marshal parse 0.070000 0.000000 0.070000 ( 0.072296) |
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 'rubygems' | |
| require 'soap/wsdlDriver' | |
| wsdl_url = 'https://ccuapi.akamai.com/ccuapi-axis.wsdl' | |
| user = '[email protected]' | |
| pass = '...' | |
| urls = ['http://staticcdn.omgpop.com/embed/v1/omgpop-external-embed.js'] | |
| driver = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver |
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
| module QikLog | |
| def self.method_missing meth | |
| unless logger = instance_variable_get(:"@#{meth}") | |
| logger = Logger.new(File.join('log',"#{meth}.log")) | |
| instance_variable_set(:"@#{meth}", logger) | |
| end | |
| logger | |
| 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
| server: | |
| :start: "merb -p 80{{instance%2}}" | |
| :instances: 40 | |
| :environment: | |
| merb_env: production | |
| workers: | |
| :start: rake resque:work | |
| :instances: 1 | |
| :arg0: '*' |
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 Stack | |
| def initialize | |
| @main = [] | |
| @min = [] | |
| end | |
| def push val | |
| @main << val | |