Skip to content

Instantly share code, notes, and snippets.

@PifyZ
PifyZ / calculatrice.hs
Last active April 5, 2016 06:03
Calculatrice
data Expr =
Num Float
| Add Expr Expr
| Sub Expr Expr
| Mul Expr Expr
| Div Expr Expr
deriving (Show)
a :: Expr
a = Div (Num 5) (Num 2.6)
@PifyZ
PifyZ / mini-jquery.js
Last active January 4, 2016 06:28
Mini jQuery
(function() {
var _ = {};
_.concat = function(destination, source) {
for (var property in source) {
if (source.hasOwnProperty(property)) {
destination[property] = source[property];
}
}
@PifyZ
PifyZ / build.sh
Last active October 12, 2015 06:06
rock --libpath=libhang-c/src --incpath=libhang-c/include -lhang
@PifyZ
PifyZ / Essai01.nim
Last active August 29, 2015 14:26
TerraNova en Nim
#
# Portage pur
#
type
lhMutex = object
id: int64
lhWindow = object
id: int64
x: int
@PifyZ
PifyZ / friendly_urls.markdown
Last active August 29, 2015 14:25 — forked from CyberLight/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.

@PifyZ
PifyZ / STLC.idr
Last active August 29, 2015 14:25 — forked from david-christiansen/STLC.idr
data Typ =
IntTyp
| BolTyp
| FunTyp Typ Typ
toType : Typ -> Type
toType IntTyp = Integer
toType BolTyp = Bool
toType (FunTyp x y) = toType x -> toType y
@PifyZ
PifyZ / api-bmc.php
Last active August 29, 2015 14:25
API BMC
<?php
/*
Vocabulaire des méthodes :
- get = obtenir
- set = définir
- add = ajouter
- remove = supprimer
- is = booléen
@PifyZ
PifyZ / HxCanvas.hx
Created July 14, 2015 17:30
Haxe javascript-like canvas
package hx;
import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.display.PixelSnapping;
import openfl.display.Sprite;
import openfl.display.Graphics;
import openfl.display.DisplayObject;
import openfl.geom.Matrix;
import openfl.geom.Rectangle;
@PifyZ
PifyZ / learn.hs
Last active August 29, 2015 14:12
Apprentissage de l'Haskell
module Main where
import Data.Char (isDigit)
data Associativity = Ltr | Rtl deriving (Eq)
data Expr = ConstInt Float
| Add Expr Expr
| Sub Expr Expr
| Mul Expr Expr
@PifyZ
PifyZ / Hx3D.hx
Last active August 29, 2015 14:10
LD#31
typedef Rgb = {
r: Float,
g: Float,
b: Float
}
typedef Rgba = { > Rgb,
a: Float
}