Skip to content

Instantly share code, notes, and snippets.

@statonjr
statonjr / remote.rake
Last active August 29, 2015 13:56
Rails hack for using databases running in a virtual machine
# Rails only allows databases local to your machine. If you run your databases in a VM
# (and you should), then you need to add this
namespace :db do
def local_database?(config, &block)
if config['host'].in?(['127.0.0.1', 'localhost', '172.16.12.102']) || config['host'].blank?
yield
else
$stderr.puts "This task only modifies local databases. #{config['database']} is on a remote host."
end
@statonjr
statonjr / Makefile
Created March 20, 2014 18:20
Using a Makefile to package a Datomic-backed Clojure app on Immutant
# target: dist - Archive and deploy to local Immutant VM
dist:
lein immutant archive && \
scp target/charon.ima local@172.16.12.105:apps/ && \
scp resources/deployment/local.clj 'local@172.16.12.105:.immutant/current/jboss/standalone/deployments/charon.clj' && \
ssh -t local@172.16.12.105 "touch ~/.immutant/current/jboss/standalone/deployments/charon.clj.dodeploy"
# target: help - Display callable targets.
help:
egrep "^# target:" Makefile

Keybase proof

I hereby claim:

  • I am statonjr on github.
  • I am statonjr (https://keybase.io/statonjr) on keybase.
  • I have a public key whose fingerprint is 5017 2133 BC35 DD9A 8CBD A997 3869 FC94 42C2 D6ED

To claim this, I am signing this object:

@statonjr
statonjr / gist:128dfbe60240311faf97
Created August 21, 2014 00:58
Summing digits in Factor
: sum-digits ( n -- n ) number>string [EBNF rule=[0-9]+ EBNF] [ 1 swap <string> string>number ] map 0 [ + ] reduce ;

Project

Description: What does this project do and who does it serve?

Project Setup

How do I, as a developer, start working on the project?

  1. What dependencies does it have (where are they expressed) and how do I install them?
  2. How can I see the project working before I change anything?
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global:
@statonjr
statonjr / edn.bnf
Last active August 29, 2015 14:21 — forked from bjeanes/edn.bnf
EDN ::= Whitespace (Comment | (Discard Whitespace)? (Tag Whitespace)? (List | Vector | Map | Set | String | Number | Keyword | Symbol | Nil | Boolean | Char) Whitespace Comment?)
Nil ::= "nil"
True ::= "true"
False ::= "false"
Boolean ::= True | False
Symbol ::= (Namespace "/")? ("/" | (Alphabetic Alphanumeric*)? (("-" | "." | "+")? Alphabetic | ("*" | "!" | "_" | "?" | "$" | "%" | "&" | "=")) (Alphanumeric | "#" | ":")*) /* FIXME: very inaccurate */
Keyword ::= ":" Symbol
/* Whitespace */
@statonjr
statonjr / keybase.md
Last active August 29, 2015 14:21
keybase.md

Keybase proof

I hereby claim:

  • I am statonjr on github.
  • I am statonjr (https://keybase.io/statonjr) on keybase.
  • I have a public key whose fingerprint is 899B 6EF0 1970 57F8 AA41 A7F9 3D1A C5AF 2290 3D2D

To claim this, I am signing this object:

[[NSBundle bundleWithPath:'/Library/Frameworks/JSON.framework'] load];
#!/usr/bin/macruby
# Need the AddressBook framework
framework 'AddressBook'
# Singleton
ab = ABAddressBook.sharedAddressBook
# me is the ABRecord of the current logged in user
# valueForProperty() is the KVO method to get the constant