Based on the popular open-source "Contract Killer" for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Modified by Platypus Innovations, LLC: July 29, 2020
- Original post
<?php | |
function validatePostedJson() { | |
$json = file_get_contents('php://input'); | |
if ($json == null) { | |
header('HTTP/1.1 400 Bad Request', true, 400); | |
die('No Data Found'); | |
} | |
//Check the Hash |
// Use JDK 1.8.0_66 | |
// Test here to make life easy: https://www.jdoodle.com/online-java-compiler/ | |
import javax.crypto.Mac; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.InvalidKeyException; | |
import javax.xml.bind.DatatypeConverter; | |
public class Main { |
// These are the bare minimum fields that you should exclude from the URL params: | |
//skip = ['id', 'item_number', 'sub_enddate', 'sub_nextdate', 'sub_startdate']; | |
// You can exclude these without problems - keeps things shorter: | |
skip = ['id', 'item_number', 'downloadable_id', 'expires', 'height', 'is_parent', 'length', 'multiship', 'parent_code', 'price_each', 'price_each_is_fractional', 'price_is_fractional', 'quantity_max', 'quantity_min', 'shipto', 'sub_enddate', 'sub_frequency', 'sub_frequency_raw', 'sub_nextdate', 'sub_startdate', 'url', 'weight', 'weight_each', 'width']; | |
FC.json.items.forEach(function(item) { | |
var urlArr = {}; | |
Object.keys(item).forEach(function(el) { | |
if (!skip.includes(el)) { |
<?php | |
$allowedOrigins = [ | |
'https://domain.com', | |
'https://www.domain.com', | |
'https://subdomain.domain.com', | |
'*', | |
]; | |
$origin = cors($allowedOrigins, 'GET, POST'); |
javascript:(function()%7B%2F%2FTurn this into a bookmarklet using a tool like https%3A%2F%2Fwww.shareprogress.org%2Fbookmarklet%2F%0Aemails %3D %5B%5D%3B%0Axhr %3D new XMLHttpRequest()%3B%0A%0Axhr.onload %3D () %3D> %7B%0A%09if (xhr.status %3D%3D 200) %7B%0A%09%09var result %3D JSON.parse(xhr.response)%3B%0A%09%09result.forEach(function(obj) %7B%0A%09%09%09if (obj.type %3D%3D %27PushEvent%27) %7B%0A%09%09%09%09email %3D obj.payload.commits%5B0%5D.author.email%3B%0A%09%09%09%09if (email.includes(%27noreply%27) %7C%7C email.includes(%27no-reply%27)) %7B%0A%09%09%09%09%09%2F%2FI know there%27s a better way to do this%2C but I%27m too lazy. This works.%0A%09%09%09%09%7D%0A%09%09%09%09else if (!emails.includes(email)) %7B%0A%09%09%09%09%09emails.push(email)%3B%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D)%3B%0A%09%09if (emails.length > 0) %7B%0A%09%09%09output %3D emails.join(%27%2C%27)%3B%0A%09%09%7D%0A%09%09else %7B%0A%09%09%09output %3D "No emails found."%3B%0A%09%09%7D%0A%09%09var textnode %3D document.createT |
#!/bin/bash | |
PATHNAME="" | |
FUNCTION="[a-zA-Z0-9_-]+" | |
PRIVATE=0 | |
TYPE="" | |
while getopts ":hf:p:" opt; do | |
case ${opt} in | |
h ) |
#!/bin/bash | |
if [ ! -e "$1" ] | |
then | |
echo Invalid file or directory. | |
exit | |
fi | |
i=0 |
/* | |
* Requires https://gist.github.com/summersab/ac6f801c8249d6940ca74d3f4634daf9 | |
* Put this in your footer JS section to prevent customers from entering fields over 35 characters (UPS limit) | |
*/ | |
$('#shipping_first_name, #shipping_last_name, #shipping_company, #shipping_address1, #shipping_address2').on('input',function(){ | |
checkLengths(); | |
}); | |
$("body").on("focusout.fc", function() { | |
// I'm sure there's a better way to do this, but this makes sure to run the length validation logic AFTER the default FC validations. Otherwise, the custom error field highlighting briefly disappears. | |
var delay = setTimeout(function() { |
(function (FC, $) { | |
FC.util.notifyErrors = function() { | |
var $notifier = $("[data-fc-error-notifier]") | |
, $textEl = $notifier.find("[data-fc-notifier-text]") | |
, messagesWithContext = function() { | |
var count = 0; | |
return FC.json.messages.errors.forEach(function(error) { | |
"" !== error.context && (count += 1) | |
}), | |
count |