This is the reference point. All the other options are based off this.
|-- app
| |-- controllers
| | |-- admin
// quite untested, adapted from BigstickCarpet's gist, attempt to make it simpler to use | |
function openIndexedDB (fileindex) { | |
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback | |
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
var openDB = indexedDB.open("MyDatabase", 1); | |
openDB.onupgradeneeded = function() { | |
var db = {} |
// _____ __ _ _ | |
///__ \_ _ _ __ ___/ _\ ___ _ __(_)_ __ | |_ | |
// / /\/ | | | '_ \ / _ \ \ / __| '__| | '_ \| __| | |
// / / | |_| | |_) | __/\ \ (__| | | | |_) | |_ | |
// \/ \__, | .__/ \___\__/\___|_| |_| .__/ \__| | |
// |___/|_| |_| | |
//Typescript Cheat Sheet: every syntax feature exemplified | |
//variables are the same as javascript, but can be defined with a type: | |
var myString:string; |
import { join } from 'path' | |
import { readdir, stat } from 'fs-promise' | |
async function rreaddir (dir, allFiles = []) { | |
const files = (await readdir(dir)).map(f => join(dir, f)) | |
allFiles.push(...files) | |
await Promise.all(files.map(async f => ( | |
(await stat(f)).isDirectory() && rreaddir(f, allFiles) | |
))) | |
return allFiles |
# location of keystore | |
storeFile=/path/to/app.keystore | |
# Key alias | |
keyAlias=alias_name | |
# Store password | |
storePassword=Password1 | |
# Key password |
var fs = require('fs'); | |
var Promise = require('promise'); | |
var promises = []; | |
var readline = require('readline'); | |
var readFile = function (file) { | |
return new Promise(function (resolve, reject) { | |
var lines = []; | |
var rl = readline.createInterface({ | |
input: fs.createReadStream('./logs/' + file) |
// components/Login/Login.js | |
class Login extends Component { | |
// ... | |
handleSubmit(evt) { | |
evt.preventDefault(); | |
this.props.mutate(this.state) | |
.then(({ data }) => { |
function removeVietnameseTones(str) { | |
str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a"); | |
str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e"); | |
str = str.replace(/ì|í|ị|ỉ|ĩ/g,"i"); | |
str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o"); | |
str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u"); | |
str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y"); | |
str = str.replace(/đ/g,"d"); | |
str = str.replace(/À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ/g, "A"); | |
str = str.replace(/È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ/g, "E"); |
#!/bin/bash | |
# NOTE: The commands here only applicable for Ubuntu 16.04 Xenial, do not use it for other distros | |
# Update server to latest packages | |
sudo apt update && sudo apt upgrade -y | |
# Install nginx and git | |
sudo apt install -y nginx git |
import { Injectable } from '@angular/core'; | |
import * as firebase from 'firebase'; | |
//...omitted | |
@Injectable() | |
export class AuthService { | |
resetPassword(email: string) { | |
var auth = firebase.auth(); | |
return auth.sendPasswordResetEmail(email) |