start new:
tmux
start new with session name:
tmux new -s myname
| // require modules | |
| var restify = require('restify'), | |
| i18n = require('i18n'), | |
| app; | |
| // minimal config | |
| i18n.configure({ | |
| locales: ['en', 'de'], | |
| directory: __dirname + '/locales' | |
| }); |
| import {call, put, take, fork} from 'redux-saga/effects' | |
| import {END} from 'redux-saga' | |
| import CategoryActions, {CategoryTypes} from '../Redux/CategoryRedux' | |
| // attempts to fetch category | |
| export function* fetchCategoryServer (api) { | |
| let action = yield take(CategoryTypes.CATEGORY_SERVER) | |
| // check when it stopped | |
| while (action !== END) { | |
| yield fork(fetchCategoryAPI, api) |
using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
| const Joi = require('joi') | |
| const main = () => { | |
| const VALID_TITLES = ["Mr.", "Mrs.", "Ms."] | |
| const ADDRESS_HOME = "Home" | |
| const ADDRESS_OFFICE = "Office" | |
| const VALID_ADDRESS_TYPES = [ADDRESS_HOME, ADDRESS_OFFICE] | |
| const digitalSchema = Joi.object().keys({ |
| /* | |
| * Node.js Sample Server with Restify | |
| * Copyright (C) 2014 - Thiago Uriel M. Garcia | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * |
| version: "2" | |
| services: | |
| postgres: | |
| image: postgres:9.4 | |
| container_name: kong-database | |
| ports: | |
| - "5432:5432" | |
| environment: | |
| - POSTGRES_USER=kong |
| # all of your tables are in a single schema, this approach could work (below code assumes that the name of your schema is public | |
| DROP SCHEMA public CASCADE; | |
| CREATE SCHEMA public; | |
| # If you are using PostgreSQL 9.3 or greater, you may also need to restore the default grants. | |
| GRANT ALL ON SCHEMA public TO postgres; | |
| GRANT ALL ON SCHEMA public TO public; |