Skip to content

Instantly share code, notes, and snippets.

@oem
oem / recursive_ls.rb
Created October 25, 2010 11:17
print the folder structure recursively from the current folder
def read_dir(current, indent="")
Dir[current + "/*"].each do |dir|
puts indent + dir.to_s.scan(/[^\/]+$/).to_s
read_dir(dir, indent + " ") if FileTest.directory?(dir)
end
end
read_dir(".")
@oem
oem / gist:758561
Created December 29, 2010 14:01
capybara date select step definition for cucumber
# capybara step definition for a quick and dirty date select
# For example:
# When I select "May 7, 2010" as the post "published_on" date
When /^I select "([^"]*)" as the (.+) "([^"]*)" date$/ do |date, model, selector|
date = Date.parse(date)
select(date.year.to_s, :from => "#{model}[#{selector}(1i)]")
select(date.strftime("%B"), :from => "#{model}[#{selector}(2i)]")
select(date.day.to_s, :from => "#{model}[#{selector}(3i)]")
end
@mattiaslundberg
mattiaslundberg / arch-linux-install
Last active May 26, 2024 17:26
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap