Skip to content

Instantly share code, notes, and snippets.

View rodaine's full-sized avatar
😅
err != nil

Chris Roche rodaine

😅
err != nil
View GitHub Profile
@rodaine
rodaine / Prism.markdown
Last active December 23, 2015 03:49
A Pen by Chris Roche.

Prism

HTML5 Canvas based animations reminiscent of the Bezier screensaver from Windows. Essentially, it is a bunch of triangles of random color/opacity whose vertices translate independently. Tweak the values at in the config object at the top of the JS editor to affect the number of triangles, the speed of the animation, and the color pallette used.

Thanks to Paul Irish for his article on requestAnimationFrame (http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/), and Bob Nystrom for his book on Game Programming Patterns (http://gameprogrammingpatterns.com/) which inspired the loop logic for this pen.

A Pen by Chris Roche on CodePen.

License.

@rodaine
rodaine / functions.php
Created September 11, 2013 21:10
Gists for an upcoming blog post titled "Add A Custom Wordpress Admin Contextual Help Menu To Your Plugin Or Theme"
<?
add_action('init', 'cjr_register_books_cpt');
add_action('admin_menu', 'cjr_add_book_settings');
/**
* Registers the Books CPT to WordPress. Must be called in 'init' action hook.
*/
function cjr_register_books_cpt()
{
@rodaine
rodaine / accordion.coffee
Last active December 16, 2015 22:09
Code Snippets for my blog post "Unchain HTML and JavaScript using Dependency Injection" (http://clarknikdelpowell.com/blog/untangle-html-and-javascript-using-dependency-injection/)
$('#browsers, #web-team').on 'click', 'li', (e) ->
# get the clicked li as a jQuery object
$el = $ this
# get the whole list as a jQuery object
$delegate = $ e.delegateTarget
# the class to be toggled on the element
cls = 'active'
@rodaine
rodaine / boilerplate.jquery.js
Created May 15, 2012 13:30
JavaScript: jQuery Plugin Boilerplate [$.method()]
// based off Nettuts+ article by Jonathan Cutrell:
// "14 Reasons Why Nobody Used Your jQuery Plugin"
// http://goo.gl/yx8up
;(function($, window, undefined){ "use strict";
if (!$.myPlugin) $.myPlugin = function(opts) {
var defaults = {
//plugin defaults
};
@rodaine
rodaine / boilerplate.jquery.js
Created May 15, 2012 13:22
JavaScript: jQuery Plugin Boilerplate [$(selector).method()]
// based off Nettuts+ article by Jonathan Cutrell:
// "14 Reasons Why Nobody Used Your jQuery Plugin"
// http://goo.gl/yx8up
;(function($, window, undefined){ "use strict";
$.fn.myPlugin = function(opts) {
var defaults = {
//plugin defaults
};