Skip to content

Instantly share code, notes, and snippets.

View susanBuck's full-sized avatar

Susan Buck susanBuck

View GitHub Profile
@susanBuck
susanBuck / iframe-qualtrics.md
Created October 14, 2025 19:53
Embed jsPsych experiment in Qualtrics via iframe

Embed your jsPsych experiment in a Qualtrics survey

Using a HTML iframe element, you can embed your jsPsych experiment directly in a question within your Qualtrics survey - E.g.:

<iframe 
    src='https://susanbuck.github.io/psy1903/projects/lexical-decision/?qualtricsId=${e://Field/ResponseID}' 
    id='experimentEmbed'>
</iframe>
@susanBuck
susanBuck / a.js
Created October 13, 2025 16:50
Code Chat 1
// Welcome
let welcomeTrial = {
type: jsPsychHtmlKeyboardResponse,
stimulus: `
<h1 class='welcomeHeader'>Welcome!</h1>
<p>In this experiment, you will be shown a series of words.</p>
<p>Press the letter <span class='key'>F</span> if the word is positive.</p>
<p>Press the letter <span class='key'>J</span> if the word is negative.</p>
<p>Press <span class='key'>SPACE</span> to begin.</p>
`,
@susanBuck
susanBuck / index.html
Last active October 7, 2025 21:50
PSY1903 file updates
<!doctype html>
<html lang='en'>
<head>
<title>PSY1903</title>
<link href=data:, rel=icon>
</head>
<body>
<h1>My PSY1903 Web Server</h1>
@susanBuck
susanBuck / example.js
Created September 26, 2025 15:24
variable scope example
// For the purposes of this demo, hard-code answer and response
let answer = 4;
let response = 'e';
// THE FOLLOWING WILL *NOT* WORK
for (let i = 0; i < 3; i++) {
if (answer % 2 == 0 && response == 'e') {
let correct = true;
@susanBuck
susanBuck / consent.txt
Created September 17, 2025 17:15
Experiment Consent Screen
@susanBuck
susanBuck / app.js
Created September 16, 2025 18:10
Week 3 Task Set Tips
// Select the elements on the page we will alter
let num1Span = document.getElementById('num1');
let num2Span = document.getElementById('num2');
// Example numbers
let num1 = 5;
let num2 = 9;
// Update the elements on the page with the example numbers
num1Span.innerHTML = num1;
@susanBuck
susanBuck / example.js
Created September 9, 2025 16:38
Note on capturing responses with the prompt method and reusing variables
// Don’t redeclare the same variable:
let answer = prompt('What is 1 + 1?');
console.log('You answered: ' + answer);
let answer = prompt('What is 4 + 8?');
console.log('You answered: ' + answer);
// Instead do this:
@susanBuck
susanBuck / employee_survey.csv
Created March 12, 2025 16:09
employee_survey.csv
We can't make this file beautiful and searchable because it's too large.
Emp ID,satisfaction_level,last_evaluation,number_project,average_montly_hours,time_spend_company,Work_accident,promotion_last_5years,dept,salary
1,0.38,0.53,2,157,3,0,0,sales,low
2,0.8,0.86,5,262,6,0,0,sales,medium
3,0.11,0.88,7,272,4,0,0,sales,medium
4,0.72,0.87,5,223,5,0,0,sales,low
5,0.37,0.52,2,159,3,0,0,sales,low
6,0.41,0.5,2,153,3,0,0,sales,low
7,0.1,0.77,6,247,4,0,0,sales,low
8,0.92,0.85,5,259,5,0,0,sales,low
9,0.89,1,5,224,5,0,0,sales,low
## Basic text formatting
**This text is bold - it must be important**
_This text is italicized; you should probably pay attention to it..._
[Click this link to learn about jsPsych...](https://www.jspsych.org)
Lists are created using asterisks or plus signs:
+ Item 1
@susanBuck
susanBuck / consent-screen
Created November 5, 2024 01:52
Consent Screen