Skip to content

Instantly share code, notes, and snippets.

View rajbdilip's full-sized avatar
🎯
Focusing

Dilip Raj Baral rajbdilip

🎯
Focusing
View GitHub Profile
@rajbdilip
rajbdilip / stopwords.txt
Created April 23, 2017 14:03
Stopwords for Topic modelling
a
able
about
above
abst
accordance
according
accordingly
across
act
@rajbdilip
rajbdilip / slugify.php
Created April 2, 2017 09:04
Generate clean URL (slug) from a string
<?php
/**
* Generates clean URL
*
* @param string
* @return string
*/
function slugify( $string ) {
$cleanString = preg_replace( "/[^a-zA-Z0-9\/_|+ -]/", '', $string );
$cleanString = strtolower( trim( $cleanString, '-' ) );
@rajbdilip
rajbdilip / .bash_profile
Created February 14, 2017 21:18
Show Git branch name of terminal prompt (OS X)
# Add the following lines of code to ~/.bash_profile
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
# Run the following code and restart terminal
# $ bash ~/.bash_profile
@rajbdilip
rajbdilip / smarty-php-date-format-converter.php
Last active May 13, 2016 19:53
Smarty Date Format to PHP Date Format converter
<?php
$arr = array(
'M' => '%b',
'F' => '%B',
'd' => '%d',
'j' => '%e',
'S' => '%f',
'H' => '%H',
'h' => '%I',
'G' => '%k',
@rajbdilip
rajbdilip / .bashrc
Last active May 27, 2016 07:58 — forked from lukaswilkeer/.bashrc
Gnome terminal with colors and git branch.
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
#define GIT_COLOR_NORMAL “”
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options