Skip to content

Instantly share code, notes, and snippets.

View reneviering's full-sized avatar

René Viering reneviering

View GitHub Profile
@cvbuelow
cvbuelow / reducers.js
Last active July 25, 2019 11:10 — forked from gaearon/reducers.js
Code splitting in Redux with SSR
import { combineReducers } from 'redux';
import users from './reducers/users';
import posts from './reducers/posts';
// Inject the initial state for async loaded reducers
function injectState(reducers, preloadedState = {}) {
return Object.keys(reducers).reduce((finalReducers, key) => {
if (typeof reducers[key] === "function") {
finalReducers[key] = (state = preloadedState[key], action) => reducers[key](state, action);
}
@brennanMKE
brennanMKE / README.md
Created October 4, 2016 16:10
React Native on macOS Sierra

React Native Trouble

Updating to macOS Sierra is causing trouble with React Native due to some of the Node.js and system utilities it uses. Specifically the watch utility fails due to a limit on the number of files which can be opened at a time.

The following command shows the current limit.

launchctl limit maxfiles
@markerikson
markerikson / appEntryPoint.js
Last active August 1, 2022 07:41
Webpack React/Redux Hot Module Reloading (HMR) example
import React from "react";
import ReactDOM from "react-dom";
import configureStore from "./store/configureStore";
const store = configureStore();
const rootEl = document.getElementById("root");
@chantastic
chantastic / on-jsx.markdown
Last active May 30, 2024 13:11
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@casperin
casperin / func.js
Last active July 9, 2020 07:12
Some examples of currying and composing functions in javascript
var log = console.log.bind(console);
// Core component (not curried).
// compose(g, f) === function (x) { return g(f(x)); }
// Takes any number of functions as arguments
// from underscore.js
function compose (/* fn1, fn2, ... */) {
var funcs = arguments;
return function() {
var args = arguments;
@WickyNilliams
WickyNilliams / bad.js
Last active January 30, 2020 17:46
fast builds with grunt and browserify
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
pkg : grunt.file.readJSON("package.json"),
paths : {
src : "<%= pkg.main %>",
@BrandonSmith
BrandonSmith / AndroidManifest.xml
Last active July 19, 2023 19:11
Quick example of how to schedule a notification in the future using AlarmManager
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cards.notification">
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"