Skip to content

Instantly share code, notes, and snippets.

View auginator's full-sized avatar

Agustin Sevilla auginator

View GitHub Profile
@erelson
erelson / gist:35a23ac28aa800af9a06ba7822afdaa7
Created August 13, 2021 05:04
Set an email when cloning repos
# Use this with a git alias like `cl = "!sh ~/clone_helper.sh"`
# A bash function to replace `git clone` could also be done
# like in https://stackoverflow.com/a/39357426/999505
set -e
if [ $# = 0 ]; then # forgot to pass anything, d'oh
echo ERROR Must pass repo path to clone
exit 1
fi
class MyEventEmitter {
constructor() {
this._events = {};
}
on(name, listener) {
if (!this._events[name]) {
this._events[name] = [];
}
@WebReflection
WebReflection / why-i-use-web-components.md
Last active December 5, 2023 17:47
Why I use web components

Why I use web components

This is some sort of answer to recent posts regarding Web Components, where more than a few misconceptions were delivered as fact.

Let's start by defining what we are talking about.

The Web Components Umbrella

As you can read in the dedicated GitHub page, Web Components is a group of features, where each feature works already by itself, and it doesn't need other features of the group to be already usable, or useful.

@davidgilbertson
davidgilbertson / http2.js
Last active October 9, 2023 06:09
HTTP2 server with compression and caching
const http2 = require('http2');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const brotli = require('brotli'); // npm package
const PORT = 3032;
const BROTLI_QUALITY = 11; // slow, but we're caching so who cares
const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/');
const cache = {};
@richtr
richtr / config.yml
Last active November 28, 2017 21:36
Parse YAML from bash with sed and awk.
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
password:
apt:
- somepackage
- anotherpackage
font-family: -apple-system, BlinkMacSystemFont, “Roboto”, “Droid Sans”, “Helvetica Neue”, Helvetica, Arial, sans-serif;
@msssk
msssk / throttleBoss.js
Last active May 20, 2022 16:58
Throttle with trailing call preservation
// This is a typical throttle implementation with the difference that it doesn't discard
// the final invocation - instead it runs it at the next valid timeslice.
throttleBoss: function(callback, delay) {
var ready = true,
args = null;
return function throttled() {
var context = this;
@BFTrick
BFTrick / install-wp.sh
Last active April 1, 2024 04:14
Download & Install WordPress via Curl
curl -O https://wordpress.org/latest.zip
unzip latest.zip
mv wordpress site
rm latest.zip
@demisx
demisx / angularjs-providers-explained.md
Last active March 17, 2024 11:09
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@nasirkhan
nasirkhan / git command.markdown
Last active May 12, 2022 03:17
`git` discard all local changes/commits and pull from upstream

git discard all local changes/commits and pull from upstream

git reset --hard origin/master

git pull origin master