Skip to content

Instantly share code, notes, and snippets.

@loctanvo
loctanvo / counties_Norway
Last active December 27, 2015 09:19
Counties of Norway. Contribution to countriesfor.us . Sources: http://snl.no/fylker_i_Norge http://en.wikipedia.org/wiki/Counties_of_Norway [Note: iso-code 13 is not in use]
var no = [
'Østfold',
'Akershus',
'Oslo',
'Hedmark',
'Oppland',
'Buskerud',
'Vestfold',
'Telemark',
'Aust-Agder',
# Nginx proxy for Elasticsearch + Kibana
# If you use this, you'll want to point config.js at http://FQDN:80/ instead of
# http://FQDN:9200
server {
listen *:80 ;
server_name kibana.myhost.org;
access_log /var/log/nginx/kibana.myhost.org.access.log;
@loctanvo
loctanvo / Delete merged branches
Created February 10, 2015 09:07
Delete merged branches
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
public class TokenService
{
public static IEnumerable<Claim> ValidateAndParseToClaims(string token, string validAudience)
{
var parameters = CreateTokenValidationParameters(validAudience);
SecurityToken jwt;
var principal = new JwtSecurityTokenHandler().ValidateToken(token, parameters, out jwt);
return principal.Claims;
@loctanvo
loctanvo / .gitconfig-aliases
Created September 28, 2015 07:47 — forked from jstclair/.gitconfig-aliases
Git aliases
[alias]
# common aliases - acquired from many places...
# operations
b = branch
cl = clone
ci = commit
amend = commit --amend --no-edit
st = status --short --branch
class Program
{
static void Main()
{
Console.WriteLine("Default Math.Round(x)");
Console.WriteLine(Round(1.5));
Console.WriteLine(Round(2.5));
Console.WriteLine(Round(3.5));
}
using System;
using System.Globalization;
namespace MathRound.Demo
{
class Program
{
static void Main()
{
Console.WriteLine("Math.Round(x, MidpointRounding.AwayFromZero)");
using System;
using System.Linq;
namespace MathRandom
{
class Program
{
static void Main()
{
var random1 = new Random();
using System;
using System.Linq;
using System.Threading;
namespace MathRandom
{
class Program
{
static void Main()
{
using System;
using System.Linq;
using System.Threading;
namespace MathRandom
{
class Program
{
static void Main()
{