Skip to content

Instantly share code, notes, and snippets.

var AsyncStateManager = require('../managers/asyncStateManager');
var AsyncComponentMixin = {
componentWillMount: function AsyncComponentMixin_componentWillMount() {
var self = this;
var asyncStateGetter = this.constructor.getInitialAsyncState;
var asyncStateKey = asyncStateGetter.name;
// ====> AsyncStateManager should not be module / global, it should be tied to request
if ( AsyncStateManager.hasData(asyncStateKey) ) {
@yurynix
yurynix / gist:ab192ffb016308f47ce6
Created October 23, 2014 09:38
diff --git a/main_good.js b/main_bad.js
diff --git a/main_good.js b/main_bad.js
index 22979ef..9521811 100644
--- a/main_good.js
+++ b/main_bad.js
@@ -1054,124 +1054,4 @@ function hasOwnProperty(obj, prop) {
}
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./support/isBuffer":4,"_process":3,"inherits":2}],4:[function(require,module,exports){
-module.exports = function isBuffer(arg) {
function Data(a, b, c) {
this.a = a;
this.b = b;
this.c = c;
}
/* Statics */
Data.getBufferDesc = function Data_getBufferDesc() {
// avoid new instance here, but i'm lazy.
return [
{ type: 'UInt32BE', size: 32 },
@yurynix
yurynix / mongodb_capped_collection_tail.js
Last active September 20, 2015 08:53
A test for tailed cursor
var MongoClient = require('mongodb').MongoClient
, assert = require('assert')
, cappedCollectionName = "capped_test";
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function createTailedCursor(db, callback) {
@yurynix
yurynix / tlushim-summary.js
Last active January 31, 2016 10:28
tlushim.co.il hours summary
var hours = [];
totalMinutes = 0,
maxMinutes = 0;
minMinutes = Number.MAX_VALUE;
Array.prototype.forEach.call(document.querySelectorAll('table.atnd > tbody > tr'), function (tr) {
// if there is an error td, then don't count that row
var errorTd = tr.querySelectorAll('td.atnd_error');
if (errorTd && errorTd.length > 0) {
#include <stdio.h>
#include <sys/time.h> /* select */
#include <sys/types.h> /* select */
#include <unistd.h> /* select, exit */
#include <stdlib.h> /* atexit */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pcap.h>
@yurynix
yurynix / actions.js
Created April 21, 2016 16:55
coomments polling
/**
* Internal dependencies
*/
import wpcom from 'lib/wp';
import {
COMMENTS_RECEIVE,
COMMENTS_COUNT_RECEIVE,
COMMENTS_REQUEST,
COMMENTS_REQUEST_SUCCESS,
COMMENTS_REQUEST_FAILURE,
// External dependencies
import React, { PropTypes } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
// Internal dependencies
import styles from './styles.scss';
import Input from './input';
const wrapInputChildRecursivly = refSaver => {
const recurser = child => {
////////////
///
/// Delphin with RegExp x 131,568 ops/sec ±1.01% (85 runs sampled)
/// Delphin with for loop x 15,235 ops/sec ±0.72% (90 runs sampled)
/// Delphin with regex replace x 291,946 ops/sec ±1.08% (88 runs sampled)
/// Calypso x 323,048 ops/sec ±1.51% (87 runs sampled)
/// Fastest is Calypso
///
////////////
{
"name": "test",
"version": "1.0.0",
"description": "test",
"scripts": {
"build": "cross-env NODE_ENV=production webpack --env.prod=true --config webpack.config.js --progress --colors",
"start": "webpack-dev-server",
"prod": "cross-env NODE_ENV=production webpack-dev-server --env.prod=true",
"test": "cross-env NODE_PATH=.:app jest --maxWorkers=4",
"lint": "eslint ./src ./webpack.config.js -f table || true"