Skip to content

Instantly share code, notes, and snippets.

View cpojer's full-sized avatar

Christoph Nakazawa cpojer

View GitHub Profile
instance.extend("parseImportSpecifiers", function (inner) {
return function (node) {
node.importKind = "value"
if (this.isContextual("type") || this.type === tt._typeof) {
if (this.type === tt._typeof) {
node.importKind = "typeof"
this.eat(tt._typeof)
}
module.exports = function(file, api) {
var j = api.jscodeshift; // alias the jscodeshift API
var root = j(file.source); // parse JS code into an AST
// the main update method replaces merge with ObjectExpression
const update = path =>
j(path).replaceWith(j.objectExpression(
flatten(path.value.arguments.map(p =>
p.type == 'ObjectExpression'
? p.properties
import relayNestedRoutes from 'relay-nested-routes';
const NestedRootContainer = relayNestedRoutes(React, Relay);
React.render(
<Router history={new BrowserHistory()}>
<Route component={NestedRootContainer}>
<Route
name="home" // added a name to the route
path="/"
function matchRoute<T>(
route: {name: string},
map: {[key: string]: () => T}
): ?T {
return map[route.name] ? map[route.name]() : null;
}
// Usage
matchRoute(this.props.route, {
'ProfileRoute': () => <Profile {...props} />,
<RelayRootContainer
Component={Component}
route={{name, params, queries}}
/>
<!doctype html>
<html>
<head>
<style type="text/css">
body {
margin: 0;
}
iframe {
bottom: 0;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>UserAgent</title>
<script src="ua.js" type="text/javascript"></script>
/*
* Use the Slick Selector Engine with MooTools Core 1.2.4 by @cpojer
*
* Tested with Slick branch "develop":
* http://github.com/mootools/slick/tree/develop
*
* How to use:
* - Download Slick from github and include Slick.Parser.js and Slick.Finder.js
* - Remove Selectors.js
* - Optionally you can remove all the methods mentioned below from your mootools-core build
#
# Configuration File for JavaScript Lint 0.2.6
# Developed by Matthias Miller (http://www.JavaScriptLint.com)
#
# This configuration file can be used to lint a collection of scripts, or to enable
# or disable warnings for scripts that are linted via the command line.
#
#### NOTE TO TEXTMATE BUNDLE USERS:
#### Feel free to experiment with enabling/disabling individual warnings to
/*
JavaScript Implementation of the TOY CPU which we used in the
lecture RECHNERNETZE UND -ORGANISATION (Computer Networks and Organization)
More Information: http://www.cs.princeton.edu/introcs/52toy/
Instruction Set: http://www.cs.princeton.edu/introcs/53isa/
This implementation comes with a built-in boot loader.
It expects files in the following format:
line 1: CAFE