Skip to content

Instantly share code, notes, and snippets.

View hejrobin's full-sized avatar
👠

Robin Grass hejrobin

👠
View GitHub Profile
CREATE TABLE IF NOT EXISTS geo_counties (
id INT (11) NOT NULL,
slug VARCHAR (64) NOT NULL,
name VARCHAR (64) NOT NULL,
name_long VARCHAR (64) NOT NULL,
PRIMARY KEY(id)
) ENGINE = MyISAM;
CREATE TABLE IF NOT EXISTS geo_counties (
<route path="login">
<controller>Authenticator</controller>
<request type="post" controllerCallback="validateLogin" />
<request type="get" controllerCallback="showLoginForm" />
<request type="ajax" controllerCallback="showJavaScriptModal" />
</route>
<route path="request">
<controller>Request</controller>
<request type="get" callback="get" />
<request type="post" callback="post" />
<request type="put" callback="put" />
<request type="delete" callback="delete" />
<request type="get" callback="getAjax" ajax="true" />
@hejrobin
hejrobin / gist:921737
Created April 15, 2011 13:56
Demo of some of some routes in Architect
<routes>
<defaultController>Default</defaultController>
<!-- A simple custom route -->
<route path="about-us">
<controller callback="aboutUsPage">Company</controller>
</route>
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
class InternalStore {
protected $store;
public function __construct($store = array()) {
$this->setStore($store);
@hejrobin
hejrobin / gist:1117967
Created August 1, 2011 11:22
Architect Localization Usage
<?php
// English
$arch->locale->setLocale('en-US');
// Default english dict (en-US.xml)
echo $arch->lang->get('hello_world'); // Hello World
// Bork, english dict (en-US.xml) + translator module
$arch->locale->setTranslator('Enchefenizer');
echo $arch->lang->get('hello_world'); // Hellu Vurld
// I moustache you a question, but I'll shave it for later...
String.prototype.moustache = function(object, regex) {
return this.replace(regex || (/\\?\{\{([^{}]+)\}\}/g), function(match, key) {
if(match.charAt(0) == '\\')
return match.slice(1);
return (object[key] !== null) ? object[key] : '';
});
};
<?php
//ini_set('display_errors', 'On');
//error_reporting(E_ALL);
class Stylesheet {
private $css_rule_regex = '/(?ims)([a-z0-9\s\.\:#_\-@]+)\{([^\}]*)\}/';
public function __construct($css_data) {
$this->unparsed = $css_data;
<?php
class UploadrException extends Exception {}
class Uploadr {
public $upload_path;
protected $max_file_size;
public $max_file_count = 0;
@hejrobin
hejrobin / gist:1185988
Created September 1, 2011 11:28
Awesome Javascript Lexer-thingy
(function() {
var Lingo = this.Lingo = {};
Lingo.Dictionary = function(dictionary) {
this.setDictionary(dictionary);
};