Skip to content

Instantly share code, notes, and snippets.

View frayhan32's full-sized avatar

Faris Rayhan frayhan32

View GitHub Profile
function findValueThenRemove(value){
var a = ['a','b','c','d'];
for(var i = 0 ; i<= a.length-1;i++){
if(a[i] === value){
a.splice(i,1);
}
}
alert(a);
}
findValueThenRemove('b');
@frayhan32
frayhan32 / gist:2dd706a70eb2b9a77710
Created July 23, 2014 07:00
disappearAddressBarOnMobileWebView
<script>
// Hides mobile browser's address bar when page is done loading.
window.addEventListener('load', function(e) {
setTimeout(function() { window.scrollTo(0, 1); }, 1);
}, false);
</script>
@frayhan32
frayhan32 / PHPS_SERVER
Created July 20, 2014 09:59
PHP S_SERVER
<?php
$indicesServer = array('PHP_SELF',
'argv',
'argc',
'GATEWAY_INTERFACE',
'SERVER_ADDR',
'SERVER_NAME',
'SERVER_SOFTWARE',
'SERVER_PROTOCOL',
'REQUEST_METHOD',
// Pig Latin Translator Project
// Created By Faris Rayhan
// Copyrgiht 2014
// This function will add the string at the end of string which begin by vocal with "-way"
// If begin with consonant the consonant word will be moved at the end of string plus "ay"
@frayhan32
frayhan32 / js_strength_password
Last active December 23, 2015 05:49
Strength password
/**
* Strength Password Class
*
* Build with full of the love
*
* Faris Rayhan
*
* Copyright 2014
*/
@frayhan32
frayhan32 / js_check_time
Last active December 23, 2015 04:09
Check time
<script>
/**
* Checktime class
*
* Faris Rayhan 2014
*
* Profitable when dealing with time scope
*
* @param {Year} as number
* @param {Month} as number
@frayhan32
frayhan32 / js_email_Valid
Created September 16, 2013 08:51
Email Validation
//********************************//
//********Email Validation********//
//********************************//
//***************************************************//
//********Plese read instruction before using********//
//***************************************************//
//*This is simple email validation function accept one arguments using regular expression*//
@frayhan32
frayhan32 / js_captcha
Created September 15, 2013 07:43
js_captcha
//*************************************************************//
//***************************JS CAPTCHA************************//
//*************************************************************//
//*************************************************************//
//*****************Please Read Carefully Before Using**********//
//*************************************************************//
//This my way when dealing with captcha
//I use help of Jquery so you should include jquery at first
@frayhan32
frayhan32 / js_rand_int
Last active December 23, 2015 02:39
Random int
//*****************************************************************//
/*getRandomint function to return random number in range min and max you supply*/
/*very useful for me when building captcha*/
//*****************************************************************//
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
@frayhan32
frayhan32 / js_trim
Last active December 23, 2015 02:39
Trim Function
//Trim function i usually use this to dismiss space either in the front , back , or middle
//very useful when dealing with email input so no space is exist
/*this is alternative way , whether you want to use keypress validation that just allow number , character , space , an , backspace
its up to you*/
//**********************************//
//***********TRIM FUNCTION***********//
//**********************************//
function trim(str){
return str.replace(/^\s+/g,"").replace(/\s+/g,"")