Skip to content

Instantly share code, notes, and snippets.

@yewton
yewton / wrapper.vbs
Created June 8, 2012 02:21
ウィンドウを開かないでバッチファイル実行
CreateObject("Wscript.Shell").Run WScript.Arguments(0),0
#include "A.hpp"
#include <iostream>
A::A() { }
A::~A() { }
void A::execute() { }
Pool<A> A::merePool(sizeof(A));
@yewton
yewton / gist:2723321
Created May 18, 2012 05:23
LCG, xor shift
#include <iostream>
using namespace std;
class LCG {
unsigned long s;
static const unsigned long M = 1103515245UL;
static const unsigned long A = 12345UL;
static const unsigned long B = 2147483647UL;
public:
@yewton
yewton / gist:2245904
Created March 30, 2012 02:24
PDO::FETCH_INTO leaks memory; PHP 5.3.10, MySQL 5.0.77
<?php
class A {
public $m;
public function __construct($pdo) {
$sql = 'select 1 as m';
$stmt = $pdo->prepare($sql);
$stmt->setFetchMode(PDO::FETCH_INTO, $this);
$stmt->execute();
}