Skip to content

Instantly share code, notes, and snippets.

View holdenhinkle's full-sized avatar

Holden Hinkle holdenhinkle

View GitHub Profile
@holdenhinkle
holdenhinkle / rail_fence_cipher_1.js
Last active December 13, 2019 14:22
This solution is wrong. I misunderstood the problem.
function railFenceCipher(operation, string, height = 3) {
function performOperation(operation, string, height, lines) {
let results = ''; // only for decrypt
let currentLine = 0;
let moveUp = true;
let moveDown = false;
for (let i = 0; i < lines[0].length; i += 1) {
if (operation === 'encrypt') {
lines[currentLine].splice(i, 1, string[i]);
@holdenhinkle
holdenhinkle / pedac_sort_queue.txt
Created December 27, 2019 20:46
PEDAC example of sorting the background jobs queue
***********
**PROBLEM**
***********
**INPUT**
Upon form submission an array like the following is provided as a value to a key in Sinatra's params hash
[{"job_id"=>"43", "new_order"=>""},
{"job_id"=>"44", "new_order"=>""},
{"job_id"=>"46", "new_order"=>""},
{"job_id"=>"47", "new_order"=>""},
@holdenhinkle
holdenhinkle / qas_oncall.rb
Created August 18, 2022 18:50
generate a random on-call list
qas = %w[holden darius curt ryan1 ryan2 ryan3]
puts qas.delete(qas.sample) until qas.empty?