Skip to content

Instantly share code, notes, and snippets.

View shaneriley's full-sized avatar

Shane Riley shaneriley

View GitHub Profile
console.clog = function() {
var format = "font: normal 18px 'Comic Sans MS', Chalkboard; color: purple;";
if (arguments.length > 1) {
console.log("%c" + arguments[0], format, [].slice.call(arguments, 1));
}
else {
console.log("%c" + arguments[0], format);
}
};
@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()
@shaneriley
shaneriley / gist:ab945b15084f47056ad5
Created March 23, 2015 19:54
State select element
<select name="state">
<option>AK</option>
<option>AL</option>
<option>AR</option>
<option>AZ</option>
<option>CA</option>
<option>CO</option>
<option>CT</option>
<option>DC</option>
<option>DE</option>
@shaneriley
shaneriley / skeleton
Last active August 29, 2015 14:16
HTML Skeleton
<!doctype html>
<html lang="en-US">
<head>
<title></title>
<meta charset="UTF-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
</head>
<body>
</body>
@shaneriley
shaneriley / gist:99133ec9811161c2ea50
Created July 15, 2014 18:59
Precompile all Handlebars templates
var templates = (function() {
var o = {};
$("[type=\"text/x-handlebars\"]").each(function() {
o[$(this).attr("data-id")] = Handlebars.compile(this.innerHTML);
});
return o;
})();
@shaneriley
shaneriley / colors.styl
Last active August 29, 2015 14:00
Color iteration in Stylus? Nope.
// Only one of the strings in the list of colors gets interpolated, thanks
// to Stylus converting the color keywords to hex values.
// Thanks, Stylus!
li
for color in red pink orange yellow green blue purple brown black shit
&.{color}
background: color
// What I had to do instead to make it work. Note that simply wrapping the
@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 / states.haml
Last active January 4, 2016 07:19
States helper
-# Middleman doesn't like options_for_select, have to run through manually
%select(name="state")
- states.each do |name, val|
%option(value="#{val}")= name
-# If we're in Rails land
= select_tag :state, options_for_select(states)
@shaneriley
shaneriley / gist:7371446
Created November 8, 2013 14:01
Reset search inputs
input[type="search"]
-webkit-appearance: none
-moz-appearance: none
input[type='search']::-webkit-search-decoration,
input[type='search']::-webkit-search-cancel-button,
input[type='search']::-webkit-search-results-button,
input[type='search']::-webkit-search-results-decoration
display: none
@shaneriley
shaneriley / mixins.styl
Created October 29, 2013 13:58
Stylus mixins
prefixes = moz, ms, webkit, khtml, o
font-smoothing()
-webkit-font-smoothing: antialiased
image-smoothing()
image-rendering:optimizeSpeed
image-rendering:-webkit-optimize-contrast
image-rendering: -moz-crisp-edges
-ms-interpolation-mode: nearest-neighbor