Skip to content

Instantly share code, notes, and snippets.

View jaytaph's full-sized avatar
:shipit:
Calculating pi

Joshua Thijssen jaytaph

:shipit:
Calculating pi
View GitHub Profile
@jaytaph
jaytaph / gist:1438895
Created December 6, 2011 16:45
Why lazy-loading getIterator does not work
// Our book class. We can still iterate over our chapters with the
// help of the iteratorAggregate implementation.
class Book implements IteratorAggregate {
protected $_title;
protected $_author;
protected $_chapters;
protected $_it = null;
function __construct($title, $author) {
CREATE TABLE biography (id INT AUTO_INCREMENT NOT NULL, owner_id INT DEFAULT NULL, description VARCHAR(50) NOT NULL, biography LONGTEXT NOT NULL, path VARCHAR(255) DEFAULT NULL, dt_added DATETIME NOT NULL, dt_updated DATETIME NOT NULL, joindin_url VARCHAR(250) NOT NULL, slideshare_url VARCHAR(250) NOT NULL, blog_url VARCHAR(250) NOT NULL, homepage_url VARCHAR(250) NOT NULL, INDEX IDX_E3B3665C7E3C61F9 (owner_id), PRIMARY KEY(id)) ENGINE = InnoDB;
CREATE TABLE fos_user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) NOT NULL, username_canonical VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, email_canonical VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, locked TINYINT(1) NOT NULL, expired TINYINT(1) NOT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)', credentials_expired T
@jaytaph
jaytaph / intro.tex
Created January 22, 2012 13:01
Small intro into LaTeX
\documentclass[]{article}
\begin{document}
\title{This is the title of the article}
\author{Joshua Thijssen}
\date{\today}
\maketitle
\section{In the beginning}
package { [ 'php-pdo', 'php-mysql, 'php-xml', 'php-gd', ... ] :
ensure => 'present',
require => Package['php'],
}
class Model_Blog_Entity extends Model_Entity {
protected $_id;
protected $_title;
protected $_post;
protected $_author;
public function getId() {
return $this->_id;
 }
public function setId() {
$this->_id = $id;
@jaytaph
jaytaph / complete_console.sh
Last active October 5, 2015 21:08
Console completion for Symfony2
#!/bin/sh
#
# Symfony2 App/Console autocompletion (commands and arguments only)
#
# Usable for both bash and zsh (probably)
#
# Usage:
# Load the script (or add to your .bashrc)
#
# source ./complete_console.sh
@jaytaph
jaytaph / Vagrantfile
Created June 28, 2012 17:00
Vagrantfile
Vagrant::Config.run do |config|
# This vagrant will be running on centos 6.2, 64bit with puppet provisioning
config.vm.box = 'centos-62-64-puppet'
config.vm.box_url = 'http://packages.vstone.eu/vagrant-boxes/centos/6.2/centos-6.2-64bit-puppet-vbox.4.1.12.box'
# Use :gui for showing a display for easy debugging of vagrant
config.vm.boot_mode = :gui
config.vm.define :project do |project_config|
project_config.vm.host_name = "www.example-project.dev"
@jaytaph
jaytaph / checktoken.php
Created July 6, 2012 19:41
Varnish oauth offloader
<?php
// Crude check. Off course this should be stored in a (memory) database. $token is an
// access token that is provided by oauth.
$token = $_SERVER['HTTP_X_AUTH_TOKEN'];
if ($token == "mellon") {
header("X-Api-User: Gandalf");
header("X-Api-Context: Middle-Earth");
header("Cache-Control: public, max-age=120");
%{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "node.h"
#include "parser.tab.h"
%}
hashes and lists and other data structures
------------------------------------------
The current idea for shorthand notation:
lists:
[ 1, 2, 3, 4]
hash:
{ "foo":1, "bar":2, 3:"baz" }