Skip to content

Instantly share code, notes, and snippets.

View yakovmeister's full-sized avatar
🐶
doggy doggy what now?

Jacob yakovmeister

🐶
doggy doggy what now?
View GitHub Profile
class Dice {
constructor() {
this.recentlyRolledValue = 1;
this.diceMaxValue = 6;
}
roll() {
let roll = Math.ceil(Math.random() * this.diceMaxValue);
this.recentlyRolledValue = roll;
@yakovmeister
yakovmeister / S3Wrapper.ts
Created August 15, 2019 02:47
Simplified S3 node API wrapper
import { info } from "@utils/logger/logger";
import { S3 } from "aws-sdk";
import {
CopyObjectOutput,
CopyObjectRequest,
DeleteObjectOutput,
DeleteObjectRequest,
GetObjectOutput,
GetObjectRequest,
ListObjectsV2Output,
@yakovmeister
yakovmeister / array-limits.ts
Created May 10, 2019 09:18
Because, why not?
declare global {
interface Array<T> {
limit: (limit: number) => Array<T>;
full: () => Array<T>;
isFull: () => boolean;
}
}
@yakovmeister
yakovmeister / array-limits.js
Last active May 10, 2019 08:01
Reimagine javascript's Array to add arr.full functionality
Array.prototype.limit = function (limit) {
this.limit = limit;
return this;
}
Array.prototype.full = function() {
if (!this.limit) {
this.limit = 1000000;
}
@yakovmeister
yakovmeister / DocumentClient.ts
Created February 14, 2019 07:00
document client wrapper...
import { DynamoDB } from "aws-sdk"
type DynamoDocType = DynamoDB.DocumentClient.DocumentClientOptions | DynamoDB.Types.ClientConfiguration
/**
* Promised enabled DocumentClient
* @class DocumentClient
*/
export class DocumentClient {
private documentInstance: DynamoDB.DocumentClient
@yakovmeister
yakovmeister / BetterSwitch.ts
Last active August 9, 2019 12:52
A better switch case replacement
function noop(...params: any[]) { }
export class BetterSwitch {
private cases: any = {};
constructor(defaultCaseRoutine: any = noop) {
this.cases.default = defaultCaseRoutine
}
/**
@yakovmeister
yakovmeister / BetterSwitch.js
Last active July 30, 2018 11:03
Just another replacement for switch, a better replacement.
/// NOTE: This snippet requires babel preset stage-2 or greater.
class BetterSwitch {
cases = {};
constructor(defaultCaseRoutine = undefined) {
if (defaultCaseRoutine) {
this.cases.default = defaultCaseRoutine
}
}
This file has been truncated, but you can view the full file.
[
{
"Code": "010000000",
"Name": "REGION I (ILOCOS REGION)",
"Inter-Level": "Reg",
"City Class": "",
"Income Classification": "",
"Urban / Rural (based on 2010 CPH)": "",
"POPULATION (2015 POPCEN)": "5,026,128"
},
@yakovmeister
yakovmeister / lazy_mode_on.php
Created March 17, 2017 02:45
When u a lzy af.
<?php
require('vendor/autoload.php');
require('include/header.php');
use Capstone\Model\Item;
$viewPageMode = 0; /* 0 = summary mode, 1 = stock card mode */
$withdrawSearch = null;
/**
@yakovmeister
yakovmeister / hopfield.py
Last active March 12, 2017 11:21
supposedly hopfield implementation in python, idk wtf I'm doing actually. lmao.
from __future__ import print_function
import numpy as np
# create an empty matrix
# @param iteration: length of an array
# @return matrix
def generateEmptyMatrix(iteration):
print("matrix: ")
matrix = np.array([[0 for x in range(iteration)] for y in range(iteration)])