Skip to content

Instantly share code, notes, and snippets.

View eldadfux's full-sized avatar
🎵
<b>CODE IS POETRY</b>

Eldad A. Fux eldadfux

🎵
<b>CODE IS POETRY</b>
View GitHub Profile
@IcyMidnight
IcyMidnight / MySQL functions to convert between binary and string uuids
Created July 31, 2009 09:27
MySQL functions to convert between binary and string uuids
DELIMITER |
CREATE FUNCTION uuid_from_bin(b BINARY(16))
RETURNS CHAR(36) DETERMINISTIC
BEGIN
DECLARE hex CHAR(32);
SET hex = HEX(b);
RETURN CONCAT(LEFT(hex, 8), '-', MID(hex, 9,4), '-', MID(hex, 13,4), '-', MID(hex, 17,4), '-', RIGHT(hex, 12));
END
|
@imme-emosol
imme-emosol / .htaccess
Last active February 15, 2023 14:31
apache's mod_rewrite to index.php if 404 unfound/not-found
<IfModule rewrite_module>
#OR<IfModule mod_rewrite.c>
#OR<IfModule mod_rewrite.so>
# according to apache-documentation, followsymlinks is needed for mod_rewrite
Options +FollowSymLinks
# Enable the RewriteEngine
RewriteEngine On
# if needed add(/uncomment) the following:
#RewriteBase /path/to/file/to/be/found/
# check if the request is not an existing file
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@jbroadway
jbroadway / Slimdown.md
Last active February 5, 2024 10:43
Slimdown - A simple regex-based Markdown parser.
@ksafranski
ksafranski / Common-Currency.json
Last active June 12, 2024 16:45
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@krimdomu
krimdomu / gist:3490661
Created August 27, 2012 17:36
Using Rex Templates
#######################
# Rexfile
#######################
task "test", sub {
my @arr = ("one", "two", "three");
my %hash = (
name => "foo",
@sergigp
sergigp / gist:5504930
Last active January 25, 2021 10:12
small benchmark between curl, multicurl and file_get_contents. Results: CURL: 7.37 s // MULTI CURL: 1.93 s // FILE GET CONTENTS: 25.94 s
<?php
$data = array(
'http://www.marca.com',
'http://www.wowebook.be',
'http://www.meneame.net',
'http://www.google.com',
'http://www.elpais.es',
'http://www.reddit.com',
'http://www.digg.com',
@tott
tott / ip_in_range.php
Created November 27, 2013 22:46
php check if IP is in given network range
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
@cjthompson
cjthompson / RobustPDO.php
Created February 3, 2014 19:52
Extended PDO class that detects dropped connections and reconnects
<?php
class RobustPDO extends PDO
{
/** Call setAttribute to set the session wait_timeout value */
const ATTR_MYSQL_TIMEOUT = 100;
/** @var array */
protected $config = [];
/** @var bool For lazy connection tracking */
@ranacseruet
ranacseruet / VideoStream.php
Last active June 17, 2024 11:54
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";