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 / GalleryContext.cs
Created September 15, 2013 10:46
Async Database Call Sample with Raw ADO.NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.Threading.Tasks;
namespace AsyncDatabaseCall.Models {
@tugberkugurlu
tugberkugurlu / FizzBuzz.cs
Last active October 12, 2022 20:14
FizzBuzz problem solution with C#.
// reference: http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html
static class Program {
static void Main(string[] args) {
for (int i = 1; i <= 100; i++) {
bool canBeMultipliedByFive = i.CanBeMultipliedBy(5);
bool canBeMultipliedByThree = i.CanBeMultipliedBy(3);
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
function guidGenerator() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}
@tugberkugurlu
tugberkugurlu / gist:3848723
Created October 7, 2012 15:50 — forked from benfoster/gist:3848715
Adding IServiceProvider to ValidationContext in ASP.NET MVC
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
/* usual sh** ommitted for brevity */
var resolver = new CustomDependencyResolver();
DependencyResolver.SetResolver(resolver);
DataAnnotationsModelValidatorProvider.RegisterDefaultAdapterFactory(
@tugberkugurlu
tugberkugurlu / WebApiSimplePatchSample.cs
Last active January 20, 2022 13:08
ASP.NET Web API Patch Sample.
public class Car {
public int Id { get; set; }
[Required]
[StringLength(20)]
public string Make { get; set; }
[Required]
[StringLength(20)]
@tugberkugurlu
tugberkugurlu / bcdedit.ps1
Created June 2, 2012 13:32
bcdedit examples
##################################################
#resources
##################################################
#http://technet.microsoft.com/en-us/library/cc721886(v=ws.10).aspx
#http://technet.microsoft.com/en-us/library/cc709667(v=ws.10).aspx
##################################################
#resources
##################################################
####################################################################################
@tugberkugurlu
tugberkugurlu / DbGeographyTryOut.cs
Created June 4, 2012 19:51
System.Data.Spatial.DbGeography sample (Latitude and Longitude).
class Program {
public class Db {
public static Dictionary<string, DbGeography> Locations = new Dictionary<string, DbGeography>() {
//instert the place locations here...
};
}
➜ aws ec2 describe-images --image-id ami-0a879f21e6f3b1fb2
{
    "Images": [
        {
            "Architecture": "arm64",
            "CreationDate": "2020-12-10T18:09:00.000Z",
            "ImageId": "ami-0a879f21e6f3b1fb2",
            "ImageLocation": "amazon/amzn2-ami-ecs-hvm-2.0.20201209-arm64-ebs",
            "ImageType": "machine",