Skip to content

Instantly share code, notes, and snippets.

View luan0ap's full-sized avatar
👁️‍🗨️
Looking for a job

Luan AP luan0ap

👁️‍🗨️
Looking for a job
View GitHub Profile
@kitek
kitek / gist:1579117
Created January 8, 2012 17:50
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");
@marioluan
marioluan / remover-acentos.js
Created October 10, 2013 18:27
Funcao marota para remover acentos de strings. Foi utilizado expressao regular em cima de caracteres representados na base hexadecimal.
/**
* Remove acentos de caracteres
* @param {String} stringComAcento [string que contem os acentos]
* @return {String} [string sem acentos]
*/
function removerAcentos( newStringComAcento ) {
var string = newStringComAcento;
var mapaAcentosHex = {
a : /[\xE0-\xE6]/g,
e : /[\xE8-\xEB]/g,
@arthurfigueiredo
arthurfigueiredo / dtlist.html
Created December 30, 2013 20:28
JavascriptBrasil - Exemplo pegar o primeiro elemento do datalist com js.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Exemplo DataList</title>
</head>
<body>
<input list="browsers" id="my-input"/>
@RubenVerborgh
RubenVerborgh / gist:9372495
Created March 5, 2014 17:47
Requesting a representation through HTTP with GZIP compression
var request = require('request'),
zlib = require('zlib');
var headers = { 'Accept-Encoding': 'gzip' };
var response = request({ url:'http://perdu.com/', headers: headers });
response.on('response', function (response) {
// decode the stream if necessary
if (response.headers['content-encoding'] === 'gzip')
response = response.pipe(zlib.createGunzip());
@webinista
webinista / array.chunk.js
Last active March 29, 2023 23:02
Array.prototype.chunk: Splits an array into an array of smaller arrays containing `groupsize` members
/*
Split an array into chunks and return an array
of these chunks.
With kudos to github.com/JudeQuintana
This is an update example for code I originally wrote 5+ years ago before
JavaScript took over the world.
Extending native objects like this is now considered a bad practice, so use
@calimaborges
calimaborges / combinatorial-analysis.js
Last active December 1, 2021 10:56
Array combinations, permutations and arrangements
// permutation: Permutação
// P(n) = n!
// Exemplo: número de anagramas da palavra LIVRO = P(5) = n!
// Possibilidades de uma fila de 25 pessoas = P(25) = 25!
// combination: Combinação
// C(p,n) = = n! / p!(n - p)!
// Exemplo: formar comissão de 3 pessoas escolhidas entre 10 pessoas. C(3,10) = 10! / 3!(10 - 3)!
// arrangement: Arranjo
@fabiorecife
fabiorecife / gist:faa0badf35e33062e0ff
Created March 28, 2015 15:40
uuid - javascript
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);});
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 22, 2024 02:29
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

--<<Naga auto farm/stack/creepwave cut>>
--[[ Naga Farm script by Moones ]]--
require("libs.ScriptConfig")
require("libs.Utils")
require("libs.EasyHUD")
require("libs.SkillShot")
local currentVersion = 0.5
@kelvearagao
kelvearagao / dateEn.js
Created January 6, 2016 18:15
Função javascript para converter a data do formato brasileiro para formato inglês.
/**
* Recebe um data no formato dd/mm/yyyy e retorna yyyy-mm-dd.
*
* @param string date - Data no formato 'dd/mm/yyyy'.
* @return string - Data no formato 'yyyy-mm-dd'.
*/
function dateToEN(date)
{
return date.split('/').reverse().join('-');
}