Skip to content

Instantly share code, notes, and snippets.

View rickcnagy's full-sized avatar

Rick Nagy rickcnagy

View GitHub Profile
@rickcnagy
rickcnagy / log-unused-style-rules.js
Created December 23, 2018 20:05
Logs all the unused style rules in loaded stylesheets.
function logUnusedStyleRules() {
const unusedRules = [];
[...document.styleSheets].forEach((sheet) => {
[...sheet.rules].forEach((rule) => {
if (!document.querySelector(rule.selectorText)) {
unusedRules.push(rule);
}
});
});
@rickcnagy
rickcnagy / jindosh-solution.pl
Last active September 3, 2018 16:37
An overkill Prolog solution to the Jindosh riddle in Dishonored 2
exists(A, list(A, _, _, _, _)).
exists(A, list(_, A, _, _, _)).
exists(A, list(_, _, A, _, _)).
exists(A, list(_, _, _, A, _)).
exists(A, list(_, _, _, _, A)).
rightOf(R, L, list(L, R, _, _, _)).
rightOf(R, L, list(_, L, R, _, _)).
rightOf(R, L, list(_, _, L, R, _)).
rightOf(R, L, list(_, _, _, L, R)).
@rickcnagy
rickcnagy / crestmontApplication.html
Last active August 29, 2015 14:13
Crestmont Application Form
<!-- Copy this entire code block-->
<div id="application-form"></div>
<div class="qsstandalone-footnote" id="enquiry-footer">Form powered by <a href="http://www.quickschools.com" target="_blank">QuickSchools.com - Student Information System</a></div>
<style>
.qsform {
color: #545454;;
background: #F6FFF5;
font-family: Arial, Verdana, Sans-Serif;
}
@rickcnagy
rickcnagy / qsCustomize.js
Created November 17, 2014 15:16
Customize a QS application/inquiry form via jQuery/JS
var loadingForQS = setInterval(function() {
if (typeof _qs$ !== "undefined" && _qs$(".qslabel").length) {
clearInterval(loadingForQS);
qsCustomize(_qs$)
}
});
function qsCustomize($) {
// do something
}
@rickcnagy
rickcnagy / disableSiblingsForParents.html
Created July 5, 2014 22:08
Disable adding/removing siblings when parents login to the Parent Portal while still allowing them to add/edit parents.
<script type="text/javascript">
$(window).load(function() {
var extendTimer = setInterval(function() {
if (typeof S_ParentTab !== "undefined") {
clearInterval(extendTimer);
disableSiblingsBoxForParents();
}
}, 50);
});
@rickcnagy
rickcnagy / languageOnEmbed.html
Last active August 29, 2015 14:02
LanguageOn QS Embed HTML
<div id="enquiry-form"></div>
<div class="qsstandalone-footnote" id="enquiry-footer">Form powered by <a href="http://www.quickschools.com" target="_blank">QuickSchools.com - School Management System</a></div>
<script src="https://languageon.quickschools.com/sms/es/enquiry?divId=enquiry-form" async></script>
<script src="https://cdn.rawgit.com/br1ckb0t/64d96aee8b69db777c3e/raw/8dd3d39bfd37c5e42735a19134974a73c7eba1b6/languageOnQSEmbed.js" async></script>
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/br1ckb0t/8c8059a0aff97c345879/raw/ef2fb8b0c0f2fa0e568f29747cfc3c17ddd5e20b/languageOnQSEmbed.css">
@rickcnagy
rickcnagy / languageOnQSEmbed.css
Last active August 29, 2015 14:02
LanguageOn QS Embed CSS
<style type="text/css">
.contact input.qsinputfield, .contact textarea.qsinputfield {
width: 340px;
max-width: 340px;
min-width: 340px;
padding: 5px 10px;
}
.contact textarea.qsinputfield {
height: 150px;
@rickcnagy
rickcnagy / languageOnQSEmbed.js
Created June 18, 2014 18:19
LanguageOn QS Embed JS
qsMatchLabels = ["Questions or Comments"]
var loadingForTextareaReplace = setInterval(function() {
if (typeof _qs$ !== "undefined" && _qs$(".qslabel").length) {
clearInterval(loadingForTextareaReplace);
qsTextAreas();
moveComments();
}
}, 10);
@rickcnagy
rickcnagy / extend.js
Created June 9, 2014 21:55
Extend an existing function. Great for writing code on top of existing systems.
function extend(oldFunc, newFunc, callAfter) {
callAfter = callAfter || true;
if (callAfter) {
return function() {
var ret = oldFunc.apply(this, arguments);
newFunc.apply(this, arguments);
return ret;
}
} else {
return function() {
@rickcnagy
rickcnagy / qsTextAreasWithoutJS.html
Created May 19, 2014 18:55
qsTextAreas.html, but no directly embedded javascript. Instead, link to the Gist files.
<!-- Copy this entire code block-->
<div id="application-form"></div>
<div class="qsstandalone-footnote" id="enquiry-footer">Form powered by <a href="http://www.quickschools.com" target="_blank">QuickSchools.com - Student Information System</a></div>
<script src="https://lwspa.quickschools.com/sms/es/application?divId=application-form" async></script>
<script src="https://cdn.rawgit.com/br1ckb0t/13dbbe3283039b9175bc/raw/fc8bddf19495e1777f46d476f39df28ad8146b7a/qsTextAreas.js" async></script>
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/br1ckb0t/385458993cfcc8a81258/raw/7d69ade7dbf951206e150ed021375e32aad7bb56/qsTextAreas.css">