Skip to content

Instantly share code, notes, and snippets.

View khairulhasanmd's full-sized avatar

Md. Khairul Hasan khairulhasanmd

View GitHub Profile
@khairulhasanmd
khairulhasanmd / post-data.php
Created March 8, 2016 04:48
get all post-data
echo'<table>';
foreach ($_POST as $key => $value) {
echo "<tr>";
echo "<td>";
echo $key;
echo "</td>";
echo "<td>";
echo $value;
echo "</td>";
@khairulhasanmd
khairulhasanmd / Incremental_Selection.py
Last active April 2, 2016 05:18
incremental selection sublime
in Tools/New Plugin...:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
import sublime, sublime_plugin
class IncrementSelectionCommand(sublime_plugin.TextCommand):
def run(self, edit):
start_value = int(self.view.substr(self.view.sel()[0]))
counter = 0
for selection in self.view.sel():
self.view.insert(edit, selection.begin(), str(start_value + counter))
@khairulhasanmd
khairulhasanmd / index.htm
Last active May 7, 2016 08:31
Scroll to top and Scroll to bottom
<html>
<head>
<script>
$( document ).ready(function() {
$('#scrolltotop').fadeOut();
$('#scrolltotop').on("click", function () {
var percentageToScroll = 100;
var percentage = percentageToScroll / 100;
var height = $(document).scrollTop();
var scrollAmount = height * (1 - percentage);
@khairulhasanmd
khairulhasanmd / var www
Last active September 27, 2024 01:39
permission to var www
sudo adduser $USER www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www
sudo chgrp www-data /var/www
#logout and login
@khairulhasanmd
khairulhasanmd / biscuit.htm
Created September 25, 2016 04:37
taken from mdn
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.biscuit {
display: inline-block;
min-width: 20px;
vertical-align: baseline;
margin-left: 10px;
border-radius: 2px;
@khairulhasanmd
khairulhasanmd / rest.php
Last active December 17, 2016 04:02
Rest API
//receiver
CREATE TABLE `sync` (
`name` varchar(100) NOT NULL,
`id` int(11) NOT NULL,
`address` varchar(100) NOT NULL,
`phone` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@khairulhasanmd
khairulhasanmd / controller and model functions list.php
Created April 22, 2017 06:11
controller and model functions list
<?php
public function test($value='')
{
echo '<h2>Controller</h2>'.$this->router->class.'<pre>';
$mthds = (get_class_methods ( $this->router->class ));
foreach ($mthds as $key => $value) {
echo $value.'<br>';
}
echo '</pre><h2>Model</h2>';
echo '<pre>'.$this->router->class.'_mdl';
@khairulhasanmd
khairulhasanmd / jsidle.js
Created April 23, 2017 05:38
js idle detection
var timeout = null;
$(document).on('mousemove', function() {
if (timeout !== null) {
$(document.body).text('');
clearTimeout(timeout);
}
timeout = setTimeout(function() {
$(document.body).text('Mouse idle for 3 sec');
onchange="check_start_date(this)"
function check_start_date1(object) {
var name = 'input[name="' + object.name + '"]';
var objects = $(name);
var index = objects.index( object );
var leave_type_id = document.getElementsByName('leave_type_id[]');
var detail_start_date = document.getElementsByName('detail_start_date[]');
@khairulhasanmd
khairulhasanmd / time-reqd.php
Last active July 13, 2017 06:26
php time required for a code run in seconds
<?php
$start = microtime(true);
//some code
$now = microtime(true);
echo $now - $start . '<br>';
$start = $now;