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
#r "Newtonsoft.Json" | |
using System.Net; | |
using System.Linq; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Primitives; | |
using Newtonsoft.Json; | |
public class FacebookPost | |
{ |
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
export default class Log { | |
private prefix: string; | |
private logSource: object; | |
private parseArgument(arg: any): string { | |
return typeof(arg) === "string" ? arg : JSON.stringify(arg); | |
} | |
private getMethodName(callingFunction: Function): string { | |
const methodNames = Object.getOwnPropertyNames(Object.getPrototypeOf(this.logSource)); |
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
(async function() { | |
let userIds = [239, 405]; | |
// computed property name: [prop]: | |
// rest parameters: ...props | |
// stolen from: https://stackoverflow.com/a/25554551 | |
function pick(o, ...props) { | |
return Object.assign({}, ...props.map(prop => ({[prop]: o[prop]}))); | |
} |
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
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/ | |
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch | |
// async function | |
async function fetchAsync () { | |
// await response of fetch call | |
let response = await fetch('https://api.github.com'); | |
// only proceed once promise is resolved | |
let data = await response.json(); | |
// only proceed once second promise is resolved |