Skip to content

Instantly share code, notes, and snippets.

View pranid's full-sized avatar
🎯
Focusing

Praneeth Nidarshan pranid

🎯
Focusing
View GitHub Profile
@pranid
pranid / multi_array_sort.php
Created March 24, 2020 16:58
PHP - Multidimensional array sorting by specific key
<?php
/**
* @param array $array
* @param string $_key
* @param string $_direction
* @version 1.0.0
* @author Praneeth Nidarshan (praneeth.nidarshan@gmail.com)
*/
function multiArraySort(&$array, $_key,$_direction = 'desc')
@pranid
pranid / compare_string_change.php
Created June 20, 2019 15:23
Compare character change count between string
<?php
$str_one = "PASS12345";
$str_two = "PASSWOD45";
$str_one_arr = str_split($str_one);
$new_arr = str_split($str_two);
$arr_intersect = array_intersect($new_arr, $str_one_arr);
$arr_changes = array_diff($new_arr, $arr_intersect);
@pranid
pranid / html-table2json-string.js
Last active December 16, 2021 19:00 — forked from ccheney/gist:4389114
jQuery: Convert HTML Table to JSON
(function($){
var convertTableToJson = function()
{
var rows = [];
$('table tr').each(function(i, n){
// Ignore empty
if(i != 0) {
var $row = $(n);
rows.push({
display_name: $row.find('td:eq(0)').text(),
@pranid
pranid / TinyLog.php
Last active April 19, 2018 06:53
PHP Logger for analytics
<?php
namespace TinyLog;
/**
* Tiny Log Generator
* @Author Praneeth Nidarshan
* @email praneeth.nidarshan@gmail.com
* @version 2.5.1
*
@pranid
pranid / ReadMe.txt
Created December 11, 2017 12:11 — forked from zeuxisoo/ReadMe.txt
Simple upload and resize image on PHP
- attachment
- 1.jpg
- 2.jpg
...
...
...
- index.php
- resize_image.php
- uploader.php
@pranid
pranid / timezone-grabber.php
Created September 19, 2017 11:06
Get PHP timezone list
<?php
/**
* TIMEZONE GRABBER
* @author PRANEETH NIDARSHAN
*/
$zones = timezone_identifiers_list();
$new_list = array();
@pranid
pranid / Country API with Jquery | Bootstrap
Created August 17, 2017 04:27
Get countries from restcountries.eu and Display it using Bootstrap & Jquery
<!DOCTYPE html>
<html>
<head>
<title>API TEST</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-1">
@pranid
pranid / form-submit-jquery.js
Last active April 17, 2018 07:31
PHP Ajax form controller Jquery
$(function () {
$.notifyDefaults({
placement: {from: "top", align: "center"},
animate: {enter: "animated fadeInUp", exit: "animated fadeOutDown"}
});
$('body').on('submit', 'form', function (e) {
e.preventDefault();
$('button[type=submit]').attr('disabled', true);
var data = new FormData($(this)[0]);
@pranid
pranid / select2.full.js
Created May 18, 2017 10:00
Bootstrap-Jquery Select2 :: Improved
/*!
* Select2 4.0.3
* https://select2.github.io
*
* Released under the MIT license
* https://github.com/select2/select2/blob/master/LICENSE.md
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
@pranid
pranid / bulk_renamer.php
Last active March 10, 2022 06:35
Rename bulk files or folders :: PHP
<?php
/**
* BULK FILE AND FOLDER RENAMER
* @author PRANEETH NIDARSHAN
* @version 1.3
* @email praneeth.nidarshan@gmail.com
*/
$results = array();