Skip to content

Instantly share code, notes, and snippets.

View johhansantana's full-sized avatar

Johhan Santana johhansantana

View GitHub Profile
@Maqsim
Maqsim / 413-payload-too-large-fix.js
Last active April 30, 2024 20:36
HOW TO FIX "413 Payload too large" in NodeJS (Express)
const express = require('express');
const bodyParser = require('body-parser');
...
// Express 4.0
app.use(bodyParser.json({ limit: '10mb' }));
app.use(bodyParser.urlencoded({ extended: true, limit: '10mb' }));
// Express 3.0
@keeguon
keeguon / countries.json
Created April 5, 2012 11:11
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@rubenvarela
rubenvarela / gist:8475772
Created January 17, 2014 15:54
Listado de Municipios de Puerto Rico en orden alfabético / List of Puerto Rico Municipalities in alphabetical order
Adjuntas
Aguada
Aguadilla
Aguas Buenas
Aibonito
Arecibo
Arroyo
Añasco
Barceloneta
Barranquitas
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@eSlider
eSlider / mbtiles2pbf.sh
Created September 24, 2019 13:53
Extract PBF tiles from mbtiles (SQLite)
#!/bin/sh
git clone https://github.com/mapbox/mbutil
cd mbutil
./mb-util --image_format=pbf *.mbtiles tiles
gzip -d -r -S .pbf *
find . -type f -exec mv '{}' '{}'.pbf \;
@kevinsalter
kevinsalter / array-spread-reordering.js
Last active June 25, 2023 12:04
reordering array using ES2015 array spread operator
const reorderArray = (event, originalArray) => {
const movedItem = originalArray.find((item, index) => index === event.oldIndex);
const remainingItems = originalArray.filter((item, index) => index !== event.oldIndex);
const reorderedItems = [
...remainingItems.slice(0, event.newIndex),
movedItem,
...remainingItems.slice(event.newIndex)
];
@lambdahands
lambdahands / _readme.md
Created September 28, 2015 17:09
FlowType and CSS Modules

Huh?

So basically FlowType doesn't know about CSS Modules, a really handy way of dealing with the plagues of CSS in codebases (global variables and dependency wackiness mainly).

What WebPack allows us to do is "require" CSS files and use their class names:

import styles from "my_styles.css";
import React from "react";
@mlynch
mlynch / autofocus.js
Last active August 24, 2022 15:03
AngularJS Autofocus directive
/**
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded
* templates and such with AngularJS. Use this simple directive to
* tame this beast once and for all.
*
* Usage:
* <input type="text" autofocus>
*
* License: MIT
*/