Skip to content

Instantly share code, notes, and snippets.

View davetannenbaum's full-sized avatar
🐋
hello world!

David Tannenbaum davetannenbaum

🐋
hello world!
View GitHub Profile
*maintain: *Judgments of City Sizes*
>> cityA = ["New York", "Chicago", "San Francisco", "Madrid"]
>> cityB = ["Austin", "Portland", "Boulder", "Paris"]
>> cityA.randomize
>> cityB.randomize
>> i = 1
*while: i <= cityA.size
*question: Which of these two cities is larger?
Qualtrics.SurveyEngine.addOnload(function()
{
// Assigning subjects to either Heads or Tails focus
var coin = _.sample([{
side1:"Heads",
side2:"Tails"
},
{
side1: "Tails",
side2: "Heads"
<!doctype html>
<html>
<head>
<title>My experiment</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="jsPsych-4.0.1/jspsych.js"></script>
<script src="jsPsych-4.0.1/plugins/jspsych-text.js"></script>
<script src="jsPsych-4.0.1/plugins/jspsych-survey-text.js"></script>
<script src="jsPsych-4.0.1/plugins/underscore.js"></script>
<link href="jsPsych-4.0.1/css/jspsych.css" rel="stylesheet" type="text/css"></link>
<script type="text/JavaScript">
function killCopy(e){
return false
}
function reEnable(){
return true
}
document.onselectstart=new Function ("return false")
if (window.sidebar){
document.onmousedown=killCopy
@davetannenbaum
davetannenbaum / Qualtrics JS.js
Last active December 12, 2017 05:36
Javascript Qualtrics code to pass previous response to a textbox
Qualtrics.SurveyEngine.addOnload(function()
{
/* Removes 0s from Text Boxes */
var inputs = $(this.questionContainer).select('input');
inputs.each(function(el) {if (el.value == 0) el.value='';});
/* Creating variable to pass previous response to text fields */
var selectedChoice = "${q://QID5/ChoiceNumericEntryValue/1}";
var selectedChoice = parseInt(selectedChoice);