This file contains 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
/** | |
* I have recently started to embrace TDD or BDD or whatever we are calling it today. I was | |
* hoping for some feedback on my how I am structuring my tests. Currently I am writing | |
* functional tests for my API routes. One thing I dislike is that I have included a global | |
* data object in each file and beforeEach test generating json web tokens for auth purposes. | |
* I could probably move that actual logic to some test helper but I still have to store | |
* this global (for the page) object. Just trying to some feedback. Any advice, even | |
* unrelated to this, is gladly appreciated. | |
*/ |
This file contains 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
'use strict'; | |
var _ = require('lodash'), | |
Promise = require('bluebird'), | |
models = require('../database'), | |
pipeline = require('../utils/pipeline'), | |
utils = require('./utils'), | |
errors = require('../errors'); | |
var listing = { |
This file contains 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
/** | |
* This does not work on node v4.2.0 | |
* | |
* Reason has been determined. The first example of arrow functions is a function | |
* definition, not a function call. The second is a function call that passes the | |
* return value to Promise.join | |
*/ | |
'use strict'; | |
const Promise = require('bluebird'); |
This file contains 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
# /etc/rc.d/rc.local | |
HOMEDIR = /home/ec2-user | |
GITREPO = git@github.com:org/project.git | |
GITDIR = $HOMEDIR/project | |
cd $HOMEDIR | |
# Clone the latest version | |
git clone $GITREPO |
This file contains 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 someArray = [4,3,3,2,5,6,63,1,43,34,46,46,2,35,35,64,75]; | |
function sum(list) { | |
let count = 1; | |
function add(x,y) { | |
const sum = x + y; | |
if(++count > list.length - 1) { | |
return sum; |
This file contains 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 someArray = [4,3,3,2,5,6,63,1,43,34,46,46,2,35,35,64,75]; | |
function reduction(list, callback) { | |
if (typeof callback !== 'function') { | |
throw new Error('callback not function'); | |
} | |
let count = 1; | |
function reducting(current) { | |
if (++count > list.length - 1) { |
This file contains 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
import React, { Component, PropTypes } from 'react'; | |
import { connect } from 'react-redux'; | |
import NavBar from './Navbar'; | |
import Login from './Login'; | |
export default class App extends Component { | |
constructor(props, context) { | |
super(props, context); |
This file contains 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 | |
# This kills all connections to a database a resets it based | |
# on a backup file. The first argument passed should be the | |
# name of the database. The second should be the complete | |
# filepath for the backup. The backup should have already been | |
# compressed using the gzip utility. If you are working on a | |
# remote database set the environment variables recognized by | |
# psql | |
# |
This file contains 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 | |
APPLICATION_NAME="YOUR_APP_NAME" | |
DEPLOYMENT_GROUP="YOUR_DEPLOY_GROUP_NAME" | |
REGION="us-west-2" | |
REPOSITORY="your/github-repo" | |
# Install jq if not already installed | |
# We use jq to parse the json return by the AWS API's | |
# If you don't know about jq, it is dope. Learn more here: https://stedolan.github.io/jq/ |
This file contains 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
import qs from 'querystring'; | |
import { CALL_API } from 'redux-api-middleware'; | |
export default function queryMiddleware() { | |
return next => action => { | |
if (action.hasOwnProperty(CALL_API) && action[CALL_API].hasOwnProperty('query')) { | |
const request = action[CALL_API]; | |
request.endpoint = [ | |
request.endpoint.replace(/\?*/, ''), | |
qs.stringify(request.query), |
OlderNewer