Skip to content

Instantly share code, notes, and snippets.

View oakmac's full-sized avatar

Chris Oakman oakmac

View GitHub Profile
@oakmac
oakmac / jquery-animate.cljs
Created March 17, 2016 19:44
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")
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)
static PARENS: HashMap = HashMap::new();
fn set_parens() {
PARENS.insert("{", "}");
PARENS.insert("}", "{");
PARENS.insert("[", "]");
PARENS.insert("]", "[");
PARENS.insert("(", ")");
PARENS.insert(")", "(");
}
use std::collections::HashMap;
static PARENS: HashMap = HashMap::new();
PARENS.insert("{", "}");
PARENS.insert("}", "{");
PARENS.insert("[", "]");
PARENS.insert("]", "[");
PARENS.insert("(", ")");
PARENS.insert(")", "(");
@oakmac
oakmac / interop.cljs
Created December 20, 2016 21:38
ClojureScript Interop Example
;; 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))
@oakmac
oakmac / index.html
Created February 25, 2017 20:08
dynamically inject script
<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);
})();

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 / easy-instructions.md
Last active March 30, 2020 18:13
instructions to help with CheckForCorona translations

Instructions for non-technical users to assist with CheckForCorona.com translations

  1. Create a GitHub account: https://github.com/join
  2. Go to https://gist.github.com
  3. In the Filename including extension... field, put your language name plus .edn.
    • example: ja.edn for Japanese
  4. Copy this file into the main input area: https://raw.githubusercontent.com/LuminareMed/quickscreen-translations/master/en.edn
    • this is the latest English dictionary file
  5. Click "Create public gist" button
  6. You should see a page like: https://gist.github.com/YOUR_USERNAME/
@oakmac
oakmac / cljs-follow-up-questions.md
Last active October 6, 2020 04:03
ClojureScript Questions Follow-Up

ClojureScript Follow Up Questions + Answers

Some follow-up questions and answers from this gist. -- C. Oakman, 05 Oct 2020


when I said CDN/server I meant are you keeping the compiled javascript artifacts in your UI server OR do you keep them on something like S3 and then

@oakmac
oakmac / clojurescript-questions.md
Created September 27, 2020 18:33
ClojureScript Questions + Answers

ClojureScript Questions + Answers

A friend emailed me some questions related to ClojureScript for discussion. I thought these answers might be helpful in a public forum. -- C. Oakman, 27 Sep 2020


Do you serve your CLJS/html from CDN or from same domain as application server?

In general I serve static assets from the same domain as the application server.