This file contains 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
try { | |
DB::connection()->pdo->beginTransaction(); | |
// database queries here | |
DB::connection()->pdo->commit(); | |
} catch (\PDOException $e) { | |
// Woopsy | |
DB::connection()->pdo->rollBack(); | |
} |
This file contains 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
<!-- SINGLE COLUMN LAYOUT --> | |
<div id="wrap"> | |
<header id="header"></header> | |
<section id="main"></section> | |
</div> | |
<footer id="footer"></footer> | |
<!-- MULTI COLUMN LAYOUT --> | |
<div id="wrap"> | |
<header id="header"></header> |
This file contains 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
<script> | |
showMap([ | |
{ | |
target: "map-canvas", | |
locations: [ | |
["Saved Home 1",-25.363882,131.040922], | |
["Saved Home 2",-25.363882,131.044922], | |
["Saved Home 3",-25.363882,131.048922], | |
["Saved Home 4",-25.363882,131.052922], | |
["Saved Home 5",-25.363882,131.056922], |
This file contains 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
$doc = new DOMDocument(); | |
$doc->loadHTML($html); | |
$tags = $doc->getElementsByTagName('img'); | |
foreach ($tags as $tag) { | |
echo $tag->getAttribute('src'); | |
} |
This file contains 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 getRealIpAddr() | |
{ | |
if (!empty($_SERVER['HTTP_CLIENT_IP'])) | |
//check ip from share internet | |
{ | |
$ip=$_SERVER['HTTP_CLIENT_IP']; | |
} | |
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) | |
//to check ip is pass from proxy | |
{ |
This file contains 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
$.extend({ | |
countUnique : function(array) { | |
var result = []; | |
$.each(array, function(i,v) { | |
if($.inArray(v, result) == -1) { | |
result.push(v); | |
} | |
}); | |
return result.length; | |
} |
This file contains 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
// Get distinct values from an array | |
$.extend({ | |
distinct : function(anArray) { | |
var result = []; | |
$.each(anArray, function(i,v){ | |
if ($.inArray(v, result) == -1) result.push(v); | |
}); | |
return result; | |
} |
This file contains 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
var fullList = []; | |
$(".list-wrapper").each(function() { | |
var tempStr = ""; | |
tempStr = '"' + $(this).find(".company-list-name a").text() + '"'; | |
tempStr += ',"' + $(this).find(".profile-update").text() + '"'; | |
tempStr += ',"' + $(this).find(".company-focus").text() + '"'; | |
fullList.push(tempStr); | |
}); | |
var output = fullList.join('\n'); | |
var uri = 'data:application/csv;charset=UTF-8,' + encodeURIComponent(output); |
This file contains 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 | |
//define('UPLOADFILES', dirname(dirname(__FILE__)) . '/sixpoints'); | |
function recursiveDelete($path) { | |
// if (strpos($path, UPLOADFILES) === false) { | |
// exit('Trying to remove from wrong path to uploadfiles!'); | |
// } | |
if (is_file($path)) { | |
return unlink($path); | |
} elseif ( is_dir($path) ){ |
This file contains 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 | |
function getExtension($str) { | |
$i = strrpos($str,"."); | |
if (!$i) { return ""; } | |
$l = strlen($str) - $i; | |
$ext = substr($str,$i+1,$l); | |
return $ext; | |
} |