Skip to content

Instantly share code, notes, and snippets.

View tugberkugurlu's full-sized avatar
:shipit:
💥 shakalaka

Tugberk Ugurlu tugberkugurlu

:shipit:
💥 shakalaka
View GitHub Profile
@tugberkugurlu
tugberkugurlu / ComplexTypeConvention.cs
Created April 6, 2016 15:16
Bind complex type objects from body by default on ASP.NET Core 1
using Microsoft.AspNet.Mvc.ApplicationModels;
using Microsoft.AspNet.Mvc.ModelBinding;
using System;
namespace Foo.Web.Infrastructure.Conventions
{
public class ComplexTypeConvention : IActionModelConvention
{
public void Apply(ActionModel action)
{
@tugberkugurlu
tugberkugurlu / deploy_application.ps1
Created January 12, 2016 12:37
Octopus Deploy "Deploy Application" step which deploys to local folder
$folder = $OctopusParameters["app-directory"]
$packagePath = $OctopusParameters["Octopus.Action[Extract App Package].Output.Package.InstallationDirectoryPath"]
Remove-Item "$folder\*" -Recurse -Force
Copy-Item $packagePath -Destination $folder -Recurse
$tempFolder = "$folder\$((dir $folder | select -First 1).Name)"
Copy-Item "$tempFolder\*" -Destination "$folder" -Recurse
Remove-Item "$tempFolder" -Recurse -Force
@tugberkugurlu
tugberkugurlu / gulp-build.log
Created December 24, 2015 10:18
Aurelia build error with typescript
...
jspm_packages\npm\[email protected]\lib\lib.webworker.d.ts(558,5): error TS2300:
Duplicate identifier 'objectStore'.
jspm_packages\npm\[email protected]\lib\lib.webworker.d.ts(559,5): error TS2300:
Duplicate identifier 'unique'.
jspm_packages\npm\[email protected]\lib\lib.webworker.d.ts(573,5): error TS2300:
Duplicate identifier 'lower'.
jspm_packages\npm\[email protected]\lib\lib.webworker.d.ts(574,5): error TS2300:
Duplicate identifier 'lowerOpen'.
@tugberkugurlu
tugberkugurlu / agency-movie-person-query.cypher
Last active December 12, 2015 00:40
agency-movie-person.cypher
MATCH (agency:Agency { name:"Agency-A" })-[:ACQUIRED]->(actor:Person)<-[:EMPLOYED]-(movie:Movie)
WITH DISTINCT movie, collect(actor) AS actors
MATCH (movie)-[:EMPLOYED]->(allemployees:Person)
WITH movie, actors, count(allemployees) AS c
WHERE c = size(actors)
RETURN movie.name
services.AddScoped<FoursquareContext>(provider =>
{
var bonVoyageContext = provider.GetService<BonVoyageContext>();
var httpContextAccessor = provider.GetService<IHttpContextAccessor>();
var accessToken = httpContextAccessor.HttpContext.User.FindFirstValue("access_token");
return bonVoyageContext.CreateFoursquareContext(accessToken);
});
@tugberkugurlu
tugberkugurlu / eventlog.ps1
Created November 3, 2015 11:32
collect event logs with PowerShell
$ErrorActionPreference = 'Stop'
# Get-EventLog -List = get all the EventLog
# Get-EventLog system -Newest 3 = get latest 3 event logs
# Get-EventLog application | where { $_.Source -eq ".NET Runtime" } | select TimeWritten
$today = [DateTime]::UtcNow.Date
$todayMarker = $today.ToString("yyyy-MM-dd")
$file = "application-dotnet-runtime-$todayMarker"
$todayFilePath = "$PSScriptRoot\$file.txt"
@tugberkugurlu
tugberkugurlu / program.cs
Created October 4, 2015 21:09
trying out ZonedDateTimeSerializer
var mongoDatabase1 = ConfigureAndGetMongoDatabase();
var racesCollection = mongoDatabase1.GetCollection<RaceEntity>("races");
racesCollection.Drop();
DateTimeZone london = DateTimeZoneProviders.Tzdb["Asia/Istanbul"];
LocalDateTime local = new LocalDateTime(1955, 3, 15, 0, 45, 00);
ZonedDateTime londonTime = london.AtStrictly(local);
var race = new RaceEntity("foo", londonTime, "bar");
try
@tugberkugurlu
tugberkugurlu / nginxproxy.md
Created October 2, 2015 12:13 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@tugberkugurlu
tugberkugurlu / gist:3184a06ff084d808d4dd
Created September 22, 2015 18:14
beta8 effort but it doesn't work :s
using System;
using System.Collections.Immutable;
using System.IO;
using System.Reflection;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.Dnx.Compilation.CSharp;
using Microsoft.Dnx.Runtime;
public class AnalyzersCompilationModule : ICompileModule