Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Oakman oakmac

View GitHub Profile
@oakmac
oakmac / interop.cljs
Created Dec 20, 2016
ClojureScript Interop Example
View interop.cljs
;; var aphrodite = require('aphrodite');
(def js-aphrodite (js/require "aphrodite"))
;; aphrodite.StyleSheet.extend([foo, bar]);
(defn aphrodite-extend [args]
(apply (aget js-aphrodite "StyleSheet" "extend") args))
View test.rs
use std::collections::HashMap;
static PARENS: HashMap = HashMap::new();
PARENS.insert("{", "}");
PARENS.insert("}", "{");
PARENS.insert("[", "]");
PARENS.insert("]", "[");
PARENS.insert("(", ")");
PARENS.insert(")", "(");
View test.rs
static PARENS: HashMap = HashMap::new();
fn set_parens() {
PARENS.insert("{", "}");
PARENS.insert("}", "{");
PARENS.insert("[", "]");
PARENS.insert("]", "[");
PARENS.insert("(", ")");
PARENS.insert(")", "(");
}
View changes.diff
diff --git a/parinferlib.el b/parinferlib.el
index f5ddd7d..fa694fb 100644
--- a/parinferlib.el
+++ b/parinferlib.el
@@ -627,15 +627,14 @@
(defun parinferlib--init-indent (result)
(let ((mode (gethash :mode result))
(in-str? (gethash :isInStr result)))
- (case mode
- ((:indent)
@oakmac
oakmac / jquery-animate.cljs
Created Mar 17, 2016
jquery-animate.cljs
View jquery-animate.cljs
;; JS:
;; $('html,body').animate({ scrollTop: element.offset().top }, 'slow');
(def $ js/jQuery)
(let [js-anim-dest (js-obj "scrollTop" (aget (.offset element) "top"))])
(.animate ($ "html,body") js-anim-dest "slow")
View gist:61493446c44f136191e4
(let [a (:a my-map)
b (:b my-map)
c (:c my-map)]
(do-a-thing a b c))
@oakmac
oakmac / example.cljs
Created Feb 13, 2016
branching off CLJS code
View example.cljs
(when js/webRequest
;; code that references webRequest goes here
)
View gist:7639728fc162045c4f3b
oakmac@oakmac-desktop:~/parinfer/lib$ node test/perf.js
Processing long_map_with_strings : 303 lines, 4380 chars
indent: 8.528ms
paren: 4.110ms
Processing really_long_file : 2865 lines, 112431 chars
indent: 11.779ms
paren: 17.577ms
Processing really_long_file_with_unclosed_paren : 2865 lines, 112432 chars
@oakmac
oakmac / perf.txt
Created Feb 3, 2016
parinfer.js performance using SENTINEL_NULL
View perf.txt
performance for parinfer.js using SENTINEL_NULL
oakmac@oakmac-desktop:~/parinfer/lib$ node test/perf.js
Processing long_map_with_strings : 303 lines, 4380 chars
indent: 8.627ms
paren: 3.932ms
Processing really_long_file : 2865 lines, 112431 chars
indent: 12.117ms
paren: 22.751ms
@oakmac
oakmac / perf.txt
Created Feb 3, 2016
parinfer.js performance using null
View perf.txt
performance for parinfer.js using null
oakmac@oakmac-desktop:~/parinfer/lib$ node test/perf.js
Processing long_map_with_strings : 303 lines, 4380 chars
indent: 9.467ms
paren: 8.073ms
Processing really_long_file : 2865 lines, 112431 chars
indent: 22.413ms
paren: 30.437ms