This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
$db = new PDO('mysql:host=127.0.0.1;dbname=sampledb;charset=utf8', 'root', ''); | |
} catch (PDOException $e) { | |
echo $e->getMessage(); | |
} | |
$stmt = $db->query('SELECT DISTINCT(Sensor) FROM measure2'); | |
$row_count = $stmt->rowCount(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IF a EQUAL TO b AND b EQUAL TO c THEN | |
PRINT 'The numbers are same'; | |
ELSE | |
IF a SMALLER THAN b THEN | |
BEGIN | |
IF a SMALLER THAN c THEN | |
PRINT a; | |
ELSE | |
PRINT c; | |
END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
RED="\[\033[31m\]" | |
YELLOW="\[\033[33m\]" | |
GREEN="\[\033[32m\]" | |
BLUE="\[\033[34m\]" | |
PURPLE="\[\033[35m\]" | |
CYAN="\[\035[36m\]" | |
NO_COLOUR="\[\033[0m\]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Answer #2 | |
preg_match_all('/<a(?:\s+(?:href=[\'"](?P<href>.*?)[\'"]|title=[\'"](?P<title>.*?)["\']|\w+=[\'"](?P<other_attribute_goes_here>.*?)[\'"]))+/', $str, $match,PREG_PATTERN_ORDER); | |
print_r(array('href'=>$match['href'],'title'=>$match['title'])); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$post_string = 'cmd=_notify-validate&' . file_get_contents("php://input"); | |
$ch = curl_init(PAYPAL_URL); | |
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); | |
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private $zones = array( | |
'UM12' => '-12:00', | |
'UM11' => '-11:00', | |
'UM10' => '-10:00', | |
'UM95' => '-9:30', | |
'UM9' => '-9:00', | |
'UM8' => '-8:00', | |
'UM7' => '-7:00', | |
'UM6' => '-6:00', | |
'UM5' => '-5:00', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$destination_url = Array( | |
0 => 'http://www.google.com', | |
1 => 'http://www.google.com', | |
2 => 'http://www.google.com' | |
); | |
$split_percentage = Array( | |
0 => 50, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Jomniaga Conversion code | |
* | |
* Put this file to catalog/view/theme/default/template/common/success.tpl | |
* before | |
* <?php echo $content_bottom; ?> | |
* | |
*/ | |
if(isset($this->session->data['jomniaga'])){ |