Skip to content

Instantly share code, notes, and snippets.

View taktran's full-sized avatar

Tak Tran taktran

View GitHub Profile
@taktran
taktran / README.md
Last active April 18, 2024 19:08
Extract Chat GPT Logs

Extract Chat GPT Logs

Made this to help me extract Chat GPT logs, for future reference.

Chat GPT did help in helping me write this :)

To use

@taktran
taktran / machine.js
Created July 24, 2022 11:13
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@taktran
taktran / machine.js
Last active June 26, 2022 17:43
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@taktran
taktran / machine.js
Last active March 29, 2021 12:10
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@taktran
taktran / machine.js
Last active July 17, 2020 12:01
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@taktran
taktran / machine.js
Last active July 17, 2020 12:07
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@taktran
taktran / mongo-utils.js
Last active June 10, 2020 08:58
Mongo db utils
const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');
exports.findInCollection = ({ db, collectionName }) => query => {
assert.notEqual(db, undefined);
const collection = db.collection(collectionName);
return collection.find(query).toArray();
};
@taktran
taktran / machine.js
Last active March 15, 2020 16:52
Generated by XState Viz: https://xstate.js.org/viz
const isWinner = ({ score, totalScore }) => score >= totalScore;
const playMachine = Machine({
id: "play",
initial: "playing",
context: {
score: 0,
totalScore: 10
},
states: {
@taktran
taktran / Makefile
Created December 11, 2018 12:55
Test makefile playground
HELLO_FILE_NAME := ".hello"
tidy-hello:
-rm $(HELLO_FILE_NAME)
save-hello: tidy-hello write-to-hello
write-to-hello:
echo "save this hello" > $(HELLO_FILE_NAME)
@taktran
taktran / spaces-settings.json
Last active November 12, 2018 16:50
Settings for .vscode/settings.json
// For 2 spaces + semi colons
{
"editor.formatOnSave": true,
"editor.tabSize": 2,
"files.exclude": {
"node_modules": true
},
"prettier.semi": true,
"prettier.tabWidth": 2,
"prettier.useTabs": false,