Skip to content

Instantly share code, notes, and snippets.

View lensanag's full-sized avatar

Lenin Sanchez lensanag

View GitHub Profile
@lensanag
lensanag / component-builder.js
Created June 10, 2023 06:14
automate creation of react components, you can easily update file templates to your needs 😎
/*
// include script in package.json the line number 6
{
"scripts": {
"mk:component": "node scripts/component-builder.js"
}
}
// then use:
- pnpm create vite project-name --template template-name
- pnpm dlx eslint --init
- To check syntax, find problems, and enforce code style - JavaScript modules (import/export)
- (select type of project)
- Does your project use TypeScript?
- Where does your code run?
- How would you like to define a style for your project? - Which style guide do you want to follow?
- What format do you want your config file to be in?
- Would you like to install them now?
- Which package manager do you want to use?
@lensanag
lensanag / babel.config.js
Last active November 13, 2021 21:54
configure react jest scaffold with vite
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
esmodules: true,
},
},
],
@lensanag
lensanag / aes-256-cbc-test.js
Created October 30, 2021 14:10 — forked from brettscott/aes-256-cbc-test.js
AES 256 CBC encryption between Golang and Node JS
// Node v6.9.0
//
// TEST FILE (cut down for simplicity)
// To ensure Golang encrypted string can be decrypted in NodeJS.
//
let crypto;
try {
crypto = require('crypto');
@lensanag
lensanag / vscode-italic-font-settings.md
Created January 21, 2021 20:31 — forked from junagao/vscode-italic-font-settings.md
VSCode italic font settings

VSCode italic font settings

Add this to settings.json (cmd ,):

{
  "editor.fontFamily": "Operator Mono, Fira Code iScript, Menlo, Monaco, 'Courier New', monospace",
  "editor.fontLigatures": true,
  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
@lensanag
lensanag / regex-router.js
Created November 28, 2020 20:03
simple "regex router" & node http server
const notFoundHandler = (_0, _1, res) => (res.writeHead(404, {}) && res.end());
let _defaultHandler;
let _context;
const tmpHandlers = {
'GET': [],
'POST': [],
'PUT': [],
'DELETE': [],
@lensanag
lensanag / index.js
Last active August 23, 2020 00:25 — forked from wdmtech/index.js
Facebook SDK (Graph/REST API) integration as a Vue.js mixin
export let facebookSDK = {
mounted () {
let _this = this
this.$nextTick(() => {
window.fbAsyncInit = function () {
window.FB.init({
appId: 'XXX',
xfbml: true,
version: 'v2.6'
})
@lensanag
lensanag / composer-install.sh
Created August 5, 2020 01:33
install composer programmatically on php cli alpine
#!/bin/ash
EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php