Skip to content

Instantly share code, notes, and snippets.

View jsstrn's full-sized avatar
🕺
Your best friend

Jesstern Rays jsstrn

🕺
Your best friend
  • Singapore
  • 01:12 (UTC +08:00)
View GitHub Profile
open -a safari https://youtu.be/X2W3aG8uizA
osascript -e 'set volume output volume 100'
@jsstrn
jsstrn / diceware.json
Last active September 6, 2017 13:44
Diceware Word List
{
"11111" : "a",
"11112" : "a&p",
"11113" : "a's",
"11114" : "aa",
"11115" : "aaa",
"11116" : "aaaa",
"11121" : "aaron",
"11122" : "ab",
"11123" : "aba",
class Payment {
constructor() {
this.paymentMethod = ''
}
setPaymentMethod(paymentMethod) {
this.paymentMethod = paymentMethod
}
pay(amount) {
@jsstrn
jsstrn / lab-how-the-web-works.md
Last active February 21, 2019 16:21
Lab: How the web works

🌐 Lab: How the web works

IP Address

We've learned that each device connected to a network is assigned an IP address. This includes your mobile phones and computers, and if you have a toaster that's hooked up to the Internet then your toaster, too.

What's the IP address of your computer?

Use ipconfig from your Terminal

@jsstrn
jsstrn / a.js
Created May 2, 2019 16:27
Write a function that checks if an array has duplicate values
function hasDuplicateValue(array) {
let counter = 0
for (let i = 0; i < array.length; i++) {
for (let j = 0; j < array.length; j++) {
counter++
if (i !== j && array[i] === array[j]) {
return true
}
}
}
@jsstrn
jsstrn / findDuplicates.js
Last active November 23, 2021 09:30
A simple algorithm to find duplicates in two arrays
/*
time: O(m + n)
space: O(n) // whichever is smaller
arr1 = [ 1, 2, 3, 5, 6, 7 ]
^
arr2 = [ 3, 6, 7, 8, 20 ]
^
arr3 = [ 3, 6, 7 ]
@jsstrn
jsstrn / binarySearch.js
Last active November 24, 2021 02:40
A simple binary search algorithm
/*
time: O(log n)
space: O(1)
*/
function binarySearch(value, array) {
let start = 0
let end = array.length