Skip to content

Instantly share code, notes, and snippets.

Avatar

Sandro Pasquali sandro-pasquali

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am sandro-pasquali on github.
  • I am spasquali (https://keybase.io/spasquali) on keybase.
  • I have a public key ASBZw2sR2JegCq_zjCT1MIgPQJdQz62XpRCZMM9nYfq5DQo

To claim this, I am signing this object:

View gist:6e95f7434e2609482473387a6b4a4221
// https://github.com/AlessandroMinoccheri/human-names/blob/master/data/female-human-names-en.json
let nlp = require('compromise');
let results = [
"Aaliyah",
"Aarushi",
"Abagail",
"Abbey",
"Abbi",
View gist:bbedbe1adacdb3a31d4946cde050f6ba
function getAccessibleColor(rgb) {
let [ r, g, b ] = rgb;
let colors = [r / 255, g / 255, b / 255];
let c = colors.map((col) => {
if (col <= 0.03928) {
return col / 12.92;
}
return Math.pow((col + 0.055) / 1.055, 2.4);
View copy style
function copyStyles(sourceDoc, targetDoc) {
Array.from(sourceDoc.styleSheets).forEach(styleSheet => {
if (styleSheet.cssRules) { // for <style> elements
const newStyleEl = sourceDoc.createElement('style');
Array.from(styleSheet.cssRules).forEach(cssRule => {
// write the text of each rule into the body of the style element
newStyleEl.appendChild(sourceDoc.createTextNode(cssRule.cssText));
});
View html5-video-streamer.js
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@sandro-pasquali
sandro-pasquali / index.js
Created May 3, 2015 — forked from tmpvar/index.js
requirebin sketch
View index.js
var fc = require('fc');
var center = require('ctx-translate-center');
var poly = require('ctx-render-polyline');
var points = require('ctx-render-points');
var bounds2 = require('2d-bounds');
var gridlines = require('ctx-render-grid-lines');
var isect = require('robust-segment-intersect');
var createSDF = require('sdf-polygon-2d');
var area = require('2d-polygon-area');
var segseg = require('segseg');
View GIFDownloader.h
//
// GIFDownloader.h
// TheJoysOfCode
//
// Created by Bob on 29/10/12.
// Copyright (c) 2012 Tall Developments. All rights reserved.
//
#import <Foundation/Foundation.h>
View linux_running_a_node_service_pm2.md
View rediff.py
import urlparse
import argparse
import redis
import sys
from multiprocessing import Pool
import signal
def parse_redis_url(s):
url = urlparse.urlparse(s)
if not url.scheme:
View phantomjs install ubuntu
#!/bin/bash
PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user" 2>&1
exit 1
else
apt-get update
apt-get install -y build-essential chrpath libssl-dev libxft-dev
apt-get install -y libfreetype6 libfreetype6-dev
apt-get install -y libfontconfig1 libfontconfig1-dev
You can’t perform that action at this time.