Skip to content

Instantly share code, notes, and snippets.

View jsborjesson's full-sized avatar

Jimmy Börjesson jsborjesson

View GitHub Profile

Org-mode solution to this riddle.

More to learn about org-mode than to solve the riddle…

  1. The product of the 3 numbers is 36.
  2. The sum is the hallway number, which Zara knows.
  3. The largest number is unique.
  4. Zara needed the third clue.

Work out all the factors that produce 36:

@jsborjesson
jsborjesson / moneywise_wallet_migrate.rb
Last active September 16, 2016 19:21
Migrate data from MoneyWise to Wallet
# This is a quick script migrating data from MoneyWise to Wallet
#
# MoneyWise: https://play.google.com/store/apps/details?id=com.handynorth.moneywise
# Wallet: https://play.google.com/store/apps/details?id=com.droid4you.application.wallet
#
# It uses MoneyWise's CSV export to upload via the Wallet API.
#
# Data loss/Things I did not care about.
# - Time. All records will be at 00:00 at the correct date.
# - Accounts. Everything will go into the same account.
@jsborjesson
jsborjesson / postgres_exclude_constraint.sql
Last active January 17, 2017 10:50
Demonstrate how to use EXCLUDE to prevent overlapping time sequences.
-- Create 2 tables to link together
CREATE TABLE customer (id SERIAL PRIMARY KEY);
CREATE TABLE article (id SERIAL PRIMARY KEY);
-- Insert a few rows
INSERT INTO customer DEFAULT VALUES;
INSERT INTO customer DEFAULT VALUES;
INSERT INTO article DEFAULT VALUES;
INSERT INTO article DEFAULT VALUES;
# Measure startup time on a Ruby file
vim_startup_time=$((time vim Rakefile +q) 2>&1 >/dev/null | grep real | awk '{ print $2 }')
# Echo the results
echo $(git sha) " " $vim_startup_time
# Step back one commit without warnings
git checkout HEAD~ 2> /dev/null
# Recurse
class Matrix
def initialize(rows = [])
@rows = rows
end
def [](x, y)
@rows.fetch(y, [])[x]
end
def []=(x, y, value)