Skip to content

Instantly share code, notes, and snippets.

View sastraxi's full-sized avatar
🥰

Cameron Gorrie sastraxi

🥰
View GitHub Profile
@sastraxi
sastraxi / Shrimp Biryani.md
Last active February 2, 2021 02:58
Ni's Shrimp Biryani

Image

Ni's Shrimp Biryani

This delicious Kerala-style biryani recipe makes 8 servings. This biryani is made with a number of different "sub-recipes" that are baked together in layers, then mixed before serving.

Ingredients

For the marinated shrimp:

  • 500g shrimp de-shelled and de-veined (keep the shells to make stock)

Employee Hierarchies Problem Set

This problem set explores a number of questions related to a company and its employees; specifically, its hierarchy of management:

const employees = [
  { name: 'Alice',  manager: null,    title: 'CEO' },
  { name: 'Bob',    manager: 'Alice', title: 'Head of Marketing' },
 { name: 'Carol', manager: 'Alice', title: 'Head of Engineering' },
@sastraxi
sastraxi / recompose-form.jsx
Last active May 15, 2018 15:41
An idea of how to use recompose to separate out form concerns
import React from 'react';
import _ from 'lodash';
import { compose, withProps, withPropsOnChange, lifecycle, withStateHandlers } from 'recompose';
const fetch = (id) => {};
const create = (state) => {};
const update = (id, state) => {};
const validate = state => {
const errors = {};
@sastraxi
sastraxi / graphql.js
Last active January 31, 2018 19:06
Hacky way to combine PostGraphile with another GraphQL schema
import express from 'express';
import bodyParser from 'body-parser';
import { graphqlExpress, graphiqlExpress } from 'apollo-server-express';
import { postgraphile } from 'postgraphile';
import { createApolloFetch } from 'apollo-fetch';
import {
makeRemoteExecutableSchema,
introspectSchema,
mergeSchemas,
FROM node:6-slim
# Put micro-support where it can be found
RUN mkdir -p /usr/src
COPY build-context /usr/src
# Working directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
@sastraxi
sastraxi / DebouncedProp.jsx
Last active June 22, 2020 07:28
Store quickly-changing state directly in Redux (e.g. the value of a textarea) without a bajillion actions being dispatched
import React from 'react';
import _ from 'lodash';
/**
* Protect a heavyweight setter by caching values locally.
* Allows functional controlled components with e.g. a redux backing store,
* without dispatching actions on every keypress.
*
* @param {*} valueProp the value to cache (e.g. a key from mapStateToProps)
* @param {*} setterProp the heavyweight setter to protect (e.g. a key from mapDispatchToProps)
<script type="text/javascript">
$(function() {
// prepare a typeahead using the song IDs
$('#songId').autocomplete({
serviceUrl: "@{Publishers.clientSongIds}",
paramName: "prefix",
dataType: "json",
transformResult: function(response, originalQuery) {
return {
@sastraxi
sastraxi / demolator.py
Last active March 21, 2017 21:09
Python REAscript for REAPER to process demos from the Zoom H4n. Tested on REAPER v4.22 (x86).
import os, os.path, shutil, errno
import datetime
# http://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass