Skip to content

Instantly share code, notes, and snippets.

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

Saiful Islam saaiful

🏠
Working from home
View GitHub Profile
@saaiful
saaiful / CONFIG
Last active August 29, 2015 14:06
Login Function
<?php
//DB Config
date_default_timezone_set('Asia/Dhaka');
$db=new PDO('mysql:host=localhost;dbname=dbname;charset=utf8','root','pass');
//Site Url
$siteUrl = "http://localhost/fdfdf";
?>
@saaiful
saaiful / Gmail Email Filter
Created September 17, 2014 17:59
Gmail Email Filter
<?php
function fraud_gmail($user_email)
{
$user_email = strtolower($user_email);
$data = explode('@', $user_email);
if(count($data)===2)
{
if(preg_match("/g(oogle)?mail(.*)/", $data[1], $ext))
{
$trick = explode('+', $data[0]);
@saaiful
saaiful / gist:0077b0620b9a7a590977
Last active August 29, 2015 14:06
PDO Prepared Query
<?php
try{
date_default_timezone_set('Asia/Dhaka');
$db = new PDO('mysql:host=localhost;dbname=dbname;charset=utf8','root','pass');
}
catch(Exception $e){
var_dump($e); // Change it With Error Text
die();
}
@saaiful
saaiful / Datatable Laravel
Last active August 29, 2015 14:06
Datatable Laravel
<?php
// কন্ট্রোলারের মেথড
// সার্চ / সিলেক্ট / সর্ট কুয়েরী।
// কুয়রী রাউট সেট করুন গেট স্টাইলে , চাইলে পোস্টেও করতে পারেন।
function getData(){
return Datatable::collection(User::all(array('id','username')))
->showColumns('id', 'username')
->searchColumns('username','id')
->orderColumns('id','username')
@saaiful
saaiful / result.php
Last active August 29, 2015 14:07
Def. All Result
<?php
ini_set('xdebug.var_display_max_depth', 5);
ini_set('xdebug.var_display_max_children', 256);
ini_set('xdebug.var_display_max_data', 1024);
function get_result($data){
static $all = array();
$data = str_replace(array(" ","\n","\r",' ',' ',' '), '', $data);
// echo '<textarea>'. $data .'</textarea>';
$pr[] = '<td width[a-zA-Z0-9=" ]+>([A-Za-z0-9 - ]+)<\/td>';
@saaiful
saaiful / fix.php
Last active August 29, 2015 14:07
Theme and Plugins Folder Direct Access Deny
<?php
/*
Plugin Name: Theme and Plugins Folder Direct Access Deny
Plugin URI: htp://saiful.im/
Description: WordPress Theme and Plugins Folder Direct Access Deny
Author: Saiful Islam
Version: 0.0.2
Author URI: http://saiful.im/
*/
@saaiful
saaiful / javascript.blade.php
Last active August 29, 2015 14:07
Datatable Laravel JS Fix
<script type="text/javascript">
jQuery(document).ready(function(){
// dynamic table
oTable = jQuery('#{{ $id }}').dataTable({
@foreach ($options as $k => $o)
{{ json_encode($k) }}: @if(!is_array($o)) @if(preg_match("/function/", $o)) {{ $o }} @else {{ json_encode($o) }}, @endif
@else
[{
@saaiful
saaiful / dt.mod.php
Created October 13, 2014 10:48
Modifying Datatable Data
<?php
->addColumn('customer',function($model){
return User::find($model->customer)->username." (".$model->customer.")";
})
?>
<?php
class myClass
{
public $db = '';
private $host = 'localhost';
private $dbname = 'card';
private $dbuser = 'root';
private $dbpass = '';
@saaiful
saaiful / DB+myClass.php
Created October 22, 2014 11:45
Another One
<?php
/**
* DB Class
*/
class DB
{
public $db = '';
private $host = 'localhost';
private $dbname = 'card';