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
const webpack = require('webpack') | |
const path = require('path') | |
const nodeExternals = require('webpack-node-externals') | |
const StartServerPlugin = require('start-server-webpack-plugin') | |
module.exports = { | |
entry: [ | |
'webpack/hot/poll?1000', | |
'./local/server' | |
], | |
watch: true, |
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
const http = require('http') | |
const express = require('express') | |
const port = 3000 | |
// This function creates an Express app to emulate Google Cloud | |
// Platform's Cloud Function httpsTrigger[s] then registers all of | |
// the Cloud Function handlers with the Express app. We'll be passing in | |
// all of the exports from our index.js file as the "functions" parameter | |
// below. | |
const setUpApp = (functions) => { |
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
struct UserLogin { | |
password: String, | |
username: String, | |
} | |
let loginInfo: UserLogin = getLoginFromEnvironment(); | |
// These variable names must match the struct names for the short syntax. | |
let UserLogin { username, password } = loginInfo; | |
// You can rebind explicitly, if you want new names. | |
let UserLogin { username: myUsername, password: myPassword } = loginInfo; |
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
data class UserLogin(val password: String, val username: String) | |
val loginInfo: UserLogin = getLoginFromEnvironment() | |
val (username, password) = loginInfo | |
System.out.println("Trying to log in with username $username.") | |
performLogin(username, password) |
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
data class UserLogin(val username: String, val password: String) | |
val loginInfo: UserLogin = getLoginFromEnvironment() | |
val (username, password) = loginInfo | |
System.out.println("Trying to log in with username $username.") | |
performLogin(username, password) |
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
// Arguments for an execution of 'rm'. Now with sorted flags! | |
data class RmOptions(val path: String, val force: Boolean, val recursive: Boolean) | |
val options: RmOptions = getOptions() | |
// (oops) | |
val (path, recursive, force) = options | |
val args = ArrayList<String>() | |
if (recursive) { | |
args.append("-r") |
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
data class User(val field0: String, val field1: Int) | |
val myUser = User("Chip", 15) | |
val userName = myUser.field0 | |
val userAge = myUser.field1 |
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
data class User(val name: String, val age: Int) | |
val myUser = User("Chip", 15) | |
// Destructuring myUser into two fields. | |
val (userName, userAge) = myUser |
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
#!/usr/bin/env bash | |
# "Do no harm" autoformatter pre-commit script template. | |
# This example uses gofmt on all .go files. | |
# Files matching this pattern will be auto-formatted. | |
FILE_PATTERN='\.go$' | |
# The tool to check for. | |
FORMAT_TOOL=gofmt |
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
# Vim swap files. | |
.*.sw[p-z] | |
# Emacs backups. | |
*~ | |
# OS X cache files. | |
.DS_Store | |
.Trashes | |
.Spotlight-V100 |