Skip to content

Instantly share code, notes, and snippets.

View mahmut-gundogdu's full-sized avatar

Mahmut Gundogdu mahmut-gundogdu

View GitHub Profile
@mahmut-gundogdu
mahmut-gundogdu / MgExtensions.cs
Last active October 17, 2016 12:52
En Çok Kullandığım işlevleri Extensiyon yapıyorum. Böylece her projede kullanırken ufak da olsa zaman kazanıyorum. Kullanmak istediğiniz projeye eklemeniz yeteril.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data.SqlClient;
using System.IO;
public static class MGExtensions
{
public static bool DoluMu(this string s)
{
@mahmut-gundogdu
mahmut-gundogdu / Ayarlar.cs
Created July 18, 2014 13:49
Nosql biggy ile asp.net de sabit verilerin ve uygulama ayarlarının saklanması. http://mahmutgundogdu.azurewebsites.net/?p=242
using Biggy;
using Biggy.JSON;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace AYarlar
{
public class Firma
@mahmut-gundogdu
mahmut-gundogdu / Çözüm 1
Last active August 29, 2015 14:04
SqlDataReader ve null gelen veri sorununa prait çözümler. Çözüm 1: SqlDataReader için generic extension olusturulur. Çözüm 2: de bir static fonksiyon olusturulur. Bu fonksiyon null ile default değeri gönderir yoksa convert ederek verir.Convert.ToInt32() yerine düşünün. Çözüm 3: c# ?? operatörü.
//Kaynak: http://stackoverflow.com/questions/18550769/sqldatareader-best-way-to-check-for-null-values-sqldatareader-isdbnull-vs-dbnul
using System;
using System.ComponentModel;
using System.Data.SqlClient;
public static class SqlReaderHelper
{
private static bool IsNullableType(Type theValueType)
<asp:DataPager ID="DataPagerProducts" runat="server" PagedControlID="LvCategoryItems" PageSize="10" OnPreRender="PagerCategoryItems_PreRender" class="btn-group pager-buttons">
<Fields>
<asp:NextPreviousPagerField ShowLastPageButton="False" ShowNextPageButton="False" ButtonType="Button" ButtonCssClass="btn" RenderNonBreakingSpacesBetweenControls="false" />
<asp:NumericPagerField ButtonType="Button" RenderNonBreakingSpacesBetweenControls="false" NumericButtonCssClass="btn" CurrentPageLabelCssClass="btn disabled" NextPreviousButtonCssClass="btn" />
<asp:NextPreviousPagerField ShowFirstPageButton="False" ShowPreviousPageButton="False" ButtonType="Button" ButtonCssClass="btn" RenderNonBreakingSpacesBetweenControls="false" />
</Fields>
</asp:DataPager>
@mahmut-gundogdu
mahmut-gundogdu / a.sql
Last active August 29, 2015 14:23
Sql server Veritabanındaki tüm kayıtları silmek. Kaynak: http://stackoverflow.com/a/16765160/3928982
CREATE PROCEDURE [dbo].[deleteAllDataFromAllTables] AS
SET NOCOUNT ON
DECLARE @dropAndCreateConstraintsTable TABLE ( DropStmt varchar(max) , CreateStmt varchar(max) )
insert @dropAndCreateConstraintsTable select
DropStmt = 'ALTER TABLE [' + ForeignKeys.ForeignTableSchema +
'].[' + ForeignKeys.ForeignTableName +
'] DROP CONSTRAINT [' + ForeignKeys.ForeignKeyName + ']; '
, CreateStmt = 'ALTER TABLE [' + ForeignKeys.ForeignTableSchema +
@mahmut-gundogdu
mahmut-gundogdu / bs3-login-form.html
Last active August 27, 2015 12:58 — forked from bMinaise/bs3-login-form.html
Bootstrap 3 - Login Form Example From: http://bootsnipp.com
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>
<div class="account-wall">
<img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
alt="">
<form class="form-signin">
<input type="text" class="form-control" placeholder="Email" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>
@mahmut-gundogdu
mahmut-gundogdu / gist:d9a524b8af3ae51ea5a1
Created November 9, 2015 12:01
MySQL Slugify Function kullanımı (Bence seo url de lazım olabilir. http://tanerdogan.com/mysql/mysql-slugify-function
DROP FUNCTION IF EXISTS slugify;
DELIMITER ;;
CREATE DEFINER='root'@'localhost'
FUNCTION slugify (temp_string VARCHAR(200) CHARSET utf8)
RETURNS VARCHAR(200)
DETERMINISTIC
BEGIN
DECLARE x, y , z Int;
DECLARE new_string VARCHAR(200);
DECLARE is_allowed Bool;
@mahmut-gundogdu
mahmut-gundogdu / gist.js
Created November 18, 2015 09:23
Form datasını jquery ile javascript objecte (dolayısı ile istersek json a) dönüştürmek
var formData = {};
$(".form-secici").serializeArray().map(function (x) { formData[x.name] = x.value; });
@mahmut-gundogdu
mahmut-gundogdu / gist.js
Created November 18, 2015 09:24
Form datasını jquery ile javascript objecte (dolayısı ile istersek json a) dönüştürmek. Special thansk for http://stackoverflow.com/a/17784656
var formData = {};
$(".form-secici").serializeArray().map(function (x) { formData[x.name] = x.value; });
//Extensiyonumuz
public static class HtmlExtensions
{
public static MvcHtmlString Script(this HtmlHelper htmlHelper, Func<object, HelperResult> template)
{
htmlHelper.ViewContext.HttpContext.Items["_script_" + Guid.NewGuid()] = template;
return MvcHtmlString.Empty;
}