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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'mechanize' | |
require 'yaml' | |
config = YAML.load_file(File.expand_path("~/.simple-note-backup.yml")) | |
email = config['email'] | |
password = config['password'] |
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
# In attribute file: | |
my_gem_packages = [ | |
"nokigiri", # Only a gem name, without a version requirement or other options" | |
["bundler", "=1.0.0"], # A gem with a version requirement | |
["rails", "~>2.3.9", "--no-ri --no-rdoc --source http://rubygems.org"], # A gem with a version requirement and options" | |
["json", nil, "--source http://rubygems.org"] # Gem with options but no version requirement | |
] | |
# In recipe: |
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
# I want to turn this: | |
array = [1, 2, 3, 4, 5, 6, 7, 8, 9] | |
# into this: | |
=> [[1, 2, 3], [4, 5, 6], [7, 8, 9]] | |
def to_grid(ary) | |
array = ary.dup | |
row_length = Math.sqrt(array.size).to_i | |
result = [] |
NewerOlder