Skip to content

Instantly share code, notes, and snippets.

View willamesoares's full-sized avatar

Will Soares willamesoares

View GitHub Profile
@willamesoares
willamesoares / bst.js
Created July 13, 2019 17:20
JavaScript Binary Search Tree
// Constructor to create a new Node
function Node(key) {
this.key = key;
this.parent = null;
this.left = null;
this.right = null;
}
// Constructor to create a new BST
function BinarySearchTree() {
@willamesoares
willamesoares / toPdf.js
Last active March 11, 2020 19:06
Convert images in a folder to PDF
/*
toPdf.js
Gather all JPG, JPEG and PNG images in a folder and convert them to
individual files in an output folder named after the source folder name
$ node toPdf.js [source/folder/path]
The script will, within the current directory, create a folder with the
same name as the input folder and add all generated PDF files to it.
[user]
email = willame_soares@hotmail.com
name = Will Soares
[alias]
alias = config --get-regexp ^alias\\.
ci = commit
ps = push
st = status -s
co = checkout
br = branch
# split panes using | and -
bind - split-window -h
bind | split-window -v
unbind '"'
unbind %
# open and split windows keeping current dir
bind | split-window -v -c "#{pane_current_path}"
bind - split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
@willamesoares
willamesoares / recursive_asd.rb
Created March 11, 2018 15:28
Compilers - Recursive Predictive Parser in Ruby
#!/usr/bin/env ruby
require 'pry'
require 'terminal-table'
DELIM = '$'
def get_next_token(input)
@token = input[@counter]
@counter += 1
function revert (arr) {
const len = arr.length
if (len === 1) {
return arr
}
const last = arr.splice(-1,1)
return last.concat(revert(arr))
@willamesoares
willamesoares / settings.json
Created January 17, 2018 14:31
VS Code settings
{
"workbench.startupEditor": "newUntitledFile",
"window.zoomLevel": 1,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/vendor": true
},
@willamesoares
willamesoares / sudover.py
Last active February 5, 2018 00:05
Sudoku solver using recursive backtracking
import sys
# initial sudoku matrix
V = [
0, 0, 0, 2, 6, 0, 7, 0, 1,
6, 8, 0, 0, 7, 0, 0, 9, 0,
1, 9, 0, 0, 0, 4, 5, 0, 0,
8, 2, 0, 1, 0, 0, 0, 4, 0,
0, 0, 4, 6, 0, 2, 9, 0, 0,
0, 5, 0, 0, 0, 3, 0, 2, 8,
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
#string para identificar quando ESC for pressionado
ESCAPE = '\033'
RETURN = '\r'
angle = 45
fAspect = 1

Git Cheat Sheet

Unstage tracked files

$ git reset HEAD [file]

Undo last commit (keeping changes)

$ git reset --soft HEAD^