Skip to content

Instantly share code, notes, and snippets.

View thecocce's full-sized avatar

TheCocce thecocce

View GitHub Profile
///
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude (quill18@quill18.com)
/// Latest Version: https://gist.github.com/quill18/5a7cfffae68892621267
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// 2015-04-16: Changed Pool to use a Stack generic.
///
/// Usage:
///
@thecocce
thecocce / !Profiler.hx
Created June 19, 2016 11:08 — forked from hamaluik/!Profiler.hx
Simple Haxe Profiler
package ;
import haxe.ds.StringMap;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Printer;
import haxe.macro.Type.ClassType;
import neko.Lib;
using haxe.macro.ExprTools;
@thecocce
thecocce / extract-attachments.py
Created June 14, 2016 06:39 — forked from stefansundin/extract-attachments.py
Extract attachments from emails that Gmail doesn't allow you to download. This is dumb. (Only tested with Python 3.4)
#!/usr/bin/env python3
# Get your files that Gmail block. Warning message:
# "Anti-virus warning - 1 attachment contains a virus or blocked file. Downloading this attachment is disabled."
# Based on: http://spapas.github.io/2014/10/23/retrieve-gmail-blocked-attachments/
# Go to your emails, click the arrow button in the top right, "Show original", save to the same directory as this script.
import email
import sys
import os
@thecocce
thecocce / index.html
Created June 13, 2016 13:40 — forked from davidwkeith/index.html
Link directly to custom protocol handlers for mobile, without worrying if the user has your App installed. Licensed under the WFTPL http://www.wtfpl.net/txt/copying/
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!-- iframe used for attempting to load a custom protocol -->
<iframe style="display:none" height="0" width="0" id="loader"></iframe>
var vx:Number = 0;
var vy:Number = 0;
var targetX:Number;
var targetY:Number;
var spring:Number = .5;
var friction:Number = .9;
this.addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void
@thecocce
thecocce / ThreadingSample.hx
Created May 16, 2016 07:47 — forked from jgranick/ThreadingSample.hx
How to make a background worker thread (NME recipe)
import com.eclecticdesignstudio.motion.Actuate;
import cpp.vm.Thread;
import nme.display.Sprite;
import nme.events.Event;
import nme.Lib;
class ThreadingExample extends Sprite {
package;
import flash.Lib;
import openfl.utils.JNI;
class SystemPath {
class Main extends Sprite
{
private var doneFrame:Bool;
public function new()
{
super();
doneFrame = false;
graphics.beginFill(0xff5555);

Alpha Masking Without Shaders

Shaders are often more efficient, but for simple purposes this may do the trick. It also means it supports GLES10.

The three textures can be downloaded here.

@thecocce
thecocce / stackblur.cpp
Created April 4, 2016 10:19 — forked from usrlocalben/stackblur.cpp
stackblur - c++, floating-point, vectorized
/*
* "stackblur"
* originally, Mario Klingemann, mario@quasimondo.com
* this implementation, Benjamin Yates (benjamin@rqdq.com)
* http://incubator.quasimondo.com/processing/stackblur.pde
*
* this blur routine seems to be quite popular.
*
* unfortunately, mario didn't comment anything.
* but, it's easy to see it's just a flavor of a two-pass