Skip to content

Instantly share code, notes, and snippets.

View misabitencourt's full-sized avatar
🏠
Working from home

ms_bit misabitencourt

🏠
Working from home
  • Custo misa
  • Florianópolis, Brazil
View GitHub Profile
@misabitencourt
misabitencourt / knex-sqlite3-repository.ts
Last active May 20, 2024 15:04
Typescript Bun Knex Sqlite3 Repository Start
import knex from "knex";
import fs from 'fs';
if (!fs.existsSync('./local.db')) {
fs.appendFileSync('./local.db', '');
}
export const localDb = knex({
client: 'sqlite3',
connection: {
@misabitencourt
misabitencourt / gist:2bd17b33cc2de3e3f4368f7169e34804
Last active July 10, 2023 17:22
Javascript simple properties/env parser
const content = `
PROPERTY=value
Property2=value2
`;
const config = (content + '').split('\n').map(line => {
line = line.trim();
if (line.indexOf('#') === 0) {
return '';
}
@misabitencourt
misabitencourt / normalizing_chars_sample.cpp
Created November 1, 2022 14:13
Remove special characters from String on C++
#include <iostream>
#include <string>
#include <bits/stdc++.h>
std::string normalizeString(const std::string &input)
{
std::string output = "";
std::string validChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZáãàâéêẽèíìîóôòõúù!@#$%^&*()_|+,.<>{}[]\\/-=?;:'\" \n";
std::string validUpper = "" + validChars;
transform(validUpper.begin(), validUpper.end(), validUpper.begin(), ::toupper);
@misabitencourt
misabitencourt / hello.js
Created September 8, 2018 21:18
A simple gist file
console.log('Hello world!');
@misabitencourt
misabitencourt / hello.js
Created September 8, 2018 21:09
A simple gist file
console.log('Hello world!');
@misabitencourt
misabitencourt / hello.js
Created September 8, 2018 21:04
A simple gist file
console.log('Hello world!');
@misabitencourt
misabitencourt / hello.js
Created September 8, 2018 21:02
A simple gist file
console.log('Hello world!');
@misabitencourt
misabitencourt / hello.js
Created September 8, 2018 21:00
A simple gist file
console.log('Hello world!');
@misabitencourt
misabitencourt / hello.js
Created September 8, 2018 21:00
A simple gist file
console.log('Hello world!');
@misabitencourt
misabitencourt / hello.js
Created September 8, 2018 20:59
A simple gist file
console.log('Hello world!');