Skip to content

Instantly share code, notes, and snippets.

@trdarr
trdarr / cps.js
Created October 11, 2012 06:26
"Thunks, Trampolines, and Continuation Passing" in JavaScript
/* "Thunks, Trampolines, and Continuation Passing"
* Python implementation from http://jtauber.com/blog/2008/03/30/
* JavaScript implementation by Thomas Darr <[email protected]>.
*/
// thunk = lambda name: lambda *args: lambda: name(*args)
var thunk = function thunk(fn) {
return function _thunk() {
var splat = Array.prototype.slice.apply(arguments);
return function __thunk() { return fn.apply(this, splat); };
@trdarr
trdarr / usage.py
Last active December 20, 2015 06:59
PaRappa the Wrapper
#!/usr/bin/env python
# This prints a useless representation of a _sre.SRE_Pattern object.
import re
uuid_pattern = r'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{8}'
print re.compile(uuid_pattern, re.I)
# _sre.SRE_Pattern has pattern and __repr__ methods.
if not hasattr(re, '_pattern_type'):
re._pattern_type = type(re.compile(''))
@trdarr
trdarr / xrebase
Last active December 23, 2015 07:29
A manual cross-repository rebase
# If you haven't already, clone the new repo and `cd` into its directory.
git clone [email protected]:username/new-repo.git
cd new-repo
# Add the old repo as a remote and fetch from it.
# If you're trying to do this from an unpushed branch,
# git remote add old-repo ~/dev/old-repo.git
git remote add old-repo [email protected]:username/old-repo.git
git fetch old-repo
@trdarr
trdarr / scale
Created November 20, 2013 03:48
Scale and export (SVG, MDPI / non-Retina) app assets
#!/usr/bin/env sh
# vim: set ft=sh
mkdir -p ios
mkdir -p res/drawable-{mdpi,hdpi,xhdpi,xxhdpi,xxxhdpi}
scale () {
infile=$1
outfile=${infile%.svg}
@trdarr
trdarr / hubot-digitalocean.md
Last active March 28, 2022 20:34
Deploying Hubot on DigitalOcean (with Slack integration)
@trdarr
trdarr / porndoge.py
Created February 26, 2014 04:00
wow. such pornmd. very live search terms. https://porndoge.herokuapp.com/
#!/usr/bin/env python
import flask
import operator
import random
import re
import requests
def get_terms(json, n=3):
'''Get a list of n acceptable random terms from the JSON array.'''
@trdarr
trdarr / keybase.md
Created November 25, 2015 12:36
Keybase proof

Keybase proof

I hereby claim:

  • I am trdarr on github.
  • I am trdarr (https://keybase.io/trdarr) on keybase.
  • I have a public key whose fingerprint is 01A3 54BE E59D 3990 D144 DA65 D33C 80CB C321 CE26

To claim this, I am signing this object:

@trdarr
trdarr / plink.js
Created July 18, 2017 16:51
Keyboard controls for Plink <http://dinahmoelabs.com/_plink/>.
@trdarr
trdarr / gif.go
Created November 6, 2019 14:28
convert a video to a gif, maybe
package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
)
- This page is a collection of some of the Advanced queries from the [[Datalog]] channel on the [[Logseq/Discord]] server. #datalog
id:: 61db13f4-75e8-4f87-ad60-3ac3479c5fc8
- ### Resources
- [link: The first message on the datalog channel](https://discord.com/channels/725182569297215569/743139225746145311/743139795865174119)
- [link: Logseq docs - Advanced queries](https://docs.logseq.com/#/page/advanced%20queries)
- [link: Logseq datascript schema](https://gist.github.com/tiensonqin/9a40575827f8f63eec54432443ecb929)
- [link: Logseq frontend db model](https://github.com/logseq/logseq/blob/master/src/main/frontend/db/model.cljs)
- [link: How to Graph Your Data - talk by Paula Gearon](https://youtu.be/tbVwmFBnfo4)
- [link: Domain modelling with datalog - talk by Norbert Wojtowicz](https://youtu.be/oo-7mN9WXTw)
- [link: Athens Research ClojureFam](https://github.com/athensresearch/ClojureFam)