start new:
tmux
start new with session name:
tmux new -s myname
#!/bin/bash | |
# where to store the sparse-image | |
WORKSPACE=~/Documents/workspace.dmg.sparseimage | |
create() { | |
if [ -f $WORKSPACE ]; then | |
echo "File ${WORKSPACE} already exists"; | |
exit 1; |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
public class StreamFlatMap { | |
public static void main(String[] args) { | |
List<String> list = new ArrayList<>(); |
class MyClass { | |
static [Symbol.hasInstance](lho) { | |
console.log('with-sugar: is', lho, 'an array?'); | |
return Array.isArray(lho); | |
} | |
} | |
console.log([] instanceof MyClass); // true | |
console.log('my string' instanceof MyClass); // false |
const PersonMonad = person => { | |
const ValidMon = failList => { | |
return { | |
map: ({ f, error }) => { | |
if (!f(person)) { | |
failList.push(error); | |
} | |
return ValidMon(failList); | |
}, | |
flatMap: ({ f, error }) => { |
// oneAction could be setCountry | |
export const oneAction = params => { | |
return { | |
type: "ONE_ACTION", | |
payload: Promise.resolve(`(value from oneAction ${params})`) | |
}; | |
}; | |
// otherAction could be fetchRegions | |
export const otherAction = params => { |
const moment = require('moment'); | |
const createDates = () => { | |
return [ | |
moment({ year: 2015, month: 11, day: 25 }), | |
moment({ year: 2015, month: 11, day: 26 }), | |
moment({ year: 2015, month: 11, day: 27 }), | |
moment({ year: 2015, month: 11, day: 28 }), | |
moment({ year: 2015, month: 11, day: 29 }), | |
moment({ year: 2015, month: 11, day: 30 }), |
Provarei matematicamente o que esta acontecendo e por que eh legitimo que a revolta popular seja maior contra Lula que contra Aecio.
Temos a regra geral:
Xn * F = Yn
Xn = mal causado por alguem (n)
Yn = revolta popular contra alguem (n)
l = Lula dataset
Array.prototype.mapReduce = function(keyGrouper, reducer) { | |
const emit = (key, value) => ({key, value}); | |
const obj = this | |
.map(value => keyGrouper(emit, value)) | |
.reduce((prev, {key, value}) => { | |
prev[key] = Array.isArray(prev[key]) ? prev[key] : []; | |
return prev[key].push(value) && prev; | |
}, {}); | |
return Object.keys(obj).map(key => reducer(key, obj[key])); | |
}; |
#!/bin/bash | |
cmd=$1 | |
key=$2 | |
value=$3 | |
file=db.data | |
if [[ "$cmd" = "" ]]; then | |
echo "Invalid command"; | |
exit 1; |