Skip to content

Instantly share code, notes, and snippets.

View martiuh's full-sized avatar

Tona González martiuh

View GitHub Profile
@martiuh
martiuh / copyEnvFile.js
Last active December 22, 2021 16:34
nextjs-using-staging-deploy
/**
* Generate a `.env.production` file depending on the value from TARGET_ENV environment variable
* created with ❤️ by Tona González (@martiuh)
*/
const fs = require('fs');
/**
* @description copies the given `.env.base.${TARGET_ENV}` file to a `.env.production` file.
*/
@martiuh
martiuh / keybase.md
Created August 17, 2020 23:06
Identity

Keybase proof

I hereby claim:

  • I am martiuh on github.
  • I am martiuh (https://keybase.io/martiuh) on keybase.
  • I have a public key ASAUxuI6jtk0-k6HVAqLdMsnhdogb6VO29WCdEKEyYVgFwo

To claim this, I am signing this object:

@martiuh
martiuh / explanation.md
Last active March 21, 2020 02:19
Brief SSR Explanation

Imaginemos que la página es esto

function App() {
    <h1>Hello World</h1>
}

con client side tu mandas un index.html vacío como este

@martiuh
martiuh / .gitconfig
Created February 6, 2020 16:46
DotFiles
[user]
name = Tonatiuh González
email = martiuh@gmail.com
[core]
pager = diff-so-fancy | less --tabs=4 -RFX
excludesfile = ~/.gitignore_global
[includeIf "gitdir:~/BSA/"]
path = ~/.gitconfig-bsa
@martiuh
martiuh / .htaccess-react-static-705
Created April 8, 2019 17:53
.htaccess for hosting a react-static app
ErrorDocument 404 /404.html
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Map http://www.example.com to /dist.
@martiuh
martiuh / rustic-node-js-monitor.bash
Last active March 22, 2019 18:10
Check if a node.js app in a shared hosting is still running
APP_PORT=49159
log () {
echo $1 >> /home/hidroval/monitor.log
}
if /usr/bin/netstat -anp | /usr/bin/grep 49154 > /dev/null; then
log "API IS UP"
else
cd /home/hidroval/api/
@martiuh
martiuh / builder-server.js
Last active February 23, 2019 19:29
Build hook for node app.
/*
Server for make a self-building gatsby site
Build by Tonatiuh González <martiuh@gmail.com>
with love to the community
*/
const http = require('http')
const fs = require('fs')
const { spawn, exec } = require('child_process')
const port = process.env.NODE_ENV ? parseInt(process.env.NODE_ENV, 10) : 3000
// ls.stdout.on('data', data => {
@martiuh
martiuh / canGrant.js
Created January 24, 2019 03:58
Object Rank Role Resolver
const ranks = require('./ranks')
module.exports = (ownRole, otherRole) => {
if (!ownRole) {
console.error('ownRole es necesario')
return false
}
let activeRanks = Object.keys(ranks).map(R => ({
name: R, content: ranks[R], solved: false, from: [], parent: null
}))
@martiuh
martiuh / .htacess-a2hosting-node
Created December 15, 2018 15:49
Simple .htaccess file for ensure htttps on apache a2hosting server
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ https://example.com.mx/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://example.com.mx/$1 [L,R=301]
RewriteCond %{REQUEST_URI} !=^/movies/(\d*)/?$
RewriteRule ^movies/\d* /public/movies/movieId/ [L]