Some courses won't work outside of an LMS. That's annoying when you just want to review a course, so drop this in to provide a fake SCORM API implementation - getAPI
should then pick up this fake API.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class document { | |
public static function getElementsByClassName($name) { | |
global $xpath; | |
$nodes = array(); | |
$elements = $xpath->query(sprintf("//div[contains(@class, '%s')]", $name)); | |
foreach ($elements as $e) { | |
array_push($nodes, $e); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function list_dir($resource) { | |
$files = array(); | |
$scan = glob(rtrim($resource, '/') . '/*'); | |
if (is_file($resource)) { | |
array_push($files, $resource); | |
} | |
if (is_dir($resource)) { | |
foreach ($scan as $path) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require("express"); | |
var app = express(); | |
app.get("/restricted", function(req, res, next){ | |
// Grab the "Authorization" header. | |
var auth = req.get("authorization"); | |
// On the first request, the "Authorization" header won't exist, so we'll set a Response | |
// header that prompts the browser to ask for a username and password. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.config/starship.toml | |
format = """ | |
[♥](bold red)\ | |
${custom.git_user}\ | |
${custom.ip}\ | |
$ruby${custom.bundler}\ | |
$golang\ | |
$nodejs${custom.npm}${custom.yarn}\ | |
$terraform\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query starredRepositories($repositories: Int = 10, $after: String, $releases: Int = 1) { | |
viewer { | |
starredRepositories(first: $repositories, after: $after, ownedByViewer: false, orderBy: {field: STARRED_AT, direction: DESC}) { | |
pageInfo { | |
hasNextPage | |
endCursor | |
} | |
edges { | |
cursor | |
starredAt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A "pangram" is a sentence that includes every letter of the alphabet. | |
// Write a function that will return what letters of the alphabet are | |
// missing from a sentence (thus meaning it is not a pangram). | |
// "A quick brown fox jumps over the lazy dog" includes every letter, returning "" | |
// "Lions, and tigers, and bears, oh my!" does not include every letter, returning "cfjkpquvwxz" | |
function findMissingLetters(str) { | |
const alphabet = 'abcdefghijklmnopqrstuvwzyz'; | |
if (str.length) { | |
const reducer = (memo, letter) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o nounset | |
if [ "$(git status -s | wc -l | bc)" -gt "0" ]; then | |
if [ "$(git diff --cached master -G '"version":' | wc -l | bc)" -eq "0" ]; then | |
echo -e "\033[31m✘\033[0m Aborting commit! \"package.json\" was not updated with a new version." | |
fi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this function to .bashrc or .bash_profile | |
# $ pkg | |
# $ pkg dependencies # (to show only the dpendencies) | |
# Requires `jq` | |
pkg() { | |
if [ -f package.json ]; then | |
cat package.json | jq .$1 | |
else | |
read -p "package.json doesn't exist. Create one? [Y/n] " -n 1 -r | |
if [[ $REPLY =~ ^(Y|y| ) ]] || [[ -z $REPLY ]]; then |
NewerOlder