Skip to content

Instantly share code, notes, and snippets.

View rahsheen's full-sized avatar

Rahsheen Porter rahsheen

View GitHub Profile
@rahsheen
rahsheen / FirebaseProfilePhoto.tsx
Created March 21, 2020 15:33
Component to allow display and upload of image to Firebase.
import React, {Component} from 'react'
import {TouchableOpacity, StyleSheet, Image, Alert, View} from 'react-native'
import ImagePicker from 'react-native-image-picker'
import Permissions from 'react-native-permissions'
import firebase from 'react-native-firebase'
import {Avatar} from 'react-native-elements'
const options = {
title: 'Select Avatar',
storageOptions: {
import React, { useEffect, useState } from "react";
import SignUp from "../components/SignUp";
import { useAuth } from "./auth-context";
const getUserData = async (idToken: string) => {
const response = await fetch(`http://localhost:4000/user`, {
headers: {
Accept: "application/json",
Authorization: "Bearer " + idToken
}
@rahsheen
rahsheen / dump.sql
Last active December 31, 2019 01:47
CREATE TABLE public.boxes (
id integer NOT NULL,
hand_amount money NOT NULL,
frequency integer DEFAULT 2 NOT NULL,
start_date date NOT NULL
);
CREATE SEQUENCE public.boxes_id_seq
AS integer
START WITH 1
INCREMENT BY 1
import Service from '@ember/service';
import { service } from '@ember-decorators/service';
import GlobalsService from './globals';
import Fetch from './fetch';
import { alias } from '@ember-decorators/object/computed';
export default class TosAgreement extends Service {
@service globals!: GlobalsService;
@service fetch!: Fetch;
@rahsheen
rahsheen / build.gradle
Last active September 30, 2018 18:45
Gradle files
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
firebaseVersion = "16.0.3"
@rahsheen
rahsheen / rspec_mock_net_http.rb
Created November 30, 2017 19:33
Easily Mock Net::HTTP with Rspec
require 'rails_helper'
RSpec.describe MyWorker, type: :job do
include ActiveJob::TestHelper
let(:sqs_msg) { double AWS::SQS::ReceivedMessage,
id: 'fc754df7-9cc2-4c41-96ca-5996a44b771e',
body: 'test',
delete: nil }
{:include=>[:"active-alarms", :"alarm-groups", {:installations=>[:address, {:analogs=>[:"last-analog-reading", :"second-to-last-analog-reading"]}, {:"analog-outputs"=>[:"last-analog-output-reading"]}, {:counters=>[:"cache-reading"]}, {:"digital-inputs"=>{:"last-digital-input-reading"=>[:"digital-input-reading"]}}, {:"digital-outputs"=>{:"last-digital-output-reading"=>[:"digital-output-reading"]}}, :"rain-counters", :"plc-registers", {:pumps=>[:"digital-input", :"digital-output"]}, {:valves=>[:"digital-input", :"digital-output"]}, {:rtu=>[:"gpg-remotes", {:stackup=>{:modem=>[{:provisioning=>:surname}]}}]}]}, {:"gpg-neighborhoods"=>{:"gpg-remote-installations"=>[:"gpg-remote", :address]}}, {:"dashboard-displays"=>{:"dashboard-elements"=>[:"dashboard-elements"]}}], :expose=>{:context=>{:current_user=>#<User id: 82, username: "httadmin", contact_id: 81, created_at: "2016-03-03 16:54:16", updated_at: "2017-11-07 15:37:53", auth_token: "-xJKVcZhtqafFuFjGxU5", second_factor_attempts_count: 0, encrypted_otp_secret_ke
@rahsheen
rahsheen / react-wizard.jsx
Last active May 29, 2017 19:57
React Wizard Interface
// via @wordyallen
class ModalContent extends React.Component{
state={currentView:0}
style=create({
card:{
justifyContent:'space-around',
alignItems:'center',
minWidth:300,
}