Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
Doubling Down

Various Authors variousauthors

🐢
Doubling Down
View GitHub Profile
@variousauthors
variousauthors / gist:10999437
Last active Aug 29, 2015
Rockets Rockets Rockets
View gist:10999437

I'm not down with the new(er) [Ruby hash syntax][0]. I'm not down.

In javascript, I can do this:

hash = {
  first  : "one"
  second : "two"
  third  : "three"
}
@variousauthors
variousauthors / class.lua
Last active Aug 29, 2015
I wanted to be able to copy my instances!
View class.lua
-- @param _construct: map args --> object
-- @param tcurtsnoc_: map object --> args
Klass = function (_construct, tcurtsnoc_)
local constructor
local function copy(o)
return constructor(tcurtsnoc_(o))
end
constructor = function (...)
View gist:ff9490f81a0e17b656a8
function do_socket_stuff ()
print("in")
local http = require("socket.http")
local ltn12 = require("ltn12")
local base_url = "http://gamejolt.com/api/game/v1"
--Helper for priniting nested table
function deep_print(tbl)
for i, v in pairs(tbl) do
@variousauthors
variousauthors / gist:5948006
Created Jul 8, 2013
I wrote a thing here.
View gist:5948006
Action is a form of communication that earns my trust.
@variousauthors
variousauthors / closure.js
Last active Dec 19, 2015
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++).
View closure.js
$(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 Dec 20, 2015
Sunniest month ever record broken in Vancouver.
View july.js
// 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 Dec 20, 2015
If you don't understand Japanese but still want to use Foundation 4 with Rails 4, check it out!
View gist:6142170

#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
View gist:6225556
$('.man:last-child').on('doomsday', function(e) {
setTimeOut(this.awake, 2147483647 + 1);
});
@variousauthors
variousauthors / postMessage
Created Aug 16, 2013
"Recently we've waded a little way out / And the water seems inviting."
View postMessage
window.onLoad = function() {
var other_worlds = window.parent;
if (typeof other_worlds.postMessage === "function") {
other_worlds.postMessage("Hello?", "http://www.space.com");
}
};
View gist:6346160
.lovely {
color: lavender;
}