Skip to content

Instantly share code, notes, and snippets.

JamesChevalier / poly_to_osm.rb
Created February 8, 2014 00:35
This is my script to generate OSMs out of all of a country's POLY files.
View poly_to_osm.rb
#!/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'"\
EdwardDiehl / Bracket
Created May 28, 2018 13:16 — forked from Integralist/Bracket
[Bracket Terminology] #bracket #terminology
View Bracket
parentheses:     ( ) 
braces:          { } 
brackets:        < > 
square-brackets: [ ]
danielpclark / rps-blackbytes.rb
Created April 24, 2017 18:45
Rock Paper Scissors Black Bytes blog version
View rps-blackbytes.rb
module BlackBytesExample
class Game
def, move2)
return :tie if move1.class == move2.class
class Rock
View memory.rb
require 'bundler/inline'
gemfile do
source ''
gem 'pg'
gem 'activerecord', '5.2.0'
gem 'memory_profiler'
gem 'benchmark-ips'
joejag / peach.rb
Created August 14, 2014 13:06
Parallel each method for ruby
View peach.rb
class Array
def peach(&block)
threads = []
self.each do |item|
threads << do
threads.each {|t| t.join }
mockdeep / bulk_updateable.rb
Created October 29, 2015 17:13
module to add ActiveRecord bulk update functionality for postgres
View bulk_updateable.rb
module BulkUpdatable
def bulk_update(objects, attribute)
return unless objects.any?
query = build_query_for(objects, attribute)
hartator / benchmark-deep-vs-flat-directories.rb
Last active December 28, 2018 10:28
Source code for Benchmark: Deep directory structure vs. flat directory structure to store millions of files on ext4 article (
View benchmark-deep-vs-flat-directories.rb
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
danielchappell /
Last active October 21, 2019 11:51
Computed Properties Best Practices

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!

wbotelhos /
Last active December 12, 2019 12:08
Installing PhantomJS 1.9 on Ubuntu 12/14.xx x64/x86
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
twolfson /
Last active December 28, 2019 22:38
Node.js ORM evaluation

We are planning on building a Node.js service. Here's our evaluation of the current ORM landscape:

Last updated: May 2 2016