Skip to content

Instantly share code, notes, and snippets.

View spikebrehm's full-sized avatar

Spike Brehm spikebrehm

View GitHub Profile
@spikebrehm
spikebrehm / modifierKey.js
Created September 19, 2012 02:50
Determine if a modifier key is pressed in JavaScript.
// modifierKey used to check if cmd+click, shift+click, etc.
!function($, global){
var $doc = $(document);
var keys;
global.modifierKey = false;
global.keys = keys = {
'UP': 38,
'DOWN': 40,
@spikebrehm
spikebrehm / Redux-resources.md
Last active September 16, 2018 14:42
Redux resources, courtesy of Dan Abramov.
@spikebrehm
spikebrehm / App.js
Created April 28, 2017 21:47
React VR blog post: Day 1 posters example
import React, { Component } from 'react';
import {
asset,
Pano,
View,
StyleSheet,
} from 'react-vr';
import Poster from './Poster';
import posters from '../posters.json';
@spikebrehm
spikebrehm / SimpleComponent.jsx
Created April 24, 2017 20:02
Simple example of a React component
class SimpleComponent extends React.Component {
render() {
return (
<View>
<Header title="A simple example" />
<Button onPress={onPressButton}>
Press me
</Button>
</View>
);
[ignore]
# This config is based on the `.flowconfig` file generated by `react-native
# init`.
# We fork some components by platform
.*/*[.]android.js
# Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
@spikebrehm
spikebrehm / ErrorBridge.m
Created August 29, 2016 23:27
React Native error bridge
#import "ErrorBridge.h"
#import <React/RCTRedbox.h>
@implementation ErrorBridge
@synthesize bridge = _bridge;
RCT_EXPORT_MODULE()
- (NSArray<NSString *> *)supportedEvents
var gulp = require('gulp')
, browserify = require('gulp-browserify')
, hbsfy = require('hbsfy')
;
gulp.task('scripts', function() {
return gulp.src('./js/main.js')
.pipe(browserify({
debug: true,
transform: ['hbsfy'],
@spikebrehm
spikebrehm / gulpfile.js
Created January 14, 2014 20:00
Why is hbsfy not working? Where the heck does this error come from?
var gulp = require('gulp')
, browserify = require('gulp-browserify')
;
gulp.task('scripts', function() {
return gulp.src('./js/sample.js')
.pipe(browserify({
debug: true,
transform: ['hbsfy'],
}))
$ make build
./node_modules/.bin/browserify entry.js -o bundle.js
Error: Cannot find module 'router.js' from '/Users/spike/code/router.js-browserify-example'
var spec = {
collection: {
collection: 'Databases',
params: {database_name: params.database_name},
},
};