Skip to content

Instantly share code, notes, and snippets.

View sineld's full-sized avatar
🏢
Full Stack Developer

Sinan Eldem sineld

🏢
Full Stack Developer
View GitHub Profile
@sineld
sineld / gunleriBul.php
Created October 5, 2012 08:10
Php: gunleriBul
<?php
function gunleriBul($startTime, $endTime) {
$day = 86400;
$format = 'Y-m-d';
$startTime = strtotime($startTime);
$endTime = strtotime($endTime);
$numDays = round(($endTime - $startTime) / $day) + 1;
$days = array();
@sineld
sineld / while.php
Created October 6, 2012 08:19
Php: while
<?php
$family = array('Sinan', 'Bilge', 'Tuana Şeyma');
$size = sizeof($family);
$i = 0;
while($size--)
{
echo $family[$i].', ';
$i++;
}
@sineld
sineld / setup-sync-sublime-over-dropbox.sh
Last active December 15, 2015 12:34
zsh-scripts/bin/setup-sync-sublime-over-dropbox.sh
#!/bin/sh
#
# Original URL: https://github.com/miohtama/ztanesh/blob/master/zsh-scripts/bin/setup-sync-sublime-over-dropbox.sh
# Set-up Sublime settings + packages sync over Dropbox
# Kullanım: $sh dosya.sh
# Will sync settings + Installed plug-ins
#
# Tested on OSX - should support Linux too as long as
# you set-up correct SOURCE folder
#
@sineld
sineld / twigfunctions.php
Created November 2, 2012 08:28
useful methods to add to twigview/twigfunctions.php
<?php
//Source: http://forums.laravel.com/viewtopic.php?id=1272&p=2
// useful methods to add to twigview/twigfunctions.php
// return if the current IP matches
function twig_fn_is_ip($ip){
if($ip === $_SERVER['REMOTE_ADDR']){
return true;
}
return false;
@sineld
sineld / routes.php
Created November 5, 2012 07:00
Twitter username style urls: twitter.com/sineld
<?php
// Source: http://www.everyonecanweb.com/snippet/view/28
Route::filter('before', function()
{
// Direct user to clouddueling.com/nickname
$nickname = URI::segment( 1 );
if( !in_array( $nickname, Controller::detect() ) )
{
$user = User::where_nickname( $nickname )->first();
@sineld
sineld / dr.sh
Created November 11, 2012 21:58
Set-up Sublime settings + packages sync over Dropbox - Ubuntu Linux
#!/bin/sh
#
# Set-up Sublime settings + packages sync over Dropbox
#
# Will sync settings + Installed plug-ins
#
# Tested on OSX - should support Linux too as long as
# you set-up correct SOURCE folder
#
# Copyright 2012 Mikko Ohtamaa http://opensourcehacker.com
@sineld
sineld / cities.php
Created November 19, 2012 20:37
Turkey Cities Php Array
<?php
$cities = [['id'=>'1','no'=>'1','name'=>'Adana'], ['id'=>'2','no'=>'2','name'=>'Adıyaman'], ['id'=>'3','no'=>'3','name'=>'Afyon'], ['id'=>'4','no'=>'4','name'=>'Ağrı'], ['id'=>'68','no'=>'5','name'=>'Aksaray'], ['id'=>'5','no'=>'6','name'=>'Amasya'], ['id'=>'6','no'=>'7','name'=>'Ankara'], ['id'=>'7','no'=>'8','name'=>'Antalya'], ['id'=>'75','no'=>'9','name'=>'Ardahan'], ['id'=>'8','no'=>'10','name'=>'Artvin'], ['id'=>'9','no'=>'11','name'=>'Aydın'], ['id'=>'10','no'=>'12','name'=>'Balıkesir'], ['id'=>'74','no'=>'13','name'=>'Bartın'], ['id'=>'72','no'=>'14','name'=>'Batman'], ['id'=>'69','no'=>'15','name'=>'Bayburt'], ['id'=>'11','no'=>'16','name'=>'Bilecik'], ['id'=>'12','no'=>'17','name'=>'Bingöl'], ['id'=>'13','no'=>'18','name'=>'Bitlis'], ['id'=>'14','no'=>'19','name'=>'Bolu'], ['id'=>'15','no'=>'20','name'=>'Burdur'], ['id'=>'16','no'=>'21','name'=>'Bursa'], ['id'=>'17','no'=>'22','name'=>'Çanakkale'], ['id'=>'18','no'=>'23','name'=>'Çankırı'], ['id'=>'19','no'=>'24','name'=>'Çorum'], ['id'=>'20',
@sineld
sineld / gravatar.php
Created November 26, 2012 09:59
Gravatar Macro for Laravel
<?php
// Source: http://forums.laravel.com/viewtopic.php?pid=20704#p20704
// Here's a handy macro for creating an image tag that links to a gravatar image.
//If these files/folders don't exist, create a 'macros' folder in your application folder, and create an 'html.php' file in the macros folder.
// In application/start.php add this to the end of the file:
require path('app').'macros/html.php';
@sineld
sineld / closure.php
Created November 27, 2012 07:12
Using Closures with use and new array style @ Php 5.4
<?php
$message = ['Good Morning', 'Good Afternoon', 'Good Evening', 'Good Night'];
$greetingsTo = function($to) use($message){
return $message[rand(0,count($message)-1)].' '.$to;
};
echo $greetingsTo('Tuana Şeyma');
@sineld
sineld / menu.php
Created November 29, 2012 15:02
menu
Menu::handler('sineld', array('class' => 'nav'))
->add('admin', '<i class="icon-home"></i>Ana Sayfa</a>')
->add('#', '<i class="icon-edit"></i>Duyurular <b class="caret"></b>',
Menu::items('notify', array('class' => 'dropdown-menu'), 'ul')
->add('admin/notify/add', '<i class="icon-pencil"></i>Ekle')
->add('admin/notify/list', '<i class="icon-file"></i>Listele')
, array('class'=>'dropdown-toggle', 'data-toggle'=>'dropdown'), array('class'=>'dropdown'))
->add('#', '<i class="icon-leaf"></i>Bayi <b class="caret"></b>',