Skip to content

Instantly share code, notes, and snippets.

View ronisaha's full-sized avatar

Roni Saha ronisaha

View GitHub Profile
@ronisaha
ronisaha / gitrmtags.sh
Last active August 17, 2017 17:38
Remove all tags(local and remote) from git repository
#!/bin/sh
git tag -d $(git tag -l)
#Fetch remote tags.
git fetch
#Delete remote tags.
git push origin --delete $(git tag -l) # Pushing once should be faster than multiple times
#Delete local tags.
git tag -d $(git tag -l)
@ronisaha
ronisaha / backup.bat
Created April 5, 2017 18:33
Backup restore MySQL(Windows)
@echo off
TITLE MySQL Backup Executor
:: Change the values that match your environment
SET backup_dir=D:\mysql_daily_backups\
SET mysqldb=zxy_mis
SET mysqlpassword=123456
SET mysqluser=root
SET mysqlpath=mysqldump
@ronisaha
ronisaha / bn_url_slug.php
Last active March 5, 2017 13:41 — forked from sgmurphy/url_slug.php
URL Slugs in PHP (with UTF-8 and Transliteration Support)
<?php
function url_slug($string = null, $separator = "-") {
if (is_null($string)) {
return "";
}
// Remove spaces from the beginning and from the end of the string
$string = trim($string);
@ronisaha
ronisaha / wordwrap.js
Created February 8, 2017 05:54
PHP_WORDWRAP in javascript
function wordwrap( str, width, brk, cut ) {
brk = brk || '\n';
width = width || 75;
cut = cut || false;
if (!str) { return str; }
var regex = '.{1,' +width+ '}(\\s|$)' + (cut ? '|.{' +width+ '}|.+$' : '|\\S+?(\\s|$)');
return str.match( new RegExp(regex, 'g') ).join( brk );
@ronisaha
ronisaha / checkall.js
Last active February 4, 2017 10:55
Check Box Select All
$("body").delegate('input[data-group]','click',function () {
var name = $(this).data('group');
$(this).closest('.group_checkbox').find('input[name=' + name +']').attr('checked', this.checked);
});
$("body").delegate('input[type=checkbox]:not([data-group])','change',function () {
var name = $(this).attr("name");
var groupEl=$(this).closest('.group_checkbox');
@ronisaha
ronisaha / pos.js
Created February 2, 2017 05:33
temp
EasyPOSPrinter.setJustification(1);
EasyPOSPrinter.selectPrintMode(32);
EasyPOSPrinter.text("Umar Biz LTD.\n");
EasyPOSPrinter.selectPrintMode();
EasyPOSPrinter.setJustification(1);
EasyPOSPrinter.text("Dhaka\n");
EasyPOSPrinter.text("017XXXXXXXX\n");
EasyPOSPrinter.feed();
@ronisaha
ronisaha / chrom-kiosk.bat
Created January 18, 2017 04:10
Run chrome in kiosk mode
chrome --kiosk --new-window --incognito --kiosk-printing --user-data-dir=c:\temp http://192.168.1.24:8080/
@ronisaha
ronisaha / CombinationGenerator.Php
Created December 30, 2016 06:32
CombinationGenerator example
<?php
class CombinationGenerator implements \Iterator
{
private $array;
private $length;
private $itemCount;
private $pos = -1;
private $binArray = array();
private $cache = array();
<?php
class KillingRoom {
private $peoples;
private $survivor;
public function __construct($people)
{
$this->newGame($people);
}
@ronisaha
ronisaha / get_title_and_url.applescript
Created August 17, 2016 03:21 — forked from vitorgalvao/Get Title and URL.applescript
Applescript to get frontmost tab’s url and title of various browsers.
# Keep in mind that when asking for a `return` after another, only the first one will be output.
# This example is meant as a simple starting point, to show how to get the information in the simplest available way.
# Google Chrome
tell application "Google Chrome" to return URL of active tab of front window
tell application "Google Chrome" to return title of active tab of front window
# Google Chrome Canary
tell application "Google Chrome Canary" to return URL of active tab of front window
tell application "Google Chrome Canary" to return title of active tab of front window
# Chromium