Skip to content

Instantly share code, notes, and snippets.

@sangheestyle
sangheestyle / Practice.csproj
Created November 14, 2018 11:38
Practice closure in C#
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
</Project>
@sangheestyle
sangheestyle / HttpClientFactoryExample.csproj
Created November 12, 2018 23:00
An example for using httpclientfactory
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.6" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
@sangheestyle
sangheestyle / omnisharp.json
Created November 6, 2018 13:10
omnisharp.json for me
{
"FormattingOptions": {
"NewLine": "\n",
"UseTabs": false,
"TabSize": 4,
"IndentationSize": 4,
"SpacingAfterMethodDeclarationName": false,
"SpaceWithinMethodDeclarationParenthesis": false,
"SpaceBetweenEmptyMethodDeclarationParentheses": false,
"SpaceAfterMethodCallName": false,
@sangheestyle
sangheestyle / README.md
Last active October 25, 2018 21:35
Query geo position on ES

Query geo position on ElasticSearch

Install ES

Assume you have a mac and use brew. ES requires Java8 so do the following:

brew cask install homebrew/cask-versions/java8
brew search [email protected]
elasticsearch
@sangheestyle
sangheestyle / Program.cs
Last active September 25, 2018 21:45
Run async tasks concurrently on Rx with maximum concurrent level
using System;
using System.Threading.Tasks;
using System.Reactive.Linq;
namespace rxconcurrent
{
class Program
{
static void Main(string[] args)
{
@sangheestyle
sangheestyle / Program.cs
Last active September 4, 2018 21:15
Say I want to mock out a framework class which doesn't implement an interface
using System;
public class ExchangeService
{
public void Subscribe()
{
Console.WriteLine("Exchange: Subscribe");
}
public void Unsubscribe()
@sangheestyle
sangheestyle / LoggerDemo.csproj
Created September 1, 2018 20:38
Newbie's practice 1: Logging and Configuration
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0-preview1-35029" />
<PackageReference Include="Microsoft.Extensions.Configuration.JSON" Version="2.2.0-preview1-35029" />
@sangheestyle
sangheestyle / step1_nongeneric.py
Last active February 20, 2018 21:39
Generic and non-generic version of map reduce (from item 22: use @classmethod polymorphism to construct objects generically in Effective Python)
class InputData(object):
"""Abstraction base class"""
def read(self):
raise NotImplementedError
class PathInputData(InputData):
"""Concrete class"""
def __init__(self, path):
super().__init__()
@sangheestyle
sangheestyle / index.html
Created December 6, 2017 04:31
flight tracker with google maps API from https://goo.gl/VoHD3D
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>flight</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="page-header">
@sangheestyle
sangheestyle / practice1.js
Last active August 11, 2017 14:55
Practice #1 for Chicago on August 10, 2017
// Two inputs
const users = [
{ userId: 1, name: 'matt', email: '[email protected]' },
{ userId: 2, name: 'sanghee', email: '[email protected]' },
];
const dashboards = [
{ dashboardId: 1, ownerId: 1, title: 'summer trend 2016' },
{ dashboardId: 2, ownerId: 1, title: 'autumn trend 2016' },
{ dashboardId: 3, ownerId: 1, title: 'shared to me' },