Skip to content

Instantly share code, notes, and snippets.

View ertankayalar's full-sized avatar
🏠
Working from home

Ertan Kayalar ertankayalar

🏠
Working from home
View GitHub Profile
@ertankayalar
ertankayalar / blank.html
Created April 11, 2013 13:34
HTML: Blank Template Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>POST Page - WP Bootstrap Temple</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<?php
$the_url = isset($_REQUEST['url']) ? htmlspecialchars($_REQUEST['url']) : '';
?>
<form method="post">
Please enter full URL of the page to parse (including http://):<br />
<input type="text" name="url" size="65" value="<?php echo $the_url; ?>"/><br />
or enter text directly into textarea below:<br />
<textarea name="text" cols="50" rows="15"></textarea>
@ertankayalar
ertankayalar / csv-from-db.php
Created June 22, 2013 13:53
create .csv from DB
<?php
import_request_variables('gpc');
$host = ''; // <-- db address
$user = ''; // <-- db user name
$pass = ''; // <-- password
$db = 'rsvp_list'; // db's name
$table = 'guest_list'; // table you want to export
$file = '6am_event_guest_list'; // csv name.
@ertankayalar
ertankayalar / extract-image-from-html.php
Created June 22, 2013 13:54
extract image from html
<?php
$contenttograbimagefrom = $youroriginalhtmlwithimage;
$firstImage = "";
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $contenttograbimagefrom, $ContentImages);
$firstImage = $ContentImages[1] [0]; // To grab the first image
echo $firstImage;
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
if ($handle = opendir('/media/book')) {
echo "Directory handle: $handle\n";
echo "Files:\n";
/* This is the correct way to loop over the directory. */
@ertankayalar
ertankayalar / start and end dates of the week.php
Created June 22, 2013 14:03
start and end dates of week
<?php
// calculate start and end dates of the week
// 0 = Sunday
echo date("Y-m-d", strtotime(date("Y").'W'.date('W')."0"));
// 7 = Saturday
echo date("Y-m-d", strtotime(date("Y").'W'.date('W')."7"));
@ertankayalar
ertankayalar / doctrine-guide.php
Created June 22, 2013 14:05
doctrine notları
<?php
/*
doctrine ile kodlama yaparken mümkün oldukça array olarak döndürelim
---------------------------------------------------------------------
*/
public function getUserId($username) {
$user = Doctrine_Query::create()
->select('u.id, u.user_name')
->from('User u')
@ertankayalar
ertankayalar / yii-breadcrumbs-menu.php
Created June 22, 2013 14:06
yii breadcrumbs menu
<?php
$this->breadcrumbs=array(
Yii::t('holiday', 'Adverts'),
);
veya
$this->breadcrumbs=array(
'Menu Items'=>array('index'),
'Create',
);
@ertankayalar
ertankayalar / Yii-CActiveDataProvider.php
Created June 22, 2013 14:07
yii active data provider
<?php
$dataProvider=new CActiveDataProvider('Post', array(
'criteria'=>array(
'condition'=>'status=1',
'order'=>'create_time DESC',
'with'=>array('author'),
),
'pagination'=>array(
'pageSize'=>20,
),