Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].
Today we're looking for:
def pretty_inspect(object, indent = 2) | |
if object.is_a?(Array) | |
entries = object.collect{|x| "#{pretty_inspect x, indent + 2}"} | |
pretty_indent entries, "[", "]", indent | |
elsif object.is_a?(Hash) | |
entries = object.keys.sort.collect{|x| "#{pretty_inspect x} => #{pretty_inspect object[x], indent + 2}"} | |
pretty_indent entries, "{", "}", indent | |
else | |
object.inspect | |
end |
// This is just an example of nested callbacks. I know you could achieve this | |
// goal with simpler code but I'm just showing an example | |
// The well-known callback pattern | |
fs.mkdir("some-path", function(err) { | |
fs.open("some-path/file", "w", function(err, fd) { | |
var buffer = new Buffer("hello world"); | |
fs.write(fd, buffer, 0, buffer.length, null, function(err, bytes) { | |
console.log("Wrote " + bytes + " bytes"); |
class AppDelegate | |
def applicationDidFinishLaunching(notification) | |
MainMenu.build! | |
MainMenu[:app].subscribe :quit do |_| | |
NSApp.terminate(self) | |
end | |
MainMenu[:file].subscribe :new do |_| |
Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].
Today we're looking for:
class Object | |
def send(method, *args) | |
end | |
def method_missing(*args) | |
end | |
def self.method_added(method_name) | |
remove_method(method_name) | |
end |
import Ember from "ember"; | |
export default Ember.Component.extend({ | |
active: false, | |
slideshow: null, | |
init: function() { | |
this._super(); |