Skip to content

Instantly share code, notes, and snippets.

View kaero's full-sized avatar
🐢
slow developer

Philipp Kovalev kaero

🐢
slow developer
View GitHub Profile
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();
@kaero
kaero / uri.js
Created September 6, 2012 20:43 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
((_)->((_)->(->_--)(_--))(_))(0)
@kaero
kaero / xslt20-with-resources.xsd
Created May 26, 2011 09:37
xslt20-with-resources.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:res="http://example.com/app/resources"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/XSL/Transform"
targetNamespace="http://www.w3.org/1999/XSL/Transform">
<xs:import namespace="http://example.com/app/resources" schemaLocation="resources.xsd"/>
<xs:redefine schemaLocation="http://www.w3.org/2007/schema-for-xslt20.xsd">
<!--
@kaero
kaero / resources.xsd
Created May 26, 2011 09:36
resources.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/app/resources" xmlns="http://example.com/app/resources"
xmlns:res="http://example.com/app/resources">
<xs:complexType name="resource-description">
<xs:attribute name="src"/>
<xs:attribute name="media"/>
</xs:complexType>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="group">
<!--Start recursion over group children-->
<xsl:apply-templates select="*[1]" mode="group"/>
</xsl:template>