Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
This gist assumes:
/** | |
* Trapezoid | |
* - Image transforming class. | |
* | |
* Heavily inspired from: | |
* http://www.leven.ch/canvas/perspective.html | |
*/ | |
/** | |
* Module dependencies. |
Loosely ordered with the commands used most towards the top. Sublime also offer full documentation.
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
Ctrl+⇧+↩ | insert line before |
Ctrl+⇧+↑ | move line (or selection) up |
<?php | |
function get_ip_address() { | |
$ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'); | |
foreach ($ip_keys as $key) { | |
if (array_key_exists($key, $_SERVER) === true) { | |
foreach (explode(',', $_SERVER[$key]) as $ip) { | |
// trim for safety measures | |
$ip = trim($ip); | |
// attempt to validate IP | |
if (validate_ip($ip)) { |
import os | |
import shutil | |
import threading | |
import sys | |
import time | |
import pymongo | |
import re | |
# Two steps: 1. run the test. 2. parse the log. |
var map = function() { emit(this.e, { notifications : this.notifications});}; | |
var reduce = function(key, values) { | |
var count = 0; | |
values.forEach(function(docs) { | |
for(var doc in docs.notifications){ | |
if(docs.notifications[doc].date>1332836355){ | |
count+=1; | |
} | |
} |
<?php | |
// has also some orther sites that is not a disposable mail service | |
$disposalbe = array( | |
'veryrealemail.com', // mirror of mailinator | |
'rtrtr.com', | |
'bobmail.info', | |
'tradermail.info', // mirror of mailinator | |
'omurtlak.com', | |
'mp3dinleq.com', // top spammer |
DROP TABLE IF EXISTS `pk_il`; | |
CREATE TABLE `pk_il` ( | |
`il_id` int(2) NOT NULL COMMENT 'plaka kodu', | |
`il_adi` varchar(255) NOT NULL, | |
PRIMARY KEY (`il_id`), | |
KEY `il_adi` (`il_adi`) USING BTREE | |
) ENGINE=MyISAM; | |
-- ---------------------------- | |
INSERT INTO `pk_il` VALUES ('1', 'ADANA'); |