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 / 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 / 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 / depoyment.sh
Created October 13, 2015 06:31
Nodejs deployment
#!/bin/bash
while:
do
node server.js
echo "server crached!"
sleep 1
done
@eftakhairul
eftakhairul / nginx_rails4_puma_configuration
Last active November 30, 2016 16:38
Configuration for nginx with rails by puma
upstream app {
# Path to Puma SOCK file, as defined previously
server unix:/home/app/abc-app/shared/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root /home/app/abc-app/public;