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
sudo apt-get update | |
sudo apt-get install build-essential linux-headers-$(uname -r) | |
sudo apt-get install virtualbox-ose-guest-x11 |
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 | |
$ns = 'http://ns'; | |
function parse($text){ | |
$parser = new DOMDocument('1.0'); | |
$parser->loadXML($text); | |
return $parser; | |
} | |
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
var ns = 'http://ns'; | |
function parse(text){ | |
var parser = new DOMParser(); | |
return parser.parseFromString(text, 'text/xml'); | |
} | |
var xml = parse('<!DOCTYPE html><html xmlns:glue="'+ns+'"><body><glue:if>something</glue:if></body></html>'); | |
console.log(xml); |
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
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE html> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:glue="http://www.chrisp.co.za/2012/glue"> | |
<head> | |
<title>glue</title> | |
<meta charset="UTF-8" /> | |
</head> | |
<body> | |
<!-- conditionals --> |
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
function diff($start, $end) | |
{ | |
$start = new DateTime($start); | |
$end = new DateTime($end); | |
$interval = $start->diff($end); | |
return array( | |
"years" => $interval->format("%y"), | |
"months" => $interval->format("%m"), |
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
walk = (parts, value) -> | |
stack = {} | |
part = parts.shift() | |
if parts.length | |
stack[part] = walk(parts, value) | |
else | |
stack[part] = value | |
return stack |
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
has = (self, key) -> | |
Object.hasOwnProperty.call(self, key) | |
each = (object, method, context) -> | |
for key in object | |
if method.call(context, object[key], key, object) == false | |
break | |
object | |
create = Object.create or (self) -> |
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
Function::implements = (argv...) -> | |
for proto in argv | |
for key, value of proto:: | |
@::[key] = value | |
@ | |
class Animal | |
hello: (what) -> | |
alert(what) |
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
do -> | |
Function::implements = (argv...) -> | |
for proto in argv | |
for key, value of proto:: | |
@::[key] = value | |
@ | |
has = (key) -> | |
return Object::hasOwnProperty(key) |
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
### | |
CoffeeScript | |
marker = null; | |
require(["ace/range"], (range) -> | |
marker = editor.getSession().addMarker(new range.Range(7, 0, 7, 2000), "warning", "line", true); | |
) | |
setTimeout(-> |