Skip to content

Instantly share code, notes, and snippets.

View gohkhoonhiang's full-sized avatar

Goh Khoon Hiang gohkhoonhiang

View GitHub Profile
@gohkhoonhiang
gohkhoonhiang / ruby_meetup_july_2023.js
Last active June 10, 2023 12:57
Ruby Meetup July 2023 Lightning Talk
function x1(value) {
return (
Object.is(value, undefined) ||
Object.is(value, null)
);
}
function x2(val1, val2, val3) {
return (
val1 >= val2 &&
# shortcut to a declared environment variable to a directory
# eg. declare myrepo=~/Documents/repo
# then do 'to myrepo' will be equivalent to 'cd ~/Documents/repo'
function to() {
if [ -z "$1" ]; then
echo "Empty argument"
return
fi
eval temp_var=\$$1
if [ -z "${temp_var}" ]; then
import sys
def create_map(filename):
f = open(filename, "r")
lines = f.readlines()
rows = int(lines[0].split()[0])
cols = int(lines[0].split()[1])
skimap = [[int(c) for c in lines[i].split()] for i in range(1,len(lines))]