Skip to content

Instantly share code, notes, and snippets.

View scytacki's full-sized avatar

Scott Cytacki scytacki

  • Concord Consortium
  • Medford, MA
View GitHub Profile
{
"background_image": "",
"description": "",
"editor_mode": 0,
"id": 21610,
"layout": 0,
"name": "Test Built in Open Response and TE",
"notes": "",
"related": "",
"runtime": "LARA",
@scytacki
scytacki / timesheet-updater.js
Last active October 16, 2023 16:00
Some scripts for updating cells in timesheet.
function updateReactInput(inp, value) {
Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set.call(inp, value);
inp.dispatchEvent(new Event('change', { bubbles: true}));
}
function updateReactSelect(inp, value) {
Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype, 'value').set.call(inp, value);
inp.dispatchEvent(new Event('change', { bubbles: true}));
}
Admin::Project.where("landing_page_content LIKE '%renderMaterialsCollection(101%'")

Tools have:

  • tool_id
  • url
  • name

Usage of tool_id

API/ReportUsersController

#external_report_query

@scytacki
scytacki / create-cases.js
Created October 5, 2020 13:03
Google spreadsheet function to 'explode' a range based on a column that has a 'count' in it. Each row is duplicated 'count' times.
function CREATE_CASES(input_range, count_column) {
return input_range.map((row) => {
let rows = [];
for(let i=0; i<row[count_column]; i++){
rows.push(row);
}
return rows
}).flat();
}
@scytacki
scytacki / Instructions.md
Created April 11, 2020 00:15
Test demonstrating broken issue with chromedriver

These are the files used to file a bug with chromedriver: https://bugs.chromium.org/p/chromedriver/issues/detail?id=3422

To run the test:

  1. Download index.html, prototype.js, and test.js
  2. install selenium-webdriver: npm install selenium-webdriver
  3. start chromedriver
  4. run a webserver to serve the index.html page (I used http-server from npm)
  5. run the test: node test.js
@scytacki
scytacki / fix_moved_students_in_lara.rb
Last active January 23, 2020 22:25
Fix moved student in LARA
# get offering and class json api responses from running teacher report
# URL templates:
# https://learn.concord.org/api/v1/classes/[class_id]
# https://learn.concord.org/api/v1/offerings/[offering_id]
# modify offering json by adding class_hash property from the class json
# The following commands are to be run in the LARA rails console
offering_json = <<-EOS
# Paste modified offering json string inside here
@scytacki
scytacki / update-activity-runs.rb
Last active January 7, 2020 21:24
scripts to run in the rails console to update activity runs
def update_seq_platform_info(sequence_run)
sequence_run.runs.each { |r|
r.update_attributes(
class_info_url: sequence_run.class_info_url,
context_id: sequence_run.context_id,
platform_id: sequence_run.platform_id,
platform_user_id: sequence_run.platform_user_id,
resource_link_id: sequence_run.resource_link_id
)
}
@scytacki
scytacki / incomplete.js
Last active November 26, 2019 04:53
examples of let like behavior in jest
// For a more complete version of this look at given: https://github.com/tatyshev/given2/
// it supports more options and has more checks, but is also much bigger than this
// 15 line approach.
const c = {};
// Approach #1 add properties to a variable `c`
// these use a getter that gets replaced after being called the first time
// In theory this can be used with the global object, but that means your test would be adding
// properties to the global namespace
device = // Step 1: ask for a device
await navigator.bluetooth.requestDevice({
filters: [{ services: [tagIdentifier] }],
optionalServices: [serviceAddr]
});
server = // Step 2: Connect to device
await device.gatt.connect();
deviceConnected(server);
service = // Step 3: Get the Service
await server.getPrimaryService(serviceAddr);