Skip to content

Instantly share code, notes, and snippets.

@yasinkuyu
yasinkuyu / Distance.cs
Created April 27, 2014 19:03
C# distance between two points (c# ile mesafe hesaplama)
// @yasinkuyu
// 27/04/2014
public static double Distance(double lat1, double lon1, double lat2, double lon2, char unit)
{
Func<double, double> deg2Rad = (x) => (x * (Math.PI / 180));
Func<double, double> rad2Deg = (x) => (x / Math.PI * 180.0);
var theta = lon1 - lon2;
@yasinkuyu
yasinkuyu / foursquare.py
Created May 15, 2014 10:38
Foursquare categories recursive MySQL Database insert with Python
# @yasinkuyu
# 15/05/2014
import json
import MySQLdb
# First dump foursquare-categories.json ----> https://gist.github.com/janosgyerik/2906942
# CREATE TABLE `category` (
# `CatId` int(11) NOT NULL AUTO_INCREMENT,
# `ParentId` int(11) DEFAULT NULL,
@yasinkuyu
yasinkuyu / foursquare.cs
Last active August 29, 2015 14:01
Foursquare categories recursive MySQL Database insert with C#
// @yasinkuyu
// 15/05/2014
using System;
using System.IO;
using MySql.Data.MySqlClient;
using Newtonsoft.Json.Linq;
namespace FoursquareCategories
{
@yasinkuyu
yasinkuyu / languageCodes.cs
Last active August 29, 2015 14:01
Get All Language Codes
// @yasinkuyu
// 15/05/2014
string code = "";
string name = "";
foreach (CultureInfo lang in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
try
{
code = CultureInfo.CreateSpecificCulture(lang.Name).Name.Replace("-", "_");
@yasinkuyu
yasinkuyu / units.js
Last active August 29, 2015 14:03
CSS/HTML/JS Units of Measure Parsing
/*
@ CSS/HTML/JS Units of Measure Parsing
@ Regular Expressions (RegEx / RegExp) Pattern
@ Test http://www.regexr.com/39424
@ Pattern RegExp(/(\d*\.?\d+)\s?(px|em|ex|%|in|cm|mm|pt|pc+)/igm)
Yasin Kuyu - twitter.com/yasinkuyu */
#Comments
@yasinkuyu
yasinkuyu / turkish-letter-frequency.js
Created January 12, 2016 15:12
Turkish letter frequency
// @yasinkuyu
// https://tr.wikipedia.org/wiki/T%C3%BCrk_alfabesindeki_harflerin_kullan%C4%B1m_s%C4%B1kl%C4%B1klar%C4%B1
// Türk alfabesindeki harflerin kullanım sıklıkları
var alfabe = {
'A': 11.92,
'B': 2.844,
'C': 0.963,
'Ç': 1.156,
'D': 4.706,
'E': 8.912,
@yasinkuyu
yasinkuyu / codemirror-prism-okaidia.css
Last active May 31, 2016 02:49
prism.js Okaidia Dark theme for CodeMirror
@charset "UTF-8";
/**
*
* prism.js Okaidia dark for JavaScript, CSS and HTML
* @author Yasin Kuyu
* http://code.insya.com
*
*/
@yasinkuyu
yasinkuyu / aa.xml
Created July 3, 2016 22:01
AnadoluAjansı xml
<?xml version="1.0" encoding="utf-8"?>
<newsMessage xml:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1" xml:noNamespaceSchemaLocation="http://iptc.org/std/nar/2006-10-01/XSD/NewsML-G2_2.9-spec-All-Core.xsd" standard="NewsML-G2" standardversion="2.9" conformance="core" xml:lang="tr_TR" xmlns="http://iptc.org/std/nar/2006-10-01/">
<catalogRef href="http://www.iptc.org/std/catalog/catalog.IPTC-G2-Standards_19.xml" />
<header>
<sent>2016-07-03T22:53:47Z</sent>
<sender>aa.com.tr</sender>
<priority>4</priority>
<channel qcode="AApackage:1">
<name xml:lang="fr">Général</name>
<name xml:lang="sq">E Përgjithshme</name>
@yasinkuyu
yasinkuyu / get_mem.cs
Last active August 31, 2016 17:27
C# WMI memory usage
// @yasinkuyu
// 06/05/2014
public dynamic get_mem()
{
dynamic returndata = new ExpandoObject();
var search = new ManagementObjectSearcher("root\\CIMV2", "Select TotalVisibleMemorySize, FreePhysicalMemory from Win32_OPeratingSystem");
foreach (var x in search.Get())
@yasinkuyu
yasinkuyu / lol.txt
Last active September 19, 2016 22:04
: to line end regex
:[^\n]+
xxxx : bla bla bla