Skip to content

Instantly share code, notes, and snippets.

@aderchox
aderchox / promisifying.js
Last active Oct 11, 2022
Promisification Quick Example
View promisifying.js
// This example illustrates how a synchronous method from the "fs" module could be promisified.
// Note that Node provides a built-in promisified fs module itself out of the box, and this snippet is just for illustration purposes.
const fs = require("fs");
// Non-promisified (async using callbacks, which can lead to callback hell... 👿🔥)
fs.readFile("./package.json", function callback(err, data) {
const package = JSON.parse(data.toString("utf8"));
console.log(package.name);
@aderchox
aderchox / karel_addFast
Last active Aug 30, 2022
karel the robot add fast problem solution
View karel_addFast
/*
0-0-0-0-1-1-1-1
0-0-1-1-0-0-1-1
0-1-0-1-0-1-0-1
—-1-1-c-1-c-c-1c
*/
void addFast(){
repeat(8){
View DataTable.js
import React from 'react';
import DataTableField from './DataTableField.js';
import { groupBy } from './helpers';
class DataTable extends React.Component {
constructor(props) {
super(props);
this.data = this.props.data;
this.categorizedData = groupBy(this.data, "category");
console.log(this.categorizedData);
@aderchox
aderchox / irc-quickstart.txt
Last active Nov 29, 2021
IRC Quick Guide (with Irssi terminal client)
View irc-quickstart.txt
====== IRC Intro: ======
An IRC Cheat Sheet: https://gist.github.com/xero/2d6e4b061b4ecbeb9f99
Terminology:
In IRC, there are "Networks", and then each network is available on a "server" (usually on
multiple servers, but one of them is used more often, so we can simplify things by thinking of
networks and servers as one-to-one mappings), and then each network(server) has several "Channels".
"Users" connect to networks first, using "IRC clients"(e.g. Irssi, mIRC, etc.), and then join channels.
@aderchox
aderchox / cloudSettings
Last active Feb 7, 2021
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2021-02-07T13:21:29.612Z","extensionVersion":"v3.4.3"}