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 type="text/javascript"> | |
$(document).ready(function() { | |
$('.dragger').mousedown(function (event) { | |
$(this) | |
.data('down', true) | |
.data('x', event.clientX) | |
.data('scrollLeft', this.scrollLeft) | |
.addClass("dragging"); | |
return false; |
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
// https://github.com/lsmith/addBusinessDays/blob/master/addBusinessDays.js | |
// var d = new Date(); | |
// addBusinessDays(d, numberOfDays); | |
function addBusinessDays(d,n) { | |
d = new Date(d.getTime()); | |
var day = d.getDay(); | |
d.setDate(d.getDate() + n + (day === 6 ? 2 : +!day) + (Math.floor((n - 1 + (day % 6 || 1)) / 5) * 2)); | |
return d; | |
} |
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 array_has_dupes($array) { | |
return count($array) !== count(array_unique($array)); | |
} |
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 | |
// PHP SECURE FILE DOWNLOAD | |
// Put the Files in a directory that is not publically accessible.. maybe outside document root or set correct permissions | |
if (!$_SESSION["authenticated"]) { | |
// If not authenticated then send back to the login page | |
$host = $_SERVER["HTTP_HOST"]; | |
$path = rtrim(dirname($_SERVER["PHP_SELF"]), "/\\"); | |
header("Location: http://$host$path/login.php?err=true"); | |
exit; |
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 | |
//on pageload | |
session_start(); | |
$idletime=60;//after 60 seconds the user gets logged out | |
if (time()-$_SESSION['timestamp']>$idletime){ | |
session_destroy(); | |
session_unset(); | |
}else{ |
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
var cursorFocus = function(elem) { | |
var x = window.scrollX, y = window.scrollY; | |
window.scrollTo(x, y); | |
elem.focus(); | |
} | |
cursorFocus(document.getelementbyId('search-terms')); |
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()->getPdo()->beginTransaction(); | |
// database queries here | |
DB::connection()->getPdo()->commit(); | |
} catch (\PDOException $e) { | |
// Woopsy | |
DB::connection()->getPdo()->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
<!doctype html> | |
<html> | |
<head> | |
<title>Title of your document</title> | |
<meta charset="utf-8"> | |
<meta name="description" content=""> | |
</head> | |
<body> |
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
openssl base64 < path/to/file.png | tr -d '\n' | pbcopy |
NewerOlder