View gist:d011b030ec880f0df881
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) | |
} |
View rm-merge.js
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 |
View App.js
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="/" |
View matchRoute.js
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} />, |
View RootContainer.js
<RelayRootContainer | |
Component={Component} | |
route={{name, params, queries}} | |
/> |
View main-panel.html
<!doctype html> | |
<html> | |
<head> | |
<style type="text/css"> | |
body { | |
margin: 0; | |
} | |
iframe { | |
bottom: 0; |
View UserAgent.html
<!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> |
View gist:361474
/* | |
* 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 |
View gist:440783
# | |
# 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 |
View Toy.js
/* | |
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 |
OlderNewer