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
  • 06:43 (UTC +05:30)
  • X @rkkth
View GitHub Profile
@mbostock
mbostock / .block
Last active June 9, 2024 02:00
Polar Clock
license: gpl-3.0
@xeoncross
xeoncross / timezone.php
Created September 8, 2011 18:43
The perfect TimeZone selectbox list for PHP 5.3+
<?php
$regions = array(
'Africa' => DateTimeZone::AFRICA,
'America' => DateTimeZone::AMERICA,
'Antarctica' => DateTimeZone::ANTARCTICA,
'Aisa' => DateTimeZone::ASIA,
'Atlantic' => DateTimeZone::ATLANTIC,
'Europe' => DateTimeZone::EUROPE,
'Indian' => DateTimeZone::INDIAN,
'Pacific' => DateTimeZone::PACIFIC
@niieani
niieani / gist:1213709
Created September 13, 2011 12:33
PHP Camel Case functions
<?php
// source: http://www.paulferrett.com/2009/php-camel-case-functions/
/**
* Translates a camel case string into a string with underscores (e.g. firstName -&gt; first_name)
* @param string $str String in camel case format
* @return string $str Translated into underscore format
*/
function from_camel_case($str) {
$str[0] = strtolower($str[0]);
@AzeemMichael
AzeemMichael / StringTokenizer.class.php
Created October 2, 2011 23:39
The string tokenizer class allows an application to break a string into tokens.
<?php
/**
* The string tokenizer class allows an application to break a string into tokens.
*
* @author Azeem Michael
* @example The following is one example of the use of the tokenizer. The code:
* <code>
* <?php
* $str = "this is:@\t\n a test!";
@AzeemMichael
AzeemMichael / Comparable.interface.php
Created October 3, 2011 01:09
The String class represents character strings and performs several string manipulation operations
<?php
/**
* This interface imposes a total ordering on the objects of each class that implements
* it. This ordering is referred to as the class's natural ordering, and the class's
* compareTo method is referred to as its natural comparison method
* @author Azeem Michael
*/
interface Comparable {
/**
@LouisLandry
LouisLandry / cache.php
Created November 1, 2011 03:43
JCache concept.
<?php
/**
* @package Joomla.Platform
* @subpackage Cache
*
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die();
@xeoncross
xeoncross / fixEvent.js
Created November 4, 2011 18:54
Fix a JavaScript event
function fixEvent(event)
{
if (!event) var event = window.event;
// Fix target property, if necessary (IE 6/7/8 & Safari2)
if ( ! event.target)
{
event.target = originalEvent.srcElement || document;
}
@xeoncross
xeoncross / Email.php
Created November 10, 2011 20:14 — forked from anonymous/Email.php
<?php
function Email($name, $from, $to, $subject, $message, $bcc = null, $attachments = null)
{
ini_set('SMTP', 'localhost');
ini_set('sendmail_from', $from);
$name = filter_var($name, FILTER_SANITIZE_STRING);
$from = filter_var($from, FILTER_SANITIZE_EMAIL);
$subject = filter_var($subject, FILTER_SANITIZE_STRING);
@ptz0n
ptz0n / gist:1432870
Created December 5, 2011 08:35
Image manipulation
<?php
/**
* Resize Image Class
*
* @author Erik Pettersson <[email protected]>
* @copyright 2011 Erik Pettersson <[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/
class Image {
@xeoncross
xeoncross / i.full.php
Created December 6, 2011 19:23
A simple, easy-to-type, default-value, input class for PHP
<?php
/**
* Here is a non-magic-method version for those that need better auto-complete and faster access times.
* It also filters the input to be valid UTF-8 just when needed thanks to phunction.
*/
class input
{
public static $encoding = 'UTF-8';
public static function server($key, $default = NULL, $control = true)