Skip to content

Instantly share code, notes, and snippets.

View lucasklaassen's full-sized avatar

Lucas Klaassen lucasklaassen

View GitHub Profile
@lucasklaassen
lucasklaassen / TestRunner2.java
Created April 17, 2020 18:21
Algorithms 1 Union-find with specific canonical element
public class Canonical {
private int members[];
public void setMembers(int members[]) {
this.members = members;
}
private int findRoot(int memberId) {
boolean foundRoot = false;
int rootId = memberId;
@lucasklaassen
lucasklaassen / TestRunner.java
Last active April 17, 2020 01:07
Algorithms 1 Social network connectivity
import java.util.EmptyStackException;
import java.util.HashMap;
class MemberLogItem {
public int timestamp = 0;
public int follower = 0;
public int followee = 0;
public MemberLogItem(int timestamp, int follower, int followee) {
this.timestamp = timestamp;
@lucasklaassen
lucasklaassen / keybindings.json
Created November 19, 2019 19:18
VSCode Keybindings
[
{
"key": "ctrl+space",
"command": "workbench.action.terminal.toggleTerminal"
},
{
"key": "ctrl+space",
"command": "workbench.action.terminal.focus",
"when": "!terminalFocus"
},
@lucasklaassen
lucasklaassen / encryption.js
Created September 12, 2018 19:54
Encrypt/Decrypt Angular 6 Secrets Committed To Source Control
// You must create a folder in your root directory named environments/
// Add the following lines to your .gitignore
// /src/environments/environment.ts
// /src/environments/*.development.ts
// /src/environments/*.production.ts
// /src/environments/*.staging.ts
// Under src/environments add your environment.ts files like you normally do.
@lucasklaassen
lucasklaassen / fetch.js
Created March 3, 2018 17:35
Serverless lambda function which uses middleware to handle warmup, validation, JSON Parsing and error handling.
'use strict';
import ExampleObject from './../objects/ExampleObject';
const schema = {
"properties": {
"primaryID": {
"type": "string",
"format": "uuid"
}
@lucasklaassen
lucasklaassen / handler.js
Created March 3, 2018 17:21
Serverless lambda function which handles validation, JSON parsing of request and error handling.
'use strict';
import utilities from './../lib/utilities';
import ExampleObject from './../objects/ExampleObject';
import Ajv from 'ajv';
const schema = {
"properties": {
"primaryID": {
"type": "string",
@lucasklaassen
lucasklaassen / launch.json
Created December 17, 2017 02:53
serverless debugging in vscode
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Serverless",
"program": "${workspaceFolder}/node_modules/.bin/sls",
"cwd": "${workspaceFolder}",
"args": [
@lucasklaassen
lucasklaassen / webpack.config.js
Created December 17, 2017 02:51
serverless-webpack configuration for debugging
const nodeExternals = require('webpack-node-externals');
const path = require('path');
const slsw = require('serverless-webpack');
module.exports = {
devtool: 'source-map',
entry: slsw.lib.entries,
target: 'node',
externals: [nodeExternals()],
output: {