Skip to content

Instantly share code, notes, and snippets.

@jscMR
jscMR / gist:636caf5e69e0592911b8f3fa041fb478
Created December 11, 2023 23:10
Instalar Chromium headless en Ubuntu 22
sudo add-apt-repository ppa:phd/chromium-browser
echo '
Package: *
Pin: release o=LP-PPA-phd-chromium-browser
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/phd-chromium-browser
sudo apt update
@jscMR
jscMR / lua
Created November 18, 2022 09:16
Config LunarVim + React + Eslint + Prettier
--[[
lvim is the global options object
Linters should be
filled in as strings with either
a global executable or a path to
an executable
]]
-- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
@jscMR
jscMR / singleton.cs
Created July 29, 2020 08:00
Modern singleton unity
public abstract class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
private static readonly Lazy<T> LazyInstance = new Lazy<T>(CreateSingleton);
public static T Instance => LazyInstance.Value;
private static T CreateSingleton()
{
var ownerObject = new GameObject($"{typeof(T).Name} (singleton)");
var instance = ownerObject.AddComponent<T>();
@jscMR
jscMR / settings
Created December 1, 2019 12:21
settings
a
@jscMR
jscMR / verifyWebHook.js
Created July 1, 2019 12:24
Shopify Webhook verfication [ Koa + koa-bodyparser] NODEJS
const crypto = require('crypto');
const globalConfig = require('config');
const SHOPIFY_APP_SECRET = globalConfig.get(`SHOPIFY_APP_SECRET`);
module.exports = async (ctx) => {
const shop = ctx.request.headers['x-shopify-shop-domain'];
// compare hmac to our own hash
const hmac = ctx.request.headers['x-shopify-hmac-sha256'];
const hash = crypto.createHmac('sha256', SHOPIFY_APP_SECRET)
.update(ctx.request.rawBody, 'utf8', 'hex')
.digest('base64');
@jscMR
jscMR / install-docker.sh
Created May 17, 2018 09:12
install docker linux
#!/bin/bash
# compiled from https://docs.docker.com/engine/installation/linux/debian/#/debian-jessie-80-64-bit
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install apt-transport-https ca-certificates -y
sudo sh -c "echo deb https://apt.dockerproject.org/repo debian-jessie main > /etc/apt/sources.list.d/docker.list"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@jscMR
jscMR / buenasmaneras.md
Created April 3, 2018 09:07
[Buenas maneras JS ] Rational Touch
  • Guia de estilo eslint + ´AirBnb´ + prettier
  • Errores de servicio en el api se controlan dentro de cada módulo de logica de negocio, en el api y sus manejadores simplemente se les envia el error de APP
@jscMR
jscMR / hacks.js
Created February 8, 2018 11:59
[ES6 JS Hacks] hacks en JS ES6
////////////////////////////////////////////////////
// Para acceder al primer elemento del array
////////////////////////////////////////////////////
const head = ([x]) => x
const array = [1,2,3,4,5]
head(array) // 1
////////////////////////////////////////////////////
0x81acD02b05D13253D6aE1563e1316c2BBDa1fA8A
@jscMR
jscMR / natural-brain.js
Last active October 19, 2016 10:08
brain poc
var BrainJSClassifier = require('natural-brain');
var classifier = new BrainJSClassifier();
classifier.addDocument('no pasa mi test unitario', 'software');
classifier.addDocument('he probado el programa, esta bugeado', 'software');
classifier.addDocument('mañana tengo una reunion', 'meeting');
classifier.addDocument('mi pendrive tiene 1Tb de capacidad', 'hardware');
classifier.addDocument('necesito un nuevo disco duro', 'hardware');
classifier.addDocument('puedes reproducir musica?', 'music');