Skip to content

Instantly share code, notes, and snippets.

Working from home

Joe Karlsson JoeKarlsson

Working from home
View GitHub Profile
JoeKarlsson / mongodb-linked-list.js
Last active May 18, 2020
A linked list implemented using MongoDB documents
View mongodb-linked-list.js
const MongoClient = require("mongodb").MongoClient;
class LinkedList {
constructor() {}
async init() {
const uri =
this.client = new MongoClient(uri, {
useNewUrlParser: true,
View moodlite.ino
Name: Moodlite.ino
Created: 27.12.2018
Version: 2.0
AuthorS: Spigot (M.V.), Shiryou & Steve Wagg aka CdRsKuLL
License: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3.0 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <>
Support: Wether you use this project, have learned something from it, or just like it, please consider supporting us on our web site. :)
View step-1-promises.js
const resolveAfter2Seconds = () => {
console.log("starting slow promise");
return new Promise(resolve => {
setTimeout(() => {
console.log("slow promise is done");
}, 2000);
JoeKarlsson / client.js
Created Sep 18, 2018
Intro to NodeJS - using the net module and building a client and server
View client.js
const net = require('net');
const options = {
'port': 8080,
'host': ''
// creates a socket connection to a server
const client = net.connect(options, () => {
console.log('Connected to Server!');
JoeKarlsson / hash.js
Created Jul 24, 2018
JS Hashing function
View hash.js
const hashAlgorithm = (data) => {
const FNV_PRIME_32 = 0x1000193;
const FNV_OFFSET_32 = 0x811C9DC5;
let hash = FNV_OFFSET_32;
const str = JSON.stringify(data);
for (let i = 0; i < str.length; i++) {
hash ^= str.charCodeAt(i);
hash *= FNV_PRIME_32;
JoeKarlsson /
Created Jul 6, 2018
Express + Sequalize Migration Demo

Sequelize + Express Starter Guide


Based off of:

Create your project director

Create and initialize your a directory for your Express application.

# Your init script
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
# An example hack to log to the console when each text editor is saved.
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
JoeKarlsson / funArrays.js
Created Feb 11, 2017
Solutions for fun arrays
View funArrays.js
var dataset = require('./dataset.json');
create an array with accounts from bankBalances that are
greater than 100000.00
assign the resulting array to `hundredThousandairs`
var hundredThousandairs = dataset.bankBalances.filter(function(bank) {
return parseInt(bank.amount) > 100000;
View .gitconfig
name = Joe Karlsson
email =
github = joekarlsson1
branch = auto
diff = auto
status = auto
ui = auto
View gist:423c7c26116fe576b54e88870a7bce97
### Keybase proof
I hereby claim:
* I am joekarlsson on github.
* I am joekarlsson ( on keybase.
* I have a public key whose fingerprint is E626 4B25 7B52 A96C 71D3 8B69 E050 65C4 A621 9367
To claim this, I am signing this object:
You can’t perform that action at this time.