Skip to content

Instantly share code, notes, and snippets.

View Zae's full-sized avatar

Ezra Pool Zae

  • Digital Natives
  • Amsterdam
View GitHub Profile
@Zae
Zae / ExpressionLanguage.php
Last active January 15, 2018 20:46
psalm bad files
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@Zae
Zae / typekit.editor.php
Created September 18, 2012 10:08 — forked from tomjn/typekit.editor.php
Typekit fonts for TinyMCE editor plugin
add_filter("mce_external_plugins", "tomjn_mce_external_plugins");
function tomjn_mce_external_plugins($plugin_array){
$plugin_array['typekit'] = get_template_directory_uri().'/typekit.tinymce.js';
return $plugin_array;
}
@Zae
Zae / relatedpostsbytag.sql
Created September 26, 2011 20:29
Related Posts By Tag
SELECT posts.* FROM posts
JOIN post_tag A ON A.pid = posts.pid
JOIN post_tag B ON B.tid = A.tid AND B.pid = ?
WHERE
posts.pid != ?
GROUP BY pid
ORDER BY COUNT(*) DESC
LIMIT 0,5
@Zae
Zae / conway.coffee
Created August 31, 2011 23:49
Conway's Game of Life as Coffee Script
setup = (@c) ->
[@h,@w,@a,@b,@m] = [40, 80, 0, 1,[]]
spawn()
spawn = ->
@m[@a] = (Math.floor Math.random() * 2 for i in [0...@w+1] for j in [0...@h+1])
@m[@b] = (0 for i in [0...@w+1] for j in [0...@h+1])
draw = ->
lifedeathandshow()
@Zae
Zae / memcached.php
Created July 8, 2011 12:08
Memcached CakePHP CacheEngine
<?php
/**
* Memcached storage engine for CakePHP
*
* PHP versions 4 and 5
*
* @author Ezra Pool <ezra@tsdme.nl>
* @copyright BSD
* @version 0.2.1
@Zae
Zae / twitter_cake.php
Created July 2, 2011 19:13
TwitterCake
<?php
App::import('Lib', 'Twitteroauth.Twitteroauth');
class TwitterCake extends TwitterOAuth{
public $configs = array();
public function __construct($oauth_token = NULL, $oauth_token_secret = NULL, $consumer_key = NULL, $consumer_secret = NULL) {
if($consumer_key === NULL){
$consumer_key = $this->getConfig('consumerKey');
}
<?php
/**
* Function vs constant test
*
* Constant should be faster with the interpreter, but maybe the compiler inlines the function?
*
*/
class Test{
var $runs = 10000000;