Skip to content

Instantly share code, notes, and snippets.

Avatar
🖤

C[ʀ] c7tincu

🖤
View GitHub Profile
View no-with-context.md

So I needed to transfer the routing context (I’m using react-router) from component X to component ContactsEditDialog, as it’s rendered in some remote area of the DOM tree (#modal), not under the node corresponding to component X, as usual...

So I basically replaced this...

React.withContext({ router: this.context.router }, () => {
  React.render(
    <ContactsEditDialog { ...this.props } { ...i18nData }/>,
    document.getElementById('modal')
  );
View fml.jsx
// You’d expect this one…
render() {
return (
<button { ...this.props } className={ this.cn + (this.props.className ? ' ' + this.props.className : '') }>
{ this.props.children }
</button>
);
}
View ternary-operator.js
getMaxDateImpl =
// Returns the maximum valid month day, given a year and a month.
function (year, month) {
return (
indexOf([ 0, 2, 4, 6, 7, 9, 11 ], month) !== - 1 ?
// January, March, May, July, August, October, or December.
31 :
indexOf([ 3, 5, 8, 10 ], month) !== - 1 ?
// April, June, September, or November.
30 :
View ws-monkey-patch.js
WebSocket.prototype.oldSendImpl = WebSocket.prototype.send;
WebSocket.prototype.send =
function (data) {
console.log("\u2192 " + data);
this.oldSendImpl(data);
this.addEventListener(
"message",
function (msg) {
console.log("\u2190 " + msg.data);
@c7tincu
c7tincu / style.js
Last active Dec 11, 2015
RequireJS style! plugin.
View style.js
/* This is the Basic AMD Hybrid Format.
http://addyosmani.com/writing-modular-js/ */
define(
function (require, exports, module) {
"use strict";
/* Require the deps. */
var ø = require("euh-js");
var less = require("less");
You can’t perform that action at this time.