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
  • 04:30 (UTC -12:00)
  • X @rkkth
View GitHub Profile
@bantya
bantya / countrys_flags.js
Last active January 3, 2024 21:15
Javascript : Flags of the countries
/**
* All flags are thankfuly taken from http://flagpedia.net/
* Flag lovers should definitely check it out..
*
* User can modify this list as per his/her need..
*
* - Rahul K. Thakare
* INDIA
* rahulthakare1504@gmail.com
* github.com/bantya
@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 / mail_headers.php
Last active February 10, 2019 20:12
PHP: Mail headers
<?php
$headers = [
'MIME-Version: 1.0',
'Content-Type: text/html; charset="UTF-8";',
'Content-Transfer-Encoding: 7bit',
'Content-Disposition: inline',
'Date: ' . date('r', $_SERVER['REQUEST_TIME']),
'Message-ID: <' . $_SERVER['REQUEST_TIME'] . md5($_SERVER['REQUEST_TIME']) . '@' . $_SERVER['SERVER_NAME'] . '>',
'From: ' . $from,
@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 / attach_css_js.js
Created June 2, 2016 12:42
js: attach dynamic css file using javascript.
var filename='http://path/to/your/cssfile.css?' + new Date().getTime();
var fileref=document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", filename);
document.getElementsByTagName("head")[0].appendChild(fileref);