This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react' | |
| import { BrowserRouter as Router, Route, Link, Match, Redirect, Switch } from 'react-router-dom' | |
| import OverviewPage from './page/OverviewPage' | |
| import AccountPage from './page/AccountPage' | |
| /* | |
| Layouts, inline define here for demo purpose | |
| you may want to define in another file instead | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ApplicationHelper | |
| def current_class?(test_path) | |
| return 'active' if request.path == test_path | |
| '' | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Gulp 4 | |
| var gulp = require('gulp'); | |
| var using = require('gulp-using'); | |
| var grep = require('gulp-grep'); | |
| var changed = require('gulp-changed'); | |
| var del = require('del'); | |
| var coffee = require('gulp-coffee'); | |
| var less = require('gulp-less'); | |
| var coffeelint = require('gulp-coffeelint'); | |
| var sourcemaps = require('gulp-sourcemaps'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var gulp = require('gulp'), | |
| watch = require('gulp-watch'), | |
| prefixer = require('gulp-autoprefixer'), | |
| uglify = require('gulp-uglify'), | |
| sass = require('gulp-sass'), | |
| sourcemaps = require('gulp-sourcemaps'), | |
| rigger = require('gulp-rigger'), | |
| cssmin = require('gulp-minify-css'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // A typesafe shopping cart in typescript. | |
| // Immutable map :) | |
| declare class Map<T, U> { | |
| set(t:T, u:U):Map<T, U> | |
| has(t:T):boolean; | |
| delete(t:T):Map<T,U> | |
| count:number; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var provider = new firebase.auth.GoogleAuthProvider(); | |
| document.getElementById('signIn').addEventListener('click', function (e) { | |
| firebase.auth().signInWithRedirect(provider); | |
| }); | |
| document.getElementById('signOut').addEventListener('click', function (e) { | |
| firebase.auth().signOut() | |
| .then(function () { | |
| console.log('User signed out'); | |
| }).catch(function (error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var storageRef = firebase.storage().ref('media_content'); | |
| document.getElementById('fileUpload').addEventListener('change', function (e) { | |
| var fileToUpload = e.target.files[0]; | |
| var fileToUploadRef = storageRef.child(fileToUpload.name); | |
| var task = fileToUploadRef.put(fileToUpload); | |
| // The put method returns an observer called state_changed that can raise the events: running / progress / pause. | |
| // We can use these events to manage UI elements like a progress bar. | |
| // A template for that would be: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Credits to the awesome Brad Traversy, check out this video at: https://www.youtube.com/watch?v=PP4Tr0l08NE | |
| var messagesRef = firebase.database().ref('messages'); | |
| document.getElementById('contactForm').addEventListener('submit', submitForm); | |
| function submitForm(e) { | |
| e.preventDefault(); //prevent reloading the html page | |
| var name = getInputVal('name'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is the index.js file in which we write our cloud functions | |
| const https = require('https'); | |
| const functions = require('firebase-functions'); | |
| // Function that listens to a firestore events | |
| exports.messageSniffer = functions.firestore | |
| .document('forms/{userName}') | |
| .onCreate(event => { | |
| var dataWritten = event.data.data(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { firestore } from './firebase' | |
| export function updateDocument(path, data) { | |
| return firestore.doc(path).update(data); | |
| } | |
| export function deleteDocument(path) { | |
| return firestore.doc(path).delete(); | |
| } |