As configured in my dotfiles.
start new:
tmux
start new with session name:
As configured in my dotfiles.
start new:
tmux
start new with session name:
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
There are many different provisioning tools out there, the most popular of which are Chef and Puppet. Chef uses Ruby, Puppet uses a DSL (Domain Specific Language), there are others that use simple bash too, but today we're going to focus on Chef Solo.
To get Chef working properly on your local machine you need a few things.
Make sure you use Ruby 1.9.x and not Ruby 2.x as you will get errors with the json 1.6.1 gem on 2.x. Use rbenv or RVM to manage several different Rubies on the one machine.
Mocking - not testing - private functions in JavaScript
Instead of trying to extract a private function, we can rely on mocking/spying. This gist shows how to use the "new Function()" constructor to replace an internal call so that we can mock, spy or stub.
Another response to @philwalton -
http://philipwalton.com/articles/how-to-unit-test-private-functions-in-javascript/
This is a followup to https://gist.github.com/dfkaye/5971486 - a suggestion for
*annotating* functions to be extracted and tested separately (publicly).
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Nice answer on stackoverflow to the question of when to use one or the other content-types for POSTing data, viz. application/x-www-form-urlencoded
and multipart/form-data
.
“The moral of the story is, if you have binary (non-alphanumeric) data (or a significantly sized payload) to transmit, use multipart/form-data
. Otherwise, use application/x-www-form-urlencoded
.”
Matt Bridges' answer in full:
The MIME types you mention are the two Content-Type
headers for HTTP POST requests that user-agents (browsers) must support. The purpose of both of those types of requests is to send a list of name/value pairs to the server. Depending on the type and amount of data being transmitted, one of the methods will be more efficient than the other. To understand why, you have to look at what each is doing
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
'use strict' | |
/**/ | |
function moda (arr) { | |
return ((arr.sort((a, b) => | |
(arr.filter(v => v === a).length) - (arr.filter(v => v === b).length)) | |
).pop()) | |
} | |
module.exports = moda | |
console.log(moda([1,2,3,4,5])) //amodal nao tem moda(nao deveria aparecer nada) |
const rules = { | |
'env': { | |
rule: (value) => rules.env.property.includes(value) | |
, property: ['production', 'sandbox'] | |
, default: 'sandbox' | |
, errorMsg: 'Env must be production or sandbox' | |
}, | |
'email': { | |
rule: (value) => value ? true : false |