Skip to content

Instantly share code, notes, and snippets.

<?php
/**
*
* @package OpenFlame Web Framework
* @copyright (c) 2010 OpenFlameCMS.com
* @license http://opensource.org/licenses/mit-license.php The MIT License
* @link http://github.com/OpenFlame/OpenFlame-Framework
*
* Minimum Requirement: PHP 5.0.0
*/
<?php
define('SFSLIB', dirname(__FILE__) . '/src/');
define('OF_ROOT', dirname(__FILE__) . '/vendor/OpenFlame/src/');
require OF_ROOT . 'Of.php';
require OF_ROOT . 'OfException.php';
// Register the OpenFlame Framework autoloader
spl_autoload_register('Of::loader');
{% block js %}
{% if use_jquery %}
<script type="text/javascript" src="{{ global_style_path|e }}js/jquery.js"></script>
{% if javascript_globals %}
<script type="text/javascript">
$.freeq = { {% for name,value in javascript_globals %}
{{ name }} : "{{ value }}"{% if not loop.last %},{% endif %}{% endfor %}
};
</script>
{% endif %}
@katanacrimson
katanacrimson / sync_minecraft_iso.sh
Created November 5, 2010 17:06
Syncronizes ichi webserver with the latest minecraft server's iso snapshots.
#! /bin/bash
wget -q --timeout=300 -O /var/www/codebite.net/files/minecraft_iso_big.png http://***/maps/TC***_iso_full.png
wget -q --timeout=300 -O /var/www/codebite.net/files/minecraft_iso_small.png http://***/maps/TC***_iso_sml.png
chown ftpuser:ftpgroup /var/www/codebite.net/files/minecraft_iso_big.png
chown ftpuser:ftpgroup /var/www/codebite.net/files/minecraft_iso_small.png
@katanacrimson
katanacrimson / mcmap.sh
Created November 29, 2010 06:20
mcmap minecraft iso generation script, with my own modifications
#!/bin/bash
cd /home/minecraft/mcmap/
WORLD=/home/minecraft/world/
OUTPUT="/var/www/minecraft/maps"
################################
FILE=history-`date +%s`.png
OLD5=none
@katanacrimson
katanacrimson / gist:729342
Created December 5, 2010 18:53
argh, stupid realpath()
@@ -58,11 +58,12 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface
foreach ($paths as $path) {
if (!is_dir($path)) {
throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path));
}
- $this->paths[] = realpath($path);
+ $realpath = realpath($path);
+ $this->paths[] = ($realpath !== false) ? $realpath : $path;
}
@katanacrimson
katanacrimson / gist:751858
Created December 22, 2010 18:10
This server hates the world.
desdenova@deep-thought:~$ ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
--- localhost.localdomain ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 4999ms
desdenova@deep-thought:~$ ping google.com
PING google.com (74.125.227.51) 56(84) bytes of data.
64 bytes from 74.125.227.51: icmp_seq=1 ttl=56 time=1.13 ms
64 bytes from 74.125.227.51: icmp_seq=2 ttl=56 time=1.88 ms
@katanacrimson
katanacrimson / avatar.php
Created February 12, 2011 15:21
flips between two avatars, complete with cache control
<?php
$avvy_1 = './shana_avvy_small.png';
$avvy_2 = './highlander_avvy_med.png';
#########################################
$day = gmdate('j');
$start = strtotime('Today 0:00 -0000');
$expires = strtotime('Today 23:59 -0000');
$avvy = (($day % 2) === 1) ? $avvy_1 : $avvy_2;
if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $start)
@katanacrimson
katanacrimson / gist:866660
Created March 11, 2011 22:04
grabbing a random string...
<?php
$first_unique_seed = 'abcdef';
$second_unique_seed = '123456';
$hash = hash('md5', implode('', array($first_unique_seed, $second_unique_seed, (string) microtime(true))));
$str = '';
foreach(str_split($hash, 2) as $char)
{
$str .= hexdec($char);
}
@katanacrimson
katanacrimson / CookieInstance.php
Created April 6, 2011 17:20
Cookie Instance Object - in progress
<?php
/**
*
* @package OpenFlame Web Framework
* @copyright (c) 2010 OpenFlameCMS.com
* @license http://opensource.org/licenses/mit-license.php The MIT License
* @link https://github.com/OpenFlame/OpenFlame-Framework
*
* Minimum Requirement: PHP 5.3.0
*/