This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List, Optional | |
from bson import ObjectId | |
from pydantic import BaseModel, Field | |
class PyObjectId(ObjectId): | |
@classmethod | |
def __get_validators__(cls): | |
yield cls.validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------------------------------------------------------------------------- | |
# | |
# Description: This file holds all my BASH configurations and aliases | |
# | |
# Sections: | |
# 1. Environment Configuration | |
# 2. Make Terminal Better (remapping defaults and adding functionality) | |
# 3. File and Folder Management | |
# 4. Searching | |
# 5. Process Management |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
if [ -z "$1" ] || [ -z "$2" ]; then | |
printf "Use BRANCH and ALIAS as arguments. Ex:\n" | |
printf "./deploy.sh develop tangerine\n" | |
exit 1 | |
fi | |
GITBRANCH=$1 | |
ALIAS=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function textLike(str) { | |
var escaped = str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); | |
return new RegExp(escaped, 'i'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Forked from kaushikgopal/.phoenix.js | |
// Released under MIT license - http://opensource.org/licenses/MIT | |
var BROWSER; | |
var EDITOR; | |
var FINDER; | |
var GRID_HEIGHT; | |
var GRID_WIDTH; | |
var MARGIN_X; | |
var MARGIN_Y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// request context | |
function Context(reqArgs, entity) { | |
this.req = reqArgs.req; | |
this.res = reqArgs.res; | |
this.next = reqArgs.next; | |
this.entity = entity; | |
} | |
Context.prototype.handleErrors = function(fn) { | |
var context = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo kill $(sudo lsof -t -i:8080) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var snakeCaseStr = 'lorem-ipsum'; | |
var camelCaseStr = snakeCaseStr.replace(/(\-\w)/g, function(match){return match[1].toUpperCase();}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// implementation | |
var Beat = require('beat'); | |
module.exports = function(alias) { | |
var app = new Beat(alias); | |
var BeatObject = function BeatObject(callback) { | |
for(var key in BeatObject) | |
if(BeatObject.hasOwnProperty(key)) { | |
var keyParts = key.match(/^(.+)Factory$/); | |
if(keyParts === null) | |
app.value(key, BeatObject[key]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dados = [ | |
['Nome', 'Sobrenome', 'Profissão'], | |
['Paula', 'Tejando', 'Adivinha' ], | |
['Cuca', 'Beludo', 'Padeiro' ], | |
['Thomas', 'Turbano', 'Popeye' ] | |
]; | |
var csv = dados.map(function(linha){ | |
return linha.map(function(celula){ | |
return '"'+(celula.replace(/\"/g, '\"').replace(/\r/g, '\\r'))+'"'; |
NewerOlder