Skip to content

Instantly share code, notes, and snippets.

Avatar

Franco Laiuppa francolaiuppa

View GitHub Profile
@francolaiuppa
francolaiuppa / data.json
Created Jan 19, 2017
Sample multiline JSON for demos
View data.json
{
"web-app": {
"servlet": [
{
"servlet-name": "cofaxCDS",
"servlet-class": "org.cofax.cds.CDSServlet",
"init-param": {
"configGlossary:installationAt": "Philadelphia, PA",
"configGlossary:adminEmail": "ksm@pobox.com",
"configGlossary:poweredBy": "Cofax",
@francolaiuppa
francolaiuppa / data.json
Created Jan 18, 2017
Sample monoline JSON data
View data.json
{"web-app":{"servlet":[{"servlet-name":"cofaxCDS","servlet-class":"org.cofax.cds.CDSServlet","init-param":{"configGlossary:installationAt":"Philadelphia, PA","configGlossary:adminEmail":"ksm@pobox.com","configGlossary:poweredBy":"Cofax","configGlossary:poweredByIcon":"/images/cofax.gif","configGlossary:staticPath":"/content/static","templateProcessorClass":"org.cofax.WysiwygTemplate","templateLoaderClass":"org.cofax.FilesTemplateLoader","templatePath":"templates","templateOverridePath":"","defaultListTemplate":"listTemplate.htm","defaultFileTemplate":"articleTemplate.htm","useJSP":false,"jspListTemplate":"listTemplate.jsp","jspFileTemplate":"articleTemplate.jsp","cachePackageTagsTrack":200,"cachePackageTagsStore":200,"cachePackageTagsRefresh":60,"cacheTemplatesTrack":100,"cacheTemplatesStore":50,"cacheTemplatesRefresh":15,"cachePagesTrack":200,"cachePagesStore":100,"cachePagesRefresh":10,"cachePagesDirtyRead":10,"searchEngineListTemplate":"forSearchEnginesList.htm","searchEngineFileTemplate":"forSearchEngines
@francolaiuppa
francolaiuppa / sequelize-schema-file-generator.js
Last active Aug 5, 2020 — forked from manuelbieh/sequelize-schema-file-generator.js
Automatically generates migration files from your sequelize models
View sequelize-schema-file-generator.js
'use strict';
//////////////////////////////////
// How to use?
// 1. Create `sequelize-schema-file-generator.js` in your app root
// 2. Make sure you've ran the `sequelize init` before (It should create `config`,`seeders`,`migrations` folders).
// 3. Update `DATABASE_DSN` below to match your connection string (works with any database adapter that Sequelize supports)
// 4. Run it with `node sequelize-schema-file-generator.js`
// 5. Review the generated migrations inside of the `migrations` folder.
//////////////////////////////////
@francolaiuppa
francolaiuppa / gist:e6911b51a7602e569821e8fc3e11c0bd
Created Sep 16, 2016
Install lvm tools + vim in CentOS 7.2
View gist:e6911b51a7602e569821e8fc3e11c0bd
[root@docker-private-registry ~]# yum install -y lvm2* vim vim-common
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/2): extras/7/x86_64/primary_db
@francolaiuppa
francolaiuppa / gist:5556616ccbc76056cd1d
Created Mar 31, 2015
hackealo.co solucionador. SPOILER: Aunque pongas la respuesta correcta no funciona
View gist:5556616ccbc76056cd1d
// "acb" es (1*1) + (2*3) + (3*2).
var letters = ['a','b','c','d','e','f','g','h','i','j','k','l',
'm','n','o','p','q','r','s','t','u','v','w','y','x','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','Y','X','Z'];
// var word = 'HZyVYIW'.toLowerCase().split('');
var word = 'HZyVYIW'.split('');
var total = 0;
var msg = '';
@francolaiuppa
francolaiuppa / gist:9507d003c9694c451bee
Created Nov 14, 2014
Example HAProxy 1.5 configuration for load-balancing Redis nodes with Sentinel (including health checks!)
View gist:9507d003c9694c451bee
backend messages
mode tcp
option tcplog
option tcp-check
#tcp-check send AUTH\ foobar\r\n
#tcp-check expect +OK
tcp-check send PING\r\n
tcp-check expect +PONG
tcp-check send info\ replication\r\n
tcp-check expect string role:master
@francolaiuppa
francolaiuppa / express-controller.js
Last active May 4, 2018
Express JS + Amazon S3 + DropzoneJS Code Snippet
View express-controller.js
// Requires https://www.npmjs.org/package/s3-policy and https://www.npmjs.org/package/node-uuid
var config = require('env/' + process.env.NODE_ENV),
policy = require('s3-policy'),
uuid = require('node-uuid');
// SETUP S3
const AWS_ACCESS_KEY = config.s3.accessKey;
const AWS_SECRET_KEY = config.s3.secret;
const S3_BUCKET = config.s3.bucket;
@francolaiuppa
francolaiuppa / gist:40147b4bc92f576cb09d
Created Aug 11, 2014
Amazon S3 CORS Configuration (DANGER: DEVELOPMENT ONLY, NOT MEANT FOR PRODUCTION ENVIRONMENTS)
View gist:40147b4bc92f576cb09d
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
View designer.html
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
View gist:d97096bf7be37a3455ee
<?php
function droplr($droplrUrl = 'http://d.pr/i/YBbX') {
$data = file_get_contents($droplrUrl);
$result = array();
$dom = new DOMDocument;
$dom->loadHTML($data);
foreach ($dom->getElementsByTagName('img') as $node) {
$result[] = $dom->saveHtml($node);
}
$scrapedImage = array_pop($result);