Skip to content

Instantly share code, notes, and snippets.

View gurdasnijor's full-sized avatar
🤠

Gurdas Nijor gurdasnijor

🤠
View GitHub Profile
function MergeLists(list1, list2) {
if (!list1) return list2;
if (!list2) return list1;
if (list1.data < list2.data) {
list1.next = MergeLists(list1.next, list2);
return list1;
} else {
list2.next = MergeLists(list2.next, list1);
return list2;
(def dataset-schema [{:db/id #db/id [:db.part/db]
:db/ident :dataset/id
:db/valueType :db.type/uuid
:db/cardinality :db.cardinality/one
:db/unique :db.unique/identity
:db/index true
:db/doc "The globally unique id for a dataset"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :dataset/name
@gurdasnijor
gurdasnijor / co.js
Last active October 21, 2016 07:06
co in 16 lines
function co(genFunc) {
let genObj = genFunc();
run();
function run(promiseResult = undefined) {
let item = genObj.next(promiseResult);
if (!item.done) {
// A promise was yielded
item.value
.then(result => run(result))
import * as React from 'react';
// This is necessary so that when the extraData we're passing to ColumnDefinitions changes,
// the components actually update. Specifically, we want to update a line's adjustment,
// proposed amount, and percent change columns when the bulk adjustment is changed
const UpdateOnBulkAdjustmentPlugin = {
name: 'UpdateOnBulkAdjustmentPlugin',
components: {
TableBody: (InitialTableBody: typeof React.Component) => class extends InitialTableBody<any, any> {
@gurdasnijor
gurdasnijor / SketchSystems.spec
Last active December 3, 2019 21:31
Visual Tagger
Visual Tagger
Initial*
create tag -> Tag Highlighting State
delete tag -> Delete Tag State
Delete Tag State
confirm -> Initial
cancel -> Initial
@gurdasnijor
gurdasnijor / machine.js
Created December 3, 2019 08:56
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@gurdasnijor
gurdasnijor / machine.js
Last active December 5, 2019 03:05
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@gurdasnijor
gurdasnijor / onbatch.js
Created December 8, 2020 18:22
onbatch handler
// The function runnning this code will be automatically provisioned when a user clicks the
// "create integration" button at the end of the creation flow -- it'll thread various bits
// of config down to the batch handler like profile -> destination mappings, auth tokens, and other
// context needed to interact with a partner api
async function onBatch(events, { endpoint, mappings, token }) {
//The mappings object is a dictionary of traitField->destinationField, lets retrieve all the
//traits we need from the profile api
@gurdasnijor
gurdasnijor / machine.js
Created December 17, 2020 01:58
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@gurdasnijor
gurdasnijor / machine.js
Last active January 4, 2021 23:34
Generated by XState Viz: https://xstate.js.org/viz
const signupJourney = Machine(
{
"key": "cart-abandoned",
"initial": "added_sneakers",
"states": {
"added_sneakers": {
"on": {
"DIDNT_BUY_SUPREME_ENTERED": "didnt_buy_supreme"
},
"meta": {