This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def rules | |
'[(has-values _ ?attr-vals) | |
[(empty? ?attr-vals)]] | |
[(has-values ?e ?attr-vals) | |
[(conj ?t ?h) ?attr-vals] | |
[(vector ?qf ?qv) ?h] | |
[?e ?qf ?qv] | |
(has-values ?e ?t)]]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[datomic.api :as d]) | |
(d/create-database "datomic:mem://example") | |
(def conn (d/connect "datomic:mem://example")) | |
(d/transact conn | |
[{:db/id #db/id [:db.part/db -1] | |
:db/ident :foo | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one | |
:db.install/_attribute :db.part/db} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am jamesnvc on github. | |
* I am jamesnvc (https://keybase.io/jamesnvc) on keybase. | |
* I have a public key whose fingerprint is 1E7B 141B CF59 912A 5CEC 751D FCEE 8906 8DC9 A386 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
"""To use: | |
First, run `pip install python-twitter` | |
Then, you'll need to create a twitter application at apps.twitter.com. This | |
will give you the API key & secret. Set its permissions to be Read & Write. | |
Then you'll generate an access token on the same page and put all four values | |
in the appropriate variables below. | |
Once that's done, just run ./twitter_autoblock_rts.py <some-tweet-id> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '(javax.script ScriptEngineManager)) | |
(defn eval-js | |
[js] | |
(let [engine (.getEngineByName (ScriptEngineManager. ) "nashorn")] | |
(.eval engine js))) | |
(require '[cljs.closure :as cljsc]) | |
(eval-js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set spacenumber to 9 | |
tell application "System Events" | |
set _desktops to every desktop | |
if (count of _desktops) > 1 then | |
-- if you have multiple displays (eg: external monitor) ask which | |
display dialog "Choose your screen." buttons (get display name of every desktop) default button 1 | |
set _display to the button returned of the result | |
else | |
-- else set the one display as selected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// closures | |
func makeIncr() -> (Int -> Int) { | |
var n = 0 | |
return { x in n += x; return n } | |
} | |
let inc1 = makeIncr() | |
let inc2 = makeIncr() | |
println("inc1 +1 \(inc1(1))") | |
println("inc2 +1 \(inc2(1))") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def replace_template(map, template): | |
trie = Trie(map) | |
iter = template.__iter__ | |
for c in iter: | |
if c != '$': print c | |
else: | |
s = iter.next() | |
trie.lookup(iter) | |
if replacement: | |
print replacement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> James Cash's Custom Quix Commands | |
@James Cash's Custom Quix Commands | |
src view-source:%r View source natively | |
insta javascript:function%20iprl5(){var%20d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location;try{if(!b)throw(0);d.title='(Saving...)%20'+d.title;z.setAttribute('src',l.protocol+'//www.instapaper.com/j/pL8VMUDiGTio?u='+encodeURIComponent(l.href)+'&t='+(new%20Date().getTime()));b.appendChild(z);}catch(e){alert('Please%20wait%20until%20the%20page%20has%20loaded.');}}iprl5();void(0) Add to Instapaper | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
func makeIncr() -> (Int -> Int) { | |
var x = 0 | |
return { y in x += y; return x } | |
} | |
let inc1 = makeIncr() |
OlderNewer