Skip to content

Instantly share code, notes, and snippets.

Redux Action Registry

Create an object with all your action creators. This makes it easier to debug your application, since now you can dispatch actions from the console or from the Redux Devtools Extension.

Usage

ActionRegistry['data/accountBalance'].SET_ACCOUNT_BALANCE // "ordoro/data/accountBalance/SET_ACCOUNT_BALANCE"
ActionRegistry['data/accountBalance'].setAccountBalance(3) // {type: "ordoro/data/accountBalance/SET_ACCOUNT_BALANCE", payload: 3}
@prestonp
prestonp / Form.jsx
Last active July 20, 2016 22:15
react validation
class TestForm extends React.Component {
constructor() {
super();
this.state = {
name: '',
address: '',
};
this.nameOnChange = this.nameOnChange.bind(this);
this.addressOnChange = this.addressOnChange.bind(this);
@twolfson
twolfson / README.md
Last active August 1, 2023 10:45
Node.js job queue evaluation

We are building a Node.js service which will need asynchronous support for tasks like sending emails. Here's our evaluation:

@eloraburns
eloraburns / listener.py
Created October 9, 2015 14:33
Statsd listener for debugging stats locally
# From https://wiki.python.org/moin/UdpCommunication modified for Statsd + debugging usage
import datetime
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 8125
sock = socket.socket(
socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
@luqmaan
luqmaan / log all jasmine.ajax requests.js
Last active June 26, 2016 19:52
A copypesto to console.log all jasmine ajax requests. Makes it easier to debug why a request might have been missed. Karma
for (var i = 0; i < jasmine.Ajax.requests.count(); i++) {
var req = jasmine.Ajax.requests.at(i);
console.log(
req.method.toUpperCase(),
req.url,
req.status,
req.responseText ? req.responseText.length : null
)
}
@liviu-
liviu- / tota11y.user.js
Last active August 29, 2015 14:23
tota11y userscript
// ==UserScript==
// @name Tota11y userscript
// @namespace https://khan.github.io/tota11y/
// @description Tota11y userscript version
// @version 1
// @match *://*/*
// @require https://khan.github.io/tota11y/tota11y/build/tota11y.min.js
// @grant none
// ==/UserScript==
@scascketta
scascketta / 11106@2015-01-20T14:57:00-06:00<---->2015-01-20T15:31:00-06:00.geojson
Last active August 29, 2015 14:13
Recorded location of three CapMetro vehicles on 01/20/15. Click on an individual marker to see the time at that position.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
# coding: utf-8
# GistID: 7799767
from __future__ import print_function
# import cStringIO
import itertools
import os
import re
@aklowther
aklowther / Log Define
Last active December 16, 2015 08:19
Replace NSLog for more info to where the printout is. Add to project .pch file to use in the whole project w/o needed imports
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#ifdef DEBUG
# define ULog(fmt, ...) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; }
#else
# define ULog(...)
@johntyree
johntyree / dualscreen.sh
Created March 14, 2013 17:51
Easy xRandr settings.
#!/bin/sh
# GistID: 5163520
usage () {
echo "Usage: $0 OPTION
Change multi-head display settings.
Options:
-a Do something reasonable
-0 Laptop
-1 Laptop + VGA