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
@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);
@scytacki
scytacki / survey-cleaner.gs
Last active February 8, 2017 17:54 — forked from kjola8/survey-cleaner.gs
Google Spreadsheet script to convert survey answers to numbers.
/*
The goal is to identify each column for the type that is
and then convert the cells to numbers.
To identify it, we need to ignore the first few rows which will be headers.We could probably be safe and just skip the first
4 rows and start there.
*/
function getUnique_(values) {
var o = {}, a = [], i, e;
@scytacki
scytacki / survey-cleaner.gs
Last active February 8, 2017 18:06
Google Spreadsheet script to convert survey answers to numbers.
/*
The goal is to identify each column for the type that is
and then convert the cells to numbers.
To identify it, we need to ignore the first few rows which will be headers.We could probably be safe and just skip the first
4 rows and start there.
*/
function getUnique_(values) {
var o = {}, a = [], i, e;
deploy@ip-10-0-2-52:/web/portal/current$ NEW_RELIC_DISPATCHER=delayed_job RAILS_ENV=production bundle exec script/delayed_job run --prefix /web/portal/current
loading version from version.yml
delayed_job: process with pid 12622 started.
/usr/local/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): mapping keys are not allowed in this context at line 28 column 11 (Psych::SyntaxError)
from /usr/local/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from /usr/local/lib/ruby/1.9.1/psych.rb:151:in `parse'
from /usr/local/lib/ruby/1.9.1/psych.rb:127:in `load'
from /web/portal/shared/bundle/ruby/1.9.1/gems/delayed_job-3.0.3/lib/delayed/backend/base.rb:84:in `payload_object'
from /web/portal/shared/bundle/ruby/1.9.1/gems/delayed_job-3.0.3/lib/delayed/backend/base.rb:71:in `name'
from /web/portal/shared/bundle/ruby/1.9.1/gems/delayed_job-3.0.3/lib/delayed/worker.rb:230:in `handle_failed_job'
@scytacki
scytacki / report.json
Created March 10, 2016 22:03
Example report api response
{
"report": {
"id": 765,
"type": "Activity",
"name": "HAS Activity Dashboard Test 2",
"children": [
{
"id": 2093,
"type": "Section",
"name": "HAS Activity Dashboard Test 2 Section",
@scytacki
scytacki / trace.txt
Created February 23, 2016 20:01
Error when exporting a sequence
A NoMethodError occurred in sequences#export:
undefined method `id' for nil:NilClass
app/services/lara_serialization_helper.rb:24:in `key'
-------------------------------
Request:
-------------------------------