parentheses: ( )
braces: { }
brackets: < >
square-brackets: [ ]
#!/usr/bin/env ruby | |
Dir.glob('poly/*.poly').each_slice(50) do |group| | |
bp_wx = '' | |
group.each do |poly_file| | |
file = File.basename(poly_file, '.poly') | |
city, region = file.split('_') | |
bp_wx << "--buffer bufferCapacity=50000"\ | |
" --bp file='poly/#{city}_#{region}.poly'"\ |
module BlackBytesExample | |
class Game | |
def self.play(move1, move2) | |
return :tie if move1.class == move2.class | |
move2.wins_against?(move1) | |
end | |
end | |
class Rock |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'pg' | |
gem 'activerecord', '5.2.0' | |
gem 'memory_profiler' | |
gem 'benchmark-ips' | |
end |
class Array | |
def peach(&block) | |
threads = [] | |
self.each do |item| | |
threads << Thread.new do | |
block.call(item) | |
end | |
end | |
threads.each {|t| t.join } | |
end |
module BulkUpdatable | |
def bulk_update(objects, attribute) | |
return unless objects.any? | |
query = build_query_for(objects, attribute) | |
connection.execute(query) | |
end | |
private |
require 'digest' | |
require 'benchmark' | |
hash = {} | |
10_000_000.times do | |
key = Digest::MD5.hexdigest(rand.to_s) | |
value = Digest::MD5.hexdigest(rand.to_s) | |
hash[key] = value | |
end |
Computed Property Theory & Best Practices or Functional Programming in Ember or How I learned to stop worrying and love the Tomster.
In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it the same way you would any normal, static property. -- The Ember Guides
The Ember Object Model is the corner stone of Ember, and at the heart of the Object Model are computed properties.
The guides do a fine job giving need to know information on how to create and use computed properties and what to expect from the cacheing system they provide. However, I feel so much of the beauty that computed properties provide is lost in terse (but wonderful) documentation.
Quick..the basics!
#!/bin/bash | |
sudo apt-get remove phantomjs | |
sudo unlink /usr/local/bin/phantomjs | |
sudo unlink /usr/local/share/phantomjs | |
sudo unlink /usr/bin/phantomjs | |
cd /usr/local/share |
We are planning on building a Node.js service. Here's our evaluation of the current ORM landscape:
Last updated: May 2 2016
- Objection.js
- http://vincit.github.io/objection.js/#introduction
- Bad: API is Promise based and bulky. This means people can forget to have an error handler due to not being error first
- Good: Uses JSON schema for validation; this means content should be relatively reusable between server/browser
- http://vincit.github.io/objection.js/#validation