Skip to content

Instantly share code, notes, and snippets.

View zackify's full-sized avatar
🤠
coding like crazy

Zach Silveira zackify

🤠
coding like crazy
View GitHub Profile
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@zackify
zackify / index.js
Last active December 17, 2018 06:11
Wait on components to load before changing routes in react router v4
import Route from "utils/route"
import Link from "utils/link"
import { Match, Redirect } from "react-router"
export default () => (
<div>
{*/will wait for ./views/employers.js to load before changing route */}
<Link className='-active' to='/employers'>employers</Link>
<Match
@zackify
zackify / app.js
Created January 9, 2017 14:50
Lazy load in webpack 2
import Header from './header'
import Lazy from 'utils/lazy'
import { BrowserRouter } from 'react-router'
export default () => (
<BrowserRouter>
<div>
<Header />
<Lazy
module={System.import('./footer')}
Possible Unhandled Promise Rejection (id: 0):
this.H.INTERNAL.factories[a] is not a function
@zackify
zackify / webpack.prod.config.js
Created July 31, 2016 20:50
my production webpack config
var webpack = require('webpack')
var path = require('path')
module.exports = {
entry: {
main: ['babel-polyfill', './routers/client.jsx'],
},
output: {
path: __dirname + '/public/assets/js/',
filename: '[name].js',
@zackify
zackify / example.js
Last active March 8, 2016 19:33
ajax redux middleware
return {
type: 'ajax',
url: 'http://google.com',
method: 'POST',
body: state => {
/*
return false will skip the request
and call .then with skip = true
useful if you call this action and no data has changed
@zackify
zackify / init.js
Created February 15, 2016 17:07
Resolve paths on server and client
//server initialize with babel
require('babel-register')({
"presets": [
"react",
"es2015"
],
"plugins": [
"transform-object-rest-spread",
"transform-class-properties"
@zackify
zackify / binder.jsx
Created February 5, 2016 02:16
Auto-binds actions to your redux store. Idk if this has been done or not haha
import { connect } from 'react-redux'
export const binder = component => {
return class Binder extends React.Component {
static contextTypes = {
store: React.PropTypes.object
};
render() {
let boundActions = {}
for(let action in component.actions) {
@zackify
zackify / transition.jsx
Last active January 31, 2016 23:46
transition in react router demo
import React from 'react'
export default class Transition extends React.Component{
static contextTypes = {
router: React.PropTypes.object
};
constructor(props){
super()
let opacity = 1
import React from 'react-native';
var Dimensions = require('Dimensions');
var windowSize = Dimensions.get('window');
import SafariView from 'react-native-safari-view'
var {
StyleSheet,
Text,
View,
TextInput,