Skip to content

Instantly share code, notes, and snippets.

View the1sky's full-sized avatar

nant the1sky

View GitHub Profile
@the1sky
the1sky / Functor.js
Created June 13, 2017 17:32 — forked from CrossEye/Functor.js
First Functor Fantasy
(function(global) {
var types = function(obj) {
throw new TypeError("fmap called on unregistered type: " + obj);
};
// inefficient as hell, but as long as there aren't too many types....
global.Functor = function(type, defs) {
var oldTypes = types;
types = function(obj) {
if (type.prototype.isPrototypeOf(obj)) {
@the1sky
the1sky / dataURItoBlob
Created August 7, 2016 05:19 — forked from kosso/dataURItoBlob
convert base64 to raw binary data held in a string
/**
via http://stackoverflow.com/questions/4998908/convert-data-uri-to-file-then-append-to-formdata/5100158
via http://www.smartjava.org/content/face-detection-using-html5-javascript-webrtc-websockets-jetty-and-javacvopencv
**/
function dataURItoBlob(dataURI) {
var binary = atob(dataURI.split(',')[1]);
var array = [];
for(var i = 0; i < binary.length; i++) {
@the1sky
the1sky / pptpd.sh
Last active June 25, 2019 06:32 — forked from yinhm/pptpd.sh
针对amazon ec2 linux x86_84平台的修改
# Automaticlly install pptpd on Amazon EC2 Amazon Linux
#
# Ripped from http://blog.diahosting.com/linux-tutorial/pptpd/
# pptpd source rpm packing by it's authors
#
# WARNING:
# first ms-dns setting to 172.16.0.23, 172.16.0.23 was showing on my
# /etc/resolv.conf, I'm not sure this is the same on all Amazon AWS zones.
#
# You need to adjust your "Security Groups" which you are using too.
@the1sky
the1sky / RobotlegsAsyncCommand.as
Created March 28, 2012 04:21 — forked from darscan/RobotlegsAsyncCommand.as
An Async Command for Robotlegs
package org.robotlegs.extensions.mvcs
{
import flash.utils.Dictionary;
import org.robotlegs.base.EventMap;
import org.robotlegs.core.IEventMap;
import org.robotlegs.mvcs.Command;
public class AsyncCommand extends Command
{