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
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install php5.6 | |
a2dismod php5* | |
a2enmod php5.6 |
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
$("body").on("submit", "#my-form", function(e){ | |
e.preventDefault(); | |
var _this = $(this); | |
var formData = new FormData(this); | |
$.ajax({ | |
url: 'some-url', | |
data: formData, | |
method: 'POST', | |
cache: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
<?php | |
function ago($datetime, $full = false) { | |
$now = new DateTime; | |
$ago = new DateTime($datetime); | |
$diff = $now->diff($ago); | |
$diff->w = floor($diff->d / 7); | |
$diff->d -= $diff->w * 7; |
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
d - The day of the month (from 01 to 31) | |
D - A textual representation of a day (three letters) | |
j - The day of the month without leading zeros (1 to 31) | |
l (lowercase 'L') - A full textual representation of a day | |
N - The ISO-8601 numeric representation of a day (1 for Monday, 7 for Sunday) | |
S - The English ordinal suffix for the day of the month (2 characters st, nd, rd or th. Works well with j) | |
w - A numeric representation of the day (0 for Sunday, 6 for Saturday) | |
z - The day of the year (from 0 through 365) | |
W - The ISO-8601 week number of year (weeks starting on Monday) | |
F - A full textual representation of a month (January through December) |
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 | |
$years = []; | |
$months = []; | |
foreach(range(Carbon::now()->year - 100, Carbon::now()->year, 1) as $year){array_push($years, $year);} | |
foreach(range(2, 12) as $key=>$month){array_push($months, date('F', mktime(0,0,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
%a - abbreviated weekday name | |
%A - full weekday name | |
%b - abbreviated month name | |
%B - full month name | |
%c - preferred date and time representation | |
%C - century number (the year divided by 100, range 00 to 99) | |
%d - day of the month (01 to 31) | |
%D - same as %m/%d/%y | |
%e - day of the month (1 to 31) | |
%g - like %G, but without the century |
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
$('#file-input').change(function(e){ | |
var files = e.target.files; | |
for (var i = 0, f; f = files[i]; i++) { | |
if(f.type){ | |
var image_types = ['image/png', 'image/jpg', 'image/jpeg']; | |
if((f.type && image_types.indexOf(f.type) < 0)) { | |
alert('Invalid file selected. Supported formats are jpeg and png.'); | |
$(this).val(''); | |
} else { | |
readURL(f, $('.image-preview')); |
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>Manage Contact Types</title> | |
<link rel="stylesheet" href="...."> | |
<meta name="csrf-token" content="<?php echo csrf_token() ?>"/> | |
</head> | |
$(function () { |
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 addMinutes(time, minsToAdd) { | |
function z(n){ | |
return (n<10? '0':'') + n; | |
} | |
var bits = time.split(':'); | |
var mins = bits[0]*60 + (+bits[1]) + (+minsToAdd); | |
return z(mins%(24*60)/60 | 0) + ':' + z(mins%60); | |
} |
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
Email regex | |
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ |
OlderNewer