Skip to content

Instantly share code, notes, and snippets.

View 509dave16's full-sized avatar

David Fall 509dave16

  • ex-Gopuff
  • Spokane, WA
View GitHub Profile
@509dave16
509dave16 / auth.service.ts
Created July 12, 2018 15:57
Auth Service for Gun.js
import { gun } from './gun.service';
export const STATUS_SUCCESS = 'success';
export const STATUS_ERROR = 'error';
const ACTION_CREATE = 'create';
const ACTION_AUTH = 'auth';
const SESSION_KEY_USERNAME = 'rt_username';
const SESSION_KEY_PASSWORD = 'rt_password';
export interface Credentials {
username: string;
@509dave16
509dave16 / auth.service.ts
Created July 12, 2018 15:57
Auth Service for Gun.js
import { gun } from './gun.service';
export const STATUS_SUCCESS = 'success';
export const STATUS_ERROR = 'error';
const ACTION_CREATE = 'create';
const ACTION_AUTH = 'auth';
const SESSION_KEY_USERNAME = 'rt_username';
const SESSION_KEY_PASSWORD = 'rt_password';
export interface Credentials {
username: string;
@509dave16
509dave16 / firebase.json
Created June 24, 2018 02:08
Example firebase config file
{
"hosting": {
"public": "www",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
@509dave16
509dave16 / .eslintrc.json
Created June 24, 2018 02:06
Sample eslint config file
{
"rules": {
"indent": ["error", 2],
"linebreak-style": ["error", "unix"]
}
}
@509dave16
509dave16 / preact.config.js
Created June 24, 2018 02:05
Sample preact.config.js with wepback modifications
/**
* Function that mutates original webpack config.
* Supports asynchronous changes when promise is returned.
*
* @param {object} config - original webpack config.
* @param {object} env - options passed to CLI.
* @param {WebpackConfigHelpers} helpers - object with useful helpers when working with config.
**/
import AggressiveMergingPlugin from "./node_modules/webpack/lib/optimize/AggressiveMergingPlugin";
import CompressionPlugin from "compression-webpack-plugin";
import './style';
import react, {Component} from 'react';
import { render } from 'react-dom';
import Framework7 from 'framework7';
import Framework7React, {App as F7App, View, Page} from 'framework7-react';
import Something from './something/something';
Framework7.use(Framework7React);
class TestPage extends Component {
render() {
@509dave16
509dave16 / sample-json-schema.json
Last active June 14, 2018 17:54
Sample JSON Schema
{
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"pattern": "^\\w+\\s\\w+$"
},
"username": {
"type": "string",
{
"name": "AwesomeProjectTS",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start --transformer node_modules/react-native-typescript-transformer/index.js --skipflow --sourceExts ts,tsx",
"test": "jest"
},
"dependencies": {
"react": "16.2.0",
{
"compilerOptions": {
"jsx": "react",
"target": "es5",
"module": "es2015",
"types": ["react", "react-native", "jest", "realm"],
"lib": ["es2015", "dom"],
"moduleResolution": "node",
"experimentalDecorators": true,
"noEmit": true,
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
class DogModel {
public static schema: Realm.ObjectSchema = {name: 'Dog', properties: {name: 'string'} };
public name: string ;