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 | |
$url = 'http://beheer.e-poc.nl/onderwijs/plugins/montessori/website/rooster_groesbeek.php'; | |
preg_match_all("/<tr>(.+)<\/tr>/siU", @file_get_contents($url), $matches); | |
preg_match_all("/<td colspan=\"5\" class=\"title\">(.+)<\/tr>/siU", @file_get_contents($url), $titles); | |
$titles_count = count($titles); | |
$changes = $matches[0]; | |
$changes = str_replace ('<td colspan="5"> </td>', '', $changes); |
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 | |
session_start(); | |
if (empty($_SESSION['captcha'])) | |
{ | |
$captcha = mt_rand(10000, 99999); | |
$_SESSION['captcha'] = $captcha; | |
} | |
else | |
{ |
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 | |
// make sure the trackback ping's URL links back to us | |
$handle = fopen($url, "r"); | |
$tb_page = ''; | |
while (!feof($handle)) { | |
$tb_page .= fread($handle, 8192); | |
} | |
fclose($handle); | |
$pos = strpos($tb_page, "http://imgur.com"); | |
if ($pos === 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
server { | |
listen 80; | |
root /var/www; | |
index index.php; | |
server_name domain.dev; | |
# Do nice rewrite stuff in here | |
location / { | |
#try_files $uri $uri/ /index.php?$args; |
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
############################################################################### | |
# SECTION:Initial Settings | |
############################################################################### | |
# Testing flag - enables a CRON job that clears iptables incase of | |
# configuration problems when you start csf. This should be enabled until you | |
# are sure that the firewall works - i.e. incase you get locked out of your | |
# server! Then do remember to set it to 0 and restart csf when you're sure | |
# everything is OK. Stopping csf will remove the line from /etc/crontab | |
# | |
# lfd will not start while this is enabled |
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
$.ajax({ | |
type: "POST", | |
url: "form.php", | |
data: $('#form').serialize(), | |
beforeSend: function() { | |
$('#form').append('<div class="alert alert-success save-message">Saving...</div>'); | |
}, | |
success: function(data) { | |
$('.save-message').remove(); | |
} |
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() { |
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
<?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
public static function do_sort($a, $b) { | |
$date = $a->publishOn; | |
$date2 = $b->publishOn; | |
$aval = strtotime($date); | |
$bval = strtotime($date2); | |
if ($aval == $bval) { | |
return 0; |
OlderNewer