- Jim Weirich: The Building Blocks of Modularity – http://goo.gl/g4Nk
- Jim Weirich: SOLID Ruby – http://goo.gl/z3jd
- Sandi Metz: SOLID Object-Oriented Design – http://goo.gl/PDn6T
- Sandi Metz: Less – The Path to Better Design – http://goo.gl/VuTl4
- Demeter is for Encapsulation – http://is.gd/eeyLx
- Opinionated Modular Code – http://is.gd/eeyXm
- Scaling to Hundreds of Millions of Requests – http://vimeo.com/12814529
- Confident Code – http://goo.gl/VFLX
- Destroy All Software Screencasts – https://www.destroyallsoftware.com/screencasts
- Corey Haines: Fast Rails Tests – http://goo.gl/Va2gb
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
#!/usr/bin/env ruby | |
# A quick and dirty implementation of an HTTP proxy server in Ruby | |
# because I did not want to install anything. | |
# | |
# Copyright (C) 2009-2014 Torsten Becker <[email protected]> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the | |
# "Software"), to deal in the Software without restriction, including | |
# without limitation the rights to use, copy, modify, merge, publish, |
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 Hash | |
def dig(*path) | |
path.inject(self) do |location, key| | |
location.is_a?(Hash) ? location[key] : nil | |
end | |
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
#!/bin/bash | |
ADMIN="[email protected]" | |
ALERT=95 | |
df -H | grep -vE '^Filesystem|none|tmpfs|cdrom|varrun|varlock|udev|devshm|boot' | awk '{ print $4 " " $5 " " $6 }' | while read output; | |
do | |
usep=$(echo $output | awk '{ print $2}' | cut -d'%' -f1 ) | |
partition=$(echo $output | awk '{ print $3 }' ) | |
free=$(echo $output | awk '{ print $1 }' ) | |
if [[ $usep -ge $ALERT ]]; then | |
echo "Running out of space $partition ($usep% used, $free avail) |
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
# On Heroku we'll read the config from ENV | |
if postgres = URI.parse(ENV['DATABASE_URL'] || '') | |
ActiveRecord::Base.configurations[:production] = { | |
:adapter => 'postgresql', | |
:encoding => 'utf8', | |
:database => postgres.path[1..-1], | |
:username => postgres.user, | |
:password => postgres.password, | |
:host => postgres.host | |
} |
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
{"idea":{"description":"fghgfh","planned_at":"2012-10-18 11:35:32 +0300","lon":-122.4105,"image_base64":"iVBORw0KGgoAAAANSUhEUgAAAMAAAAEcCAYAAACRV7vnAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAHGlET1QAAAACAAAAAAAAAI4AAAAoAAAAjgAAAI4AAB\/sBALxiAAAH7hJREFUeAHsnWdwXNd5hjeJI1k2gMWCaKREgA0ECZIi\/Sf5lYziyQ\/nhx17PHQscheFALahkQQIgqQkVrH3XkRRhaKsaku2ZU+cmYwnk+IZO4nHE8WJ7diWTTWbYhcbsDfv+9177l6UXbRdACY\/znxz7hbuXpx93vOVe865PsuyfDT8+2Nfbe0nfeHFfl\/oS8U5DcFHCsLBhvxozYpAJLg6NxLamhcJ7skNB4\/nRZb+MC8c\/FlueOlv8PiDvHDoIzy+hPaKPxa8Dbvjj4W6\/dFgN9oefxQWq+7xR0IJsain5bHavd0H5KI3E+DFcAOOhCcwFQ3eAmOXHdZ+D\/7O4\/jXsLfB5nfQHvKHl+5Gu74gGmoPRKrjgcbQV+8LPzrHV\/vFfF\/L0jzfI498Aqz\/kcu9e6ACuLchHM9BaDwFICM\/4ff5PuELf\/5TvuW1+b6GR0tyoo9+tiCyJJwvSgqtyW0Mbof69uU2hk7mRUKOBwjCA4TEA\/jD1ZcwusMDhG7nx4N38uEBbKvuycfoL4ZOxuc5Vo1WTfvAMGC4QGt4kRYcgSc\/LRq6BcbgAaoZbcADBD0eYOl38xqDR2B7EaFsDMSCqwLRYHMgvHTJffHQXF9sScC3Ouz3zZt3H1j\/kyT3DHsk9Al\/Kh9u4tNtj5Y80La4LC\/y6OcC4WCzvyG4Nh8uJRfhD8A\/nBupftofCf4H3NEvcEK\/hX2Ak7qI9jLgv+qP1dz2x6shgOpuf7yG1pNPi8G8wMfwh6tpHxgGvGw4z |
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
# The purpose of this gist is to propose use of inheritance when upgrading objects to have "more functionality". | |
# For example: | |
# Lets say you have a `company` model and your project manager purposes a huge pivot to your existing application. | |
# Now new fields are "required" for the new companies you create. Unfortunately adding validators to the existing | |
# `company` model will cause things to blow up. You could create a form object for the new forms with form specific | |
# validators. Several issues are now introduced: | |
# 1) There can be several form objects for the company. Each with a slight difference in logic. |
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
#!/usr/bin/env bash | |
git ls-files db/migrate/*.rb | sort | tail -1 | \ | |
ruby -e "schema_version=STDIN.read[/\d+/]; init_schema=%(db/migrate/#{schema_version}_init_schema.rb); | |
%x(git rm -f db/migrate/*.rb; | |
mkdir db/migrate; | |
git mv db/schema.rb #{init_schema}; | |
rake db:migrate; | |
git add db/schema.rb; git commit -m 'Squashed migrations')" |
Phoenix 1.4 ships with exciting new features, most notably with HTTP2 support, improved development experience with faster compile times, new error pages, and local SSL certificate generation. Additionally, our channel layer internals receiveced an overhaul, provided better structure and extensibility. We also shipped a new and improved Presence javascript API, as well as Elixir formatter integration for our routing and test DSLs.
This release requires few user-facing changes and should be a fast upgrade for those on Phoenix 1.3.x.
The mix phx.new archive can now be installed via hex, for a simpler, versioned installation experience.
To grab the new archive, simply run: