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
{ | |
"todos": [ | |
{ | |
"id": "fa7639c3-c19d-4038-9ac3-10ddc816074b", | |
"text": "test", | |
"completed": false | |
}, | |
{ | |
"id": "7691c444-b37d-44ad-aeaa-5ecaf5f2fc79", | |
"text": "hellow", |
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
http://fundsuche02.kivbf.de/MyApp.asp?wci=FundHeader&Mdt=berlin-ZFB&format=&PLZ=10999&KM=100&DATUM=20.03.2017&VOLLSUCHE=geldbeutel | |
26|08|braun|Führerschein|Theresa|Tobollik|1991|1989|Andre|Herculano|TK|BMW|Babbel |
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
defmodule Map do | |
def map([], _), do: [] | |
def map([head|tail], fun), do: [fun.(head) | map(tail, fun)] | |
def reduce([], acumulator, _), do: acumulator | |
def reduce([head|tail], acumulator, fun), do: reduce(tail, fun.(head, acumulator), fun) | |
def mapsum(list, fun) do | |
map(list, fun) | |
|> reduce(0, &(&1 + &2)) |
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
#!/bin/bash | |
echo "spec_type,examples,time" > specs_times.csv | |
for spec_type in "helpers" "models" "features" "services" "observers" "policies" "validators" "routing" "controllers" "serializers" | |
do | |
total_time=0 | |
examples=$(gtime --format="%e" -o time_output.txt bundle exec rake SPEC=spec/$spec_type 2>/dev/null | grep 'examples' | cut -d" " -f1) | |
real_time=`cat time_output.txt` | |
total_time=$(echo "scale=3; $total_time + $real_time" | bc -l) |
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 _ from 'underscore'; | |
// Convert fooBar to foo_bar | |
const underscoreCase = function(str) { | |
return str.replace(/([a-z])([A-Z]+)/g, function(terms) { | |
return terms[0] + '_' + terms[1].toLowerCase(); | |
}); | |
}; | |
const underscorify = function(stringOrObject) { |
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 {createStore} from 'redux'; | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
// the reducer is a pure function which is the responsible for changing | |
// the state of the application (without mutating the parameters) | |
const counter = (state = 0, action) => { | |
switch (action.type) { | |
case 'INCREMENT': | |
return state + 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
// A crude implementation of a Redux store | |
// It keeps track of the state of the application and calls the listeners | |
// whenever there's a action dispatch | |
const createStore = (reducer) => { | |
let state; | |
const listeners = []; | |
const getState = () => state; | |
const dispatch = (action) => { |
NewerOlder