Skip to content

Instantly share code, notes, and snippets.

View kevinah95's full-sized avatar
🇨🇷

Kevin Hernández Rostrán kevinah95

🇨🇷
View GitHub Profile
function print (path: any, layer: any) {
if (layer.route) {
layer.route.stack.forEach(print.bind(null, path.concat(split(layer.route.path))))
} else if (layer.name === 'router' && layer.handle.stack) {
layer.handle.stack.forEach(print.bind(null, path.concat(split(layer.regexp))))
} else if (layer.method) {
console.log('%s /%s',
layer.method.toUpperCase(),
path.concat(split(layer.regexp)).filter(Boolean).join('/'))
}
@kevinah95
kevinah95 / remove_no_longer_on_remote.sh
Last active July 24, 2020 15:59
Remove tracking branches no longer on remote.
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
# More info: https://stackoverflow.com/a/33548037/4752488
#
# rgl layout text file (v2.1) - raygui layout file generated using rGuiLayout
#
# Number of controls: 19
#
# Ref. window: r <x> <y> <width> <height>
# Anchor info: a <id> <name> <posx> <posy> <enabled>
# Control info: c <id> <type> <name> <rectangle> <anchor_id> <text>
#
r 0 0 -1 -1
@kevinah95
kevinah95 / run.sh
Created June 10, 2020 17:17
Run ralib local linking
cc game.c -Llib -Wl,-rpath,lib -lraylib -Iinclude
libsdl2-2.0-0 libsdl2-dev libsdl2-image-2.0-0 libsdl2-image-dev
git config --global alias.purge 'git fetch -p && for branch in `git branch -vv --no-color | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done'
let quicksort = (arr) => {
quicksortHelper(arr, 0, arr.length - 1)
}
let quicksortHelper = (arr, first, last) => {
if(first < last){
let p = partition(arr, first, last)
quicksortHelper(arr, first, p - 1)
quicksortHelper(arr, p + 1, last)
}
let binarySearch = (arr, left, right, searchValue) => {
if (left <= right) {
middle = Math.floor((left + (right - left) / 2))
if (searchValue === arr[middle]) {
return middle
}
if (searchValue < arr[middle]) {
return binarySearch(arr, left, middle - 1, searchValue)
} else {
│ ┌── 8
│ ┌── 6
│ │ └── 5
│ ┌── 5
│ │ │ ┌── 4
│ │ └── 3
│ │ └── 8
└── 2
│ ┌── 5
│ ┌── 6
Module Module1
Class Node
Public Key As Integer
Public Left, Right As Node
Sub New(Item As Integer)
Key = Item
Left = Nothing
Right = Nothing