Skip to content

Instantly share code, notes, and snippets.

@ebidel
ebidel / coverage.js
Last active Mar 29, 2021
CSS/JS code coverage during lifecycle of page load
View coverage.js
Moved to https://github.com/ebidel/puppeteer-examples
@jmarceli
jmarceli / README.md
Last active Oct 31, 2019
React errors explained
View README.md

1

You will get one of these:

Uncaught (in promise) TypeError: Cannot read property 'toUpperCase' of undefined(…)

ReactCompositeComponent.js:870 Uncaught TypeError: Cannot read property 'displayName' of undefined

if you try to:

@zxbodya
zxbodya / render-react-with-rxjs.md
Last active Mar 12, 2021
React with RxJS, reactive way :)
View render-react-with-rxjs.md

Observable React elements with RxJS

Note: if you want to skip history behind this, and just looking for final result see: rx-react-container

When I just started using RxJS with React, I was subscribing to observables in componentDidMount and disposing subscriptions at componentWillUnmount.

But, soon I realised that it is not fun to do all that subscriptions(that are just updating property in component state) manually, and written mixin for this...

Later I have rewritten it as "high order component" and added possibility to pass also obsarvers that will receive events from component.

@bevacqua
bevacqua / gulp-npm-publish.js
Created Jan 18, 2014
Publish packages to `npm` using Gulp.
View gulp-npm-publish.js
var spawn = require('child_process').spawn;
gulp.task('npm', function (done) {
spawn('npm', ['publish'], { stdio: 'inherit' }).on('close', done);
});
@tonygambone
tonygambone / https_forward_proxy.js
Created Apr 19, 2012
HTTP/HTTPS forward proxy in node.js
View https_forward_proxy.js
// HTTP forward proxy server that can also proxy HTTPS requests
// using the CONNECT method
// requires https://github.com/nodejitsu/node-http-proxy
var httpProxy = require('http-proxy'),
url = require('url'),
net = require('net'),
http = require('http');
View escapeHTML.js
function escapeHTML(s,r){r='replace';return s[r](/&/g,'&amp;')[r](/>/g,'&gt;')[r](/</g,'&lt;')}
@millermedeiros
millermedeiros / build.xml
Created Feb 13, 2011
RequireJS optimizer Ant task
View build.xml
<?xml version="1.0" encoding="utf-8"?>
<project name="sample-require-js" default="" basedir=".">
<!-- properties -->
<property name="r.js" value="_build/rjs/r.js" />
<property name="closure.jar" value="_build/closure/compiler.jar" />
<property name="rhino.jar" value="_build/rhino/js.jar" />
<property name="js.build" value="_build/js.build.js" />
<property name="css.build" value="_build/css.build.js" />
@ryanflorence
ryanflorence / app.js
Created Feb 4, 2011
Node.JS + Socket.IO + 10 minutes = Chat
View app.js
/**
* Module dependencies.
*/
var express = require('express')
, io = require('socket.io');
var app = module.exports = express.createServer();
// Configuration