Skip to content

Instantly share code, notes, and snippets.

View benjaminreid's full-sized avatar
💭
🦕 are my jam

Benjamin Reid benjaminreid

💭
🦕 are my jam
View GitHub Profile
// reducers setup
import AsyncStorage from '@react-native-async-storage/async-storage';
import { persistCombineReducers } from "redux-persist";
const config = {
key: STORAGE_PREFIX,
debug: ENV === "development",
storage: AsyncStorage,
};
import React from 'react';
import {Control, Controller} from 'react-hook-form';
import {TextInputProps} from 'react-native';
import styled from 'styled-components/native';
type InputType = 'text' | 'password' | 'email';
interface InputProps extends TextInputProps {
type?: InputType;
}
[{
key: "reserve",
url: "http://whatever.com/?menu=reserve",
label: "Reserve",
}, {
key: "website",
url: "http://someothersite.com",
label: "Visit Website",
}]
@benjaminreid
benjaminreid / hook.js
Last active June 7, 2019 16:08
React Native Modal Select
// @flow
import * as React from "react";
function useSelect(
initialValue: string | number,
items: Array<{ label: string, value: string | number }>,
) {
const [value, setValue] = React.useState(initialValue);
function onChangeValue(value: string) {
@benjaminreid
benjaminreid / remove-no-js.js
Created January 24, 2017 13:22
Removes the "no-js" class and replaces with "js" without altering other classes
(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)
function request() {
let options = {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': '4f2a8bb583700b1291763f0832d718b628e9abea813b5119616d7b12aa1fb531'
},
}
return fetch('http://localhost:3000/api/user', options)
@benjaminreid
benjaminreid / gulpfile.js
Created October 14, 2015 11:07
Current favourite Sass compilation with gulp, it also sucks in bower depdencies
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var filter = require('gulp-filter');
var streamify = require('gulp-streamify');
var watch = require('gulp-watch');
var bower = require('main-bower-files');
var es = require('event-stream');
@benjaminreid
benjaminreid / compare.js
Created August 27, 2015 13:54
Gulp vs Grunt
// gulp
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('sass', function () {
gulp.src('./sass/**/*.scss')
.pipe(sass())
.pipe(gulp.dest('./css'));
});
// javascripts/components/foo.js
export default function() {
console.log('foo');
}