Skip to content

Instantly share code, notes, and snippets.

View AntJanus's full-sized avatar

Antonin Januska AntJanus

View GitHub Profile
// weird method 1
function someAction() {
return fetchData()
.then(data => {
return cumulativePromise([data], fetchOtherData());
})
.then(accumulation => {
var fetchedData = accumulation[0];
var fetchedOtherData = accumulation[1];
interface Callback {
(data: any, error: string): any
}
export function getUserId(id, callback: Callback) {}
@AntJanus
AntJanus / gist:390d56a28c2e7617c766c726478692e6
Last active September 17, 2019 03:54 — forked from molovo/gist:6907965
A short snippet for exporting posts from Anchor CMS into separate .markdown files for use with Jekyll. Just add the created files straight into your _posts folder in jekyll. The following code goes into /anchor/routes/site.php, then just visit <site URL>/export to create the files
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