Skip to content

Instantly share code, notes, and snippets.

Max Kaplan kaplanmaxe

  • Kaplan Komputing, LLC
Block or report user

Report or block kaplanmaxe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View inversions.py
def read_file(fileName):
nums= []
with open(fileName, "r") as fp:
for num in fp:
nums.append(int(num))
return nums
def inv_count_brute_force(arr, n):
inv_count = 0
View bubbleSort.asm
# an interative approach to bubble sort
# c/c++ implementation: https://codescracker.com/cpp/program/cpp-program-bubble-sort.htm
.data
arr: .word 7,4,6,9,1,3
N: .word 6
.text
la $s0, arr # get address of array
la $s1, N # get address of N
lw $s1, 0($s1) # get value of N
.globl main
View kin.go
package main
import (
"fmt"
"math"
)
const (
d = 0.00061
r0 = 6000000000000
View onename.txt
Verifying that "kaplanmaxe.id" is my Blockstack ID. https://onename.com/kaplanmaxe
View keybase.md

Keybase proof

I hereby claim:

  • I am kaplanmaxe on github.
  • I am kaplanmaxe (https://keybase.io/kaplanmaxe) on keybase.
  • I have a public key ASBzC2l3T7uD6OgaGLRVv_4PQ45Ng55tSy8Ooiq8KJPmIwo

To claim this, I am signing this object:

@kaplanmaxe
kaplanmaxe / speechrecognition.js
Last active Feb 19, 2017
JS Speech Recognition
View speechrecognition.js
// API: https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API
const recognition = new webkitSpeechRecognition();
recognition.onresult = function(event) {
for (let i = event.resultIndex; i < event.results.length; ++i) {
console.log(event.results[i][0].transcript);
}
}
recognition.start(); // Click allow when browser prompts to use your microphone
recognition.stop(); // Call this when done talking.
@kaplanmaxe
kaplanmaxe / objectsbyref.js
Last active Feb 19, 2017
JS Objects are By Reference by default
View objectsbyref.js
const a = { name: 'Max', age: 24 };
const b = a;
b.name = 'Barbara';
console.log(b); // { name: 'Barbara', age: 24 }
console.log(a); // { name: 'Barbara', age: 24 } (a.name was overwritten as well by b.name)
// To avoid passing by reference
const foo = { name: 'Max', age: 24 };
const bar = Object.assign({}, foo);
bar.name = 'Barbara';
@kaplanmaxe
kaplanmaxe / arraysbyref.js
Created Feb 19, 2017
JS Arrays are By Reference by default
View arraysbyref.js
const a = [0, 1, 2, 3];
const b = a;
b.push(10);
console.log(b); // [0, 1, 2, 3, 10]
console.log(a); // [0, 1, 2, 3, 10] (10 got pushed to a even though we only pushed to b)
// To AVOID passing by reference
const foo = [0, 1, 2, 3];
const bar = foo.concat([10]);
console.log(bar); // [0, 1, 2, 3, 10]
@kaplanmaxe
kaplanmaxe / selectors.js
Created Feb 19, 2017
You don't need jQuery for that
View selectors.js
document.querySelector('#exampleId');
document.querySelector('.exampleClass');
document.querySelectorAll('.exampleClass');
@kaplanmaxe
kaplanmaxe / errors.js
Last active Feb 18, 2017
Throwing Errors in JS
View errors.js
/**
* The proper way of throwing an error in JavaScript. Even prints a stack trace for you!
*/
throw new Error('I am learning way too much JS in one day');
/**
* Now we can even make our own errors.
*/
function LearningError(message) {
this.message = message;
You can’t perform that action at this time.