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
### NOT A SCRIPT, JUST A REFERENCE! | |
# install dante-server | |
sudo apt update | |
sudo apt install dante-server | |
# or download latest dante-server deb for Ubuntu, works for 16.04 and 18.04: | |
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/dante/dante-server_1.4.2+dfsg-2build1_amd64.deb | |
# or older version: | |
wget http://ppa.launchpad.net/dajhorn/dante/ubuntu/pool/main/d/dante/dante-server_1.4.1-1_amd64.deb |
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
#!/bin/bash | |
archiveLocation=/backups | |
archiveTempPath=/backups/tmp_backup | |
archiveName=$(date '+%d-%m-%Y_%H:%M'); | |
archiveFullName=$archiveName.tar.gz | |
archivePath=$archiveLocation/$archiveFullName | |
deleteLocalArchive=false | |
backupPath=/var/www | |
backupToRemoteServer=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 distance($start, $destination) | |
{ | |
// Send request to Google | |
$start = urlencode($start); | |
$destination = urlencode($destination); | |
$url = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=$start&destinations=$destination&mode=driving&language=nl-NL&sensor=false"; | |
// Get response |
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 | |
for($i = 0; $i <= 23; $i++) { | |
// If hour is lower than 10, append a 0 | |
if($i < 10) { | |
$append = 0; | |
} else { | |
$append = ''; | |
} | |
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
# Disallow access to framework's files | |
RewriteRule ^(app/|bootstrap/|config/|database|resources|storage|tests|vendor|artisan|composer\.json|composer\.lock|gulpfile\.js|package\.json|phpspec\.yml|phpunit\.xml|readme\.md|server\.php|\.env) - [F,L,NC] |
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 | |
$dir = __DIR__ . '/..'; | |
$keys = [ | |
'mijnkey' | |
]; | |
$lock = $dir . '/DEPLOY.LOCK'; | |
if (!file_exists($lock)) { | |
if (isset($_GET['key']) && in_array($_GET['key'], $keys)) { |
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
public static function do_sort($a, $b) { | |
$date = $a->publishOn; | |
$date2 = $b->publishOn; | |
$aval = strtotime($date); | |
$bval = strtotime($date2); | |
if ($aval == $bval) { | |
return 0; |
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 | |
$data['var'] = urlencode($_POST['var']); | |
$ch = curl_init(); | |
$url = 'API_URL'; | |
//set the url, number of POST vars, POST data | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_POST, count($data)); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data, '', '&')); |
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
# First, Install Vagrant and Virtualbox then: | |
# Create new project directory | |
mkdir -p ~/Sites/newproject # Create new project directory | |
mk ~/Sites/newproject # Go into your new project directory | |
# Setup Vagrant | |
vagrant init | |
# Edit vagrant file box and box url to install Ubuntu, just like https://gist.github.com/fideloper/dab171a2aa646e86b782#file-vagrantfile-share-var-www-rb-L6-L8 | |
# Edit Vagrantfile to create a static IP address, just like https://gist.github.com/fideloper/dab171a2aa646e86b782#file-vagrantfile-share-var-www-rb-L10 |
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 delay = (function(){ | |
var timer = 0; | |
return function(callback, ms){ | |
clearTimeout (timer); | |
timer = setTimeout(callback, ms); | |
}; | |
})(); | |
$('input').keyup(function() { |
NewerOlder