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
# Set a timestamp to time, e.g. 2 months | |
public static function time_ago($timestamp) | |
{ | |
$years = floor($timestamp / 31536000); | |
$days = floor(($timestamp - ($years*31536000)) / 86400); | |
$hours = floor(($timestamp - ($years*31536000 + $days*86400)) / 3600); | |
$minutes = floor(($timestamp - ($years*31536000 + $days*86400 + $hours*3600)) / 60); | |
$timestring = ''; | |
if ($years > 0){ | |
$timestring .= $years . ' years '; |
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
# Pass in the level of accuracy and optionally if you are talking about speed. Which will add a per seconds suffux. | |
public static function human_datasize($bytes, $decimals = 2, $speed = false) | |
{ | |
$sz = 'BKMGTP'; | |
if(is_null($bytes)) { | |
return 'Unlimited'; | |
} | |
if ($speed) { |
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
parseQS: (qs, key, value) => | |
re = new RegExp("([?&])" + key + "=.*?(&|$)","i"); | |
separator = qs.indexOf('?') != -1 ? "&" : "?"; | |
console.log separator | |
if qs.match(re) | |
return qs.replace(re, '$1' + key + "=" + value + '$2'); | |
else | |
return qs + key + "=" + value; |
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
Create an .htaccess file in the webroot: | |
AuthUserFile /app/www/public/.htpasswd | |
AuthType Basic | |
AuthName "Restricted Access" | |
Require valid-user | |
Create a .htpasswd file: | |
htpasswd -c /app/www/public/.htpasswd [username] |
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
.textBox { | |
position: relative; | |
height: 100%; | |
} | |
.inner { | |
position: absolute; | |
display: table; | |
width: 100%; | |
height: 100%; |
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 Datatable(table){ | |
this.table = table; | |
this.dataKeys = $(this.table).data('columns'); | |
this.buildDatatable(); | |
} | |
Datatable.prototype.options = function(){ | |
var options = {}; | |
options.table = $(this.table).data('model'); | |
options.scope = $(this.table).data('scope'); |
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
// JavaScript | |
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { | |
// some code.. | |
} | |
// JQuery | |
$.browser.device = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); |
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 | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
use Illuminate\Http\Response; | |
use Symfony\Component\DomCrawler\Crawler; | |
class PjaxMiddleware |
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
$small-desktop: 960px; | |
$large-desktop: 1200px; | |
$handheld: 768px; | |
$handhelds-landscape: 1024px; | |
$mobile: 640px; | |
$mobile-landscape: 480px; | |
@mixin respond-to($media) { | |
@if $media == largeDesktop { | |
@media only screen and (min-width: $large-desktop) { @content } |
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
######################################################################### | |
# This is an example VCL file for Varnish 4.0. # | |
# From: https://gist.github.com/davidthingsaker/6b0997b641fdd370a395 # | |
# LICENSE: If this could help you in any way, you are obliged to use it # | |
# for free with no limitations. # | |
######################################################################### | |
# Marker to tell the VCL compiler that this VCL has been adapted to the | |
# new 4.0 format. |
OlderNewer