Skip to content

Instantly share code, notes, and snippets.

Avatar

Conrad Buck conartist6

  • Boulder, CO
View GitHub Profile
View example.c
struct star {
float BTmag,
float VTmag,
int Plx,
int Plx_err
}
void main() {
const char *source_holder = "H| 1| |00 00 00.22|+01 05 20.4| 9.10| |H|000.00091185|+01.08901332| | 3.54| -5.20| -1.88| 1.32| 0.74| 1.39| 1.36| 0.81| 0.32|-0.07|-0.11|-0.24| 0.09|-0.01| 0.10|-0.01| 0.01| 0.34| 0| 0.74| 1| 9.643|0.020| 9.130|0.019| | 0.482|0.025|T|0.55|0.03|L| | 9.2043|0.0020|0.017| 87| | 9.17| 9.24| | | | | | | | 1| | | | | | | | | |S| | |224700|B+00 5077 | | |0.66|F5 |S ";
View gist:738573e4915283da1f9f
Amputate the thought that says you shouldn't ever amputate a thought.
View gist:8658687
Ember.Application.create({
customEvents: {
draginit: 'dragInit',
/* Some events shadow regular dom events and thus don't need to be registered with Ember */
// dragstart: 'dragStart',
// drag: 'drag',
// dragend: 'dragEnd',
dropinit: 'dropInit',
dropstart: 'dropStart',
// drop: 'drop',
View example.js
let array = [1, 2, 3];
let seq = new Seq(array);
let keyedSeq = seq.toKeyedSequence();
seq.map(x => ++x);
Array.from(seq); // [2, 3, 4]
new Map(keyedSequence); // Map[0 => 2, 1 => 3, 2 => 4]
@conartist6
conartist6 / group-by.mjs
Last active Mar 10, 2019
iter-tools groupBy
View group-by.mjs
import { iterableCurry } from './internal/iterable'
import { WeakExchange } from './internal/queues'
import consume from './consume'
function groupBy (getKey = (k, i) => k, iterable) {
let iterator
let idx = 0
const weakExchange = new WeakExchange()
let consumer
View $flat.d.ts
import { $IterableLike, $IterableIterator, $MaybePromise } from './internal/$iterable';
type $MaybeIterable<T> = T extends $IterableLike<infer T> ? $IterableLike<T> : any;
// prettier-ignore
declare function $flat<U = any>(
depth: 0,
iterable: $MaybeIterable<U>,
): $IterableIterator<U>;
@conartist6
conartist6 / permutations.js
Last active Aug 29, 2019
Permutations generator
View permutations.js
function swap(arr, aIdx, bIdx) {
if (aIdx < 0 || aIdx >= arr.length) throw new TypeError();
if (bIdx < 0 || bIdx >= arr.length) throw new TypeError();
const temp = arr[aIdx];
arr[aIdx] = arr[bIdx];
arr[bIdx] = temp;
}
function shiftToEnd(arr, idx) {
@conartist6
conartist6 / lexer.js
Last active Apr 11, 2020
Proposed lexer API
View lexer.js
const matching = {
'{': '}',
'}': '{',
};
export const tokenize = (lexEngine) => {
const { start, get, take, end, setType } = lexEngine; // token fns
const { peekChar, pushState, popState, match, matchable, allMatched } = lexEngine;
const literal = (n) => {
@conartist6
conartist6 / post.md
Last active Jul 14, 2020
Intro to Macrome
View post.md

I'm working on a brand new build system, and I want to take a moment to address the obvious question, which is: OMGWTFBBQ why another one!?

The answer is in the trees.

The new tool, Macromé (pronounced "macro-may", imported as macrome) is powerful becase it performs in–place builds within existing directory tree structures, so that many types of data about the same underlying unit stay colocated.

For example a React component expressed as a tree-structured directory (a.k.a pod, or unit) and built by macrome might look like this:

[projectRoot]
@conartist6
conartist6 / index.js
Last active Jul 14, 2020
Built webpackable component example
View index.js
/* @macrome
* @generated-by ./index.js
*/
const React = require('react');
const styles = require('index.module.css.js');
require('index.module.css');
// The bundler needs a css require to exist for static analysis.
// Node require hooks may be used to make requiring any .css a no-op.