Skip to content

Instantly share code, notes, and snippets.

View hejrobin's full-sized avatar
👠

Robin Grass hejrobin

👠
View GitHub Profile
@hejrobin
hejrobin / gist:1185991
Created September 1, 2011 11:28
Lexer usage
var lex = new Lingo.Lexer();
lex.setLexicon('foo', new Lingo.Dictionary({
name: 'Rövarspråket',
description: 'Rövarspråket',
lexicon: {
characters: {
'B': 'Bob', 'b': 'bob',
'C': 'Coc', 'c': 'coc',
'D': 'Dod', 'd': 'dod',
(function() {
this.log = function() {
// Really old browsers
if(typeof console == undefined)
var console = {};
// Just makin' sure...
if(typeof console.log == undefined)
console.log = function() {};
// Now we're talkin'
else if(typeof console == 'function') {
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
define('TYPEHINT_PCRE', '/^Argument (\d)+ passed to (?:(\w+)::)?(\w+)\(\) must be an instance of (\w+), (\w+) given/i');
class TypeHint {
private static $error_handler;
<?php
class Stylesheet {
private $css_rule_regex = '/(?ims)([a-z0-9\s\.\:#_\-@]+)\{([^\}]*)\}/';
public function __construct($css_data) {
$this->unparsed = $css_data;
$this->css_data = $css_data;
}
@hejrobin
hejrobin / gist:2471367
Created April 23, 2012 14:45
I was super bored. So I made this.
<?php
abstract class Type {
protected $type;
public abstract function isValid();
public function getType() {
return $this->type;
{
"file_exclude_patterns": [".DS_Store"],
"folder_exclude_patterns": [".svn", ".git"],
"ignored_packages": ["Vintage"],
"tab_size": 2,
"translate_tabs_to_spaces": false,
"highlight_line": true,
<?php
/**
* random_string
*
* Generates random string based on character pool and length.
*
* @param string $type Return string type.
* @param int $length Return string length.
*
* @return string
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]><html class="ie ie9" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<?php
class SampleController implements \Brewery\Application\Controller {
public function index() {}
public function error() {}
}
// requests kräver konfig i xml
# layout.html.erb
<div id="master">
<%= yield :person %>
<%= yield %>
</div>
# view.html.erb