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
// weird method 1 | |
function someAction() { | |
return fetchData() | |
.then(data => { | |
return cumulativePromise([data], fetchOtherData()); | |
}) | |
.then(accumulation => { | |
var fetchedData = accumulation[0]; | |
var fetchedOtherData = accumulation[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
interface Callback { | |
(data: any, error: string): any | |
} | |
export function getUserId(id, callback: Callback) {} |
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
Route::get('export', function() { | |
$posts = Post::where('status', '=', 'published')->get(); | |
foreach ($posts as $post) { | |
$category = Category::where('id', '=', $post->category)->get()[0]->title; | |
$content = <<<EOD | |
--- | |
layout: post | |
title: "$post->title" | |
date: $post->created |
OlderNewer