Skip to content

Instantly share code, notes, and snippets.

View marcosleal-prd's full-sized avatar
👨‍💻
Always Writing Code

Marcos V. Leal marcosleal-prd

👨‍💻
Always Writing Code
View GitHub Profile
@marcosleal-prd
marcosleal-prd / enable-import-range-permission.js
Created March 27, 2024 12:07
Enable import range App Scripts
function enableImportRangePermission(ssId, donorId) {
console.log(`Addind ImportRangePermission for ${ssId}`)
const url = `https://docs.google.com/spreadsheets/d/${ssId}/externaldata/addimportrangepermissions?donorDocId=${donorId}`
const token = ScriptApp.getOAuthToken()
const params = {
method: 'post',
headers: {
Authorization: 'Bearer ' + token,
@marcosleal-prd
marcosleal-prd / field-mapping.ts
Created February 28, 2024 02:38
Mapping fields based on entity
export enum MappingMode {
SEND = 'send',
RECEIVE = 'receive'
}
export type MappingEntity = 'contact' | 'deal' | 'organization'
export type FieldMapping = {
sourceField: string
destinationField: string
@marcosleal-prd
marcosleal-prd / string-case-conversion.ts
Created February 24, 2024 03:22
String case conversion in TypeScript
const CONVERT_CASE_REGEXP = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
export class StrCaseConversion {
static toCamelCase(str: string): string {
const result = str.match(CONVERT_CASE_REGEXP)
if (result) {
const s = result.map(x => x.slice(0, 1).toUpperCase() + x.slice(1).toLowerCase()).join('')
return s.slice(0, 1).toLowerCase() + s.slice(1)
}
@marcosleal-prd
marcosleal-prd / cloudSettings
Last active June 15, 2021 04:46
Personal VSCode Settings Sync
{"lastUpload":"2021-06-15T04:46:04.378Z","extensionVersion":"v3.4.3"}
@marcosleal-prd
marcosleal-prd / cloudSettings
Last active July 26, 2021 04:59
VSCode Settings Sync
{"lastUpload":"2021-07-26T04:59:40.651Z","extensionVersion":"v3.4.3"}
@marcosleal-prd
marcosleal-prd / 1-basic.sh
Created September 10, 2019 14:36
Docker - Initial commands
# Show all running containers in the moment
docker ps
# Exibe todos os containers, it may be running or not.
docker ps -a
# Connects the terminal with that of the container.
docker run -it NOME_DA_IMAGEM
# Start container based on ID
@marcosleal-prd
marcosleal-prd / launch.json
Created September 10, 2019 14:24
TypeScript Debugging With VSCode
{
// TypeScript installed global and in project
// Folder used after compile, should be dist/ (in this case)
// tsconfig.json with "sourceMap": true
// Entry point is main.ts of root project
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",