Skip to content

Instantly share code, notes, and snippets.


  • United States
Block or report user

Report or block nbkhope

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ZwaarContrast / signin.js
Last active Jan 3, 2018
Sign in Component using updated redux-form.
View signin.js
import React, { Component } from 'react';
import {Field,reduxForm} from 'redux-form';
import {connect} from 'react-redux';
import * as actions from '../../actions';
class Signin extends Component {
handleSignin({ email, password }){
// Log values
console.log('Email', email);
markerikson / render-logic.js
Last active Oct 27, 2019
React render function organization
View render-logic.js
class ParentComponent extends Component {
render() {
// My basic render function structure:
// 1) Extract values from props and state
const {a, b, someBoolean, someList} = this.props;
// 2) Render any dependent items into temporary variables, such as conditional components or lists
const conditionalComponent = someBoolean ? <SomeComponent /> : null;
const listItems = => <ListItem item={item} />);
markerikson /
Last active Oct 24, 2019
Summary of process.env.NODE_ENV and its use with Webpack

[02:06 PM] acemarke: @Steven : a couple other thoughts on the whole NODE_ENV thing. First, per my comments, it really is a Node concept. It's a system environment variable that Node exposes to your application, and apparently the Express web server library popularized using its value to determine whether to do optimizations or not
[02:08 PM] acemarke: Second, because of its use within the Node ecosystem, web-focused libraries also started using it to determine whether to they were being run in a "development" environment vs a "production" environment, with corresponding optimizations. For example, React uses that as the equivalent of a C #ifdef to act as conditional checking for debug logging and perf tracking. If process.env.NODE_ENV is set to "production", all those if clauses will evaluate to false.
Third, in conjunction with a tool like UglifyJS that does minification and removal of dead code blocks, a clause that is surrounded with if(process.env.NODE_ENV !== "development")

coryhouse / package.json
Last active Oct 22, 2019
Example of pre and post scripts in package.json
View package.json
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"prebuild": "echo I run before the build script",
"build": "cross-env NODE_ENV=production webpack",
"postbuild": "echo I run after the build script"
View ListView-Redux.js
* @providesModule PatientList
import NavigationBar from 'react-native-navbar';
import NavigationButtons from 'NavigationButtons';
import React, { ListView, Navigator, StyleSheet, Text, TextInput, TouchableHighlight, View } from 'react-native';
import { connect } from 'react-redux/native'
@connect(state => ({
patients: state.patients
fxg42 / HelloController.groovy
Last active Jan 26, 2017
Comparing Express, Phoenix, Rails, Flask, Grails and... PHP?
View HelloController.groovy
class HelloController {
def index() {
render([ hello:"world!" ] as grails.converters.JSON)
ktuukkan / JsonMarshallers.groovy
Last active Apr 12, 2017
Custom Grails JSON marshalling
View JsonMarshallers.groovy
package example
import example.Book
import example.Author
import grails.converters.JSON
* Probably the cleanest way to define custom JSON marshalling in Grails.
* Imagine Book and Author are domain classes with some typical fields.
nulltask / app.js
Created Mar 17, 2012
Output CSV in Express
View app.js
* Module dependencies.
var express = require('express')
, app = module.exports = express.createServer();
// Configuration
jagregory / gist:710671
Created Nov 22, 2010
How to move to a fork after cloning
View gist:710671
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
You can’t perform that action at this time.