Skip to content

Instantly share code, notes, and snippets.

View lionelmann's full-sized avatar
🇨🇦
Live Montreal // Work Toronto

Lionel Mann lionelmann

🇨🇦
Live Montreal // Work Toronto
View GitHub Profile
@laurenashpole
laurenashpole / laurenashpole.com.conf
Created October 13, 2021 21:24
Basic Nginx Configuration with Caching
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
font/ttf max;
font/opentype max;
application/font-woff max;
font/woff2 max;
@nilocoelhojunior
nilocoelhojunior / nuxt-breadcrumb.js
Created November 7, 2019 20:37
Breadcrumb to Nuxtjs
<template>
<ol class="breadcrumb">
<li class="item">
<nuxt-link :to="'/'" class="title">
Home
</nuxt-link>
</li>
<li v-for="(item, i) in crumbs" :key="i" class="item">
<nuxt-link :to="item.to" class="title">
{{ item.title }}
@Friz-zy
Friz-zy / nginx_with_cache.conf
Last active July 1, 2025 14:52
Nginx cache example config
# Based on articles:
# https://ruhighload.com/%D0%9A%D1%8D%D1%88%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5+%D1%81+nginx
# https://wiki.enchtex.info/practice/nginx/cache
# https://gist.github.com/yanmhlv/5612256
# https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html
# https://blog.runcloud.io/2017/10/28/nginx-caching-tutorial-wordpress.html
# https://www.digitalocean.com/community/tutorials/how-to-setup-fastcgi-caching-with-nginx-on-your-vps
# https://easyengine.io/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/
@zoharbabin
zoharbabin / certbotresetcert.sh
Created July 23, 2017 16:11
Delete and reinstall SSL certificates with certbot on Ubuntu
certbot certificates
# find the path to the fullchain certificate you wish to reinstall
certbot revoke --cert-path /etc/letsencrypt/live/... #path to the cert from above
certbot delete --cert-name yourdomain.com
rm -Rf /etc/apache2/sites-available/000-default-le-ssl.conf #or whatever the name of the apache conf you had it configured on
rm -Rf 000-default-le-ssl.conf #or whatever the name of the apache conf you had it configured on
sudo apache2ctl restart
certbot #follow the guide to setup the new certificate
@fgilio
fgilio / axios-catch-error.js
Last active June 18, 2025 11:09
Catch request errors with Axios
/*
* 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 😨
@nciske
nciske / wpdb-transactions
Last active September 13, 2024 19:02 — forked from 5iDS/wpdb-transactions
MySQL database transaction, using the WordPress database object $wpdb. Requires the InnoDB table format.
<?php
global $wpdb;
// Start Transaction
$wpdb->query( "START TRANSACTION" );
// Do some expensive/related queries here
//$wpdb->query("DELETE FROM table WHERE form_id = '1' ");
//$wpdb->query("DELETE FROM data WHERE form_id = '1' ");
// set $error variable value in error handling after $wpdb modifications
@jherax
jherax / arrayFilterFactory.1.ts
Last active August 5, 2025 02:48
Filters an array of objects with multiple match-criteria.
type FilterOperator = 'AND' | 'OR';
type FiltersBy<T> = {
[K in keyof T]?: (value: T[K]) => boolean;
};
/**
* Factory function that creates a specialized function to filter
* arrays, by validating all filters (AND operator),
* or validating just one of the filters (OR operator).
* @param operator Method to validate all filters: AND, OR
@parmentf
parmentf / GitCommitEmoji.md
Last active August 13, 2025 20:30
Git Commit message Emoji
@yesvods
yesvods / gist:51af798dd1e7058625f4
Created August 15, 2015 11:13
Merge Arrays in one with ES6 Array spread
const arr1 = [1,2,3]
const arr2 = [4,5,6]
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
@joseluisq
joseluisq / terminal-git-branch-name.md
Last active July 23, 2025 13:28
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {