Skip to content

Instantly share code, notes, and snippets.

View variousauthors's full-sized avatar
🐢
Doubling Down

Various Authors variousauthors

🐢
Doubling Down
View GitHub Profile
@variousauthors
variousauthors / gist:5948006
Created July 8, 2013 11:26
I wrote a thing here.
Action is a form of communication that earns my trust.
@variousauthors
variousauthors / closure.js
Last active December 19, 2015 13:29
My very first closure in javascript! I talked about being able to do this in the interview, but my understanding was mainly theoretical (although this is very similar to specializing functors in C++).
$(function() {
var annex = $('.page-insert-annex');
var handle = annex.data()['handle'];
/* get a closure around annex and handle */
var closure = populate_annex_with_page(annex, handle);
if (annex.length) {
$.when($.get('/pages.json')).done(closure); // be sneaky
@variousauthors
variousauthors / july.js
Last active December 20, 2015 10:31
Sunniest month ever record broken in Vancouver.
// apparently we had a really sunny month?
$.each(july, function(index, days) {
if (programming) {
$.each(house.windows, function(index, window) {
window.close();
});
house.ac.open();
self.on('sunrise', go_get_coffee);
@variousauthors
variousauthors / gist:6142170
Last active December 20, 2015 13:49
If you don't understand Japanese but still want to use Foundation 4 with Rails 4, check it out!

#Using compass-rails with rails 4

If you try to use compass-rails with rails 4, the following error will stop you,

Unsupported rails environment for compass

You can fix this error by doing the following:

$ vim Gemfile
@variousauthors
variousauthors / gist:6225556
Created August 13, 2013 20:51
Winter is coming...
$('.man:last-child').on('doomsday', function(e) {
setTimeOut(this.awake, 2147483647 + 1);
});
@variousauthors
variousauthors / postMessage
Created August 16, 2013 21:13
"Recently we've waded a little way out / And the water seems inviting."
window.onLoad = function() {
var other_worlds = window.parent;
if (typeof other_worlds.postMessage === "function") {
other_worlds.postMessage("Hello?", "http://www.space.com");
}
};
@variousauthors
variousauthors / gist:6346160
Last active December 21, 2015 18:19
Pretty in pink!
.lovely {
color: lavender;
}
@variousauthors
variousauthors / gist:6809872
Created October 3, 2013 13:31
Adding event management to a backbone.marionette Layout.
MyApp.Views.MasterDetailLayout = Backbone.Marionette.Layout.extend({
template: 'backbone/templates/master_detail_layout',
regions: {
master: "#master",
detail: "#detail"
},
initialize: function() {
console.log('MasterDetailLayout->initialize');
@variousauthors
variousauthors / gist:6867013
Created October 7, 2013 12:26
This is the only way I could find to namespace a group of methods in an object.
var obj = (function (){
var self = {
foo: function () {
return 'foo';
},
namespace: {
bar: function () {
return self.foo();
}
}
@variousauthors
variousauthors / gist:6919826
Created October 10, 2013 14:59
An example of Handlebars.
{{!-- a handlebars template might look like this --}}
<div class="{{#if myLibrary}}active{{/if}} library">
{{#each books}}
<div class="book">
<h3 class="title">{{ title }}</h3>
<span class="author">by {{ author }}</span>
{{#if isAvailable }}
<span class="availability">Available!</span>
{{else}}