This file contains 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
// You come upon a column of four floors that have been entirely sealed off from the rest of the | |
// building except for a small dedicated lobby. There are some radiation warnings and a big sign | |
// which reads "Radioisotope Testing Facility". | |
struct Facility<'a> { | |
floors: Vec<Floor<'a>>, | |
} | |
struct Floor<'a>(Vec<Item<'a>>); |
This file contains 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
❯ cargo test | |
Compiling git2 v0.6.0 (file:///.../git2-rs) | |
error: borrowed value does not live long enough | |
--> src/config.rs:560:23 | |
| | |
560 | for entry in &cfg.entries(None).unwrap() { | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value created here | |
... | |
564 | } | |
| - temporary value only lives until here |
This file contains 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
extern crate rand; | |
#[derive(Clone, Copy, Debug, Eq, PartialEq)] | |
enum Nationality { | |
Dane, | |
Brit, | |
Swede, | |
Norwegian, | |
German, | |
} |
This file contains 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::env::args; | |
use std::fs::{read_dir, File}; | |
use std::io::prelude::*; | |
use std::path::PathBuf; | |
fn main() { | |
let dirs = args().skip(1); | |
let paths = dirs.flat_map(|dir| { | |
read_dir(&dir) | |
.expect(&format!("unable to read dir {}", dir)) |
This file contains 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
#!/usr/bin/env ruby | |
require 'tempfile' | |
plist = ARGF.read | |
Tempfile.create('info.plist') do |f| | |
f << plist | |
f.flush | |
vars = `/usr/libexec/PlistBuddy -c "Print :variablesdontexport" #{f.path}` |
This file contains 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
module Scrabble | |
POINTS = {} | |
{ | |
'EAIONRTLSU' => 1, | |
'DG' => 2, | |
'BCMP' => 3, | |
'FHVWY' => 4, | |
'K' => 5, | |
'JX' => 8, | |
'QZ' => 10, |
This file contains 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 'open-uri' | |
require 'rexml/document' | |
module GettingToPhilosophy | |
module Crawler | |
def self.crawl(*trail) | |
until trail.last == Wikipedia::PHILOSOPHY || trail.uniq.size != trail.size | |
puts trail.last | |
doc = Wikipedia.article(trail.last) |
This file contains 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
#!/usr/bin/env ruby | |
fan_speed = (ARGV.shift || 1100).to_i | |
smc = '~/Applications/smcFanControl.app/Contents/Resources/smc' | |
fan_speed = (fan_speed << 2).to_s(16) | |
`#{smc} -k F1Mx -w #{fan_speed}` |
This file contains 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
"Dodo" Doubleday: Fall In (1942) | |
3 Ninjas: High Noon at Mega Mountain (1998) | |
91:an Karlsson: Alla tiders 91 Karlsson (sv) (1953) | |
A Cry in the Wild/White Wolves: White Wolves III: Cry of the White Wolf (2000) | |
A Dennis the Menace Christmas (2007) (V) | |
A Nightmare on Elm Street 4: The Dream Master (1988) | |
A Thief on the Night: The Prodigal Planet (1983) | |
Abbott and Costello Meet Universal Monsters: Abbott and Costello Meet the Mummy (1955) | |
Aces Go Places 4 (1986) | |
Adams Apples: Torn (2011) |