Today, in Ruby, if I want to make a network request, I block
response = Net::HTTP.get("/post/1")
If I want to do multiple requests in parallel, I can use a thread per request
responses = ["/post/1", "/post/2"].map do |url|
Remove file from git repository (history) | |
SOLUTION: This is the shortest way to get rid of the files: | |
1. check .git/packed-refs - my problem was that I had there a refs/remotes/origin/master line for a remote repository, delete it, otherwise git won't remove those files | |
2. (optional) git verify-pack -v .git/objects/pack/#{pack-name}.idx | sort -k 3 -n | tail -5 - to check for the largest files | |
3. (optional) git rev-list --objects --all | grep #{SHA_FROM_#_3} - to check what files those are |
class CarElement | |
def accept(visitor) | |
raise NotImpelementedError.new | |
end | |
end | |
module Visitable | |
def accept(visitor) | |
visitor.visit(self) | |
end |
Dr. Alan Kay explains when "object-oriented" was first used and what it means. [] (Meaning of "Object-Oriented Programming" According to Dr. Alan Kay (meaning of OOP objectoriented definition term notion meaning explanation what is)), document, page 721691 | |
http://www.purl.org/stefan_ram/pub/doc_kay_oop_en (permalink) is the canonical URI of this page. | |
Stefan Ram | |
Dr. Alan Kay on the Meaning of “Object-Oriented Programming” | |
(To link to this page, please use the canonical URI "http://www.purl.org/stefan_ram/pub/doc_kay_oop_en" only, because any other URI is valid only temporarily.) | |
E-Mail of 2003-07-23 | |
Dr. Alan Kay was so kind as to answer my questions about the term “object-oriented programming”. | |
Clarification of "object-oriented" [E-Mail] | |
Today, in Ruby, if I want to make a network request, I block
response = Net::HTTP.get("/post/1")
If I want to do multiple requests in parallel, I can use a thread per request
responses = ["/post/1", "/post/2"].map do |url|
I've developed a useful feature in KeystoneJS that lets you populate a relationship from either side, while only storing the data on one side, and am looking for feedback on whether it is something that could / should be brought back into mongoose itself. (It might be possible to add as a separate package but I suspect there'd be too much rewriting of mongoose internals for that to be a good idea).
I've added this as an issue in mongoose for consideration: #1888 but am leaving this gist in place because the examples are easier to read.
I've used Posts and Categories as a basic, contrived example to demonstrate what I'm talking about here; in reality you'd rarely load all the posts for a category but there are other real world cases where it's less unreasonable you'd want to do this, and Posts + Categories is an easy way to demo it.
The built-in population feature is really useful; not just for
/** | |
* Find the longest class names in Spring. | |
* Also find FactoryFactory classes. | |
* a goof-off project by @thom_nic | |
*/ | |
import java.util.jar.* | |
defaultTasks 'longest', 'factoryfactory' |
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (: | |
Array.prototype.flatMap = function(lambda) { | |
return Array.prototype.concat.apply([], this.map(lambda)); | |
}; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |