Skip to content

Instantly share code, notes, and snippets.

View conartist6's full-sized avatar

Conrad Buck conartist6

View GitHub Profile
@conartist6
conartist6 / example.c
Last active August 29, 2015 13:57 — forked from anonymous/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 ";
Amputate the thought that says you shouldn't ever amputate a thought.
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',
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 March 10, 2019 18:18
iter-tools groupBy
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
@conartist6
conartist6 / $flat.d.ts
Created July 9, 2019 21:12
Flat typedefs
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 August 29, 2019 17:48
Permutations generator
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 April 11, 2020 16:48
Proposed lexer API
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 July 14, 2020 18:56
Intro to Macrome

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 July 14, 2020 20:12
Built webpackable component example
/* @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.