Worked 2015-09-08 for Phoenix 1.0.1 on Dokku 0.3.25.
These instructions assume you've set up Dokku. If not, go find a tutorial for that part. My notes for setting it up on Digital Ocean.
Create a Dokku app:
# You will need fswatch installed (available in homebrew and friends) | |
# The command below will run tests and wait until fswatch writes something. | |
# The --stale flag will only run stale entries, it requires Elixir v1.3. | |
fswatch lib/ test/ | mix test --stale --listen-on-stdin |
Worked 2015-09-08 for Phoenix 1.0.1 on Dokku 0.3.25.
These instructions assume you've set up Dokku. If not, go find a tutorial for that part. My notes for setting it up on Digital Ocean.
Create a Dokku app:
AllCops: | |
RunRailsCops: true | |
# Commonly used screens these days easily fit more than 80 characters. | |
Metrics/LineLength: | |
Max: 120 | |
# Too short methods lead to extraction of single-use methods, which can make | |
# the code easier to read (by naming things), but can also clutter the class | |
Metrics/MethodLength: |
class MigrateHstoreToJson < ActiveRecord::Migration | |
def up | |
rename_column :posts, :data, :data_hstore | |
add_column :posts, :data, :jsonb, default: {}, null: false, index: { using: 'gin' } | |
execute 'UPDATE "posts" SET "data" = json_object(hstore_to_matrix("data_hstore"))::jsonb' | |
remove_column :posts, :data_hstore | |
end | |
def down | |
rename_column :posts, :data, :data_jsonb |
class MigrateHstoreToJson < ActiveRecord::Migration | |
def up | |
rename_column :posts, :data, :data_hstore | |
add_column :posts, :data, :jsonb, default: {}, null: false, index: { using: 'gin' } | |
execute 'UPDATE "posts" SET "data" = json_object(hstore_to_matrix("data_hstore"))::jsonb' | |
remove_column :posts, :data_hstore | |
end | |
def down | |
rename_column :posts, :data, :data_jsonb |
#! /usr/bin/env python2 | |
# Requires: PIL, colormath | |
# | |
# Improved algorithm now automatically crops the image and uses much | |
# better color matching | |
from PIL import Image, ImageChops | |
from colormath.color_conversions import convert_color | |
from colormath.color_objects import LabColor | |
from colormath.color_objects import sRGBColor as RGBColor |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
'use strict'; | |
module.exports = function(grunt) { | |
// load all grunt tasks | |
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
// configurable paths | |
var paths = { |
'Runs a country iteration and does many calculations | |
Sub CountryIterations() | |
Dim iteration, period As Integer | |
iteration = Range("countryIterations") | |
If Not (IsNumeric(iteration)) Or iteration < 10 Then | |
MsgBox ("You must set the iterations above 10, check address " + Range("countryIterations").AddressLocal) | |
Exit Sub | |
End If |
# Create the file `config/initializers/queue_classic.rb` with the this contents | |
ENV["DATABASE_URL"] = "postgres://username:password@host/database" | |
require 'queue_classic' | |
module QC | |
TABLE_NAME='common.queue_classic_jobs' | |
module Setup | |
extend self |