Skip to content

Instantly share code, notes, and snippets.

View ardacetinkaya's full-sized avatar
👨‍💻
Coding with ❤

Arda Cetinkaya ardacetinkaya

👨‍💻
Coding with ❤
View GitHub Profile
@ardacetinkaya
ardacetinkaya / EmailAddressValidator.cs
Created October 8, 2014 19:32
Using regular expression for validating e-maill address can be tough sometimes. But System.Net.Mail.MailAddress simply do it for you.
public bool IsValid(string email)
{
try
{
System.Net.Mail.MailAddress address = new System.Net.Mail.MailAddress(email);
return true;
}
catch (Exception)
{
@ardacetinkaya
ardacetinkaya / .bash_profile
Created January 8, 2016 18:51 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@ardacetinkaya
ardacetinkaya / legochecker.js
Last active January 21, 2016 21:19
Blog'da yer verdiğim küçük bir yazıda anlattığım, node.js için ile yapılmış, basit bir web sitesi parse etmek ve sonra e-mail atmak gerekli olan script örneği... Ayrıntılarına http://www.minepla.net/2016/01/lego-azure-webjobs-nodejs/ yazısından bakabilirsiniz.
/* global $ */
/* global callback */
var http = require('http');
var cheerio = require('cheerio');
var sendgrid = require('sendgrid')([SEND_GRID_KEY]);
var azure = require('azure-storage');
function LegoChecker() {
this.Sender = '[SENDER_EMAIL]';
this.Receivers = '[RECEIVER_EMAIL]';
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using HelloRazor.Model;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace HelloRazor.Pages
{
@ardacetinkaya
ardacetinkaya / NET_Core_API_Reference_v21.json
Last active September 8, 2018 10:45
API references of .NET Framework 4.7.2 and .NET Core 2.1. Please always check .NET API Browser for latest updates. (https://docs.microsoft.com/en-us/dotnet/api/)
{
"apiItems":[
{
"displayName":"Microsoft.CSharp.RuntimeBinder",
"url":"https://docs.microsoft.com/dotnet/api/microsoft.csharp.runtimebinder",
"description":"The namespace provides classes and interfaces that support interoperation between Dynamic Language Runtime and C#."
},
{
"displayName":"Microsoft.VisualBasic",
"url":"https://docs.microsoft.com/dotnet/api/microsoft.visualbasic",
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
var key = Encoding.ASCII.GetBytes(Configuration["Application:Secret"]);
services.AddAuthentication(x =>
{
x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
@ardacetinkaya
ardacetinkaya / Pagination.Example
Last active April 2, 2019 06:45
Pagination Example
public class ExampleData
{
public string Name { get; set; }
public int Age { get; set; }
/// <summary>
/// Total count of the records
/// </summary>
internal int TotalCount { get; set; }
}
@ardacetinkaya
ardacetinkaya / StoredProcedure_Table_Relation.sql
Last active April 28, 2019 22:52
Simple SQL to find tables that are used in a stored procedure. #mssql #sql #sqlserver #storedprocedure
DECLARE @temptableforSP TABLE (spName varchar(100), tableName nvarchar(100))
DECLARE @SP_Name as NVARCHAR(100);
DECLARE @SP_Cursor as CURSOR;
SET @SP_Cursor = CURSOR FOR
SELECT [name] FROM sys.objects WHERE name LIKE 'sp%' AND type='P' -- Gets SPs for specific names
OPEN @SP_Cursor;
FETCH NEXT FROM @SP_Cursor INTO @SP_Name;
WHILE @@FETCH_STATUS = 0
@ardacetinkaya
ardacetinkaya / BST.cs
Created July 16, 2019 09:48
Simple Binary Search Tree
namespace BinarySearchTree
{
public class Node
{
public int Value { get; set; }
public Node Left { get; set; }
public Node Right { get; set; }
}
@ardacetinkaya
ardacetinkaya / orders.js
Last active July 31, 2019 08:46
Yemeksepeti'nde verilen toplam sipariş miktarı(TL) ve adeti olarak düzenlendi. İlk kaynak: https://eksisozluk.com/toplam-yemeksepeti-com-harcamasini-gosteren-kod--6125159?p=1
let changed = true;
let itemLength = 0;
let oldLength = 0;
let tolerance = 0;
var totalP = 0;
var sleepTime = 1500;
var repository = new Map();
function calculate() {
var totalAmount=0;