Skip to content

Instantly share code, notes, and snippets.

View mahmut-gundogdu's full-sized avatar

Mahmut Gundogdu mahmut-gundogdu

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using AutoMapper.EquivalencyExpression;
public class Program
{
public static void Main()
{
create function ProperCase(@Text as varchar(8000))
returns varchar(8000)
as
begin
declare @Reset bit;
declare @Ret varchar(8000);
declare @i int;
declare @c char(1);
select @Reset = 1, @i=1, @Ret = '';
@mahmut-gundogdu
mahmut-gundogdu / htmlFiles.js
Created July 14, 2017 11:31
Angular.Js de binding Type Değiştirmek get ve set de tür dönüşümü
function convertToNumber() {
return {
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
ngModel.$parsers.push(function (val) {
return parseInt(val, 10);
});
ngModel.$formatters.push(function (val) {
return '' + val;
});
@mahmut-gundogdu
mahmut-gundogdu / CustomRadioButtonForHelper.cs
Last active July 13, 2017 14:06
Kullanıdığım tasarımda bool ve bazı int değerleri Evet Hayır  radiobutton ile belirli bir formatta göstermek istiyordum. göstermek istiyordum. ancak model dynamic olunca farklı cozum almam gerekti. Yazım: https://mahmutgundogdu.wordpress.com/2017/07/13/asp-net-mvc-editor-template-ile-custom-radio-button-group-yapimi
/// <summary>
/// Kaynak:https://stackoverflow.com/a/23383159/3928982
/// </summary>
public static MvcHtmlString RadioButtonFor<TModel, TValue>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TValue>> expression, object value, object htmlAttributes, bool checkedState)
{
var htmlAttributeDictionary = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
if (checkedState)
@mahmut-gundogdu
mahmut-gundogdu / select2refresh.js
Created July 10, 2017 13:00
angular js select2 model değiştiğinde jquery plugininin kendini refresh etmesini sağlayan kodumuz.
angular
.module('myapp',[])
.directive('select2refresh', function () {
return {
restrict: 'A',
scope: {
'ngModel': '='
},
link: function (scope, element, attrs) {
@mahmut-gundogdu
mahmut-gundogdu / SearchWithIgnoredAlphaNumberic.js
Created June 17, 2017 10:27
regex ile aranan cumleyi & bosluk gibi karakterlerden temizleyip arayan regex paterni
var param= "mahmut gundogdu";//diye arayınca mahmut gundogdu da mahmut gundogdu da mahmut&gundogdu da gelecek. gelmeli.
param = param.replace(/([^a-z|0-9]){1,}/ig, ('([^a-z|0-9]){1,}'))
var rx = new RegExp(param, "i")
var isMatched = item.match(rx);
if (isMatched) {
return item;
}
@mahmut-gundogdu
mahmut-gundogdu / ddns.sh
Created February 6, 2017 14:59 — forked from lyoshenka/ddns.sh
Quick and dirty DDNS using Bash and Cloudflare (API v4 compatible)
#!/usr/bin/env bash
# Step 1: Fill in EMAIL, TOKEN, DOMAIN and SUBDOMAIN. Your API token is here: https://www.cloudflare.com/a/account/my-account
# Make sure the token is the Global token, or has these permissions: #zone:read, #dns_record:read, #dns_records:edit
# Step 2: Create an A record on Cloudflare with the subdomain you chose
# Step 3: Run "./ddns.sh -l" to get the zone_id and rec_id of the record you created.
# Fill in ZONE_ID and REC_ID below
# This step is optional, but will save you 2 requests every time you this script
# Step 4: Run "./ddns.sh". It should tell you that record was updated or that it didn't need updating.
# Step 5: Run it every hour with cron. Use the '-s' flag to silence normal output
@mahmut-gundogdu
mahmut-gundogdu / .js
Created December 28, 2016 14:12 — forked from nelsonomuto/.js
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserSync = require('browser-sync');
var notify = require('gulp-notify');
var less = require('gulp-less');
var autoprefix = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var exec = require('child_process').exec;
@mahmut-gundogdu
mahmut-gundogdu / html.js
Last active December 27, 2016 14:47
C:\Users\<username>\AppData\Roaming\Brackets\extensions\user\brackets-emmet\node_modules\emmet\lib\filter
/**
* Filter that produces HTML tree
*/
if (typeof module === 'object' && typeof define !== 'function') {
var define = function (factory) {
module.exports = factory(require, exports, module);
};
}
define(function(require, exports, module) {
@mahmut-gundogdu
mahmut-gundogdu / ornekplugin.js
Created November 8, 2016 13:45
summernote note için örnek pluggin geliştirme örneği .Super simple wysiwyg editor v0.8.2 için test edilmiştir.
(function (factory) {
/* global define */
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {