Skip to content

Instantly share code, notes, and snippets.

View yohanmishkin's full-sized avatar

yohanmishkin yohanmishkin

View GitHub Profile
@yohanmishkin
yohanmishkin / build.cake
Last active March 1, 2018 18:46
Example cake script
// Command line arguments
var target = Argument("target", "Default");
var tag = Argument<string>("tag", "cake");
// 1. Restore
Task("Restore").Does(() => {
DotNetCoreRestore("./src/Hello.Harvester/");
DotNetCoreRestore("./src/Hello.UnitTests/");
});
@yohanmishkin
yohanmishkin / ExampleWebTest.cs
Last active January 11, 2018 04:43
Testing the outer boundary of a JSONAPI REST API in .Net (using SimpleInjector & Saule)
using Controllers;
using Core.Entities;
using Tests.Integration.Common;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using Xunit;
@yohanmishkin
yohanmishkin / config.js
Created December 5, 2017 15:22
Better mirage logging
server.pretender.handledRequest = function(verb, path, request) {
if (server.shouldLog()) {
let { responseText, requestBody } = request;
let logData = {};
if (requestBody) {
let loggedRequest;
try {
loggedRequest = JSON.parse(requestBody);
} catch(e) {
@yohanmishkin
yohanmishkin / gist:6825bee80e483befb56ba526e04fa446
Created April 18, 2017 21:26
setTimeout() inside a foreach loop
$E.__container__.lookup('service:store').findAll('site').then((sites) => {
sites.forEach((x, index) => {
setTimeout(() => {
$E.__container__.lookup('service:gMap')
.geocode({address: x.get('location')})
.then((geocodes) => {
let lat = geocodes[0].geometry.location.lat();
let lng = geocodes[0].geometry.location.lng();
console.log(x.get('name'), lat, lng);
x.set('lat', lat);