Skip to content

Instantly share code, notes, and snippets.

View neotohin's full-sized avatar

Amzad Hossain neotohin

View GitHub Profile
@neotohin
neotohin / fix_collate.php
Created April 5, 2023 11:03
MySQL Collate fix
<?php
// Stolen from: http://www.holisticsystems.co.uk/blog/?p=931
// Modified to work using mysqli
$server = 'localhost';
$username = 'root';
$password = 'root';
$database = 'ojs';
$new_charset = 'utf8';
$new_collation = 'utf8_unicode_ci';
@neotohin
neotohin / write_excel.php
Created March 14, 2023 06:28
PHPExcel to generate xls from array
function erecruitment_export_write_excel( $data, $uri){
if( count($data) == 0 ) return '';
// load phpexcel library
$module_path = drupal_get_path('module', 'erecruitment');
require_once( $module_path . '/vendor/autoload.php' );
$doc = new PHPExcel();
@neotohin
neotohin / Lsyncd Technical Session.md
Last active May 23, 2020 09:48 — forked from mralexjuarez/Lsyncd Technical Session.md
Quick Tutorial on Using Lsyncd

Lsyncd Technical Session

Lsyncd is a tool used to keep a source directory in sync with other local or remote directories. It is a solution suited keeping directories in sync by batch processing changes over to the synced directories.

This could mean:

  • Creating a live backup of a directory which would be easy to fail over to.
  • Eliminate a single point of failure by distributing the data to multiple servers
@neotohin
neotohin / tmux.conf
Created October 5, 2016 09:34
Tmux Configuration
###########################
# Configuration
###########################
# use vim key bindings
setw -g mode-keys vi
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
@neotohin
neotohin / drush.sh
Created December 9, 2015 06:04
Drush related zsh functions for Drupal Related operation
alias dpml='drush pml | grep '
function sass.c(){
dtheme=`drush vget theme_default | cut -d' ' -f 2`;
echo "Current Theme: $dtheme";
compass compile "sites/all/themes/$dtheme";
}
function sass.w(){
dtheme=`drush vget theme_default | cut -d' ' -f 2`;
@neotohin
neotohin / metaDataWrapperHelper.php
Created December 2, 2015 07:15
Drupal MetaData Wrapper Helper
<?php
/**
* A simple closure that helps working with node fields
*
* $metadata_wrapper = entity_metadata_wrapper('node', $nid);
* $wrapper = metaDataWrapperHelper( $metadata_wrapper );
*
* $field_name = $wrapper('field_name', 'text');
*/
function metaDataWrapperHelper($wrapper){
@neotohin
neotohin / Drupal : Services Module
Created August 11, 2015 11:08
Guzzle based drupal7 Service request sample
<?php
require_once '../vendor/autoload.php';
use Guzzle\Http\Client as Guzzle;
use Guzzle\Plugin\Cookie\CookiePlugin;
use Guzzle\Plugin\Cookie\CookieJar\FileCookieJar;
$client = new Guzzle();
@neotohin
neotohin / gist:69d60568ffdd20486fd7
Created August 14, 2014 08:59
Vundle Installation on runtime
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Setting Vundle Bundles
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
"filetype off
function! LoadVundle()
let vundle_installed=filereadable(expand('~/.vim/bundle/vundle/README.md'))
@neotohin
neotohin / vimrc
Last active August 29, 2015 13:56
My VIM configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Setting Vundle Bundles
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
"filetype off
function! LoadVundle()
let vundle_installed=filereadable(expand('~/.vim/bundle/vundle/README.md'))
@neotohin
neotohin / gitconfig
Last active January 4, 2016 08:18
My gitconfig
[user]
name =
email =
[alias]
st = status -sb
f = fetch
c = commit
p = pull
b = branch -ra