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
@yakovmeister
yakovmeister / validate_credit_card.js
Created November 2, 2016 22:35 — forked from nclvp443/validate_credit_card.js
Luhn algorithm in Javascript. Check valid credit card numbers
// takes the form field value and returns true on valid number
function valid_credit_card(value) {
// accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
var nCheck = 0, nDigit = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {
<?php
namespace App\Transformers;
use Illuminate\Support\Collection;
class SampleTransformer extends Transformer
{
@yakovmeister
yakovmeister / logcat.txt
Created February 24, 2017 13:54
bootloop after update from 0207 -> 0223
This file has been truncated, but you can view the full file.
--------- beginning of system
02-24 21:47:47.219 2917 3176 D MountService: Setting up emulation state, initlocked=false
02-24 21:47:47.219 2917 3176 D CryptdConnector: SND -> {2 cryptfs unlock_user_key 0 0 ! !}
02-24 21:47:47.220 233 238 D vold : e4crypt_unlock_user_key 0 serial=0 token_present=0
02-24 21:47:47.221 2917 3178 D CryptdConnector: RCV <- {200 2 Command succeeded}
02-24 21:47:47.221 2917 3176 D MountService: Thinking about reset, mSystemReady=true, mDaemonConnected=true
02-24 21:47:47.222 2917 3176 D VoldConnector: SND -> {3 volume reset}
02-24 21:47:47.222 2917 2959 I ActivityManager: Force stopping com.android.providers.media appid=10010 user=-1: vold reset
02-24 21:47:47.224 2917 3177 D VoldConnector: RCV <- {651 emulated 7}
@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)])
@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;
/**
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 / 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
}
}
@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 / 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 / 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;
}