Skip to content

Instantly share code, notes, and snippets.

View crucialfelix's full-sized avatar
💭
Building product, looking for consulting work

Chris Sattinger crucialfelix

💭
Building product, looking for consulting work
View GitHub Profile
import React from 'react';
export const Cover = (props) => {
if (props.src) {
return <img className="mw-100 w-100 db" src={props.src} alt={props.alt || ''} />;
} else {
if (props.alt) {
return (
<div className="dt w-100 h-100 ba">
<div className="dtc v-mid tc f5 ttu tracked pa1">{props.alt}</div>
@crucialfelix
crucialfelix / export-quarks.scd
Created July 1, 2016 08:50
Scripts that were used to move Quarks into github

// Having downloaded all the quarks, load and interpret each .quark file and dump them all to quarks.json

var dir = "/Users/crucial/Desktop/DOING/quarks/quarks/DIRECTORY"; var all = (), f;

PathName(dir).filesDo({ arg f; var data; if(f.isFile, { data = f.absolutePath.loadPath; all[data['name']] = data;

@crucialfelix
crucialfelix / generate_changelog.sh
Created September 15, 2016 08:35
Generate changelog for supercollider
github_changelog_generator -t MY_GITHUB_API_KEY --since-tag=Version-3.7.1 --future-release=3.7.2 --exclude-tags=Version-3.2rc1,Version-3.2rc3,Version-3.2rc5,Version-3.2rc6,Version-3.4alpha,Version-3.4rc1,Version-3.5beta1,Version-3.5beta2,Version-3.5beta3,Version-3.5beta4,Version-3.5rc1,Version-3.5rc2,Version-3.5rc3,Version-3.6alpha1,Version-3.6alpha2,Version-3.6alpha3,Version-3.6beta1,Version-3.6beta2,Version-3.6beta3,Version-3.7.0-alpha0,Version-3.7.0-alpha1,Version-3.7.0-beta1,Version-3.7.0-beta2,after-qt5,before-qt5,pre-gui-review,start,validated-linux,pre-gui-review,before-sclang.app,travis-temp
@crucialfelix
crucialfelix / relay-fullstack_graphene-django.md
Last active October 24, 2016 02:35
Make relay-fullstack connect with graphene-django
@crucialfelix
crucialfelix / contributors.js
Last active November 11, 2016 17:48
Changelog generator used for SuperCollider 3.8
/**
* Prints contributors list sorted by number of issues and pull requests.
* Closed issues and successfully merged pull-requests only.
*/
var fs = require('fs');
var _ = require('lodash');
var ib = [];
var pb = [];
var milestone = '3.8';
@crucialfelix
crucialfelix / january-2017-gencomp-udk.md
Last active January 19, 2017 12:53
Notes for Gen Comp class at UDK, Berlin Jan 2017

supercollider.js

supercollider.js - write javascript code, run it using node.js on the commandline. runs on a single computer.

supercollider features

  • High-quality audio server
  • Hundreds of UGens (unit generators)
  • Complex low-level control system
@crucialfelix
crucialfelix / 1-data-projector.js
Last active May 3, 2017 09:32
webpack 1 : cheap-module-eval-source-map causes Reference undefined
// A simple module. One function uses a function defined in the same file.
// Easy as pie
function project(functions, path, statsParams, mapParams) {
// Undefined reference: loadDataset is not defined
return loadDataset(path, functions, statsParams).then(dataset => {
// etc
// return mapDataset(functions, mapParams, dataset);
});
}
@crucialfelix
crucialfelix / bulk_save.py
Last active October 6, 2022 08:09
Django BulkSave - batches insert, updates, deletes and m2m into the minimum number of queries
import contextlib
import hashlib
import logging
from collections import defaultdict
from decimal import Decimal
from django.db.models import DecimalField, ForeignKey
log = logging.getLogger(__name__)
@crucialfelix
crucialfelix / AsyncComponent.tsx
Created July 27, 2017 13:32
TypeScript port of react-loadable
/**
* A port, cleanup and simplification of https://github.com/thejameskyle/react-loadable
* MIT License Copyright 2017 Chris Sattinger
*/
import React from "react";
export function Loading({ loading = true }) {
return loading
? <i className="fa fa-spinner fa-spin" aria-hidden="true" />
: null;
@crucialfelix
crucialfelix / graphql_auth.py
Created August 4, 2017 19:03
django-graphene auth decorator
from decorator import decorator
def _check_auth(args, pred):
_, _, context, _ = args
if not pred(context):
raise Exception("Unauthorized")
@decorator
def is_user(fn, *args, **kwargs):