Skip to content

Instantly share code, notes, and snippets.

{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
@matt-morris
matt-morris / static-rails.rb
Last active September 10, 2015 20:33 — forked from ahoward/static-rails.rb
a script that boils a rails' app into static in a fucking hurry
#! /usr/bin/env ruby
# TODO - use a server other than passenger?
# this script uses wget and passenger to crawl a rails' application in order
# to create a static build from virtually any project.
#
# it has three simple requirements, and one optional one:
#
# 1) you have the wget program installed
@matt-morris
matt-morris / boost_template.rb
Last active September 10, 2015 21:37 — forked from codespore/boost_template.rb
Rails application template
# Rails 4 Application Template
# Usage: rails new [app_name] -m [boost_template.rb] -d postgresql
# Remove normal files we don't want
remove_file "README.rdoc"
remove_file "public/index.html"
remove_file "app/assets/images/rails.png"
# Copy database.yml to sample
inside "config" do
@matt-morris
matt-morris / hashquiz.rb
Last active September 21, 2015 21:32 — forked from potatosalad/hashquiz.rb
Ruby quiz for convert hash "dot paths" into actual hash hierarchy.
#require 'rubygems'
require 'pp'
#require 'ap' # Awesome Print
class Object
# expects [ [ symbol, *args ], ... ]
def recursive_send(*args)
args.inject(self) { |obj, m| obj.send(m.shift, *m) }
end
end

Keybase proof

I hereby claim:

  • I am matt-morris on github.
  • I am mattmorris (https://keybase.io/mattmorris) on keybase.
  • I have a public key whose fingerprint is 97EB CA34 D0AB 57FC 273B 32C4 AB84 6068 AA69 AD26

To claim this, I am signing this object:

@matt-morris
matt-morris / Static site capfile
Created June 2, 2016 16:00 — forked from bdeterling/Static site capfile
Example of using Capistrano for a static website
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
default_run_options[:pty] = true
# be sure to change these
set :github_user, '<github_user_name>'
set :github_application, "<repository_name>"
set :user, '<user_on_server>'
set :domain, '<server_name>'
set :application, '<domain_name_of_static_site>'
Verifying that "doubleemms.id" is my Blockstack ID. https://onename.com/doubleemms
# rebuttal of http://www.try-alf.org/blog/2013-10-21-relations-as-first-class-citizen
require 'arel'
require 'sqlite3'
require 'pry'
def suppliers
@suppliers ||= Arel::Table.new(:suppliers)
end
@matt-morris
matt-morris / method-missing-proxy.js
Created October 20, 2016 13:25 — forked from torgeir/method-missing-proxy.js
es6 proxies method missing example
/*
What happens?
- `new Type().what` is looked up with a call to `get` on the proxy
- a function is returned that will look up `METHOD_NAME` when called
- `METHOD_NAME` is called because of the `()` behind `new Type().what`
- if `METHOD_NAME` exists on you object, your own function is called
- if not, because of prototypal inheritance, `get` is called again
- `name` is now `METHOD_NAME` and we can throw as we know `METHOD_NAME` is not implemented on the type
credits http://soft.vub.ac.be/~tvcutsem/proxies/
@matt-morris
matt-morris / pubsub-simple.js
Created October 20, 2016 13:27 — forked from fatihacet/pubsub-simple.js
Simple PubSub implementation with JavaScript - taken from Addy Osmani's design patterns book -
var pubsub = {};
(function(q) {
var topics = {}, subUid = -1;
q.subscribe = function(topic, func) {
if (!topics[topic]) {
topics[topic] = [];
}
var token = (++subUid).toString();
topics[topic].push({
token: token,