Skip to content

Instantly share code, notes, and snippets.

View gserrano's full-sized avatar

Guilherme Serrano gserrano

View GitHub Profile
@gserrano
gserrano / mongodb.js
Last active November 25, 2015 00:08
Mongo DB basics
// Insert using [].foreEach()
var pokemons = [{
"name": "Pikachu",
"description": "Rato elétrico bem fofinho",
"type": "electric",
"attack": 100,
"height": 0.4
},
{
Verifying that +gserrano is my blockchain ID. https://onename.com/gserrano
@gserrano
gserrano / errou.sh
Created November 29, 2018 17:03
echo ascii ERROU art
echo -n $'\E[31m'
echo ' -hNNNNNNNNNNNNNNNNNNNNNNNNmdo` '
echo ' .hNNNNNNNNNNNNNNNNNNNNNNNNNNNNNms.. '
echo ' `mNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNmm- '
echo ' /dNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNms` '
echo ' .hNNNNNNmmdmmNmmmmdNdyo+sdmNNNNNNNNNNNNNNh. '
echo ' `hNNNNdo:--...-....::.....--:/sdNNNNNNNNNNmo. '
echo ' `hNNNNs----.````````````````..---yNNNNNNNNNNNy` '
echo ' yNNmm+-----.`````````````````..---/ymNNNNNNNNNh` '
echo ' :NNNN+----..``````````````````....--:hmNNNNNNNNN+ '
@gserrano
gserrano / gist:beaf784e626d70a6adb242aa6bd41f43
Created July 30, 2019 14:20
Hide posts from FB timeline
function _delete(el){
el.parentNode.removeChild(el);
}
function hidePost(){
window.scrollTo(0,document.body.scrollHeight);
btn = document.querySelector("[data-testid='post_chevron_button']");
timer = 1900;
@gserrano
gserrano / graph.js
Last active January 19, 2021 17:17
class Graph {
//VERTICES: array of vertices
//EGDES: array of edges, each edge is a 2 item array (V1, V2)
constructor(VERTICES,EDGES){
this.G = new Map();
this.VERTICES = VERTICES;
if(VERTICES)
VERTICES.forEach((V) => this.addVertex(V));
@gserrano
gserrano / recursive_copy_files.php
Created November 19, 2015 22:14
PHP Recursive copy files
/*
* This function copy $source directory and all files
* and sub directories to $destination folder
*/
function recursive_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {