Skip to content

Instantly share code, notes, and snippets.

Sam Ritchie sritchie

View GitHub Profile
@sritchie
sritchie / fix_kanji_colorizer.py
Last active Oct 31, 2017
Instructions for how to have Kanji Colorizer not replace a field with other text in it.
View fix_kanji_colorizer.py
# This is useful for multi-Kanji words; once you've deleted everything but the first Kanji, you want
# the colorizer to leave the field alone.
# 1) Look for the line that starts with `def addKanji(note, flag=False, currentFieldIndex=None)`
# 2) Scroll down almost to the bottom of that function (where the lines are indented,
# right above the "Add a colorized..." bit of text
# 3) Replace this line:
note[dstField] = dst
View appdelegate.m
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"
View circle.yml
dependencies:
pre:
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
- wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
- sudo apt-get update
- sudo apt-get install rethinkdb=1.16.3~0precise
- sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/instance1.conf
- sudo /etc/init.d/rethinkdb restart
View org.patch
diff --git a/ob-core.el b/ob-core-old.el
index ba82d88..a6ffcc4 100644
--- a/ob-core.el
+++ b/ob-core-old.el
@@ -1368,14 +1368,7 @@ specified in the properties of the current outline entry."
(or body "")))))
(preserve-indentation (or org-src-preserve-indentation
(save-match-data
- (string-match "-i\\>" switches))))
- (header-args (apply #'org-babel-merge-params
@sritchie
sritchie / distinctg.hs
Created Apr 9, 2015
State Transformer over Optional Transformer over Logger...
View distinctg.hs
-- | Remove all duplicate integers from a list. Produce a log as you go.
-- If there is an element above 100, then abort the entire computation and produce no result.
-- However, always keep a log. If you abort the computation, produce a log with the value,
-- "aborting > 100: " followed by the value that caused it.
-- If you see an even number, produce a log message, "even number: " followed by the even number.
-- Other numbers produce no log message.
--
-- /Tip:/ Use `filtering` and `StateT over (`OptionalT` over `Logger` with a @Data.Set#Set@).
--
-- >>> distinctG $ listh [1,2,3,2,6]
@sritchie
sritchie / emacs.el
Created Apr 9, 2015
add this to your .emacs to get nice indenting for Om methods (as defined by om-tools).
View emacs.el
(defvar om-methods
(list 'render
'render-state
'init-state
'will-mount
'should-update
'will-receive-props
'will-update
'display-name
'will-unmount)
View test.clj
(defn cljs-env?
"Take the &env from a macro, and tell whether we are expanding into
cljs."
[env]
(boolean (:ns env)))
(defmacro if-cljs
"Return then if we are generating cljs code and else for Clojure code.
https://groups.google.com/d/msg/clojurescript/iBY5HaQda4A/w1lAQi9_AwsJ"
[then else]
View error.scm
Result: #1=((name . #4="course") (current-response-cursor . 0) (current-response . #5="") (command-queue [cl-struct-haskell-command (#1#) #2=(lambda (state) (if (eq system-type (quote windows-nt)) (haskell-process-send-string (car state) (format ":!powershell -Command \"& { cd %s ; hasktags -e -x (ls -fi *.hs *.lhs *.hsc -exclude \\\"#*#\\\" -name -r) ; exit }\"" (haskell-session-cabal-dir (haskell-process-session (car state))))) (haskell-process-send-string (car state) (format ":!cd %s && %s | %s" (haskell-session-cabal-dir (haskell-process-session (car state))) "find . -name '*.hs' -print0 -or -name '*.lhs' -print0 -or -name '*.hsc' -print0" "xargs -0 hasktags -e -x")))) nil #3=(lambda (state response) (if (cdr state) (progn (let ((tags-file-name (haskell-session-tags-filename (haskell-process-session (car state))))) (find-tag (cdr state))))) (haskell-mode-message-line "Tags generated."))] [cl-struct-haskell-command (#1#) #2# nil #3#] [cl-struct-haskell-command (#6=((name . #4#) (next-error-region #<marker
View err
src/Course/Apply.hs:197:16-22: The first argument of ‘Apply’ should have kind ‘* -> *’, …
but ‘P.Monad’ has kind ‘(* -> *) -> Constraint’
In the instance declaration for ‘Apply P.Monad’
Compilation failed.
View test.hs
data Wrapper
= WrappedInt Integer
| WrappedFloat Float
unpack :: Num a => Wrapper -> a
unpack (WrappedInt x) = x
unpack (WrappedFloat x) = x
You can’t perform that action at this time.