Skip to content

Instantly share code, notes, and snippets.

View genomics-geek's full-sized avatar

Michael Gonzalez genomics-geek

View GitHub Profile
@genomics-geek
genomics-geek / README.md
Last active December 11, 2016 03:15
Setup Apache Spark on MacOSX
@genomics-geek
genomics-geek / README.md
Created October 31, 2016 01:51 — forked from jmarceli/README.md
React errors explained

1

You will get one of these:

Uncaught (in promise) TypeError: Cannot read property 'toUpperCase' of undefined(…)

ReactCompositeComponent.js:870 Uncaught TypeError: Cannot read property 'displayName' of undefined

if you try to:

@genomics-geek
genomics-geek / middleware.py
Created October 27, 2016 18:06 — forked from strogonoff/middleware.py
Django middleware for cross-domain XHR. WARNING: Defaults are unsafe here. Make sure to set proper restrictions in production!
from django import http
try:
from django.conf import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS
XS_SHARING_ALLOWED_HEADERS = settings.XS_SHARING_ALLOWED_HEADERS
XS_SHARING_ALLOWED_CREDENTIALS = settings.XS_SHARING_ALLOWED_CREDENTIALS
except AttributeError:
XS_SHARING_ALLOWED_ORIGINS = '*'
@genomics-geek
genomics-geek / redux_egghead_notes.md
Created October 26, 2016 01:29 — forked from diegoconcha/redux_egghead_notes.md
Redux Egghead.io Notes

###Redux Egghead Video Notes###

####Introduction:#### Managing state in an application is critical, and is often done haphazardly. Redux provides a state container for JavaScript applications that will help your applications behave consistently.

Redux is an evolution of the ideas presented by Facebook's Flux, avoiding the complexity found in Flux by looking to how applications are built with the Elm language.

####1st principle of Redux:#### Everything that changes in your application including the data and ui options is contained in a single object called the state tree

@genomics-geek
genomics-geek / README.md
Last active January 10, 2024 15:27
Setting up a Dockerized web application with Django REST APIs, ReactJS with Redux pattern, and Webpack Hot Reloading! Mouthful.

Guide on how to create and set up a Dockerized web app using Django REST APIs and ReactJS

Hopefully this will answer "How do I setup or start a Django project using REST Framework and ReactJS?"

This is a guide to show you step by step how this can be setup. If you just want to get started, use the cookiecuter I set up cookiecutter-django-reactjs. It basically is a fork of pydanny's cookiecutter, just added the front-end stuff :).

I created this because it was SUCH a pain in the ass setting up a project using all the latest technologies. After some research, I figured it out and have it working. The repo that implements this is located here. Feel free to use it as a boilerplate ;)

Main features:

  • Django REST APIs
@genomics-geek
genomics-geek / base.txt
Created October 12, 2016 15:14
Python Django requirments
# Django
django
# Configuration
dj-database-url
python-decouple
whitenoise
# Django 3rd party modules
djangorestframework
var path = require('path');
var webpack = require('webpack');
var BundleTracker = require('webpack-bundle-tracker')
module.exports = {
context: __dirname,
devtool: null,
entry: '../static/js/index',
output: {},
plugins: [],
@genomics-geek
genomics-geek / server.js
Created September 26, 2016 00:14
Node dev server
var webpack = require('webpack')
var WebpackDevServer = require('webpack-dev-server')
var config = require('./webpack.local.config')
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
inline: true,
historyApiFallback: true
}).listen(3000, '0.0.0.0', function (err, result) {
@genomics-geek
genomics-geek / karma.config.js
Created September 26, 2016 00:13
Karma unit testing config file
// Karma configuration
var webpackConfig = require('./webpack.local.config.js');
webpackConfig.entry = {};
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
@genomics-geek
genomics-geek / example_test.jsx
Created September 25, 2016 02:29
Example test using expect
import expect from 'expect';
describe('Something abstract', () => {
it('works', () => {
expect(1).toEqual(1);
});
});