Skip to content

Instantly share code, notes, and snippets.

View gillchristian's full-sized avatar
🦀
i use rust btw

Christian Gill gillchristian

🦀
i use rust btw
View GitHub Profile
let x = 0;
const f = (n) => {
if (n === 0) {
x += 1;
console.log("********");
return;
}
const mergeSort = (arr) => {
if (arr.length < 2) return arr;
const mid = Math.floor(arr.length / 2);
const l = arr.slice(0, mid);
const r = arr.slice(mid);
return mergeSorted(mergeSort(l), mergeSort(r));
};
const binarySearchRec = (arr, from, to, target) => {
if (arr.length === 0) return false;
if (arr.length === 1) return arr[0] === target;
const mid = Math.floor((from + to) / 2);
if (arr[mid] === target) return true;
if (from >= to) return false;
$ parcel build  --log-level verbose

@parcel/transformer-js: Non-static access of an `import` or `require`. This causes tree shaking to be disabled for the resolved module.

  /home/bb8/dev/listas-web/dce-output/Affjax/foreign.js:7:67
    6 |   var platformSpecific = { };
  > 7 |   if (typeof module !== "undefined" && module.require && !(typeof process !== "undefined" && process.versions["electron"])) {
  >   |                                                                   ^^^^^^^
    8 |     // We are on node.js
@gillchristian
gillchristian / coverage-parser.js
Last active April 15, 2021 19:06
[fp, tools] Coverage parser
const fs = require('fs');
const { pipe, flow } = require('fp-ts/function');
const A = require('fp-ts/Array');
const R = require('fp-ts/Record');
const NEA = require('fp-ts/NonEmptyArray');
const cells = (str) => str.split(',');
const lines = flow(
@gillchristian
gillchristian / pr-reviews.js
Created February 3, 2021 09:14
Scripts to make PR reviews easier [github,pr,reviews]
const queries = {
viewed: '[name="viewed"]',
fileHeader: '.file-header',
fileLink: '.file-info a.link-gray-dark',
};
/**
* Mark ALL not viewed files as viewed
*/
const setAllViewed = () =>
/src
  |__ components/
  |     |__ Button.ts
  |     |__ NavBar/
  |           |__ Foo.ts
  |           |__ Bar.ts
  |           |__ index.ts
  |__ hooks/
 |__ utilities/
@gillchristian
gillchristian / fp-ts-alt.ts
Last active November 2, 2020 11:03
[fp, fp-ts]
import * as Option from 'fp-ts/lib/Option'
import * as RecordFP from 'fp-ts/lib/Record'
import { pipe } from 'fp-ts/lib/pipeable'
import { showString } fro 'fp-ts/lib/Show'
const values = {
main: { a: 'a on main', b: 'b on main' },
secondary: { b: 'b on secondary', c: 'c on secondary' },
}
function curry(f) {
return (...args) =>
args.length === f.length ? f(...args) : curry(f.bind(null, ...args));
}
const concat = curry((a, b) => a + b);
// concat now works both ways, taking both arguments
console.log(concat("dog", "cat") === "dogcat");
// or one at a time
@gillchristian
gillchristian / jq-cheetsheet.md
Last active February 14, 2022 22:30 — forked from olih/jq-cheetsheet.md
jq Chaet Sheet [cheat-sheet]

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq