Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Hard Work @ Home

ECO jericopulvera

🎯
Hard Work @ Home
View GitHub Profile
View laravel.conf
server {
listen 80;
server_name example.com;
root /var/www//public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.php;
@jericopulvera
jericopulvera / axios-catch-error.js
Created Oct 17, 2019 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
View axios-catch-error.js
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@jericopulvera
jericopulvera / Description.md
Created Aug 16, 2019 — forked from blakethepatton/Description.md
Getting Mailhog running on a dev server (nginx, letsencrypt, ssl, ubuntu)
View Description.md

Get it running as a service

wget https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64

mv MailHog_linux_amd64 mailhog

chmod +x mailhog

sudo vi /etc/systemd/system/mailhog.service

@jericopulvera
jericopulvera / object-to-form-data.js
Last active Apr 1, 2019 — forked from ghinda/object-to-form-data.js
[Object to Form Data JS] #jssnippet
View object-to-form-data.js
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
@jericopulvera
jericopulvera / Nginx Proxy Setup for AdonisJS + SocketIO, and Nuxt.
Last active Apr 1, 2019
[AdonisJS + SocketIO, and Nuxt Nginx Proxy Config] #nginx #snippet
View Nginx Proxy Setup for AdonisJS + SocketIO, and Nuxt.
map $sent_http_content_type $expires {
"text/html" epoch;
"text/html; charset=utf-8" epoch;
default off;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name servername.com;
View country-bounding-boxes.py
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@jericopulvera
jericopulvera / polyFromBounds.js
Last active Apr 1, 2019 — forked from neilkennedy/polyFromBounds.js
[Leaflet LatLngBounds to Polygon]
View polyFromBounds.js
/// <summary>
/// Takes an L.latLngBounds object and returns an 8 point L.polygon.
/// L.rectangle takes an L.latLngBounds object in its constructor but this only creates a polygon with 4 points.
/// This becomes an issue when you try and do spatial queries in SQL Server or another database because when the 4 point polygon is applied
/// to the curvature of the earth it loses it's "rectangular-ness".
/// The 8 point polygon returned from this method will keep it's shape a lot more.
/// </summary>
/// <param name="map">L.map object</param>
/// <returns type="">L.Polygon with 8 points starting in the bottom left and finishing in the center left</returns>
function createPolygonFromBounds(latLngBounds) {