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
<?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
# 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
# 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
######################################################################### | |
# 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. |
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
#I did not create this, all credit to those that did. I am simply storing it here for my own use original URL: | |
#http://www.stardothosting.com/blog/2011/08/varnish-caching-with-joomla/ | |
# Place the following 2 configuration blocks right after your "backend default {…}" block | |
# inside your /etc/varnish/default.vcl file (the main Varnish configuration file) | |
# This Varnish configuration makes use of a custom HTTP header to determin whether | |
# some user is logged in or not inside Joomla! To allow this, simply append this code | |
# // Set user state in headers | |
# if (!$user->guest) { |
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
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
// 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())); |
NewerOlder