Skip to content

Instantly share code, notes, and snippets.


Ken Manheimer kenmanheimer

View GitHub Profile
kenmanheimer / sample
Created January 4, 2020 19:54
Scratch pyyaml for custom object export/import
View sample
def minimal_representer(dumper, item):
# type: (yaml.representer.Representer, spherical.item.Item) -> str
"""Minimal example of a representer that has features items will need."""
tag = "!spherical.example"
for i in spherical.utils.partially_sorted_partition(item):
fields = [['id', str(item._id)],
['title', item._title]]
return dumper.represent_sequence(tag, fields) # type: str
View gist:cdeb6c97c18adbd1fceb
def g(n):
if n == 1:
return 4
elif n < 1:
raise ArithmeticError, "g can't do negative numbers"
return g(n-1) * -3
kenmanheimer / gist:72c08453b12c0d0a813f
Last active October 12, 2015 16:29 — forked from offby1/gist:1240799
git-grep in emacs
View gist:72c08453b12c0d0a813f
;; From
;; There's something similar (but fancier) in vc-git.el: vc-git-grep
;; -I means don't search through binary files
;; --no-color, oddly enough, is required to allow emacs to colorize the output
(defcustom git-grep-switches
"git --no-pager grep --extended-regexp -I -n --ignore-case --no-color"
View gist:bc03f06dbe06a4c9fd28
(defun my-get-agent ()
"Establish my registered ssh agent in this emacs shell *and* emacs session."
(let ((process (get-buffer-process (current-buffer)))
beg end start-point)
(if (not process)
(error "Non-shell buffer")
(goto-char (process-mark process))
(insert "eval $(ga); echo SSH_AUTH_SOCK::$SSH_AUTH_SOCK::")
View gist:840834cfce780517d8d8
# Adapted from a friend's alternative solution to the Madhava implementation problem
# from question 16 in the Interactive Python Textbook problem set:
# Original gist:
def myPi(tolerance=0.01):
"""Compute Pi by Madhava's technique, to specified tolerance, default .01."""
accumulator = 0
n = 0
newvalue = abs(tolerance) + 1
View gist:3f667c00f9dff9020b55
function dembase() {
var resolvefunc,
p1 = new Promise(
function (resolve) {resolvefunc = resolve})
.done(function() {console.log("p1 resolve")}),
r1 = resolvefunc,
p2 = new Promise(
function (resolve) {resolvefunc = resolve})
.done(function() {console.log("p2 resolve")}),
r2 = resolvefunc,
View gist:72510607541f34792046
/** Show cordova .getFile() problem with some filenames containing "%" char.
* We create a file with the specified name in the Download dir,
* indicating whether or not the name of the created file is the same as
* that specified. On Android, the name is different if the specified
* one contains a sequence of chars starting with a "%" and not
* qualifying as a proper character entity - because of
* @param(string) filename - defaults to "x%y", which shows the problem.
View gist:32bba3506eb88b173de3
diff --git a/src/views/FilesView.js b/src/views/FilesView.js
index 28cfcd7..04eaa8c 100644
--- a/src/views/FilesView.js
+++ b/src/views/FilesView.js
@@ -192,11 +192,11 @@
var model = this.model;
// Start by getting the folder path
- var path = "Download/" + s("SpiderOak") + "/.favorites/" +
- (spiderOakApp.accountModel.get("b32username") || "anonymous") +
kenmanheimer / gist:6717382
Created September 26, 2013 17:17
much further - now consistently failing in transaction functionality integration tests
View gist:6717382
◦ should refuse invalid usernames:
 2) should refuse invalid usernames
◦ should refuse incorrect passphrases:
 3) should refuse incorrect passphrases
Transaction functionality
4) "before all" hook
✖ 4 of 24 tests failed:
kenmanheimer / gist:6717139
Created September 26, 2013 17:03
problem bootstrapping crypton, on 'sharing' branch
View gist:6717139
crisp.crypton 2: git branch
* sharing
crisp.crypton 3: ls
.git/ Makefile integration_tests/
.gitignore otis.config.js
.travis.yml client/ server/
crisp.crypton 4: make
make -C server test