Skip to content

Instantly share code, notes, and snippets.

View ronisaha's full-sized avatar

Roni Saha ronisaha

View GitHub Profile
@ronisaha
ronisaha / tmt20ii_status.php
Created August 5, 2016 16:30 — forked from defacto133/tmt20ii_status.php
Get TM-T20II Epson ASB status through UDP socket
/*
* $status = {
* "status": "online" | "offline",
* "cover": "open" | "closed", (opt)
* "feeding": "feeding" | "not", (opt)
* "autocutterError": "error" | "not", (opt)
* "unrecoverableError": "error" | "not", (opt)
* "recoverableError": "error" | "not", (opt)
* "paper": "paperEnd" | "paperPresent" (opt)
* }
@ronisaha
ronisaha / Remove all git tags
Created August 13, 2016 01:55 — forked from okunishinishi/Remove all git tags
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@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
<?php
class KillingRoom {
private $peoples;
private $survivor;
public function __construct($people)
{
$this->newGame($people);
}
@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();
@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 / 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 / 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 / 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 / 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);