View sample
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 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
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 g(n): | |
if n == 1: | |
return 4 | |
elif n < 1: | |
raise ArithmeticError, "g can't do negative numbers" | |
else: | |
return g(n-1) * -3 |
View gist:72c08453b12c0d0a813f
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
;; From https://gist.github.com/offby1/1240799 | |
;; 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
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
(defun my-get-agent () | |
"Establish my registered ssh agent in this emacs shell *and* emacs session." | |
(interactive) | |
(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::") | |
(comint-send-input) |
View gist:840834cfce780517d8d8
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
# Adapted from a friend's alternative solution to the Madhava implementation problem | |
# from question 16 in the Interactive Python Textbook problem set: | |
# http://interactivepython.org/runestone/static/thinkcspy/Functions/thinkcspyExercises.html | |
# Original gist: https://gist.github.com/anonymous/2f78d796e965d6abcaec/321252a19d85aebca2359188d9991f7472e9f786 | |
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
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
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
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
/** 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 | |
* https://github.com/apache/cordova-plugin-file/blob/master/www/android/FileSystem.js#L29 | |
* | |
* @param(string) filename - defaults to "x%y", which shows the problem. |
View gist:32bba3506eb88b173de3
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
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") + |
View gist:6717382
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
... | |
⦠should refuse invalid usernames: | |
[2K 2) should refuse invalid usernames | |
⦠should refuse incorrect passphrases: | |
[2K 3) should refuse incorrect passphrases | |
Transaction functionality | |
4) "before all" hook | |
â 4 of 24 tests failed: |
View gist:6717139
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
crisp.crypton 2: git branch | |
master | |
* sharing | |
crisp.crypton 3: ls | |
.git/ Makefile integration_tests/ | |
.gitignore README.md otis.config.js | |
.travis.yml client/ server/ | |
LICENSE doc/ | |
crisp.crypton 4: make | |
make -C server test |