Skip to content

Instantly share code, notes, and snippets.

View fwoelffel's full-sized avatar

Frédéric Woelffel fwoelffel

View GitHub Profile
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@evanscottgray
evanscottgray / docker_kill.sh
Last active November 7, 2023 03:40
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@allenwb
allenwb / 0Option2ConstructorSummary.md
Last active November 4, 2023 14:39
New ES6 constructor features and semantics: Alternative 2 manual super in derived classes

New ES6 Constructor Semantics and Usage Examples

Manual super: Alternative Design where subclass constructors do not automatically call superclass constructors

This Gist presents a new design of class-based object construction in ES6 that does not require use of the two-phase @@create protocol.

One of the characteristics of this proposal is that subclass constructors must explicitly super invoke their superclass's constructor if they wish to use the base class' object allocation and initialization logic.

An alternative version of this design automatically invokes the base constructor in most situations.

@carlhoerberg
carlhoerberg / reconnect.js
Created May 13, 2015 14:45
How to build reconnect logic for amqplib
var amqp = require('amqplib/callback_api');
// if the connection is closed or fails to be established at all, we will reconnect
var amqpConn = null;
function start() {
amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) {
if (err) {
console.error("[AMQP]", err.message);
return setTimeout(start, 1000);
}
@mamantoha
mamantoha / experience.rb
Last active March 14, 2024 08:21
Rails API Filtering and Sorting
# app/models/experience.rb
#
# == Schema Information
#
# Table name: experiences
#
# id :integer not null, primary key
# title :string
# description :text
# created_at :datetime not null
@Agurri
Agurri / freenas.sr.help.fix.txt
Last active January 20, 2020 17:15
FreeNAS Sickrage - Help & Info Web Page Fix
After switching to the new repo and updating, I lost the ability to see the SickRage Version, branch and commit on the Help & Info page. After trying seveal methods, I've came down to this ... It might not be the only way to do it, but it worked for me as of today (01/29/2016)
Credits go to neoatomic and delfrogo (https://forums.freenas.org/index.php?threads/new-sickrage-repo.39368/)
Step 1.
Do a backup with the Sickrage GUI. The procedure should not break anything but let's be cautious.
Step 2.
Stop Sickrage plugin in the FreeNAS GUI by going in Plugins, Installed, Stop.

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@ldez
ldez / gmail-github-filters.md
Last active July 16, 2024 09:41
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
@boogie
boogie / receive.js
Created May 21, 2017 12:25
BETTER implementation with a "processing counter": RabbitMQ client closes the connection after 2 secs
#!/usr/bin/env node
'use strict';
const amqp = require('amqplib');
const sleep = async (ms) => new Promise(resolve => setTimeout(resolve, ms));
(async () => {
let processing = 0;
@JamieMason
JamieMason / migrate-to-lerna.sh
Last active April 25, 2019 18:58
Bash script to migrate multiple projects into one Lerna monorepo (https://lernajs.io)
#!/usr/bin/env bash
set -x
shopt -s extglob dotglob
cd "$HOME"
rm -rf "$HOME/TEMP_DIR"
mkdir "$HOME/TEMP_DIR"
cd "$HOME/TEMP_DIR"
git init