Skip to content

Instantly share code, notes, and snippets.

View twfahey1's full-sized avatar

Tyler Fahey twfahey1

View GitHub Profile
/* This will work for any text entry except the forms */
Qualtrics.SurveyEngine.addOnload(function() {
var qid = this.questionId;
var placeholderText = 'I am different text';
jQuery('#' + qid + ' input[type="text"], #' + qid + ' textarea').attr('placeholder',placeholderText);
});
/*
This will work on a Form question (where there are multiple inputs)
@whoisryosuke
whoisryosuke / api-form-submit.js
Created October 3, 2018 17:14
React - Handling forms and submitting POST data to API -- @see: https://reactjs.org/docs/forms.html
class NameForm extends React.Component {
constructor(props) {
super(props);
this.state = { name: '' };
}
handleChange = (event) => {
this.setState({[event.target.name]: event.target.value});
}
# Purge the Heroku Build Cache using the terminal. This requires a new deployment FYI.
# Replace appname with name of application on Heroku.
heroku plugins:install heroku-repo
heroku repo:purge_cache -a appname
git commit --allow-empty -m "Purge cache"
git push heroku master
@tannerhodges
tannerhodges / nginx-security-headers.conf
Last active August 7, 2020 15:21
HTTP Security Headers for Nginx & PHP
# Add HTTP Headers to improve site security.
# https://owasp.org/www-project-secure-headers/#tab=Headers
# X-Frame-Options: Stop people from loading your site in an iframe on their own site.
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
add_header X-Frame-Options "SAMEORIGIN";
# X-XSS-Protection: Stop pages from loading when the browser detects cross-site scripting (XSS) attacks.
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
add_header X-XSS-Protection "1; mode=block";
@nullvariable
nullvariable / private-files.php
Created September 29, 2020 18:43
Private Files Example for Pantheon
<?php
/**
* Plugin Name: Example Private Files
* Author: Doug Cone
* Description: Auth for Pantheon Private files
* Version: 0.1.0
*/
/**
* This doesn't protect direct access, you must move your files to a folder not accessible to the public, but accessible to this script.