Skip to content

Instantly share code, notes, and snippets.

View AndersonFirmino's full-sized avatar
🐍
📜 🎼 🎮 🐧 🦆

Anderson Araujo AndersonFirmino

🐍
📜 🎼 🎮 🐧 🦆
View GitHub Profile
@AndersonFirmino
AndersonFirmino / .hyper.js
Created September 13, 2018 20:16 — forked from dariuszparys/.hyper.js
Hyper.js terminal settings with Fira Code
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 24,
// font family with optional fallbacks
fontFamily: '"Fira Code", Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: '#1df9ca',
#!/bin/bash
# NOTE: actually it would be nice to add something like the branch and SHA, but for the sake of demonstration I'm just using this file to feed Wakatime
# these variables are not used, but they might be useful; for someone else to play around
MESSAGE=$1
SHA=$(git rev-parse HEAD)
BRANCH=$(git symbolic-ref --short HEAD)
# give it a name
@AndersonFirmino
AndersonFirmino / es6-import-cheat-sheet.md
Created August 13, 2018 18:19 — forked from samueljseay/es6-import-cheat-sheet.md
ES6 exports / imports cheat sheet
// default exports
export default 42;
export default {};
export default [];
export default (1 + 2);
export default foo;
export default function () {}
export default class {}
export default function foo () {}
@AndersonFirmino
AndersonFirmino / maskDate.js
Created August 10, 2018 21:50
maskDate JavaScript
const maskDate = value => {
let v = value.replace(/\D/g,'').slice(0, 10);
if (v.length >= 5) {
return `${v.slice(0,2)}/${v.slice(2,4)}/${v.slice(4)}`;
}
else if (v.length >= 3) {
return `${v.slice(0,2)}/${v.slice(2)}`;
}
return v
}
@AndersonFirmino
AndersonFirmino / fix_materialize_invalid.css
Created June 7, 2018 20:12
FIx for materialize error label jQuery validation + Materializecss
/* FIX Materialize error label */
label.invalid {
position: relative;
top: -1rem;
left: 0rem !important;
font-size: 0.8rem;
color: #f44336 !important;
-webkit-transform: translateY(0%);
-ms-transform: translateY(0%);
-o-transform: translateY(0%);

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@AndersonFirmino
AndersonFirmino / lisp.c
Created May 18, 2018 10:48 — forked from sanxiyn/lisp.c
Lisp
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
# Enumerate databases
sqlmap --dbms=mysql -u "$URL" --dbs

# Enumerate tables
sqlmap --dbms=mysql -u "$URL" -D "$DATABASE" --tables

# Dump table data
sqlmap --dbms=mysql -u "$URL" -D "$DATABASE" -T "$TABLE" --dump
@AndersonFirmino
AndersonFirmino / fn.py
Created April 11, 2018 18:33 — forked from dunossauro/fn.py
random par ou impar (functional example)
"""
Exemplo para ajudar a responder o problema de aninhamento em https://gist.github.com/AndersonFirmino/b0300923094a5a8450018c5bd32c9de8
"""
from itertools import filterfalse
from functools import partial
from random import choice, random
def pipe(*funcs):
def inner(data, funcs=funcs):
result = data
def odd_or_even(flag, limit):
"""Retorna um numero aleatorio pelo limite
:param flag:
:param limit:
:return:
"""
if flag:
return choice(sorted(filter(lambda x: x % 2 == 0, tuple(range(limit))), key=lambda x: random()))
return choice(sorted(filter(lambda x: x % 2 != 0, tuple(range(limit))), key=lambda x: random()))