This file contains hidden or 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
{ | |
"player": [ | |
[ | |
0.0, | |
0.0 | |
], | |
[ | |
10.0, | |
-30.0 | |
], |
This file contains hidden or 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 | |
/* | |
* As you probably know array_merge_recursive() is pretty useless. This is a function | |
* that I always tend to write when working with recursive merges of arrays. | |
* | |
* See output.txt to see the difference in behaviour. | |
*/ | |
function custom_merge_recursive(/* $a, $b, $c, ... */) { | |
$args = func_get_args(); |
This file contains hidden or 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
// | |
// FollowAction.h | |
// Battle Pong | |
// | |
// Created by Hugo Wetterberg on 2009-11-29. | |
// Copyright 2009 Good Old. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import "cocos2d.h" |
This file contains hidden or 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 | |
$ops = array( | |
array('operation' => 'insert'), | |
array('operation' => 'update'), | |
array('operation' => 'update'), | |
array('operation' => 'update'), | |
); | |
$ops2 = array( | |
array('operation' => 'update'), |
This file contains hidden or 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 | |
$half_time_24h = pow(0.5, 1/24); | |
$total = 1000; | |
$score = 700; | |
$last_update = time() - (3600*1.5); // One and a half hour ago | |
$new_total = 1010; | |
$total_delta = $new_total - $total; | |
$hour_delta = (time() - $last_update) / 3600; |
This file contains hidden or 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 | |
function db_query_debug($sql, $parameters) { | |
global $db_prefix; | |
$sql = preg_replace('/\{([^\}]+)\}/', $db_prefix . '$1', $sql); | |
if (!is_array($parameters)) { | |
$parameters = array_slice(func_get_args(), 1); | |
} | |
$args = array_merge(array($sql), $parameters); | |
$q = call_user_func_array('sprintf', $args); |
This file contains hidden or 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 | |
/** | |
* Returns all the layers in the tile service. | |
* | |
* @return array | |
*/ | |
function simplegeo_tileservice_get_layers() { | |
static $layers; | |
$cache_key = 'simplegeo_tileservice:layers'; |
This file contains hidden or 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 | |
$content = file_get_contents($argv[1]); | |
function invert_color($matches) { | |
$r = 255 - intval(substr($matches[1], 0, 2), 16); | |
$g = 255 - intval(substr($matches[1], 2, 2), 16); | |
$b = 255 - intval(substr($matches[1], 4, 2), 16); | |
$a = isset($matches[2]) ? $matches[2] : ''; | |
This file contains hidden or 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 | |
// Add the css file as you would have added a normal | |
// css file in template.php, but pass the path | |
// through cssdry_stylesheet(). | |
if (module_exists('cssdry')) { | |
drupal_add_css(cssdry_stylesheet(drupal_get_path('theme', 'a_theme') .'/css/style.css'), 'theme'); | |
} |