Skip to content

Instantly share code, notes, and snippets.

(defn N [[x y] distance] [x (+ y distance)])
(defn E [[x y] distance] [(+ x distance) y])
(defn S [[x y] distance] [x (- y distance)])
(defn W [[x y] distance] [(- x distance) y])
(def cardinal-directions [N E S W])
(defn apply-turn [current-direction turn]
"Direction is represented by the int index into `cardinal-directions`"
(let [incremement (if (= turn \R) 1 3)]
@positron
positron / npm-debug.log
Created July 20, 2016 16:55
`npm i` on a fresh install of https://github.com/dopry/mail-html5 on the `faster-local-development` branch
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/6.3.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'i' ]
2 info using npm@3.10.3
3 info using node@v6.3.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly install normalizeTree
@positron
positron / JSONUserType.java
Last active July 7, 2016 17:35 — forked from fabriziofortino/JSONUserType.java
Hibernate JSONUserType with Jackson
package com.keepithttps.hibernate.type;
import java.io.IOException;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Properties;
@positron
positron / log.txt
Created May 19, 2015 18:58
I haven't piped stdin to the log file
$ cat log.txt
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 'a'
>>> 'b'
>>>
### Keybase proof
I hereby claim:
* I am positron on github.
* I am philipjagielski (https://keybase.io/philipjagielski) on keybase.
* I have a public key whose fingerprint is 214C 181D 648B CC9A 1D9B FECC C884 6E9E 68D4 EB63
To claim this, I am signing this object:
@positron
positron / create_empty_cl.py
Last active July 7, 2022 02:42
Create an empty perforce changelist in p4python and save the changelist number
from P4 import P4
client = P4()
# set client.port, client.client, etc here
change = client.fetch_change()
change['Files'] = [] # this contains all the files in default otherwise
ret = client.save_change(change) # ['Change 1234 created.']
new_cl = ret.split()[1]
# now you can do stuff like