Skip to content

Instantly share code, notes, and snippets.

View eftakhairul's full-sized avatar
💭
writing code for spaceship :P

Md Eftakhairul Islam eftakhairul

💭
writing code for spaceship :P
View GitHub Profile
@eftakhairul
eftakhairul / gist:634f27ea84f8db63613a
Created August 27, 2015 17:04
Google Book Library based on ISBN
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Description of ISBA Library
*
* @package Library
* @author Jamael Tanveer Nayon <imjtnayon@gmail.com>
* @author Eftakhairul Islam <eftakhairul@gmail.com> http://eftakhairul.com
* @website Changebd.net
*/
@eftakhairul
eftakhairul / Simple Logger
Last active August 29, 2015 14:01
This is a simple logger written by me
function doLog($text, $path = null)
{
// open log file
$logFileName = empty($path)? "/system_log.text" : $path . "/system_log.text";
$logger = fopen($logFileName, "a") or die("Could not open log file.");
//Write the given test with time
fwrite($logger, date("d-m-Y, H:i")." - $text\n") or die("Could not write file!");
fclose($logger);
}
<?php
namespace Application\Tools\Console\Commands;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Command\Command;
/**
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/svn/wp-plugins/$DIR_NAME/$BRANCH
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise64"
config.vm.network "private_network", ip: "192.168.0.210"
config.vm.synced_folder "./dev", "/var/www", create: true
config.vm.provision "shell", path: "https://gist.githubusercontent.com/EmranAhmed/10682844/raw/13d127a5982fa47331aa019ac2d27b9c08f86229/vagrant-provision.sh"
end
@eftakhairul
eftakhairul / Apache2-Ubuntu Virtualhost Cnfiguration
Last active August 29, 2015 14:06
Whole configuration file of virtualhost in Ubuntu 14.p4 for apache 2
<VirtualHost *:80>
ServerAdmin admin@kgt-global.local
DocumentRoot /home/eftakhairul/codes/php/projects/kondar-global/
ServerName www.kgt-global.local
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/eftakhairul/codes/php/projects/kondar-global/>
Require all granted
Options Indexes FollowSymLinks MultiViews
AllowOverride All
class RemoveOldDuplicatePhoneNumberReference < ActiveRecord::Migration
def change
#fetch all user and remove the cross reference for duplicate phone number
User.real_users.find_in_batches.each(:batch_size => 100) do |batch|
batch.each do |u|
if u.annotations[:users_with_the_same_phone]
# remove other users' reference who are associated with this user
@eftakhairul
eftakhairul / .bashre creation script
Created October 22, 2014 14:57
Create New Alias .bashre Script
##------------------------------------ ##
# -- new-alias -- #
# creates new alias & writes to file #
# $1 = alias new #
# $2 = alias definition #
##------------------------------------ ##
new-alias () {
if [ -z "$1" ]; then
echo "alias name:"
read NAME
@eftakhairul
eftakhairul / Chnage App Crime Map Script
Created July 1, 2012 12:17
Raw Javascript of Crime Map at Change App
var map;
var saveLat = 0;
var saveLng = 0;
var lat = 23.71003142406148;
var lon = 90.407231156616290;
var image = "<?php echo site_url('assets/images/pirates.png')?>";
if (!navigator.geolocation) {
alert('Get a better browser');
}
@eftakhairul
eftakhairul / JsonToObjectConvert
Created September 3, 2012 20:49
Json to function call
<?php
$json = 'YOUR JOSN HERE';
$patterns = json_decode($json);
$patternObjects = array();
foreach ($patterns->patterns as $pattern) {
$patternObj = new Pattern();
$patternObjects[] = mapJsonToObject($patternObj, $pattern);
}