Skip to content

Instantly share code, notes, and snippets.

View techlab23's full-sized avatar
🚀
Right steps

Shirish Nigam techlab23

🚀
Right steps
  • Techlab23
  • Brisbane, Australia
  • 15:54 (UTC +10:00)
  • X @_shirish
View GitHub Profile
@techlab23
techlab23 / example.js
Created February 21, 2018 12:26 — forked from colingourlay/example.js
Lodash / Underscore sort object keys. Like _.sortBy(), but on keys instead of values, returning an object, not an array. Defaults to alphanumeric sort.
var obj = {b: 3, c: 2, a: 1};
_.sortKeysBy(obj);
// {a: 1, b: 3, c: 2}
_.sortKeysBy(obj, function (value, key) {
return value;
});
// {a: 1, c: 2, b: 3}
@techlab23
techlab23 / App.vue
Last active February 28, 2018 06:15
App.vue to use dark theme provided by Vuetify.
<template>
<v-app id="app" dark>
<v-toolbar app fixed dense>
<v-toolbar-title>
Trackie<sup> pro</sup>
<span class="hidden-xs-only subheading"> - Your personal health tracker</span>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn v-if="hasCurrentUser" value="left" @click="signOut">
<span class="mr-1">{{ currentUser.displayName }}</span>
@techlab23
techlab23 / Home.vue
Created February 25, 2018 18:25
Default home page to show - build time variables
<template>
<v-container fluid>
<v-slide-y-transition mode="out-in">
<v-layout column align-center>
<blockquote>
<div>PROJECT_ID: {{ getEnvironment.PROJECT_ID }} </div>
<div>AUTH_DOMAIN: {{ getEnvironment.AUTH_DOMAIN }} </div>
</blockquote>
</v-layout>
</v-slide-y-transition>
<template>
<v-container fluid>
<v-slide-y-transition mode="out-in">
<v-layout column align-center>
<blockquote>
<div>Hello World</div>
</blockquote>
</v-layout>
</v-slide-y-transition>
</v-container>
@techlab23
techlab23 / index.js
Last active February 28, 2018 05:44
Vue Router with home component
import Vue from 'vue'
import Router from 'vue-router'
// Importing Home component
import Home from '@/components/Home'
// Importing login component
import Login from '@/components/shared/Login'
// Importing our store to get access to getters
import store from '../store'
Vue.use(Router)
@techlab23
techlab23 / .env
Created February 26, 2018 02:17
.env file with Firebase development project configuration variables
API_KEY= <your-firebase-development-project-api-key-without-quotes>
AUTH_DOMAIN= <your-firebase-development-project-auth-domain-without-quotes>
DATABASE_URL = <your-firebase-development-project-database-url-without-quotes>
PROJECT_ID = <your-firebase-development-project-id-without-quotes>
STORAGE_BUCKET = <your-firebase-development-project-storage-bucket-without-quotes>
MESSENGER_SENDER_ID = <your-firebase-development-project-messenger-sender-id-without-quotes>
@techlab23
techlab23 / dev.env.js
Created February 26, 2018 02:32
Dev environment file used at build time to use firebase config variables from either process.env or .env file
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
const envConf = require('dotenv').config()
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
API_KEY: JSON.stringify(process.env.API_KEY || envConf.API_KEY) ,
@techlab23
techlab23 / prod.env.js
Created February 26, 2018 02:39
.env file to be used in production settings.
module.exports = {
NODE_ENV: '"production"',
API_KEY: JSON.stringify(process.env.API_KEY) ,
AUTH_DOMAIN: JSON.stringify(process.env.AUTH_DOMAIN) ,
DATABASE_URL: JSON.stringify(process.env.DATABASE_URL) ,
PROJECT_ID: JSON.stringify(process.env.PROJECT_ID) ,
STORAGE_BUCKET: JSON.stringify(process.env.STORAGE_BUCKET) ,
MESSENGER_SENDER_ID: JSON.stringify(process.env.MESSENGER_SENDER_ID)
}
@techlab23
techlab23 / netlify.toml
Created February 26, 2018 02:59
Netlify build time configuration file.
[build]
publish = "dist"
command = "npm run build"
# Production context: All deploys to the main
# repository branch will inherit these settings.
[context.production]
[context.production.environment]
NODE_ENV = "production"
@techlab23
techlab23 / firebase.js
Created February 26, 2018 03:12
Firebase configuration file
import firebase from 'firebase'
// Initialize Firebase
// Set the configuration for your app
const config = {
apiKey: process.env.API_KEY,
authDomain: process.env.AUTH_DOMAIN,
databaseURL: process.env.DATABASE_URL,
projectId: process.env.PROJECT_ID,