Skip to content

Instantly share code, notes, and snippets.

View letsgetrandy's full-sized avatar

Randy letsgetrandy

View GitHub Profile
@seiyria
seiyria / README.md
Last active January 8, 2018 04:29
Code Quality and You

update: this post has been moved to my blog

Welcome! Today I'd like to talk about another subject which can't be emphasized enough: Code Quality. This entails a lot of tools and patterns that ultimately come together to make your game more solid and programmer friendly. Even if you're working alone on a project, these tools can save you some precious debugging time by pointing out simple errors, if not more complex ones. I'll be using my current project, c as an example where possible.

A few notes before we get started:

  • Some of the following tools are specific to the JavaScript ecosystem.
  • Some of the following tools are only free for open source projects, so bear in mind that you might be missing out on the awesome!

Style Checking

Some of the easiest tools you can set up for your project are JSHint and JSCS. These tools provide basic st

@letsgetrandy
letsgetrandy / orphan
Last active November 19, 2021 19:11
Bash script for finding and deleting orphaned files. Works best with the Silver Searcher (https://github.com/ggreer/the_silver_searcher). Works well with ack (http://beyondgrep.com/). Works okay with grep, but you're not really still using grep, are you? Using ag or ack allows you to respect your config files and ignore files you don't want to s…
#! /bin/bash
#
# USAGE:
# orphan [-dv] filename
#
# OPTIONS:
# -d delete the file if it is an orphan
# -f force (ie, don't prompt)
# -h display help text
# -v verbose
@letsgetrandy
letsgetrandy / render.js
Last active April 14, 2018 19:04
Simple template rendering for Javascript
/* Simple JS template rendering function */
function render(obj, template) {
var re, v;
re = new RegExp("\\[\\[([^\\]]+)\\]\\]");
while (match = re.exec(template)) {
val = obj[match[1]] || '';
template = template.replace(match[0], val);
}
return template;
}