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 RoleExtender | |
def new properties = {} | |
include_roles nil, properties | |
end | |
private | |
def include_roles roles, properties | |
instance = allocate() |
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
var WeightedMarkerClusters; | |
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | |
(function($, w) {}, WeightedMarkerClusters = (function() { | |
function WeightedMarkerClusters(jq_element, options) { | |
this.ele = jq_element; | |
this.opts = options; | |
this.markerCluster = null; | |
this.entity_id = this.ele.parent().find(".context").eq(0).data("entityId"); | |
this.map = this.ele.find(this.opts.map_selector).eq(0); | |
this.map.gmap3({ |
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
Regards the building of collections of documents for entity reporting. | |
Prerequisites: | |
Import of entities | |
Import of products | |
Import of users | |
Actions: | |
Import of historic sales | |
Import of joining/leaving mailinglists |
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
h = {description: 'blah', id: '1046d670-e9ff-012f-5d84-38f6b11b6fe1', images: [1,2,3], name: 'bob', owner_id: '1005bc90-e9ff-012f-5d84-38f6b11b6fe1', creating_user_id: '1005bb10-e9ff-012f-5d84-38f6b11b6fe1', summary: 'aasdasd', tags: [1,2,3], upc: 333222} | |
=> {:description=>"blah", :id=>"1046d670-e9ff-012f-5d84-38f6b11b6fe1", :images=>[1, 2, 3], :name=>"bob", :owner_id=>"1005bc90-e9ff-012f-5d84-38f6b11b6fe1", :creating_user_id=>"1005bb10-e9ff-012f-5d84-38f6b11b6fe1", :summary=>"aasdasd", :tags=>[1, 2, 3], :upc=>333222} | |
1.9.3p194 :002 > h[:digital_commodities] = [{asset_id: '1046e450-e9ff-012f-5d84-38f6b11b6fe1', commodity_id: '10552d90-e9ff-012f-5d84-38f6b11b6fe1', from_warehouse: false, meta_data_changed: false, meta_data: {}, tags: []}] | |
=> [{:asset_id=>"1046e450-e9ff-012f-5d84-38f6b11b6fe1", :commodity_id=>"10552d90-e9ff-012f-5d84-38f6b11b6fe1", :from_warehouse=>false, :meta_data_changed=>false, :meta_data=>{}, :tags=>[]}] | |
1.9.3p194 :003 > h[:public_copy_missing] = [1,2,3,4] |
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
https://gist.github.com/guyboertje/9f092038311c4777f453 |
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 SomeModel | |
def null(*) end | |
ATTRS = ['v_string', 'v_num', 'v_boolean', 'v_decimal'] | |
attr_accessor *ATTRS.map(&:to_sym) | |
METHODMAP = Hash.new(instance_method(:null)) | |
ATTRS.each {|attr| METHODMAP[attr] = instance_method("#{attr}=") } | |
def self.load(hash) new.load(hash); end | |
def load(hash) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>comment</key> | |
<string> | |
TODO: unresolved issues | |
text: | |
"p << 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
For all below, this applies... | |
ruby -v | |
jruby 1.7.20 (1.9.3p551) 2015-05-04 3086e6a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b14 +jit [darwin-x86_64] | |
1) As a baseline for experimentation I substitute the JSON parser and generator for 'perfect' simulations. | |
So for parse I simply return a new Hash and for generate I return a new String with 1 interpolation. | |
yes '{"test": 1}' | bin/logstash -e 'input{stdin{codec => json_lines}} filter{clone{}} output{stdout{codec => json_lines}}' | pv -Wlart > /dev/null | |
01:00 [89.3k/s] [ 89k/s] |
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 LogTracker | |
def cache() | |
@cache ||= Hash.new{|h,k| h[k] = []} | |
end | |
def <<(hash) | |
hash.each{|k,v| cache[k].push(v) } | |
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
class LogTracker | |
def filter(&block) | |
cache.detect(&block) | |
end | |
def cache() | |
@cache ||= [] | |
end | |
def <<(hash) |
OlderNewer