Skip to content

Instantly share code, notes, and snippets.

View Falieson's full-sized avatar
:shipit:

Florian Mettetal Falieson

:shipit:
View GitHub Profile
@Falieson
Falieson / tgr_tsmod_2.03.ts
Last active May 31, 2018 18:28
S2. F03. import HelloWorld and use it (ARTICLE: TS-Module w/ Declarations (Part 1/4))
/** TS-Module w/ Declarations (Part 1/4)
* http://TGRstack.com/#ts-module_articles_part-1
* ./src/index.ts (Section 2. Figure 03.)
**/
import {default as HelloWorld} from './HelloWorld'
const FirstPart: string = "Hi"
const LastPart: string = "Earth"
console.log(HelloWorld(FirstPart, LastPart))
@Falieson
Falieson / tgr_tsmod_2.02.ts
Last active May 31, 2018 21:21
S2. F02. Init HelloWorld (ARTICLE: TS-Module w/ Declarations (Part 1/4))
/** TS-Module w/ Declarations (Part 1/4)
* http://TGRstack.com/#ts-module_articles_part-1
* ./src/HelloWorld.ts (Section 2. Figure 02.)
**/
function HelloWorldMaker(first: string, second: string): string {
return `${first} ${second}`
}
export default HelloWorldMaker
@Falieson
Falieson / tgr_tsmod_2.01.bash
Last active May 31, 2018 18:27
S2. F01. Init HelloWorld (ARTICLE: TS-Module w/ Declarations (Part 1/4))
### TS-Module w/ Declarations (Part 1/4)
# http://TGRstack.com/#ts-module_articles_part-1
# Init HelloWorld.ts (Section 2. Figure 01.)
###
falieson:./ts-module/$ mkdir src
falieson:./ts-module/$ touch src/index.ts src/HelloWorld.ts
@Falieson
Falieson / tgr_tsmod_1.04.ts
Created May 31, 2018 16:44
S1. F04. example of implicitAnyIndex in TypeScript (ARTICLE: TS-Module w/ Declarations (Part 1/4))
/** TS-Module w/ Declarations (Part 1/4)
* http://TGRstack.com/#ts-module_articles_part-1
* example of ENUM w/ Redux ./tsconfig.json (Section 1. Figure 04.)
**/
interface ISomeObject {
firstKey: string;
secondKey: string;
thirdKey: string;
[key: string]: string;
}
@Falieson
Falieson / tgr_tsmod_1.03.js
Created May 31, 2018 16:30
S1. F03. ENUM example (ARTICLE: TS-Module w/ Declarations (Part 1/4))
/** TS-Module w/ Declarations (Part 1/4)
* http://TGRstack.com/#ts-module_articles_part-1
* example of ENUM w/ Redux ./tsconfig.json (Section 1. Figure 03.)
**/
const ACTION_NAME = 'ACTION_NAME' // <== this is the ENUM
const actions = {
doAction: function (someArgs) {
return {
type: ACTION_NAME,
payload: someArgs
@Falieson
Falieson / WebDeveloperAcronyms.md
Created May 31, 2018 16:16
Collection of WebDeveloper Acronyms and Terminology

CWD

current working directory (linux)

PWD

current full path (linux)

@Falieson
Falieson / tgr_tsmod_1.02.json5
Last active May 31, 2018 16:10
S1. F02. tsconfig.json (ARTICLE: TS-Module w/ Declarations (Part 1/4))
/** TS-Module w/ Declarations (Part 1/4)
* http://TGRstack.com/#ts-module_articles_part-1
* description of ./tsconfig.json (Section 1. Figure 02.)
* complete file: https://github.com/Falieson/2018-typescript-module/blob/master/tsconfig.json
**/
{
"exclude": [ // regexes to exclude from the compiler
"dist", // don't compile previous iterations of the output
"**/*.spec|test.ts" // don't compile testes
@Falieson
Falieson / tgr_tsmod_1.01.bash
Last active May 31, 2018 16:08
S1. F01. Project Initialization (ARTICLE: TS-Module w/ Declarations (Part 1/4))
### TS-Module w/ Declarations (Part 1/4)
# http://TGRstack.com/#ts-module_articles_part-1
# Project Initialization (Section 1. Figure 01.)
###
falieson:~/$ mkdir -p ~/Code/Templates/ts-module/ && cd ~/Code/Templates/ts-module
falieson:./ts-module/$ npm i -g typescript # global install (i'm using version 2.8.3)
falieson:./ts-module/$ tsc -init
@Falieson
Falieson / Passport.ts
Last active February 14, 2018 20:13
GQL passport auth
// data/models/Passport.ts
import * as mongoose from 'mongoose'
import * as passport from 'passport'
import * as passportLocalMongoose from 'passport-local-mongoose'
import Model from './mongoose'
(mongoose as any).Promise = global.Promise
const ObjectIdType = mongoose.Schema.Types.ObjectId
// db/postgres.config.js
module.exports = {
client: 'pg',
connection: 'postgres://postgres@localhost:5432/ult1706',
migrations: {
directory: __dirname + "/migrations",
tableName: 'migrations',
},
seeds: {
directory: __dirname + "/seeds",