Skip to content

Instantly share code, notes, and snippets.

View bantya's full-sized avatar
🎯
Focussing

Rahul Thakare bantya

🎯
Focussing
  • http://127.0.0.1:4200
  • http://127.0.0.1:8080
  • 20:29 (UTC -12:00)
  • X @rkkth
View GitHub Profile
@bantya
bantya / JavaScriptCountries.js
Created January 17, 2016 20:15 — forked from MindaugasR/JavaScriptCountries.js
JavaScript Countries
var Country = {
countries: {
"AC": {
countryName: "ASCENSION ISLAND",
countryCode: "247",
currencyCode: "EURO"
},
"AF": {
countryName: "AFGHANISTAN",
countryCode: "93",
@bantya
bantya / color-conversion-algorithms.js
Last active February 16, 2016 17:41 — forked from mjackson/color-conversion-algorithms.js
Javascript: RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@bantya
bantya / timthumb.php
Created May 13, 2016 18:57 — forked from aabir/timthumb.php
TimThumb Image Lib for PHP
<?php
/**
* TimThumb by Ben Gillbanks and Mark Maunder
* Based on work done by Tim McDaniels and Darren Hoyt
* http://code.google.com/p/timthumb/
*
* GNU General Public License, version 2
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Examples and documentation available on the project homepage
static function detect($path1, $path2, $colorPrecision = null, $gaussianBlur = false)
{
$img1 = imagecreatefrompng($path1);
$img2 = imagecreatefrompng($path2);
$w1 = imagesx($img1); $h1 = imagesy($img1);
$w2 = imagesx($img2); $h2 = imagesy($img2);
# Stop early if the size of images such that images can not be part of each other
if (($w1 > $w2 && $h2 > $h1))
<?php
echo <<<_END
<font face='Courier New' size='4'><pre>
<ul>
<b><u>PHP PICTURE PROCESSOR</u>
<form method='post' action='picproc.php'
enctype='multipart/form-data'>
UPLOAD : <input type='file' name='p' size='1'>
ACTION : <select name='a'>
@bantya
bantya / Path.php
Created May 13, 2016 19:21 — forked from TorbenKoehn/Path.php
Path manipulation class for PHP frameworks (not fully tested)
<?php
namespace Dwarf;
class Path extends Object implements \IteratorAggregate, \Countable {
protected $path;
public function __construct( $path ) {
@bantya
bantya / rgb_to_hex_to_rgb.php
Last active May 18, 2016 19:11 — forked from Pushplaybang/rgb_to_hex_to_rgb.php
php functions convert hex to rgb and rgb to hex
// http://bavotasan.com/2011/convert-hex-color-to-rgb-using-php/
function hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
@bantya
bantya / html5-data.js
Created June 9, 2016 12:56 — forked from remy/html5-data.js
data-* support
(function () {
var forEach = [].forEach,
regex = /^data-(.+)/,
dashChar = /\-([a-z])/ig,
el = document.createElement('div'),
mutationSupported = false,
match
;
function detectMutation() {
(function () {
function detectMutation() {
mutationSupported = true;
this.removeEventListener('DOMAttrModified', detectMutation, false);
}
var forEach = [].forEach,
regex = /^data-(.+)/,
el = document.createElement('div'),
mutationSupported = false;
// Loads js files
function loadScripts(urlArray,cb) {
var scriptLoadCount = scriptLoadedCount = 0;
loadScript();
function loadScript() {
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
var url = (urlArray[scriptLoadCount].indexOf('?') == -1) ? urlArray[scriptLoadCount] + '?d=' + Math.random() : urlArray[scriptLoadCount] + '&d=' + Math.random()