Skip to content

Instantly share code, notes, and snippets.

@Tinusw
Tinusw / myController.js
Last active December 13, 2020 16:33
async/await
const mongoose = require('mongoose');
const Store = mongoose.model('Store');
const StoreB = mongoose.model('StoreB');
// Tells package to use es6 promises
mongoose.Promise = global.Promise
// Hey I'm async so i'll have awaits calls inside of me
exports.createStore = async (req, res) => {
const store = new Store(req.body);
@Tinusw
Tinusw / cloudSettings
Last active February 10, 2020 15:52
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-02-10T15:52:31.833Z","extensionVersion":"v3.4.3"}
@Tinusw
Tinusw / myController.js
Last active August 29, 2018 02:31
a promise example
const mongoose = require('mongoose');
const Store = mongoose.model('Store');
const StoreB = mongoose.model('StoreB');
// Tells package to use es6 promises
mongoose.Promise = global.Promise;
exports.createStore = (req, res) => {
const store = new Store(req.body);
const record_we_want_to_associate
{
"workbench.statusBar.visible": true,
"workbench.statusBar.feedback.visible": false,
"workbench.startupEditor": "newUntitledFile",
"window.zoomLevel": 0,
"editor.formatOnSave": true,
"javascript.format.enable": false,
"prettier.eslintIntegration": true,
"editor.scrollBeyondLastLine": false,
"editor.minimap.enabled": false,
// rake routes | grep resource
my_resource_index GET /my_resource(.:format) my_resource#index
POST /my_resource(.:format) my_resource#create
new_my_resource GET /my_resource/new(.:format) my_resource#new
edit_my_resource GET /my_resource/:id/edit(.:format) my_resource#edit
my_resource GET /my_resource/:id(.:format) my_resource#show
PATCH /my_resource/:id(.:format) my_resource#update
PUT /my_resource/:id(.:format) my_resource#update
DELETE /my_resource/:id(.:format) my_resource#destroy
import { combineReducers } from 'redux';
import { reducer as form } from 'redux-form';
import authReducer from './auth_reducer'
const rootReducer = combineReducers({
auth: authReducer
});
export default rootReducer;
export * from './auth_actions'
import { expect } from "../test_helper";
import configureMockStore from "redux-mock-store";
import thunk from "redux-thunk";
import moxios from "moxios";
import { storageMock } from "./mock_local_storage";
import { signinUser } from "../../src/actions/index";
import { AUTH_USER, AUTH_ERROR } from "../../src/actions/types";
import { expect } from "../test_helper";
import configureMockStore from "redux-mock-store";
import thunk from "redux-thunk";
import moxios from "moxios";
import { storageMock } from "./mock_local_storage";
import { signinUser, signoutUser, signUpUser } from "../../src/actions/index";
import { AUTH_USER, AUTH_ERROR, UNAUTH_USER } from "../../src/actions/types";
import { expect } from "../test_helper";
import configureMockStore from "redux-mock-store";
import thunk from "redux-thunk";
import moxios from "moxios";
import { storageMock } from "./mock_local_storage";
import { signinUser, signoutUser, signUpUser, fetchCampaigns } from "../../src/actions/index";
import { AUTH_USER, AUTH_ERROR, UNAUTH_USER, FETCH_CAMPAIGNS } from "../../src/actions/types";