Skip to content

Instantly share code, notes, and snippets.

View ActualAl's full-sized avatar

Alex ActualAl

View GitHub Profile
@ActualAl
ActualAl / JavaScript MVC
Last active December 21, 2015 21:19
This Gist shows a VERY simple separation of concerns for the types of activities commonly done to a page Including: -- Get data -- Write stuff out to the DOM -- Handle errors -- Perform decision logic This code is 100% unit testable
var CustomersController = function (dependencies) {
var self = this;
var customerRepository = dependencies.customerRepository;
var errorHandler = dependencies.errorHandler;
var customersView = dependencies.customersView;
var init = function() {
//Set up handler for 'loadCustomer' event
$(dependencies.document).on('loadCustomer', function (evt, id) {
self.loadCustomerById(id);
@ActualAl
ActualAl / Isotope - masonry layout mode.markdown
Last active August 29, 2015 14:27
Isotope - masonry layout mode
@ActualAl
ActualAl / bijective.rb
Created September 23, 2015 08:21 — forked from zumbojo/bijective.rb
Simple bijective function (base(n) encode/decode)
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join

Keybase proof

I hereby claim:

  • I am actualal on github.
  • I am alxrdmn (https://keybase.io/alxrdmn) on keybase.
  • I have a public key ASCbHm8XDAE5pn0F5dop8glzCYMKLzJKJCmz2921HBIg5wo

To claim this, I am signing this object: