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 / 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 / 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
@rastandy
rastandy / cljs-main.md
Created July 11, 2018 22:53 — forked from mfikes/cljs-main.md
Command to get a preview of cljs.main

Usage

Start up the new cljs.main with Node:

clj -Sdeps '{:deps {org.clojurescript {:git/url "https://github.com/clojure/clojurescript" :sha "3f4084efcb5cd92cceb8ca30765144691d8cfd7e"}}}' -m cljs.main -re node

The above works by specifying ClojureScript as a "git dep" and you can ensure that you are running the very latest by replacing the :sha value with the latest commit SHA at https://github.com/clojure/clojurescript.

@rastandy
rastandy / mkfavicon.sh
Created October 23, 2018 13:10 — forked from pfig/mkfavicon.sh
Make a multi-resolution favicon.ico from a source image, using ImageMagick
#!/bin/bash
# from
# http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html
convert source-WxW.png -resize 256x256 -transparent white favicon-256.png
convert favicon-256.png -resize 16x16 favicon-16.png
convert favicon-256.png -resize 32x32 favicon-32.png
convert favicon-256.png -resize 64x64 favicon-64.png
convert favicon-256.png -resize 128x128 favicon-128.png
@rastandy
rastandy / docx2md.md
Created March 13, 2019 12:03 — forked from aembleton/docx2md.md
Convert a Word Document into MD

Converting a Word Document to Markdown in One Move

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

Installing Pandoc

On a mac you can use homebrew by running the command brew install pandoc.

The Solution