Skip to content

Instantly share code, notes, and snippets.

View matthamil's full-sized avatar
๐Ÿˆ

Matt Hamil matthamil

๐Ÿˆ
View GitHub Profile
@matthamil
matthamil / firebaseangularwebsocket.js
Last active November 21, 2016 03:47
Websockets with Angular 1 and Firebase
// First, you need a reference to your DB using the Firebase SDK
// Include <script src="path/to/firebase.js"> in index.html OR
// import firebase from 'firebase' if using a module loader like Browserify/Webpack/etc
// const DATABASEREF = firebase.database().ref(`endpoint/you/want/to/connect/to`);
// The endpoint you want to connect to is YOUR-FIREBASE-URL/<endpoint>
// I use a capital letter variable name to denote that this var (1) won't change (2) is super important so I can easily find it in my code.
// Reference to myapp-firebase.io/messages.json
const DATABASEREF = firebase.database().ref(`messages`);
// @flow
import React from 'react';
import { Image, View } from 'react-native';
/**
* Resizes an image based on the size of its container.
*/
export default class DynamicImage extends React.Component<void, *, *> {
constructor(props: *) {
super(props);
@matthamil
matthamil / ReactVRProposal.md
Last active August 15, 2017 02:46
Nodevember 2017 Proposal

React: A Romance of Many Dimensions

Abstract:

Is VR an approachable medium for JavaScript developers? Can we, as front-end developers, use what we already know to build a 3D world? Can we use React to reach the 4th dimension? Yes! ReactVR is here to let us create delightful VR experiences in the browser.

Description:

We live in a 3D world, and now the web does too. Virtual Reality games and product demos immerse the user more than the traditional 2D web experience. Luckily for us JavaScript developers,

@matthamil
matthamil / babel_the_new_jquery.md
Last active September 22, 2017 04:39
NashJS Talk - October 2017

Babel, the new jQuery

As JavaScript developers, we always want to get our hands on the latest hotness. Luckily for us, the new 2016 and 2017 specifications for ECMAScript are that new hotness. The language is changing fast, and that comes with a few downsides. At our current rate of change, browser vendors struggle to implement all of the new language features. Fortunately, Babel is a tool that most of us JavaScript developers rely on to compile our ECMAScript 2015+ into browser-friendly ES5.

However, Babel is more than an ECMAScript 2015 to ES5 transformer. Babel is a compiler. We can use Babel's compiler magic to unlock a world of potential for JavaScript developers. Let's take a dive into how Babel's works internally and discuss a subset of computer science that most of us don't think about every day--compilers! We'll walk through the stages of Babel, discover why ASTs are powerful, and write Babel plugins to super-charge our code. The discussion will then focus on the

@matthamil
matthamil / actions.js
Created October 5, 2017 21:02 — forked from jtibbertsma/actions.js
react-native-navigation redux middleware example
import { createAction } from 'redux-actions';
import {
NAVIGATION_PUSH,
NAVIGATION_POP,
NAVIGATION_RESET_TO,
NAVIGATION_POP_TO_ROOT
} from './actions';
export const push = createAction(NAVIGATION_PUSH);
export const pop = createAction(NAVIGATION_POP);
/**
* Scheduling events and goals is a core feature of our platform.
* Users should be able to set goals to complete for themselves.
* The purpose of setting goals is to keep the user motivated and help
* them to stay clean.
*
* Users can set goals for themselves that repeat multiple times a week.
* Below is an example goal from the API. Bryan created a goal for himself
* to meditate three times a week on Mondays, Wednesdays, and Fridays.
*
import * as React from 'react';
import MyFavoriteMoviesFetcher from './MyFavoriteMoviesFetcher';
import FavoriteButton from './FavoriteButton';
// MovieList has access to props passed to it.
// It also has access to favoriteMovies and viewingStats, which are values calculated from the redux store.
// It can pinpoint exactly which children/nested children need these props.
// You no longer need to pass props from parent to child to child to child. You can target the level that needs the props.
const MovieList = (props) => (
<MyFavoriteMoviesFetcher>
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'w0rp/ale'
Plug 'pangloss/vim-javascript'
Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'sheerun/vim-polyglot'
Plug 'elzr/vim-json'
@matthamil
matthamil / README.md
Last active December 14, 2018 15:34
Cool Dev Things I dont want to bookmark but want to keep
@matthamil
matthamil / machine.js
Last active September 18, 2019 18:27
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions