#!/usr/bin/env ruby
class CLI < Thor
def search
# ...
selected = gets.chomp.to_i # this will raise: Broken pipe (Errno::EPIPE)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::{BufReader,BufRead}; | |
use std::fs::File; | |
use std::time::Duration; | |
use std::thread; | |
use std::env; | |
fn main() { | |
fn tail(reader: &mut BufReader<&File>) { | |
let time = Duration::from_millis(10); | |
loop { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'em-http-request' | |
require 'em-synchrony' | |
require 'em-synchrony/em-http' | |
module Gmusic | |
# = AsyncRequest | |
# This module is powered by {EventMachine}[https://github.com/eventmachine/eventmachine] and {em-http-request}[https://github.com/igrigorik/em-http-request] and {em-synchrony}[https://github.com/igrigorik/em-synchrony]. | |
# By taking advantage of EventMacine, it allows you to issue parallel requests. You can easily control concurrency and follow redirects. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/http" | |
require 'uri' | |
def download(uri_str) | |
uri = URI uri_str | |
Net::HTTP.new(uri.host, uri.port).start do |http| | |
head = http.request_head uri.path | |
length = head.content_length | |
puts length |
NewerOlder