Skip to content

Instantly share code, notes, and snippets.

Avatar

Lucas Klaassen lucasklaassen

View GitHub Profile
@lucasklaassen
lucasklaassen / TestRunner2.java
Created Apr 17, 2020
Algorithms 1 Union-find with specific canonical element
View TestRunner2.java
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 Apr 17, 2020
Algorithms 1 Social network connectivity
View TestRunner.java
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;
View keybindings.json
[
{
"key": "ctrl+space",
"command": "workbench.action.terminal.toggleTerminal"
},
{
"key": "ctrl+space",
"command": "workbench.action.terminal.focus",
"when": "!terminalFocus"
},
@lucasklaassen
lucasklaassen / encryption.js
Created Sep 12, 2018
Encrypt/Decrypt Angular 6 Secrets Committed To Source Control
View encryption.js
// 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 Mar 3, 2018
Serverless lambda function which uses middleware to handle warmup, validation, JSON Parsing and error handling.
View fetch.js
'use strict';
import ExampleObject from './../objects/ExampleObject';
const schema = {
"properties": {
"primaryID": {
"type": "string",
"format": "uuid"
}
@lucasklaassen
lucasklaassen / handler.js
Created Mar 3, 2018
Serverless lambda function which handles validation, JSON parsing of request and error handling.
View handler.js
'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 Dec 17, 2017
serverless debugging in vscode
View launch.json
{
"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 Dec 17, 2017
serverless-webpack configuration for debugging
View webpack.config.js
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: {