Skip to content

Instantly share code, notes, and snippets.

View DawnPaladin's full-sized avatar

James Harris DawnPaladin

View GitHub Profile

Keybase proof

I hereby claim:

  • I am dawnpaladin on github.
  • I am dawnpaladin (https://keybase.io/dawnpaladin) on keybase.
  • I have a public key ASBLfAFGQNGRMKsLaTaBkMa0Lb8eW4Gz5OScdPLiTOWv_Ao

To claim this, I am signing this object:

@DawnPaladin
DawnPaladin / settings.json
Last active July 17, 2019 20:49
Twilight Sparkle theme
"workbench.colorCustomizations": { // https://code.visualstudio.com/api/references/theme-color
"editor.background": "#120818",
"sideBar.background": "#331421",
"activityBar.background": "#120818",
"activityBarBadge.background": "#EA428B",
"titleBar.activeBackground": "#240b20",
"titleBar.inactiveBackground": "#1e1327",
"statusBar.background": "#2e0e29",
"editorGroupHeader.tabsBackground": "#220b2c",
"tab.activeBackground": "#4d2466",
@DawnPaladin
DawnPaladin / responsive.js
Created November 16, 2018 22:11
ResponsiveJS: Activate/deactivate various scripts depending on the width of the window.
/** Activate/deactivate various scripts depending on the width of the window. */
var responsiveJS = (function() {
var registry = [];
if (!jQuery) console.warn("jQuery not present. Responsively loading scripts from URLs will be unavailable.");
/**
* Add an entry to the list of scripts which will run if the window is the right width.
* @param {Object} entry
* @param {string} [entry.name] - Name of the entry
@DawnPaladin
DawnPaladin / custom.js
Last active August 1, 2018 22:32
scripts/custom.js for hki-limesurvey-theme
/******************
User custom JS
---------------
Put JS-functions for your template here.
If possible use a closure, or add them to the general Template Object "Template"
*/
$(document).on('ready pjax:scriptcomplete',function(){
@DawnPaladin
DawnPaladin / loader.js
Created May 24, 2018 17:28
Use jQuery to load JavaScript. Chainable. (Problem: .done() [like .then()] triggers when a file has finished loading, not when it's finished executing. With big scripts that can make a big difference. I worked around this by abandoning this code, minifying all my JavaScript into one file, and loading that with a plain old <script> tag.)
// loader.js
/**
* Loads all the scripts passed to it, returning a promise that they've all loaded.
* @param {string[]} urls: An array of URLs to load
* @param {boolean} async Load asynchronously
* @param {boolean} debug Enable to print a console message when a script starts and finishes loading
* @returns {promise} A promise that all the URLs have loaded
*/
function loadScripts(urls, async, debug) {
@DawnPaladin
DawnPaladin / userstyle.css
Created April 19, 2018 14:57
Hide Hangouts notification badge in Google Inbox
div[title="Hangouts"] .qb {
display: none;
}
@DawnPaladin
DawnPaladin / styles.less
Created May 27, 2017 21:56
Atom styles
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
@DawnPaladin
DawnPaladin / secrets_controller_spec.rb
Created February 3, 2017 00:27
Sample RSpec tests, used in Rails Handbook
require 'rails_helper'
describe SecretsController do
context "logged in user submitting valid data" do
describe "#create" do
it "creates a new secret" do
user = create(:user)
session[:user_id] = user.id
secret = build(:secret)
pile = sock_pile([:black, :white, :red], 2)
def advanced(sock_pile)
sock_book = Hash.new {|h,k| h[k] = [] }
pairs = []
sock_pile.each do |sock|
if sock_book[sock].length > 0
pairs.push([sock, sock_book[sock].pop])
else
sock_book[sock].push(sock)
def advanced(sock_pile)
sock_book = Hash.new(Array.new)
pairs = []
sock_pile.each do |sock|
if sock_book[sock].length > 0
pairs.push([sock, sock_book[sock].pop])
else
sock_book[sock].push(sock)
end
end