Skip to content

Instantly share code, notes, and snippets.

@aderchox
aderchox / promisifying.js
Last active October 11, 2022 08:04
Promisification Quick Example
// 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 August 30, 2022 06:39
karel the robot add fast problem solution
/*
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){
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 November 29, 2021 18:42
IRC Quick Guide (with Irssi terminal client)
====== 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 February 7, 2021 13:21
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-02-07T13:21:29.612Z","extensionVersion":"v3.4.3"}