Skip to content

Instantly share code, notes, and snippets.

Chris Oakman oakmac

Block or report user

Report or block oakmac

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am oakmac on github.
  • I am oakmac (https://keybase.io/oakmac) on keybase.
  • I have a public key ASBq3O96XUXHblMPchU-ST63SOPAvBVkY_7X1GubvsVLuwo

To claim this, I am signing this object:

@oakmac
oakmac / index.html
Created Feb 25, 2017
dynamically inject script
View index.html
<script>
(function() {
var useDevScript = (document.location.search.indexOf('devscript=true') !== -1);
var src = useDevScript ? 'js/FULL-VERSION.js' : 'js/MINIFIED-VERSION.js';
var scriptEl = document.createElement('script');
scriptEl.type = 'text/javascript';
scriptEl.src = src;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(scriptEl, s);
})();
@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
You can’t perform that action at this time.