Skip to content

Instantly share code, notes, and snippets.

@blerou
blerou / CouchDBLogger.php
Created February 24, 2010 15:53
CouchDB logger for symfony 1.4
<?php
/**
* Logger with CouchDB backend
*
* Available parameters:
* - url: the couchdb server url (optional, default: http://localhost:5984)
* - dbname: the name of the database (required)
* - timeout: seconds waiting for the server (optional, default: 0.5)
*
@blerou
blerou / gitg_1110
Created October 17, 2011 14:55
Gitg 0.2.5 install script for Ubuntu 11.10
#!/bin/bash
apt-get install libgtk-3-dev libgtksourceview-3.0-dev gsettings-desktop-schemas-dev
cd /tmp
wget http://ftp.gnome.org/pub/gnome/sources/gitg/0.2/gitg-0.2.5.tar.bz2
tar xjf gitg-0.2.5.tar.bz2
cd gitg-0.2.5
./configure
make
@blerou
blerou / gitg_1104
Created October 17, 2011 14:58
Gitg 0.1.2 install script for Ubuntu 11.04
#!/bin/bash
apt-get install libgtk2.0-dev libgtksourceview2.0-dev gsettings-desktop-schemas-dev
cd /tmp
wget http://ftp.gnome.org/pub/gnome/sources/gitg/0.1/gitg-0.1.2.tar.gz
tar xzf gitg-0.1.2.tar.gz
cd gitg-0.1.2
./configure
make
@blerou
blerou / first.hs
Created October 19, 2012 13:22
Let's play Haskell! - 1st session
-- az elso nyers megvalositas szambol -> szoveg
fizzbuzzText n =
if n `mod` 3 == 0 then
if n `mod` 5 == 0 then
"FizzBuzz"
else
"Fizz"
else
if n `mod` 5 == 0 then
"Buzz"
@blerou
blerou / store.hs
Created November 5, 2012 22:56
Let's play Haskell! - store
-- array($year, $model, $price)
-- (Int, String, Int)
type Price = Int
data CarType = Ford | Chevrolet deriving (Show)
data Vehicle = Car Int CarType Price
| Bicycle Price deriving (Show)
type Store = [Vehicle]
storePrice :: Store -> Price
@blerou
blerou / store.hs
Created November 11, 2012 12:16
Let's play Haskell! - store, the second day
-- array($year, $model, $price)
-- (Int, String, Int)
type Price = Int
data CarType = Ford | Chevrolet deriving (Show)
data Vehicle = Car Int CarType Price
| Bicycle Price
| Motor Price deriving (Show)
data Accessory = SteeringWheel Price | Brake Price deriving (Show)
type Store = [Vehicle]
@blerou
blerou / store.hs
Created November 19, 2012 14:05
Let's play Haskell! - #5
-- array($year, $model, $price)
-- (Int, String, Int)
type Price = Int
data CarType = Ford | Chevrolet deriving (Show)
data Vehicle = Car Int CarType Price
| Bicycle Price
| Motor Price deriving (Show)
data Accessory = SteeringWheel Price | Brake Price deriving (Show)
type Store = [Vehicle]
@blerou
blerou / .gitignore
Last active December 10, 2015 20:28
Let's play Haskell! - #6 - IO
io
redis
*.hi
*.o
bin
config
vendor
@blerou
blerou / MyJson.hs
Last active December 11, 2015 09:48
Let's play Haskell! - #7 - simple json & recycled numbers solution
module MyJson where
import Data.List
data JValue = JString String
| JBool Bool
| JNumber Double
| JNull
| JList [JValue]
| JObject [(String, JValue)]
$ php -a
Interactive shell
php > $obj = new stdClass;
php > $numKey = 123;
php > $obj->{$numKey} = 'foo';
php > $ary = (array) $obj;
php > var_dump($obj, $ary);
class stdClass#1 (1) {
public $123 =>