How to implement a custom search for Hugo usig Gruntjs and Lunrjs.
Install the following tools:
| #!/usr/bin/env bash | |
| # | |
| # Bootstrap script for setting up a new OSX machine | |
| # | |
| # This should be idempotent so it can be run multiple times. | |
| # | |
| # Some apps don't have a cask and so still need to be installed by hand. These | |
| # include: | |
| # | |
| # - Twitter (app store) |
Method lookup is a simple affair in most languages without multiple inheritance. You start from the receiver and move up the ancestors chain until you locate the method. Because Ruby allows you to mix in modules and extend singleton classes at runtime, this is an entirely different affair.
I will not build contrived code to exemplify the more complicated aspects of Ruby method lookup, as this will only serve to confuse the matter.
When you pass a message to an object, here is how Ruby finds what method to call:
| #!/usr/bin/env python | |
| # parse_toc.py | |
| from pdfminer.pdfparser import PDFParser | |
| from pdfminer.pdfdocument import PDFDocument | |
| def parse(filename, maxlevel): | |
| fp = open(filename, 'rb') | |
| parser = PDFParser(fp) | |
| doc = PDFDocument(parser) |
| [email protected] | Stefanie | House | |
|---|---|---|---|
| [email protected] | Dinah | Erickson | |
| [email protected] | Melisa | Reynolds | |
| [email protected] | Lily | Carson | |
| [email protected] | Millard | Rubio | |
| [email protected] | Octavia | Santana | |
| [email protected] | Royal | Bender | |
| [email protected] | Laverne | Hutchins | |
| [email protected] | Sherman | Wilder | |
| [email protected] | Thelma | Burris |
| tell application "Chrome" to tell the active tab of its first window | |
| reload | |
| end tell |
| # http://ruby-doc.org/stdlib-2.0.0/libdoc/open-uri/rdoc/OpenURI.html | |
| require 'open-uri' | |
| # https://github.com/flori/json | |
| require 'json' | |
| # http://stackoverflow.com/questions/9008847/what-is-difference-between-p-and-pp | |
| require 'pp' | |
| # Construct the URL we'll be calling | |
| request_uri = 'http://localhost:3000/users.json' | |
| request_query = '' |
| package main | |
| import "fmt" | |
| // fibonacci is a function that returns | |
| // a function that returns an int. | |
| func fibonacci() func() int { | |
| var a, b int | |
| return func() int { | |
| a, b = b, a + b |
| #!/bin/bash | |
| # Usage: slackpost <token> <channel> <message> | |
| # Enter the name of your slack host here - the thing that appears in your URL: | |
| # https://slackhost.slack.com/ | |
| slackhost=PUT_YOUR_HOST_HERE | |
| token=$1 |
| # gem install httparty | |
| # ruby gists.rb | |
| require 'httparty' | |
| class Gists | |
| include HTTParty | |
| @username = 'x' | |
| @password = 'x' |