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 convertToHoursMins($time) { | |
$sign = '+'; | |
if ($time < 0) | |
$sign = '-'; | |
$time = abs($time); | |
$hours = floor($time / 60); | |
$minutes = ($time % 60); | |
return $sign . sprintf('%02d:%02d', $hours, $minutes); | |
} |
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
$(document).ready(function () { | |
var multi = $('#multiscroll').multiscroll({ | |
scrollOverflow: true, | |
onLeave: function (index, nextIndex, direction) { | |
//after leaving section 2 | |
var fine = 3; | |
console.log(index, nextIndex, direction); | |
}, | |
afterLoad: function (anchorLink, index) { |
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 date = new Date(); | |
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1); | |
firstDay.setDate(firstDay.getDate()-1); | |
console.log(firstDay); | |
console.log(firstDay.getFullYear() + '-' + (firstDay.getMonth()+1) + '-' + firstDay.getDate()); | |
//fix two char month | |
var month = firstDay.getMonth()+1; | |
if(month < 10){ | |
month = '0' + month; | |
} |
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 | |
class SanitizeUrl { | |
public static function slug($string, $space="-") { | |
$string = utf8_encode($string); | |
if (function_exists('iconv')) { | |
$string = iconv('UTF-8', 'ASCII//TRANSLIT', $string); | |
} | |
$string = preg_replace("/[^a-zA-Z0-9 \-]/", "", $string); |
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 | |
//admins address | |
$admins = array('97.23.95.1', '192.168.1.74'); | |
//redirect page for unauthorized users | |
$page = 'http://www.sitename.com/redirectpage.html'; | |
////////////////////////////////////////////////////////////////////////// | |
//user ip address | |
$user = $_SERVER['REMOTE_ADDR']; | |
//user will be redirect to $page if its ip isn't in the $admin array |