Skip to content

Instantly share code, notes, and snippets.

@m242
m242 / site.jsx
Created March 23, 2017 17:34
Inferno router wildcard issue 962
import Inferno from 'inferno';
import Component from 'inferno-component';
import { Router, Route } from 'inferno-router';
import createBrowserHistory from 'history/createBrowserHistory';
const browserHistory = createBrowserHistory();
class App extends Component {
constructor(props) {
super(props);

Keybase proof

I hereby claim:

  • I am m242 on github.
  • I am mark242 (https://keybase.io/mark242) on keybase.
  • I have a public key whose fingerprint is 9E67 F4E8 E4DD CA61 3844 73E7 4086 C28D 52D6 893E

To claim this, I am signing this object:

@m242
m242 / redirect.js
Created May 3, 2016 16:29
Language redirect
var language = (navigator.language || navigator.browserLanguage).toLowerCase();
if (language == "en-gb") {
window.location = "https://www.skechers.com/en-gb/";
}
@m242
m242 / build.sbt
Last active August 29, 2015 14:06
name := "web"
version := "2.0"
lazy val root = Project(id="web", base=file(".")).enablePlugins(PlayScala)
pipelineStages := Seq(uglify, digest, gzip)
scalaVersion := "2.11.2"
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.0")
// web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")
@m242
m242 / build.sbt
Last active August 29, 2015 14:02
name := """test"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
jdbc,
@m242
m242 / Application.scala
Created January 21, 2012 19:30
HTTP Cache for Action Results, Play Framework 2.0
package controllers
import play.api._
import play.api.cache._
import play.api.libs._
import play.api.mvc._
import play.api.Play.current
trait HttpCache {
self:Controller =>
@m242
m242 / hogan.html
Created December 22, 2011 20:59
Hogan-CouchDB
<!DOCTYPE html>
<html>
<head>
<title>Activity Test</title>
</head>
<body>
<div id="output"></div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
@m242
m242 / gist:1205631
Created September 9, 2011 06:43
Scala Option in JavaScript
var MyOption, Option;
Array.prototype.filter = function(f) {
var x, _i, _len, _results;
_results = [];
for (_i = 0, _len = this.length; _i < _len; _i++) {
x = this[_i];
if (f(x)) {
_results.push(x);
}
@m242
m242 / gist:1205571
Created September 9, 2011 06:01
Scala Option in CoffeeScript
Array::filter = (f) -> (x for x in @ when f(x))
Number::filter = (f) -> [@.valueOf()].filter f
String::filter = Number::filter
Object::filter = (f) -> if f(@) then @ else null
Array::foreach = (f) -> (f(x) for x in @)
Number::foreach = (f) -> [@.valueOf()].foreach f
String::foreach = Number::foreach
Object::foreach = (f) -> if @ then f(@) else null