Skip to content

Instantly share code, notes, and snippets.

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

Matt Hamil matthamil

๐Ÿˆ
View GitHub Profile
@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,

// @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 / 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`);
# Path to your oh-my-zsh installation.
export ZSH=/Users/matthamil/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
#!/bin/bash
printf "๐Ÿค” Repo Name: "
read name
printf "โœ๏ธ $name Description: "
read description
printf "โœจ Creating repo: $name\n"
curl -u matthamil https://api.github.com/user/repos -d '{ "name": "'"$name"'",
"description": "'"$description"'" }'
git init
touch .gitignore
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
gulp.task('sass', () => {
return gulp.src('./src/sass/quiz.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./src/compiled-css'));
});
#!/bin/bash
echo ==== Boilerplate Generator 1.0 ====
wget https://github.com/matthamil/frontend-boilerplate/archive/master.zip
echo * Unzipping
unzip master.zip
rm master.zip
mv frontend-boilerplate-master/* .
mv frontend-boilerplate-master/.* .
rm -rf frontend-boilerplate-master/
bower install
{
"name": "template",
"version": "1.0.0",
"description": "boilerplate repo for new projects",
"main": "index.js",
"scripts": {
"deploy": "gh-pages -d src",
"start": "http-server src",
"test": "open http://localhost:8080/bower_components/test.html"
},
module.exports = function(grunt) {
grunt.initConfig({
browserify: {
'../dist/app.js': ['../js/quiz.js']
},
jshint: {
options: {
predef: [ "document", "console" ],
esnext: true,
@matthamil
matthamil / breadthfirstsearch.py
Last active March 7, 2016 04:24
Python implementation of breadth-first search
class SearchNode:
def __init__(self, action, state, parent):
self.state = state
self.action = action
self.parent = parent
def path(self):
if self.parent == None:
return [(self.action, self.state)]
else:
return self.parent.path() + [(self.action, self.state)]