Skip to content

Instantly share code, notes, and snippets.

View puppybits's full-sized avatar

Bobby puppybits

View GitHub Profile
@puppybits
puppybits / .circleci___config.yml
Last active November 13, 2018 20:42
Parallelized Circle CI pipeline to build/deploy Re-Natal (w/ React Native & Om Next) project and upload DSYM to Sentry
version: 2
references:
ios_config: &ios_config
macos:
xcode: "9.4.1"
working_directory: ~/my-project
environment:
FL_OUTPUT_DIR: output # for Fastlane
build_filter: &build_filter
@puppybits
puppybits / rerender.cljs
Created September 7, 2018 17:20 — forked from Peeja/rerender.cljs
What it appears to take to re-render the React tree when Figwheel reloads.
;; Re-render when Figwheel reloads.
(gevents/listen js/document.body
"figwheel.js-reload"
(fn []
(let [root-component (om-next/app-root (compassus/get-reconciler a))]
(letfn [(js-vals [o]
(map #(aget o %) (js-keys o)))
;; Finds the children of a React internal instance of a component.
;; That could be a single _renderedComponent or several
;; _renderedChildren.
@puppybits
puppybits / ios.navigation.cljs
Created February 21, 2018 00:30
ClojureScript fix for ReactNative.NavigationIOS
(ns ios.navigation
"Translation for ReactNative.NavigatorIOS API. The core
issues this addresses is the previous stack item doesn't
re-render on pop and each component inside a navigation
stack needs to read it's props differently. This wrapper
keeps all the props the same and only assoc in a `react/navigation`
prop to push, pop, popToRoot."
(:require [om.next :as om :refer-macros [defui]]
[cljs.spec.alpha :as s]
[fskl.ui :as ui]))
@puppybits
puppybits / 01-install.md
Last active November 17, 2017 23:19
Om Next in JS

Intro

There's a big learning curves getting into Om Next. It's even hard for those who don't know ClojureScript. Most developers see a Lisp and are instantly turned off or annoyed at the syntax before even stopping to ask why or figure out the trade-offs with a lisp..

In order to focus on the patterns over the langauge, this is a rough translation about the workflow and patterns in Om Next. We should first focus on the core of what Om Next does, then why it uses certian patterns and how they work. Lastly is what does it gain by being in written ClojureScript.

@puppybits
puppybits / dynamo-to-json.js
Last active October 22, 2017 21:19
Convert DynamoDB Export to standard JSON
let file = './data.dynamodata';
function mapper(data) {
const val = obj => Object.keys(obj).reduce((o,k) => o[k],obj);
const defaultFn = (obj, key) => ({[key]: val(obj)});
const recurFn = (obj, key) => ({[key]: mapper(val(obj))});
const valType = {
"NULL": (obj, key) => ({[key]:null}),
"BOOL": defaultFn,
npm ls | grep -E "babelcli|crossenv|cross-env.js|d3.js|fabric-js|ffmepg|gruntcli|http-proxy.js|jquery.js|\
mariadb|mongose|mssql.js|mssql-node|mysqljs|nodecaffe|nodefabric|node-fabric|nodeffmpeg|nodemailer-js|\
nodemailer.js|nodemssql|node-opencv|node-opensl|node-openssl|noderequest|nodesass|nodesqlite|node-sqlite|\
node-tkinter|opencv.js|openssl.js|proxy.js|shadowsock|smb|sqlite.js|sqliter|sqlserver|tkinter"
@puppybits
puppybits / Behavior Science Terms.md
Last active November 12, 2017 16:38
Behavior Science Terms

anchoring

A cognitive bias that describes the common human tendency to rely too heavily on the first piece of information offered (the "anchor") when making decisions.

asymmetric dominance

The phenomenon whereby consumers will tend to have a specific change in preference between two options when also presented with a third option that is inferior in all respects to one option; but, in comparison to the other option, it is inferior in some respects and superior in others. A higher percentage of consumers will prefer the dominating option than when the asymmetrically dominated option is absent. (starts with a)

choice architecture

@puppybits
puppybits / emac.md
Last active February 10, 2017 17:08
Emacs cheatsheet for common key commands

Diffing

cmd operation
⌥x, ediff file diff
⌥x, dired folder diff

Cursor

@puppybits
puppybits / index.html
Created October 5, 2016 06:43
Learn JS in 2016
<html>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.js"></script>
<div id="app"></div>
<script>
var el = React.createElement;
// create a component
@puppybits
puppybits / index.js
Created September 15, 2016 00:59
Rough minimal bootstrap for React w/ code splitting
const ReactDom = require('react-dom');
const { Router } = require('react-router');
const { createHistory } = require('history'),
history = createHistory();
const mount = window.document.getElementById('app');
if (!mount){
mount = window.document.createElement("div");
mount.id = "app";
window.document.body.appendChild('mount');