Skip to content

Instantly share code, notes, and snippets.

@rastandy
rastandy / links.md
Created October 28, 2013 14:57 — forked from igrigorik/links.md
Web Performance Power Tool: HTTP Archive (HAR)
@rastandy
rastandy / gist:5f88d1163023da24c80323cbf843b8de
Created May 9, 2016 15:12 — forked from marty-wang/gist:5a71e9d0a6a2c6d6263c
Compile and deploy React Native Android app of Release version to device.
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
@rastandy
rastandy / GraphQL-Architecture.md
Last active November 8, 2017 15:00 — forked from idibidiart/GraphQL-Architecture.md
Building an Agile, Maintainable Architecture with GraphQL

Building a Maintainable, Agile Architecture for Realtime, Transactional Apps

A maintainable application architecture requires that the UI only contain the rendering logic and execute queries and mutations against the underlying data model on the server. A maintainable architecture must not contain any logic for composing "app state" on the client as that would necessarily embed business logic in the client. App state should be persisted to the database and the client projection of it should be composed in the mid tier, and refreshed as mutations occur on the server (and after network interruption) for a highly

@rastandy
rastandy / fulcro reference query
Last active November 11, 2017 12:16
Ask for a specific entity in a Fulcro query
static om/IQuery
(query [this] [{:panels {:panelA [:boo], :panelB [:goo], :panelC [:sticky]}}
{[:panelB 1] [*]}
{[:current-panel _] [*]}])
@rastandy
rastandy / bbox.cljs
Last active November 11, 2017 12:16
Clojure specs for a geographical bounding box
(ns data-portal.specs.bbox
(:require [clojure.spec.alpha :as s]))
(s/def :geo/latitude (s/and number? #(<= -90 % 90)))
(s/def :geo/longitude (s/and number? #(<= -180 % 360)))
(s/def :geo/north :geo/latitude)
(s/def :geo/south :geo/latitude)
(s/def :geo/east :geo/longitude)
(s/def :geo/west :geo/longitude)
@rastandy
rastandy / spec.cljs
Last active November 15, 2017 14:43 — forked from swannodette/spec.cljs
om.next query spec
(ns om.next.spec
(:require [cljs.spec.alpha :as s]))
(s/def ::ident (s/and vector? (s/cat :ident keyword? :value #(not (coll? %)))))
(s/def ::join-key (s/or :prop keyword? :ident ::ident))
(s/def ::join (s/and (s/map-of ::join-key ::query) #(= (count %) 1)))
(s/def ::union (s/and (s/map-of keyword? ::query) #(> (count %) 1)))
(s/def ::param-expr
(s/cat :query-expr ::query-expr
@rastandy
rastandy / client.cljs
Last active November 22, 2017 11:21
Fulcro client creation
(ns data-portal.client
(:require [om.next :as om]
[fulcro.client.core :as uc]
[data-portal.ui.html5-routing :as routing]
[data-portal.ui.root :as root]
[fulcro.client.logging :as log]
[data-portal.api.core :refer [make-rest-network]]))
(defonce app
(atom (uc/new-fulcro-client
@rastandy
rastandy / replace.clj
Created November 22, 2017 11:29 — forked from chrismurrph/replace.clj
Search and replace for going to Fulcro 2.0
(ns general.replace
(:require [clojure.string :as s]
[clojure.java.io :as io]
[clojure.pprint :as pp]))
(defn indexes-of [in-str find-str]
(loop [idx 0
indexes []]
(let [found-idx (s/index-of in-str find-str idx)]
(if found-idx
@rastandy
rastandy / lambda-basic-auth.js
Created April 30, 2018 13:08 — forked from lmakarov/lambda-basic-auth.js
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
@rastandy
rastandy / cljs-serverless.md
Created July 11, 2018 22:25 — forked from lilactown/cljs-serverless.md
CLJS in AWS Lambda Quick Start