Skip to content

Instantly share code, notes, and snippets.

View pmcalabrese's full-sized avatar

Pachito Marco Calabrese pmcalabrese

View GitHub Profile
@pmcalabrese
pmcalabrese / error
Created January 10, 2017 20:57
error when running -> gulp --target=NRF52_DK
(mbed) ❯ gulp --target=NRF52_DK
[21:55:54] Using gulpfile ~/dev/mbed-js-example/Gulpfile.js
[21:55:54] Starting 'make-build-dir'...
[21:55:54] Starting 'bundle'...
[21:55:54] Starting 'ignorefile'...
[21:55:54] Finished 'make-build-dir' after 46 ms
[21:55:54] Starting 'makefile'...
$ mkdir -p ./build/source
[21:55:54] Finished 'ignorefile' after 33 ms
[21:55:54] Finished 'makefile' after 14 ms
@pmcalabrese
pmcalabrese / jsconfig.json
Last active September 22, 2016 13:01
typings.json and jsconfig.json files for Bolighed (put them in the *static_src* folder)
{
// See https://go.microsoft.com/fwlink/?LinkId=759670
// for the documentation about the jsconfig.json format
"compilerOptions": {
"target": "ES2015"
},
"exclude": [
"node_modules",
"bower_components",
"jspm_packages",
@pmcalabrese
pmcalabrese / is_email_valid.py
Created September 8, 2016 09:50
Python email validation
import re
def is_email_valid(email):
email_regex = ('^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@('
'[a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|c'
'oop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mo'
'bi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{'
'1,3}))(:[0-9]{1,5})?$')
@pmcalabrese
pmcalabrese / gulpfile.js
Created January 18, 2015 13:52
gulpfile used for copenhagenjs presentation. Based on the angular-seed example repository
// include gulp
var gulp = require('gulp');
// include plug-ins
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var minifyCSS = require('gulp-minify-css');
var argv = require('yargs').argv;
var gulpif = require('gulp-if');
var logwarn = require('gulp-logwarn');
@pmcalabrese
pmcalabrese / angular-xorcipher.js
Last active August 29, 2015 14:01
Simple Angular xorcipher service
// credit goes to the author of this code https://gist.github.com/sukima/5613286
// How to use it
// Inject the service in the controller and then use it as follow:
// define a encription key;
// var encryptionKey = "147";
// then you can decode and ancode with decode and encode methods
// var encodedString = xorcipher.encode(encryptionKey,"this is a string to encode")
// var decodedSting = xorcipher.decode(encryptionKey,encodedString)
<?php
/**
* Formats a JSON string for pretty printing
*
* @param string $json The JSON to make pretty
* @param bool $html Insert nonbreaking spaces and <br />s for tabs and linebreaks
* @return string The prettified output
* @author Jay Roberts
*/