Skip to content

Instantly share code, notes, and snippets.

View s-andringa's full-sized avatar

Sjoerd Andringa s-andringa

View GitHub Profile
@s-andringa
s-andringa / Countries
Created February 25, 2011 09:58
Countries of the world. Copy-pastable for testing long word lists.
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua & Deps
Argentina
Armenia
Australia
Austria
@s-andringa
s-andringa / meta_code.rb
Created March 4, 2012 20:56
Meta Code converts itself into a highlighted HTML or PDF document.
require "coderay"
require "pdfkit"
require File.join(File.dirname(__FILE__), "styles/tomorrow_night")
module Meta
class Code
attr_reader :creator
def initialize(options = {})
@creator = options[:creator]
@s-andringa
s-andringa / Locales.yml
Created September 19, 2012 10:09
Amsrb talk 18 sept - exceptions_app in Rails 3.2
# config/locales/en.yml
en:
exception:
show:
not_found:
title: "Not Found"
description: "The page you were looking for does not exists."
internal_server_error:
title: "Internal Server Error"
@s-andringa
s-andringa / renumber_position_column_postgres.sql
Last active August 29, 2015 14:01
Renumber a position column which is scoped to another column, useful before adding a unique index / null constraint. (Keywords: Postgres, SQL, Reorder scoped position column, row_number in UPDATE clause)
-- Table in question:
CREATE TABLE product_tags (
id integer NOT NULL,
product_id integer NOT NULL,
tag_id integer NOT NULL,
"position" integer
);
-- Renumber the position column based on row number in partition:
UPDATE product_tags pt
@s-andringa
s-andringa / import_notes_and_emails.rb
Created December 1, 2017 09:24
Highrise - ActiveCampaign migration
# TODO