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 | |
/** | |
* Craft 3 Entry Validation | |
* | |
* This goes in the main plugin class. | |
* | |
* Event::on( | |
* Entry::class, | |
* Entry::EVENT_BEFORE_SAVE, | |
* function (ModelEvent $event) { |
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
if (window.location.search) { | |
const urlParams = new URLSearchParams(window.location.search); | |
var utms = [ | |
"utm_medium=" + urlParams.get('utm_medium'), | |
"utm_source=" + urlParams.get('utm_source'), | |
"utm_campaign=" + urlParams.get('utm_campaign'), | |
"utm_content=" + urlParams.get('utm_content') | |
]; | |
document.querySelectorAll('iframe')[0].src = document.querySelectorAll('iframe')[0].src + "&" + utms.join("&"); | |
} |
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 | |
# This script downloads a list of IPs known for brute force attacking within the last two weeks. | |
# The fetched IPs get blocked with iptables with the special comment "BADIP". This script only | |
# modifies iptables rules with that comment. This measure makes it well compatible with other firewall | |
# scripts like the SUSEFirewall. | |
# The iptables rules are updated every time this script is executed. Additionally this script is | |
# quiet on stdout, which makes it well suited for being executed as a cronjob. | |
# | |
# Please also use fail2ban with the badips modification and help to maintain the list of attackers. | |
# See also: fail2ban and http:///www.badips.com |
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
html { | |
width: 100%; | |
overflow-x: hidden; | |
} | |
body { | |
width: 100%; | |
} | |
p { | |
margin: 0 0 20px 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
var EVENTDAY = '.esc_attr($day_number).'; // sunday | |
var EVENTHOUR = '.esc_attr($hour_number).'; // 9am | |
function getRemaining( now ) { | |
if ( now == null ) now = new Date(); | |
var dow = now.getDay(); | |
// the "hour" for now must include fractional parts of the hour, so... | |
var hour = now.getHours() + now.getMinutes()/60 + now.getSeconds()/3600; |
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 submitForm() { | |
$('form[name=registration]').submit(); | |
}; | |
function DialogThanks() { | |
BootstrapDialog.show({ | |
title: ' ', | |
message: '<h1>Thank You</h1><p>You’re now enrolled. Thanks!</p>', | |
buttons: [{ | |
label: 'Close', |
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
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<title>jQuery Validation + Bootstrap Dialog + Ajax</title> | |
<!-- Bootstrap --> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> |
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 submitForm() { | |
$('form[name=registration]').submit(); | |
}; | |
$("form[name=registration]").validate({ | |
errorElement: "span", | |
errorClass: "has-error", | |
rules: { | |
dobMonth: { | |
required: true, |
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
$.validator.addMethod('eighteenOrOlder', function(v, el) { | |
var month = $('input[name="dobMonth"]').val(); | |
var day = $('input[name="dobDay"]').val(); | |
var year = $('input[name="dobYear"]').val(); | |
var birthDate = new Date(); | |
birthDate.setFullYear(year, month - 1, day); | |
var currDate = new Date(); | |
currDate.setFullYear(currDate.getFullYear() - 18); | |
if ((currDate - birthDate) > 0) { | |
return true; |
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 submitShare() { | |
$('form[name=share]').submit(); | |
}; | |
$("form[name=share]").validate({ | |
submitHandler: function (form) { | |
var frm = $('[name=share]').serializeArray(); | |
var data = {}; | |
$.each(frm, function(i,v) { | |
data[v.name] = v.value |
NewerOlder