Skip to content

Instantly share code, notes, and snippets.

View lancevo's full-sized avatar

Lance Vo lancevo

View GitHub Profile
@lancevo
lancevo / auth.service.ts
Created October 31, 2018 15:19 — forked from codediodeio/auth.service.ts
Angular4 Firebase authentication service using OAuth, Anonymous, and Email/Password. Designed specifically for changes introduced in AngularFire2 4.0.0
import { Injectable } from '@angular/core';
import { AngularFireDatabaseModule, AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';
import { Router } from "@angular/router";
import * as firebase from 'firebase';
@Injectable()
export class AuthService {
@lancevo
lancevo / init.vim
Created September 12, 2018 13:55 — forked from celso/init.vim
Neovim setup for OSX users
syntax on
set ruler " Show the line and column numbers of the cursor.
set formatoptions+=o " Continue comment marker in new lines.
set textwidth=0 " Hard-wrap long lines as you type them.
set modeline " Enable modeline.
set esckeys " Cursor keys in insert mode.
set linespace=0 " Set line-spacing to minimum.
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
" More natural splits
set splitbelow " Horizontal split below current.
@lancevo
lancevo / ubuntu_nginx_nvm.md
Last active January 15, 2019 22:03
ubuntu nginx nvm
@lancevo
lancevo / child.component.ts
Created August 17, 2017 19:45
Mock Child Component
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-child',
templateUrl: '<ul><li *ngFor="let i of numbers">{{i}}</li></ul>',
styleUrls: ['./child.component.css']
})
export class ChildComponent implements OnInit {
@Input() numbers: number[];
@lancevo
lancevo / install_pms.sh
Created April 4, 2017 02:57
Install Plex on Ubuntu
echo deb https://downloads.plex.tv/repo/deb/ public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install plexmediaserver
@lancevo
lancevo / pms-pi3.md
Created March 4, 2017 14:17
Setup Plex Media Server on Raspberry Pi 3

Requires:

  • at least 8GB class 10 SD card for fast reading/writing
  • large powered external USB hard drive to store media, powered USB hard drive is more reliable, and it doesn't put more work on RPI to provide it power
  • recommend to user Ethernet over wifi to connect RPI

#Setup Raspian There are many OS images available for RPI, but the easiest is NOOBS. Download NOOBS and and follow instruction to set it up on a SD Card

@lancevo
lancevo / contribute.md
Last active February 20, 2017 14:03
Contribution Git Rebase Etc

New Issues are for bug reports or feature requests only!! Questions on how to use the grid should be posted to Stack Overflow or Gitter https://gitter.im/angular-ui/ui-grid.

Contributing to UI Grid

Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.

Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing

@lancevo
lancevo / validate-number-range.validator.ts
Last active August 4, 2016 19:49
A validator to validator range of number
import {AbstractControl, ValidatorFn} from '@angular/forms';
export function validateNumberRange(min: number, max:number): ValidatorFn {
return (control: AbstractControl): { [key:string]: any } => {
var value = parseInt(control.value,10);
return (isNaN(value) || (value < min) || (value > max)) ?
{'numberRange' : {'min': min, 'max':max, 'actualValue': value}} :
null
}
}

Before you start

Make sure you have python, OpenFace and dlib installed. You can either install them manually or use a preconfigured docker image that has everying already installed:

docker pull bamos/openface
docker run -p 9000:9000 -p 8000:8000 -t -i bamos/openface /bin/bash
cd /root/openface
// get weekday in Chicago CST
console.log( (new Date()).toLocaleDateString('en-US',{ timeZone: 'America/Chicago', weekday: 'long'}) );
// get time in Chicago CST
consoe.log( (new Date()).toLocaleTimeString('en-US',{ timeZone: 'America/Chicago', hour12: true}) )