Skip to content

Instantly share code, notes, and snippets.

@mfikes
mfikes / README.md
Last active Mar 8, 2019
cljs.main rebel-readline
View README.md

Start cljs.main with rebel-readline:

clojure -Sdeps '{:deps {github-mfikes/cljs-main-rebel-readline {:git/url "https://gist.github.com/mfikes/9f13a8e3766d51dcacd352ad9e7b3d1f" :sha "27b82ef4b86a70afdc1a2eea3f53ed1562575519"}}}' -i @setup.clj -m cljs.main
@mfikes
mfikes / README.md
Last active Mar 8, 2018
Browser REPL stress test
View README.md

Run the test.clj below in a Clojure REPL, adjusting the cmd vector as needed to launch things.

It will launch the browser REPL and imitate a user typing forms into it. (If you don't have Safari set as your default browser, you can splice ["-ro" "{:launch-browser false}" "-r"] into the end of the cmd vector and launch Safari manually, pointing it at http://localhost:9000

In your browser open the JavaScript console to see progress.

A faster verzion, zippy.clj eliminates the JavaScript console logging and the Thread/sleep calls, evaluating the sequence of integer forms as quickly as possible.

To instead compare with Figwheel, do

@granella
granella / generate-certificate-chain.sh
Created Jun 27, 2016
Create self-signed certificate with root and ca for development
View generate-certificate-chain.sh
#!/bin/bash
rm *.jks 2> /dev/null
rm *.pem 2> /dev/null
echo "===================================================="
echo "Creating fake third-party chain root -> ca"
echo "===================================================="
# generate private keys (for root and ca)
View figwheel_client_socket_repl.clj
(require 'tubular.core)
(tubular.core/connect "127.0.0.1" REPL_PORT)
View editor_plugin.cljs
(ns frontend.editor-plugin
(:require-macros [frontend.goog-extend :refer [goog-extend]])
(:import [goog.editor Plugin]))
; 4. Now the code should work with advanced compilation but Closure Compiler
; will display few warnings about using "this" in static functions.
; To fix this, the constuctor should have proper JSDoc comments:
(goog-extend ^{:jsdoc ["@constructor" "@extends {goog.editor.Plugin}"]} FooPlugin Plugin
([]
; 1. This doesn't work with advanced compilation as Closure compiler checks that first
@mfikes
mfikes / ideas.md
Created Jun 6, 2015
Figwheel light ideas
View ideas.md

It would be interesting if Figwheel could essentially decorate any implementation of IJavaScriptEnv, taking on the responsibility of watching the filesystem (perhaps even delegating that to ClojureScript :watch, and expanded :watch-fn, and perhaps minimally calling IJavaScriptEnv -load when Figwheel determines it is needed.

Then, for those REPLs that can participate, if IFigwheelSupport can be extended to them, they can do further cool stuff. (Perhaps IFigwheelSupport is actually necessary while IJavaScriptEnv as described in the previous paragraph is insufficient, and a more fancy impl of -load is needed?)

That way, things like the existing Node REPL could be minimally supported by Figwheel, as well as Ambly, the Browser REPL, etc.

What does IFigwheelSupport do?

Perhaps somewhere there is a HUD interface and Figwheel can ask a REPL to display things on its HUD? An iOS or Android-specific REPL could delegate to Objective-C or Java that implement a HUD using platform-specific UI widgets

@paf31
paf31 / 24days.md
Last active Apr 15, 2020
24 Days of PureScript
View 24days.md

This blog post series has moved here.

You might also be interested in the 2016 version.

@jordwalke
jordwalke / gist:6350319
Last active Sep 10, 2016
ReactJS: JavaScript just like you've always done it.
View gist:6350319
/**
* ReactJS: JavaScript like you've always done it.
*
* This example renders your top ten most followed friends/followers, `filter`ing
* only your favorites, and putting a star on all verified accounts.
*
* With ReactJS, any time your data changes, the UI is always brought up to date
* automatically. If friends length changes, or followCount - it always shows what
* `render` describes.
*/
@puffnfresh
puffnfresh / do.sjs
Created Oct 4, 2012
do-notation using sweet.js
View do.sjs
macro $do {
case { $y:expr } => {
$y
}
case { $x:ident <- $y:expr $rest ... } => {
λ['>=']($y, function($x) {
return $do { $rest ... }
});
}
}