Skip to content

Instantly share code, notes, and snippets.

View RafalR's full-sized avatar

Rafał Rudzik RafalR

View GitHub Profile
@mjackson
mjackson / js-to-react.js
Created August 31, 2016 20:08
Moving between React and non-React code
import React from 'react'
const MyComponent = React.createClass({
componentDidMount() {
// To go from React to non-React code, use the lifecycle hooks. In
// this example, we use componentDidMount to call some external function
// once our component is mounted. We pass the DOM node as convenience in
// case the external code needs to do something with it.
this.props.onSomething(this.node)
},
@yarl
yarl / geoportal-tms.php
Created January 2, 2014 18:32
Geoportal WMS to TMS conversion.
<?php
$zoom = htmlspecialchars($_GET["zoom"]);
$x = htmlspecialchars($_GET["x"]);
$y = htmlspecialchars($_GET["y"]);
//explanation: https://gist.github.com/tmcw/4954720
$y = pow(2, $zoom)-$y-1;
//source: https://github.com/timwaters/whoots/blob/master/whoots.rb