Skip to content

Instantly share code, notes, and snippets.

@panunu
panunu / sedux.scala
Created January 7, 2016 13:36
Sedux
import org.scalajs.dom.raw.Event
import org.scalajs.jquery.jQuery
import scala.scalajs.js.JSApp
object App extends JSApp {
def main(): Unit = {
import js.Store.Reducer
val $ = jQuery
@panunu
panunu / redux-router-async-auth.js
Last active December 16, 2016 19:31
How to handle login asynchronously with Redux and Redux Router
export default function bindCheckAuth(store, onFail) {
return (nextState, transition) => {
const resolveAuth = (resolve, reject) => {
if (!store.getState().authentication.get('isReady')) {
return setTimeout(() => resolveAuth(resolve, reject), 25);
}
store.getState().authentication.get('isLoggedIn') ? resolve() : reject();
};
@panunu
panunu / phps
Last active August 29, 2015 14:02
Macports PHP switcherooer
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: phps 54";
exit;
fi
VERSION=$1
/usr/bin/sudo ln -sf /opt/local/bin/php$1 /opt/local/bin/php