Skip to content

Instantly share code, notes, and snippets.

View mahedi2014's full-sized avatar
🙂

Mahedi Azad mahedi2014

🙂
View GitHub Profile
@mahedi2014
mahedi2014 / addMore.html
Created April 29, 2015 08:16
Add more field with jquery in bootstrap
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script>
var rowCount = 1;
function addMoreRows(){
var recRow = '<tr id="rowCount'+rowCount+'">' +
@mahedi2014
mahedi2014 / index
Created May 4, 2015 08:36
Add more with jquery by div content cloning
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type='text/javascript' src='//code.jquery.com/jquery-2.1.0.js'></script>
<script>//<![CDATA[
//Add a row in "#addedRows" by cloning '#row'
var cloneCount = 1;
@mahedi2014
mahedi2014 / index.html
Created May 5, 2015 06:12
Add more option with jq function
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
//Add a row in "#addedRows" by cloning '#row'
var cloneCount = 1; //set global var for count clone number
function cloneRow(contentRowId, addRowId, removeRowId){
var newRowId = addRowId+ cloneCount++;
var newDeleteId = "deleteId-"+newRowId;
@mahedi2014
mahedi2014 / CipherData.java
Created June 5, 2015 17:09
File encryption and decryption using DES in java
package test;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Scanner;
import javax.crypto.Cipher;
@mahedi2014
mahedi2014 / image preview
Created June 12, 2015 06:13
Make image preview on select and change value of input file value by image name
<img id="previewHolderCustomerSignature" onclick="setImage( this.id, 'fileCustomerSignaturePhoto' );" src="https://placeholdit.imgix.net/~text?txtsize=22&txt=Upload customer signature (225px X 150px)&w=225&h=80&txttrack=0" class="img-thumbnail text-center" style="cursor: pointer">
<input type="file" name="fileCustomerSignaturePhoto" value="" id="fileCustomerSignaturePhoto" class="required borrowerImageFile" style="display: none" >
<script>
function setImage(imageLinkId, inputFileName){
$("#"+inputFileName).trigger('click').change(function() {
if (this.files && this.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#'+imageLinkId).attr('src', e.target.result);
}
@mahedi2014
mahedi2014 / form_validation.js
Last active September 2, 2015 08:15
From validation
/**
* Make capital on input
*
* @param fieldId
* @param thisValue
*
* Example: onkeypress="return inputCapital(event, this.id, 100);"
*/
function inputCapital(fieldId, thisValue){
$('#'+fieldId).val( $('#'+fieldId).val().toUpperCase() );
@mahedi2014
mahedi2014 / curlFopen.php
Created September 4, 2015 04:12
Using curl and fopen
<?php
/*
go=1 (hidden)
hp='value from textbox'
message='value from texarea'
c='captcha image'
*/
/**Data generation**/
$vars = array(
@mahedi2014
mahedi2014 / phpmailer.php
Created September 13, 2015 10:17
Send mail with phpmailer and gmail smtp
<?php
//add to composer.json "phpmailer/phpmailer": "~5.2"
require_once 'vendor/autoload.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = 'smtp';
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com'; // "ssl://smtp.gmail.com" didn't worked
@mahedi2014
mahedi2014 / PasswordPolicy.php
Last active October 1, 2015 10:15
Password policy
<?php
/**
* Password policy
*
* Created by Mahedi Azad.
* User: Mahedi Azad
* Date: 01-Oct-15
* Time: 9:45 AM
*/
@mahedi2014
mahedi2014 / orcl_limit.sql
Created November 8, 2015 06:58
Oracle limit query like mysql
###Query
select * from
( select temp_table.*, ROWNUM rnum from
( <your_query_goes_here, with order by> ) temp_table
where ROWNUM <= :MAX_ROW_TO_FETCH )
where rnum >= :MIN_ROW_TO_FETCH;
###Instruction
:MAX_ROW_TO_FETCH is the maximum limit of row that be displayed