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
// Files vs. tests in file | |
var files = { | |
'one.js': 12, | |
'two.js': 22, | |
'three.js': 14, | |
'four.js': 10, | |
'five.js': 19, | |
'six.js': 10, | |
'seven.js': 18, | |
'eight.js': 10, |
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 | |
// An experiment: using traits for dependency injection | |
// A trait provides a way to inject a Logger and a way to use it | |
trait aLogger { | |
protected $logger = null; | |
public function setLogger(Logger $logger){ | |
$this->logger = $logger; | |
} | |
public function log($msg){ |
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
package main | |
import ( | |
"net/http" | |
"html/template" | |
"runtime" | |
"os" | |
"os/signal" | |
"syscall" | |
"log" |
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
#!/usr/bin/env php | |
<?php | |
date_default_timezone_set('GMT'); | |
$params = array( | |
"screen_name" => "tomnomnom", | |
"include_rts" => "true" | |
); | |
if (!file_exists('last-id')){ | |
touch('last-id'); |
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
{ | |
"version": "1.2.7", | |
"methods": [ | |
{ | |
"name": "createGroup", | |
"httpMethod": "POST", | |
"arguments": [ | |
] | |
}, |
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 | |
const INT_COUNT = 1000000; | |
// Fill an array with random ints | |
$ints = []; | |
for ($i = 0; $i < INT_COUNT; $i++){ | |
$ints[] = rand(0, 255); | |
} | |
// Sort the ints |
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
ZEND_API int zend_hash_rehash(HashTable *ht) | |
{ | |
Bucket *p; | |
uint nIndex; | |
IS_CONSISTENT(ht); | |
if (UNEXPECTED(ht->nNumOfElements == 0)) { | |
return SUCCESS; | |
} |
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 SayDate extends DateTime { | |
public function say(){ | |
$now = new DateTime(); | |
$now->setTime(0, 0, 0); | |
$interval = (int) $now->diff($this)->format('%r%a'); | |
if ($interval < 0){ | |
return $this->format('Y-m-d'); |
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
<html> | |
<head> | |
<style> | |
canvas { | |
border: 1px solid #666666; | |
} | |
</style> | |
</head> | |
<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 | |
// Change me | |
const ADDRESS_ID = 'Gold|StringOfAlphas|MY|HouseNumber'; // You can find your Address ID using this: https://gist.github.com/TomNomNom/7875919 | |
const TO_EMAIL = 'me@example.com'; | |
const FROM_EMAIL = 'server@example.com'; | |
// Don't change me | |
const SERVICE_URL = 'http://www.productsandservices.bt.com/consumerProducts/v1/productAvailability.do'; |