Skip to content

Instantly share code, notes, and snippets.

View krrishd's full-sized avatar
🤯

Krish Dholakiya krrishd

🤯
View GitHub Profile
@krrishd
krrishd / parseSlackArchive.js
Created July 26, 2018 18:27
get nice data from a slack archive
'use strict';
const fs = require('fs');
const path = require('path');
const async = require('async');
const getUserFromMessage = (messageObject, userList) => {
const relevantUser = userList.filter(user => {
return (user.id == messageObject.user);
})[0];
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@jbreckmckye
jbreckmckye / gist:4553c47e1b26dbe6130f1d7736f148d9
Last active November 10, 2023 02:07
JSTOR Open Access Book List
Title Subtitle Authors JSTOR Discipline 1
Tracking Rural Change "Community, Policy and Technology in Australia, New Zealand and Europe" Socio
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@wolever
wolever / bcsx.rst
Last active December 9, 2022 07:41
Blockchain Santa Exchange (working title): organizing fair and secure secret santa gift exchanges on the blockchain

By shazow and wolever.

Problem

How can N secret santa gift exchange participants agree on a gift-giver -> gift-recipient bijection such that:

@krrishd
krrishd / csv2json.js
Last active May 4, 2022 08:38
converting csv to json
var csv2json = (function() {
function convert(data) {
var json = [];
var d = data.split('\n');
var keys = d[0].split(',');
d = d.splice(1);
d.forEach(function(data) {
var keyVal = data.split(',');
var obj = {};
keys.forEach(function(keyData, n) {
@mlynch
mlynch / Undo.md
Last active April 9, 2024 11:28
Undo/Redo

Undo/Redo

Undo/Redo is one of those features of an application that you almost always need to have if you are building serious GUI tools for people to do work.

The best way to look at undo/redo is two stacks of operations the user has performed:

  • The Undo stack is the "history" of what they've done
  • The redo stack is the breadcrumbs back to the initial state before they started undoing
@krrishd
krrishd / http.js
Last active August 29, 2015 14:04
Simple XHR stuff. Probably already done in a neater way, but I was just experimenting and wanted simplicity of the highest degree. Essentially it's a combo of my post.js and get.js
/*
* By Krish Dholakiya (itskrish.co, git.io/krish)
* MIT Licensed.
*
* GET('http://example.com/index.html', function(response) {
* var responseFromServer = response;
* });
* POST('http://example.com', {'keyOne': 'valueOne', 'keyTwo': 'valueTwo'}, function(response) {
* var responseFromServer = response;
* });
@krrishd
krrishd / get.js
Last active August 29, 2015 14:04
For when I don't want to use jQuery or Angular to make GET HTTP requests, neither do I care for raw XHR.
/*
* By Krish Dholakiya (itskrish.co, git.io/krish)
* MIT Licensed.
*
* GET('http://example.com/index.html', 'html') => returns DOM object
* GET('http://example.com/api.json', 'json') => returns parsed JSON object
*
* TODO: add more types (XML, etc)
* CDN url: https://cdn.rawgit.com/krrishd/f17247fcd6ff2335ca5f/raw//b5c2f93d8d3246dabe07cf9b6e73d71631f907b2
*/
@krrishd
krrishd / rss2json.js
Last active November 24, 2017 08:56
rss2json
/*
* Example Usage:
*
* $.get('http://cors.io/sprunge.us/ILRc', function(data) {
* window.xmlData = data;
* window.domParser = new DOMParser();
* window.parsedXML = domParser.parseFromString(window.xmlData, 'text/xml');
* window.jsonFeed = rss2json(parsedXML);
* });
*