Skip to content

Instantly share code, notes, and snippets.

class ActiveJobLog < ApplicationRecord
enum status: {
queued: 'queued',
working: 'working',
finished: 'finished',
failed: 'failed',
}
def active?
@charlespeach
charlespeach / hack-mini.md
Last active May 26, 2017 18:06
Hack-mini part list

Parts list for the Hack-Mini

The following parts are what I used for mine. If you want to build your own, please message me and I can help with the hackintosh setup!

  • 1x ASRock Deskmini 110 (Case/Mobo/DC Powerbrick combo!)
  • 1x Intel Skylake Core i3 (You could swap this out for any Skylake processor, just be mindful the board that comes in the Deskmini has a intel H110 chipset and does not support overclocking)
  • 2x Kingston ValueRAM SO-DIMM DDR4 PC17000/2133MHz CL15 8GB (You could increase this to 2x 16GB as the system supports 32GB)
  • Lastly: What ever storage you want. There is a m.2 slot for a PCI-e x4 SSD (think intel 600p, samsung 950/960 PRO, cannot be sata) and also 2x SATA 3 headers for 2.5mm SATA SSD's. Pick your poison!

If you want wifi/bluetooth, I suggest buying this: [Broadcom WIFI Wireless AC BCM94352Z](https://www.aliexpress.com/item/NEW-Broadcom-Or

Preface:

It's useful to know the memory characteristics of different Ruby versions.

2.0 Uses less memory, but is slower - GC blocks while running

2.1 Generational GC - more memory, but faster GC meaning faster apps (split: old / young heap spaces)

2.2 Introduces incremental GC - marks in steps, reducing stop-the-world time, making OOB GC redundant.

@eoinkelly
eoinkelly / postgres-upgrade-recipe.sh
Last active November 9, 2017 16:59
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
#!/bin/bash
# This script can be used in "run & hope" mode or you can use it as a recipe to
# do things manually - you probably want the latter if you really care about
# the data in your databases.
# Happy hacking
# /Eoin/
# Tell bash to stop if something goes wrong
set -e
@PrototypeAlex
PrototypeAlex / whats-on-tap.coffee
Created July 4, 2014 07:21
Whats on tap in Wellington
# Description
# Lists what beers are available on tap at a few of Wellington's Pubs
#
# Dependencies:
# "request": "^2.36.0"
# "lodash": "^2.4.1"
#
# Configuration:
# NONE
#

In order to use asset pipeline available for static error pages (like 404.html), a few steps are required

  • Move static pages from /public into /app/assets

    (eg: public/422.html → app/assets/html/422.html.erb)

  • Add html directory to the asset pipeline

  • Update exceptions middleware to understand assets with digests

# coding: utf-8
# Can ruby have method names have newlines/be crazy?
class BadKitty
FACE = "
|\\_/|
/ @ @ \\
( > º < )
`>>x<<´
#!/usr/bin/env ruby
gem "parser", "~> 1.4"
require "parser"
require "parser/ruby19"
require "set"
class ConstantDeclarationAndUseProcessor < Parser::AST::Processor
attr_reader :declared, :used
def initialize