Skip to content

Instantly share code, notes, and snippets.

@markopostma
markopostma / Route.tsx
Last active October 9, 2021 17:51
Multiple reusable layouts in Typescript with React Router v4
/**
* DESCRIPTION:
*
* A Route component that extends the default react-router-dom Route.
* By default a Route component uses the MainLayout component as defined below.
*
* EXAMPLE USAGE:
*
* <Switch>
* <Route path="/" exact component={Home} />
@markopostma
markopostma / autoloader wordpress
Created February 17, 2016 19:07
Autoloader for wordpress
function autoload_classes( $class ) {
$class_name = ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', $class)), '_');
$filename = dirname(__DIR__)."/includes/classes/" . $class_name . ".php";
if ( file_exists($filename) ) {
require_once $filename;
}
}
function autoload_custom_post_types( $class ) {
@markopostma
markopostma / geoLocation.coffee
Created October 23, 2015 13:10
Get distance between 2 lat + lng coordinates with coffee
class @geoLocation
constructor: ->
getLocation()
getLocation = ->
if navigator.geolocation
navigator.geolocation.getCurrentPosition showLocation
else
console.warn 'Geolocation is not supported by this browser.'