Skip to content

Instantly share code, notes, and snippets.

Avatar

Sandro Pasquali sandro-pasquali

View GitHub Profile
View mies.subscribing
mies.subscribe("/my/route")
@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
View API.swift
//
// API.swift
//
// Created by Taro Minowa on 6/10/14.
// Copyright (c) 2014 Higepon Taro Minowa. All rights reserved.
//
import Foundation
typealias JSONDictionary = Dictionary<String, AnyObject>
View web_crypto_api_example.js
var string = new Uint8Array([0x01, 0x02]);
var data = new Uint8Array([0x03, 0x04, 0x05]);
var handle_error = function (error) {
cnosole.log("Error:");
console.log(err);
};
window.crypto.subtle.digest({name: "SHA-256"}, string).then(function (hash) {
console.log("SHA-256:");
View gist:b6b3dd1cd5dcff310b23

Code example using WebCrypto, File API, indexedDB, createObjectURL and Workers.

<input type="file" onsubmit="process_upload">
var workerjs=' \
  onmessage=function(evt) { \
		var encrypt=crypto.workersubtle.encrypt({name:"AES-CBC",iv:new Uint8Array(16)},evt.data[0]); \
		var buffer=evt.data[1]; \
You can’t perform that action at this time.