Skip to content

Instantly share code, notes, and snippets.

View halityurttas's full-sized avatar

Halit YURTTAŞ halityurttas

View GitHub Profile
@pmn
pmn / gist:1145504
Created August 15, 2011 00:26
C# Comb Guid generation
// C# Comb Guid generation
// Found at http://stackoverflow.com/questions/665417/sequential-guid-in-linq-to-sql/2187898#2187898
Guid GenerateComb()
{
byte[] destinationArray = Guid.NewGuid().ToByteArray();
DateTime time = new DateTime(0x76c, 1, 1);
DateTime now = DateTime.Now;
TimeSpan span = new TimeSpan(now.Ticks - time.Ticks);
TimeSpan timeOfDay = now.TimeOfDay;
@jzazove
jzazove / gist:1479763
Created December 15, 2011 03:54
URL Friendly Javascript Regex
/* function to urlify a string */
var urlify = function(a){return a.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "-").replace(/^-+|-+$/g, '')};
/* usage example */
var str_a = "* The Best Wallpaper Magazine in the . ? & world! : Rjer9238131 & ";
urlify(str_a)
/* returns */
"the-best-wallpaper-magazine-in-the-world-rjer9238131"
@berkayunal
berkayunal / Kredi Kartı BIN Listesi - CSV
Created January 11, 2012 17:16
Kredi Kartı BIN Listesi
bin,banka_kodu,banka_adi,type,sub_type,virtual,prepaid
413226,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,PLATINUM
444676,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,CLASSIC
444677,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,GOLD
444678,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,PLATINUM
453955,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, CLASSIC
453956,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, GOLD
454671,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, CLASSIC
454672,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, CLASSIC
454673,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, BUSINESS
@stevereich
stevereich / shuffle.cfm
Created October 13, 2012 01:50
Shuffle Array with Coldfusion
<cfscript>
CreateObject( "java", "java.util.Collections" ).Shuffle(variables.badwordArray);
</cfscript>
using System;
using System.Globalization;
using System.Net;
using System.Security.Cryptography;
using System.Text;
public class GoogleAuthenticator
{
const int IntervalLength = 30;
const int PinLength = 6;
@Jalalhejazi
Jalalhejazi / IIS_Verbs.config
Created May 26, 2013 16:58
CORS: Web.config to enable CORS
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*"/>
<add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS"/>
<add name="Access-Control-Allow-Headers" value="Content-Type"/>
</customHeaders>
</httpProtocol>
/*
html2image 0.0.1 <http://html2canvas.hertzen.com>
Copyright (c) 2013 Ryota Mochizuki (@polidog)
Fork by
html2canvas 0.4.0 <http://html2canvas.hertzen.com>
Copyright (c) 2013 Niklas von Hertzen (@niklasvh)
Released under MIT License
*/
@davidpaulsson
davidpaulsson / wp-get_id_by_slug
Created February 26, 2014 06:20
WordPress: Get page ID from slug
// Usage:
// get_id_by_slug('any-page-slug');
function get_id_by_slug($page_slug) {
$page = get_page_by_path($page_slug);
if ($page) {
return $page->ID;
} else {
return null;
}
@bennadel
bennadel / code-1.cfm
Created March 25, 2014 00:26
Stripping XML Name Spaces And Node Prefixes From ColdFusion XML Data (To Simplify XPath)
<!--- Store the XStandard SOAP XML. --->
<cfsavecontent variable="strXml">
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
@magnetikonline
magnetikonline / dumprequest.php
Last active April 30, 2024 08:01
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile {
public function execute($targetFile) {
$data = sprintf(
"%s %s %s\n\nHTTP headers:\n",
$_SERVER['REQUEST_METHOD'],
$_SERVER['REQUEST_URI'],
$_SERVER['SERVER_PROTOCOL']