I hereby claim:
- I am tlack on github.
- I am tlack (https://keybase.io/tlack) on keybase.
- I have a public key ASAfzQXduVcmaqcGmj495IpYs0u8ynUslUtUcEneasSOPQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Note: This article was written December 24 2013, when react-page's version number is 0.2.0. This is all likely to change, so if the advice mentioned doesn't help, please reach out to the React community.
Note: Technically, this functionality is provided by react-page-middleware
. I'm going to refer to it generally as react-page
, because I don't think they have enough of an independent identity (and usefulness outside of the whole react-page stack) to nitpick the naming.
react-page [https://github.com/facebook/react-page] is a cool new tool to link your ReactJS scripts in to your Node server config so that the entire site can be server rendered.
Unfortunately, it doesn't support custom routes - http://site.co/widget will always look for src/widget/index.js (or whatever your root elem is), even if you want http://site.co/widgets/new to go there instead.
location / { # ~ domain=(.*)& { | |
rewrite_log on; | |
if ( $arg_callback ) { | |
echo_before_body '$arg_callback('; | |
echo_after_body ');'; | |
} | |
if ($args ~ "domain=(.*)&") { | |
set $key1 $1; | |
echo_before_body "$arg_callback("; | |
# proxy_pass http://whois.api.go.co/blah=$key1; |
Idea for CodePen plugins (by @tlack) | |
Step 1: Establish simple plugin architecture/API | |
```javascript | |
CP.Plugins.add({ | |
context: CP.Html, | |
re: /fun ([a-z_][a-z0-9_]+)/, | |
callback: function(cpPluginContext, match) { | |
var str = "function "+match.$1+"() {\n// Comment\n\n}\n"; |
iEk21fuwZApXlz93750dmW22pw389dPwOk1356949137 |
_mouseCapture: function( event ) { | |
var o = this.options, | |
position, | |
normValue, | |
distance, | |
closestHandle, | |
self, | |
index, | |
allowed, | |
offset, |
// Matraka's source code decoded and beautified | |
// by @tlack | |
// | |
// Matraka is a 1005 byte Javascript "demo" by p01. It includes an 'evolving animation' | |
// and great dirty synth music. View here: | |
// | |
// http://www.p01.org/releases/MATRAKA/matraka.png.html | |
// | |
// I fondly recall the demo scene of my youth, puzzling over the work of Future | |
// Creators and those guys. I was puzzled by this worked so I had to figure it |
var h = require('handlebars'); | |
var tmpl = h.compile("<p>{{name}}</p>"); | |
var data = {name:"tlack"}; | |
console.log(tmpl(data)); |
exports.req_ip = function(req) { | |
return ( req.headers["X-Forwarded-For"] | |
|| req.headers["x-forwarded-for"] | |
|| req.client.remoteAddress ); | |
} |