Skip to content

Instantly share code, notes, and snippets.

Andrea Ercolino aercolino

Block or report user

Report or block aercolino

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AccentedChars.rb
ACCENTED_CHARS_ACUTE = %r([\u00E1\u00C1\u00E9\u00C9\u00ED\u00CD\u00F3\u00D3\u00FA\u00DA\u00FD\u00DD])
ACCENTED_CHARS_GRAVE = %r([\u00E0\u00C0\u00E8\u00C8\u00EC\u00CC\u00F2\u00D2\u00F9\u00D9])
ACCENTED_CHARS_CIRCUMFLEX = %r([\u00E2\u00C2\u00EA\u00CA\u00EE\u00CE\u00F4\u00D4\u00FB\u00DB])
ACCENTED_CHARS_DIERESIS = %r([\u00E4\u00C4\u00EB\u00CB\u00EF\u00CF\u00F6\u00D6\u00FC\u00DC])
ACCENTED_CHARS_TILDE = %r([\u00E3\u00C3\u00F1\u00D1\u00F5\u00D5])
ACCENTED_CHARS = '\u00C0-\u00C4\u00C7-\u00CF\u00D1-\u00D6\u00D9-\u00DD\u00E0-\u00E4\u00E7-\u00EF\u00F1-\u00F6\u00F9-\u00FD'
View mongodb-atlas-lambda-step1.js
function processEvent(event, context, callback) {
const storableEvent = makeEventStorable(event);
storableEvent.created_at = new Date();
console.log('Calling MongoDB Atlas from AWS Lambda: ', JSON.stringify(storableEvent));
if (cachedDb) {
console.log('- Reusing cached connection');
createDoc(cachedDb, storableEvent, callback);
aercolino / Backend services in
Last active Mar 8, 2017
Simulation of a login functionality in Angular2, token based.
View Backend services in

In this gist I show a simple setup for helping me build the frontend of a backend functionality before programming the latter. In this case it is the login functionality.

On the login page there are three buttons to allow me to login with different credentials, so that I can see what the server would tell me in each case. That will guide me to understand how I want to program the frontend.

A couple of seconds after clicking each button I'll get a response from the server.

  1. the first button will cause an error response, which I show in a feedback field on the login page.
  2. the second and third buttons will cause an OK response, which I store in the auth key of the local storage system.
View How to work on a software

How to work on a software project

Describe it

Clearly state what the application is going to do. You'll do this at all levels. Starting from a one liner and getting down to any level of detail. This will help you understand the different things you will need to provide (not only code). And most importantly you will understand better what are the limits of your application, what you don't want just now or never to belong to it.

Structure it

aercolino / 0_reuse_code.js
Created Mar 14, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
aercolino / Vending Machine Simulation
Last active Oct 18, 2019
Vending Machine Simulation in JavaScript for the browser.
View Vending Machine Simulation
Title of the Gist. (Fictitious file with a leading space.)
View convert-indentation-to-list.js
function IndentationToList(options) {
'use strict';
return Main(options);
function Interpolate(template, variables) {
var names = Object.keys(variables);
var result = template;
for (var i = 0, iTop = names.length; i < iTop; i++) {
aercolino / elasticsearch-jquery.js
Last active Dec 4, 2018
Searching into ElasticSearch with jQuery
View elasticsearch-jquery.js
// the important bit it JSON.stringify, because elasticsearch doesn't work without it'', JSON.stringify({
"query": {
"term": {
"": "1234"
}), function (data) {
aercolino / #nzymes
Last active May 2, 2017
Plugin Suspension: suspend and resume any WP plugin (draft)
View #nzymes

Plugin Suspension: suspend and resume any WP plugin

This is a set of two dynamic enzymes useful for suspending and resuming another plugin.

Work in progress...


This would be the content of a post of yours. The thingy plugin would be filtering content as usual.

aercolino / #nzymes
Last active Mar 16, 2016
#nzymes Table of Contents: add one to any page
View #nzymes

Table of Contents: add one to any page

These are my enzymes for the table of contents shown at

See Example 1: table-of-contents;example-1

This setup allows a post author to easily create and maintain a table of contents straight into the visual editor of a page. (See table-of-contents; and table-of-contents; At the same time, the table of contents can be added to any other WordPRess place, so that it's shown when the context of that place is rendered by WordPress. (See table-of-contents;example-1.html)

You can’t perform that action at this time.