Skip to content

Instantly share code, notes, and snippets.

View shaneriley's full-sized avatar

Shane Riley shaneriley

View GitHub Profile
@shaneriley
shaneriley / mixins.jade
Created February 10, 2014 20:10
Jade mixins example
// Writing JS for everything is great and all, but I don't want to see JS
// inline in my Jade templates. Thankfully, there are ways of abstrating it
// into mixins!
// Want some Rails-like helpers?
mixin link_to(name, href)
- href = href || "#"
a(href="#{href}")= name
// How about a single editing point for a class name?
@shaneriley
shaneriley / mountain.json
Created November 15, 2012 14:33
Render Tiled Scene in Canvas
{ "height":15,
"layers":[
{
"data":[79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 28, 60, 61, 62, 30, 95, 96, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 28, 76, 77, 78, 30, 79, 80, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 28, 76, 15, 78, 30, 95, 96, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 28, 76, 16, 78, 30, 79, 80, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 28, 76, 31, 78, 30, 95, 96, 95, 96, 79, 80, 95, 156, 157, 158, 95, 96, 79, 80, 95, 28, 76, 32, 78, 112, 13, 13, 79, 80, 95, 96, 79, 172, 173, 144, 158, 80, 95, 96, 79, 28, 76, 47, 48, 61, 61, 62, 95, 96, 79, 80, 156, 143, 138, 160, 190, 96, 12, 13, 13, 111, 76, 16, 15, 16, 31, 78, 13, 13, 14, 96, 172, 138, 173, 174, 79, 80, 44, 45, 45, 127, 92, 93, 93, 93, 93, 94, 109, 110, 30, 80, 188, 189, 189, 190, 95, 96, 79, 80, 95, 44, 45, 45, 45, 45, 45, 45, 141, 142, 30, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 45, 45, 46, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80,
@shaneriley
shaneriley / snippet.js
Created August 6, 2020 19:21
HG101 modal image slideshow
var $ = jQuery;
var $galleryThumbnails = $('.left-sidebar-gallery')
$galleryThumbnails.off('.gallery');
$('#gallery_modal').off('.gallery').remove();
$(document).off('.gallery');
var slidesCount = $galleryThumbnails.find('a').length;
var $modal = $('<div />', {
id: 'gallery_modal',
@shaneriley
shaneriley / gist:3853159
Created October 8, 2012 15:38
jQuery Exact Contains
// Problem: jQuery's :contains expression does not do an exact match.
// Solution: Exact contains `$("div").filter(":econtains(smart)");`
$.extend($.expr[":"], {
econtains: function(obj, index, meta, stack) {
return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
}
});
@shaneriley
shaneriley / page.html
Created November 24, 2019 02:17
RFGen collection FAQ
<td class="normaltext"><h2>General</h2>
<details open="">
<summary>What is the RF Generation Collection Software used for?</summary>
<p>The software is intended to allow video game collectors everywhere to have a place on the web to keep track of their video game collections. Not only can collectors keep a running tally of the number of cartridges, boxes, and manuals they own of each game in our ever-growing database, but they can also show off their collections to other collectors around the globe without having to send giant Word or Excel documents to one another.</p>
<p>Additionally, the software allows collectors to see what games other site members are interested in buying, trading, and selling. Through the message board Personal Messaging system, collectors can find other collectors in their area and arrange trades, sales, and purchases easily, while building a strong community of collectors and gamers alike.</p>
</details>
<details>
function throttle(delay, no_trailing, callback, debounce_mode) {
var timeout_id,
last_exec = 0;
if ( typeof no_trailing !== "boolean" ) {
debounce_mode = callback;
callback = no_trailing;
no_trailing = undefined;
}
@shaneriley
shaneriley / gist:3794514
Created September 27, 2012 15:08
CodeMirror extension: Keep track of markers and clear all
var codemirror_overrides = {
setMarker: function(line, gutter_text, line_class) {
if (!this.markers) { this.markers = []; }
this.markers.indexOf(line) === -1 && this.markers.push(line);
this._setMarker(line, gutter_text, line_class);
},
clearMarkers: function(line) {
var e = this;
if (!e.markers) { return; }
if (line) {
@shaneriley
shaneriley / move_demo.p8
Last active May 22, 2018 20:14
PICO-8 Movement Demo
pico-8 cartridge // http://www.pico-8.com
version 4
__lua__
player = {}
player.x = 5
player.y = 5
player.sprite = 0
player.speed = 2
function move()
var l = true,
n = null,
o = false,
p = [
["book of healing", 5],
["book of vision", 5],
["book of cure", 5],
["book of genocide", 5]
],
q = [
@shaneriley
shaneriley / what.js
Created August 25, 2016 23:59
frontenddevelopersayswhat
[][(![]+[])[!+[]+!![]+!![]]+([]+{})[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][([]+{})[!+[]+!![]+!![]+!![]+!![]]+([]+{})[+!![]]+([][[]]+[])[+!![]]+(![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+{})[!+[]+!![]+!![]+!![]+!![]]+(!![]+[])[+[]]+([]+{})[+!![]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([]+{})[!+[]+!![]+!![]+!![]+!![]+!![]+!![]]+([][[]]+[])[+[]]+([][[]]+[])[+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(![]+[])[!+[]+!![]+!![]]+([]+{})[!+[]+!![]+!![]+!![]+!![]]+(+{}+[])[+!![]]+([]+[][(![]+[])[!+[]+!![]+!![]]+([]+{})[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][([]+{})[!+[]+!![]+!![]+!![]+!![]]+([]+{})[+!![]]+([][[]]+[])[+!![]]+(![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+{})[!+[]+!![]+!![]+!![]+!![]]+(!![]+[])[+[]]+([]+{})[+!![]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+([]+{})[!+[