Skip to content

Instantly share code, notes, and snippets.

View asilbalaban's full-sized avatar

Asil Balaban asilbalaban

View GitHub Profile
@asilbalaban
asilbalaban / substr by word.php
Created January 12, 2015 00:07
kelime bazlı substr | sub_str for words
function Strip_text($data,$size,$elipse = true){
$data = strip_tags($data);
if(mb_strlen($data, 'utf-8') > $size){
$result = mb_substr($data,0,mb_strpos($data,' ',$size,'utf-8'),'utf-8');
if(mb_strlen($result, 'utf-8') <= 0){
$result = mb_substr($data,0,$size,'utf-8');
$result = mb_substr($result, 0, mb_strrpos($result, ' ','utf-8'),'utf-8');;
}
if($elipse) {
$result .= "...";
@asilbalaban
asilbalaban / cities.txt
Created December 27, 2014 13:02
cities with states
Abilene, Texas
Akron, Ohio
Albuquerque, New Mexico
Alexandria, Virginia
Allentown, Pennsylvania
Amarillo, Texas
Anaheim, California
Anchorage, Alaska
Ann Arbor, Michigan
Antioch, California
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
@asilbalaban
asilbalaban / index.html
Created September 18, 2014 13:05
return data from top window (window opener example)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Window</title>
</head>
<body>
<form action="">
<label for="">Müşteri ID <a href="#" id="click">[Gözat]</a></label>
<input type="text" name="musteri_id" id="musteri" value="" placeholder="Müşteri ID bilgisi">
@asilbalaban
asilbalaban / responsive.css
Created September 5, 2014 07:39
Responsive css resolutions
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
media only screen
and (min-width : 321px) {
@asilbalaban
asilbalaban / kml.html
Created August 31, 2014 10:59
Display KML file on google maps
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>KML EXAMPLE</title>
<style>
#map_canvas {
width: 500px;
height: 400px;
}
@asilbalaban
asilbalaban / slug.php
Created August 29, 2014 10:42
PHP SLUG FUNCTION - slugify
function Slug($text)
{
// replace non letter or digits by -
$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
// trim
$text = trim($text, '-');
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
@asilbalaban
asilbalaban / index.html
Created August 27, 2014 07:36
simple parallax boilerplate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Parallax</title>
<link rel="stylesheet" href="style.css">
<style>
div.space {
min-height: 1000px;
}
@asilbalaban
asilbalaban / mail.php
Created August 25, 2014 15:47
UTF8 mail function.
function mail_utf8($to, $subject = '(No subject)', $message = '', $header = '') {
$header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header_ . $header);
}
@asilbalaban
asilbalaban / index.html
Created August 25, 2014 12:42
google maps easy marker
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="jquery.gmap.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
var myLatlng = new google.maps.LatLng(41.010961, 28.900224);
var myLatlng2 = new google.maps.LatLng(39.872069, 32.861536);
var myLatlng3 = new google.maps.LatLng(39.903592, 41.271166);