A micro-gem DSL for compound conditionals.
Allowable lets you decompose large/long conditional chains into readable, testable, and inspectable segments with Ruby blocks.
| # Signal catching | |
| def shut_down | |
| puts "\nShutting down gracefully..." | |
| sleep 1 | |
| end | |
| puts "I have PID #{Process.pid}" | |
| # Trap ^C | |
| Signal.trap("INT") { |
A micro-gem DSL for compound conditionals.
Allowable lets you decompose large/long conditional chains into readable, testable, and inspectable segments with Ruby blocks.
| #!/bin/sh | |
| # Called by "git push" after it has checked the remote status, | |
| # but before anything has been pushed. | |
| # | |
| # If this script exits with a non-zero status nothing will be pushed. | |
| # | |
| # Steps to install, from the root directory of your repo... | |
| # 1. Copy the file into your repo at `.git/hooks/pre-push` | |
| # 2. Set executable permissions, run `chmod +x .git/hooks/pre-push` |
| class RefererFilter | |
| ALLOWED_HOSTS = Set.new(%w( | |
| example.com | |
| localhost | |
| )) | |
| def initialize(app) | |
| @app = app | |
| end |
Installing rbx-2.0.0-dev with Ruby 1.9 support using rbenv can be a tad tricky. This is what I did to get up and running, you'll need another version of ruby already installed as well as rake.
The basic outline:
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
| These two files should help you to import passwords from mac OS X keychains to 1password. | |
| Assumptions: | |
| 1) You have some experience with scripting/are a power-user. These scripts worked for me | |
| but they haven't been extensively tested and if they don't work, you're on your own! | |
| Please read this whole document before starting this process. If any of it seems | |
| incomprehensible/frightening/over your head please do not use these scripts. You will | |
| probably do something Very Bad and I wouldn't want that. | |
| 2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous | |
| versions of OS X may have earlier versions of ruby, which *may* work, but then again, they |
| #!/usr/bin/env ruby | |
| # List all keys stored in memcache. | |
| # Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
| require 'net/telnet' | |
| headings = %w(id expires bytes cache_key) | |
| rows = [] |
| #!/bin/sh | |
| echo "What should the Application be called (no spaces allowed e.g. GCal)?" | |
| read inputline | |
| name="$inputline" | |
| echo "What is the url (e.g. https://www.google.com/calendar/render)?" | |
| read inputline | |
| url="$inputline" |