Skip to content

Instantly share code, notes, and snippets.

View ronakjain2012's full-sized avatar

Ronak Bokaria ronakjain2012

View GitHub Profile
@ronakjain2012
ronakjain2012 / Doubly_link_list.cpp
Created February 22, 2016 11:44
Doubly link list with header circular
@ronakjain2012
ronakjain2012 / upload_file.php
Last active July 1, 2016 07:26
Uploading File using php (Single File)
<!-- HTML PART -->
<form enctype="multipart/form-data" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post" name="changer">
<input name="MAX_FILE_SIZE" value="1002400" type="hidden"> <!-- File size -->
<input name="image" accept="image/jpeg" type="file" value="">
<input value="Submit" type="submit">
<?php
if(!isset($_FILES['image']))
{
@ronakjain2012
ronakjain2012 / random.php
Created July 1, 2016 07:46
Print random String set
<?php
echo generateRandomString();
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
@ronakjain2012
ronakjain2012 / upload_files.php
Created July 1, 2016 07:50
Upload Multiple files using php
<form method="post" enctype="multipart/form-data">
<input type="file" id="file" name="files[]" multiple />
<input type="submit" value="Upload" class="btn btn-success"/>
</form>
<?php
$valid_formats = array("c", "cpp", "php", "java", "bat", "js" ,"sql" ,"html");
$max_file_size = 1024*5000; //100 kb
$path = "myfiles/"; // Upload directory
$count = 0;
@ronakjain2012
ronakjain2012 / HeadersValue.jsp
Last active May 23, 2017 06:08
Printing the request(request.getHeaderNames()) and response header(response.getHeaderNames())
<table>
<tr>
<th> Header Name </th>
<th> Header Details </th>
</tr>
<tr>
<tr>
<%
// Printing the request and response header
Enumeration header = request.getHeaderNames();
@ronakjain2012
ronakjain2012 / get_count.sh
Created May 5, 2018 17:16
count the executable files available in your environment variable in Linux shell
envpath="$PATH"
sum=0
IFS=':'
read -ra ADDR <<< "$envpath"
for x in "${ADDR[@]}"; do
cd "$x"
for y in `ls -l | grep -E "[d\-](([rw\-]{2})x){1,3}"`; do
sum=$((1 + sum))
done
done
@ronakjain2012
ronakjain2012 / CommonFunctions.php
Last active June 24, 2020 03:23
A sanitizing class can be used for different type of inputs
class CommonFunctions
{
public static function sanitize_number($number)
{
return filter_var($number, FILTER_SANITIZE_NUMBER_INT);
}
public static function sanitize_decimal($decimal)
{
return filter_var($decimal, FILTER_SANITIZE_NUMBER_FLOAT);
@ronakjain2012
ronakjain2012 / vue-table.html
Created July 10, 2018 16:29
Vue JS Table with Vue-bootstrap in single HTML page with CDN
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>table</title>
<!-- Add this to <head> -->
<link type="text/css" rel="stylesheet" href="https://unpkg.com/bootstrap/dist/css/bootstrap.min.css"/>
<link type="text/css" rel="stylesheet" href="https://unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.css"/>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<!-- Add this after vue.js -->
@ronakjain2012
ronakjain2012 / debouncing.js
Created January 16, 2019 12:22
Call any function after a delay
const debounce = (func, delay) => {
let inDebounce
return function() {
const context = this
const args = arguments
clearTimeout(inDebounce)
inDebounce = setTimeout(() => func.apply(context, args), delay)
}
}
@ronakjain2012
ronakjain2012 / end.js
Created January 19, 2019 04:37
Go to end of page
$("html, body").animate({ scrollTop: $(document).height() }, 1000);