Skip to content

Instantly share code, notes, and snippets.

View rahman541's full-sized avatar
🎯
Focusing

Rahman rahman541

🎯
Focusing
View GitHub Profile
@rahman541
rahman541 / ic_sample.php
Last active November 3, 2021 02:46
IC Number input validation on server side (PHP) using Regular Expression (Regex)
<?php
$ic = "123456-11-1111"; //default ic if not set
if(isset($_POST["ic"])){
$ic = $_POST["ic"];
}
$regex = '/^[0-9]{6}-[0-9]{2}-[0-9]{4}$/';
if (preg_match($regex, $ic)) {
echo 'Valid';
} else {
@rahman541
rahman541 / time_range_in_sql
Last active August 29, 2015 14:10
To check time if it avialble in mysql
Assuming Date Range 1 :: User Input
Date Range 2 :: Database Row
Intersection
Date Range 1 | |>----------------------<|
Date Range 2 | |>------------------------<|
where Range1Start <= Range2End and Range1End >= Range2Start
Range 1 in Range 2:
Date Range 1 | |>-------------<|
@rahman541
rahman541 / query.sql
Last active August 29, 2015 14:10
Arikal: query to check availability on specific date & time
SELECT count(*) FROM 'Booking List' WHERE BookDate != '12/12/12' AND BookTime = '10:30:00'
-- To check booking availability on specific time & date
-- Will return row number
-- If it is return zero then AVAILABLE
-- Else is for not available
-- Replace '12:12:12' with php variable. Example '$date'
-- Replace '10:30:00' with php variable. Example '$time'
@rahman541
rahman541 / add_minus.c
Created November 7, 2015 12:47
Add and Minus between two integer, aritmetic operation determined by the user.
#include <stdio.h>
int main( )
{
char op;
int num1, num2, sum;
printf("Enter 1st integers: ");
scanf("%d",&num1);
printf("Enter 2nd integers: ");
scanf("%d",&num2);
@rahman541
rahman541 / fileio.cpp
Created January 29, 2016 12:48
C++ File I/O Operation
#include <sstream>
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ofstream Finput;
Finput.open ("file.txt");
char str[100];
@rahman541
rahman541 / Install eprints 3.3 on centos 6.md
Last active April 5, 2016 16:46
Install eprints 3.3 on centos 6

The process to install ePrints 3.3.x on CentOS 6 64bit


version (centos-release-6-6.el6.centos.12.2.x86_64)

check yum process if get lock

ps aux | grep -i yum

Req:

su -

Install & Configure mysql if not installed.

@rahman541
rahman541 / install eprints 3.2 on centos 6.md
Last active April 5, 2016 16:42
The process to install ePrints 3.2.x on CentOS 6 64bit

The process to install ePrints 3.2.x on CentOS 6 64bit

issue command to get centos version rpm --query centos-release

output centos-release-6-6.el6.centos.12.2.x86_64

all command require root permission: su -

Install & Configure mysql if not installed

yum install mysql-server
# start mysql on startup
chkconfig mysqld on
@rahman541
rahman541 / select_all_checkbox_use_js.md
Last active April 25, 2016 15:20
Select all visible checkbox in a webpage

Select all visible checkbox in page via console


tested in chrome only

open chrome > open Inspect Element or press F12 in page you want to select visible checkbox. Then paste this code to Console tab.

var inputs = document.getElementsByTagName('input');
for (var i = 0; i < inputs.length; ++i) {
  if (inputs[i].type == "checkbox"){
 inputs[i].checked = true;
@rahman541
rahman541 / useful_msword_shortkey.md
Created April 25, 2016 15:56
Useful Shortut key for MS Word

Tested in ms word 2016

  1. Hightlight selected text ctrl + alt + H
@rahman541
rahman541 / jqready.sublime-snippet
Created September 22, 2016 05:28
Sublime Text 2 snippet for $(document).ready()
<snippet>
<content><![CDATA[
<script type="text/javascript">
jQuery(document).ready(function(\$) {
${1://put all your jQuery goodness in here.}
});
</script>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>jqready</tabTrigger>