Skip to content

Instantly share code, notes, and snippets.

@sveinn
sveinn / gist:5021006
Last active December 14, 2015 03:29
LA RubyConf 2013
Refactoring Fat Models with Patterns: (http://www.larubyconf.com/proposals/43)
==============================================================================
@brynary
@codeclimate
codeclimate.com
http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/
github.com/codeclimate/refactoring-fat-models
https://github.com/solnic/virtus
1 value objects # data clumps, attribute logic. if lot of methods have the same prefix
#!/usr/bin/env ruby
require 'net/telnet'
cache_dump_limit = 100
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3)
slab_ids = []
localhost.cmd("String" => "stats items", "Match" => /^END/) do |c|
matches = c.scan(/STAT items:(\d+):/)
slab_ids = matches.flatten.uniq
end
@sveinn
sveinn / taming_mobile
Last active December 28, 2015 23:09
QCon - Links from the Taming Mobile Track
# Mobile Web Performance and Stability Through Offline HTML5
http://alistapart.com/article/application-cache-is-a-douchebag
github.com/axemclion/indexeddbshim
github.com/facebook/indexeddb-polyfill
# FT Talk
http://jsmanners.com/
https://github.com/wilsonpage/fastdom (asynchronous dom)
https://github.com/slightlyoff/ServiceWorker
https://github.com/ftlabs/fastclick (solution to click delay problem)
@sveinn
sveinn / gist:11267063
Created April 24, 2014 19:43
OpenVizConf 2014
Keynote
Mike Bostock
Author of D3.js / http://d3js.org/
------------------------------------
Philosphy and Practice of design:
Philosophy:
"One commonality between writing and coding is that everything you do is in a nightmarish state of total failure until the moment it is not"
Design principles are not sufficient to produce a good design.
@sveinn
sveinn / gdk_provision.sh
Last active April 8, 2017 20:19
Vagrant Provisioning Script for Gitlab Development Kit
# To use this provisioning script, your Vagrant file needs to be like:
# Vagrant.configure("2") do |config|
# config.vm.provision "shell", path: "https://gist.github.com/sveinn/28f128bd13767aec3eab80518cdb8d90"
# end
# Git (> 1.7 needed because support/set-gitlab-upstream needs git command 'git branch --set-upstream-to')
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
#!/usr/bin/env ruby
merge_type = ARGV[0]
REGULAR_MERGE = '0'
SQUASH_MERGE = '1'
PROPERTY_DIR = File.expand_path('../../apps/property')
def bundle_install_if_needed
no_action_required = system 'echo $PWD ; bundle check', chdir: PROPERTY_DIR
!/usr/bin/env ruby
ref_of_previous_head = ARGV[0]
ref_of_new_head = ARGV[1]
checkout_type = ARGV[2]
FILE_CHECKOUT = '0'
BRANCH_CHANGE = '1'
RESTART_PASSENGER_CMD = 'bundle exec passenger stop --port 3000; bundle exec passenger start --port 3000 --max-pool-size 2'
@sveinn
sveinn / cloudSettings
Last active April 17, 2018 18:50
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-04-17T18:42:48.856Z","extensionVersion":"v2.9.0"}