This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GameOfLife(object): | |
def evolve(self, cells): | |
next_generation = set() | |
for cell in cells: | |
if self.__should_survive(cell, cells): | |
next_generation.add(cell) | |
for neighbor in self.__get_neighbors(cell): | |
if self.__should_become_alive(neighbor, cells): | |
next_generation.add(neighbor) | |
return next_generation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 REMGOSUB2000 | |
20 V=53248:AD=8192:A1=PEEK(V+17):A2=PEEK(V+24) | |
30 POKEV+17,59:POKEV+24,24 | |
60 FORI=1024TO2023 | |
70 POKEI,16 | |
80 NEXTI | |
90 FORI=8192TO16383:POKEI,0:NEXTI | |
120 REMFORX=0TO319 | |
121 REMY=100 | |
122 REMGOSUB1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __DEBUG_H_INCLUDED | |
#define __DEBUG_H_INCLUDED | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/file.h> | |
#include <sys/time.h> | |
#include <libgen.h> | |
#include <time.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://bugs.php.net/bug.php?id=53567 | |
function create_pdo() | |
{ | |
return new PDO("mysql:host=localhost;dbname=test", | |
"test", "my_password", | |
array(PDO::ATTR_PERSISTENT => true)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>JavaScript variable declaration hoisting</title> | |
<meta charset="utf-8" /> | |
<script type="text/javascript" src="test.js"></script> | |
</head> | |
<body> | |
<h1>See FireBug console :-)</h1> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyObject | |
{ | |
public function __construct() | |
{ | |
$this->properties = array(); | |
} | |
public function __get($property_name) |