Skip to content

Instantly share code, notes, and snippets.

@AbelToy
AbelToy / Composition.swift
Last active April 26, 2018 09:05
Function composition in swift
import Foundation
// identity function
func id<T>(_ x: T) -> T {
return x
}
// compositing functions
infix operator ∘: MultiplicationPrecedence
func ∘<T, U, V> (_ g: @escaping ((U) -> V), _ f: @escaping ((T) -> U)) -> ((T) -> V) {
@AbelToy
AbelToy / init.js
Created February 7, 2015 15:25
Rekcahdam Javascript
/*
Directive by HTML5 UP
html5up.net | @n33co
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
*/
(function($) {
skel.init({
reset: 'full',
@AbelToy
AbelToy / Gradient.hx
Last active August 29, 2015 14:07
Luxe Gradient Component
package;
import luxe.Color;
import luxe.Component;
import luxe.Sprite;
/**
* This will set the color of any Sprite to a gradient.
*
* @author Abel Toy
@AbelToy
AbelToy / World.as
Created March 10, 2011 16:40
frontCollidePoint on World
/**
* Returns the Entity at front which collides with the point.
* @param x X position
* @param y Y position
* @return The Entity at front which collides with the point, or null if not found.
*/
public function frontCollidePoint(x:Number, y:Number):Entity
{
var e:Entity,
i:int = 0;