Skip to content

Instantly share code, notes, and snippets.

View madcampos's full-sized avatar
🔰
Eager to learn something new

Marco Campos madcampos

🔰
Eager to learn something new
View GitHub Profile
@madcampos
madcampos / keybase.md
Created June 24, 2025 20:29
keybase.md

Keybase proof

I hereby claim:

  • I am madcampos on github.
  • I am madcampos (https://keybase.io/madcampos) on keybase.
  • I have a public key ASAX0Dl-n4_5kmKTBLaU7NMB1JDvGEk1u5TnPydfqTiw0Qo

To claim this, I am signing this object:

@madcampos
madcampos / .eslintrc.js
Last active January 4, 2021 16:01
ESLint config
/* eslint-disable max-lines, no-magic-numbers */
/* eslint-env node */
module.exports = {
root: true,
// Uses the typescript parser for ease of use and "new features".
// (a.k.a.: supported but not in the current js version yet)
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 12,
@madcampos
madcampos / index.html
Created April 6, 2018 20:26
ProcGen Noise Studio
<h1>Noise Studio: Art from Code </h1>
<div id="main">
<div id="drawspace">
<canvas width="256" height="256" id="canvas"></canvas>
</div>
<div id="workspace">
<h4 onclick="changeTab(1);" class="tabIcon" id="icon1">Noise Generation</h4>
<div id="tab1" class="tab">
<div>
<h4 class="subHead">Dimensions</h4><br>
@madcampos
madcampos / index.html
Created April 6, 2018 20:26
ProcGen Noise Studio
<h1>Noise Studio: Art from Code </h1>
<div id="main">
<div id="drawspace">
<canvas width="256" height="256" id="canvas"></canvas>
</div>
<div id="workspace">
<h4 onclick="changeTab(1);" class="tabIcon" id="icon1">Noise Generation</h4>
<div id="tab1" class="tab">
<div>
<h4 class="subHead">Dimensions</h4><br>
@madcampos
madcampos / urlsearchparams.js
Created September 12, 2017 18:55
Simple URLSearchParams
// It does not implement hooks to URL and HTMLAnchorElement
window.URLSearchParams = class URLSearchParams {
constructor(init) {
this._list = new Map();
if (typeof init === 'string') {
init = init.replace(/^\?|\&$/, '').split('&').map((param) => {
const params = param.split('=');
if (params.length === 1) {
@madcampos
madcampos / random-string.js
Last active April 23, 2017 10:57
Random string
//Generates a alphanumeric random string given the length.
//Tweet version: let randomString=(l)=>`${l?(Math.random()*Math.pow(10,18)).toString(36):''}${l>10?randomString(l-10):''}`.substr(0,l);
function randomString(length){
let str = '';
if (length) {
str += (Math.random() * Math.pow(10, 18)).toString(36);
}
if (length > 10) {
@madcampos
madcampos / date.extensions.ts
Last active September 5, 2022 21:17 — forked from weslleih/date.extensions.ts
Extend the TypeScript Date Object with some useful methods
/**
* Fork of: https://gist.github.com/weslleih/b6e7628416a052963349494747aed659
* Important notice: when using with node you need the package `full icu` installed and configured or compile node with full-icu support.
* This way the compiled js code can run using language data other then `en-us`.
*/
export {}
declare global {
interface Date {
addDays(days: number, useThis?: boolean): Date;
@madcampos
madcampos / model.js
Created June 15, 2012 05:57
modelo do banco de dados, comentem no que pode melhorar
// a documentção do mongoose (o orm que eu estou usando) está em: http://mongoosejs.com/
var mongoose = require('mongoose');
var Schema = mongoose.Schema; //schemas são modelos de como eu quero que meus dados sejam salvos
var ObjectId = mongoose.ObjectId; //objectid é um tipo de chave nativo do banco de dados, uso eles pra criar identificadores únicos, alem deles serem fáceis de indexar
/**
* Validation regexps and functions
*/
var colorValidate = /#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/;