Given this calls:
Taskman.queue(2.5) { print 'world!' }
Taskman.queue(1.0) { print 'hello ' }
When we do this one:
Taskman.work
# http://ruby-doc.org/core-2.4.0/doc/syntax/calling_methods_rdoc.html#label-Hash+to+Keyword+Arguments+Conversion | |
class Super | |
attr_reader :shared | |
# ServiceObject style class-level activation method | |
def self.run(**args) | |
new(**args).tap{ |obj| obj.run } | |
end | |
def initialize(shared: 'All subclasses see me', **args) |
#! /usr/bin/env ruby | |
# This script can be used to parse and dump the information from | |
# the 'html/contact_info.htm' file in a Facebook user data ZIP download. | |
# | |
# It dumps all cell phone call + SMS message + MMS records, plus a summary of each. | |
# | |
# Place this script inside the extracted Facebook data download folder | |
# alongside the 'html' folder. | |
# |
// Element selection | |
document.querySelector('.someclass') // $('.someclass')[0] | |
document.querySelectorAll('.someclass') // $('.someclass') | |
// DOM manipulation | |
element.remove() // $element.remove() | |
element.prepend(otherElement) // $element.prepend(otherElement) | |
element.before(otherElement) // $element.before(otherElement) | |
element.classList.add('some') // $element.addClass('some') | |
element.classList.remove('some') // $element.removeClass('some') |
window.Namespace = window.Namespace || {}; | |
// Usage: | |
// Namespace.Rolenamee.init({ prop1: '.prop1', prop2: '.prop2' }) | |
const Rolename = (function Rolename(expose) { | |
// private class/constructor | |
function Implementor({ foo, bar }) { | |
this.foo = $(foo); // store a value that will be needed asyncronously | |
$(bar).on("event", () => { // set up an asyncronous reaction | |
this.foo.method(); // use the stored value asyncronously through =>'s lexical `this` |
I have the habit of start my coding musings by branching away from other people's proposals.
In this case I found myself looking at this video, where the author codes the snake game in 4'30''
The video is very good and the code is purposefully and relentlessly hacky. And the game indeed works after that time. While I was looking at it I was thinking, wow, I cannot beat him at his own game, but is it really so much different between that
# Ignore all logfiles and tempfiles. | |
/log/* | |
/tmp/* | |
/public/packs/* | |
!/log/.keep | |
!/tmp/.keep | |
.DS_Store | |
.env.development | |
.env.staging |