Skip to content

Instantly share code, notes, and snippets.

foo://username:password@example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose
\_/ \_______________/ \_________/ \__/ \___/ \_/ \______________________/ \__/
| | | | | | | |
| userinfo host port | | query fragment
| \________________________________/\_____________|____|/ \__/ \__/
scheme | | | | | |
name authority | | | | |
| path | | interpretable as keys
| | |
| \_______________________________________________|____|/ \____/ \_____/
@jyurek
jyurek / tm.sh
Last active February 12, 2024 10:37
Create and switch sessions in tmux quickly
#!/bin/sh
tm() {
if [ -z $1 ]; then
tmux switch-client -l
else
if [ -z "$TMUX" ]; then
tmux new-session -As $1
else
if ! tmux has-session -t $1 2>/dev/null; then
TMUX= tmux new-session -ds $1
@ordinaryzelig
ordinaryzelig / .ruby-version
Last active August 29, 2015 14:01
Test cases for thread-safety in mocking libraries (http://redningja.com/dev/parallel-tests-with-single-database/)
ruby-2.0.0-p353
require 'spec_helper'
describe SimplySettings do
before do
Rails.cache.clear
end
subject(:settings) { SimplySettings }
@cupakromer
cupakromer / hilong.rb
Created February 14, 2014 17:51 — forked from jstorimer/hilong.rb
#!/usr/bin/env ruby
# A simply utility to show character counts for each line of input and
# highlight lines longer than 80 characters.
#
# Written as an example for http://jstorimer.com/2011/12/12/writing-ruby-scripts-that-respect-pipelines.html
#
# Examples:
#
# $ hilong Gemfile
#!/usr/bin/env ruby
input = "%clipboard"
subs = {
" " => " ",
"a" => "ɐ",
"b" => "q",
"c" => "ɔ",
"d" => "p",
"e" => "ǝ",
@bokmann
bokmann / zlorpian
Last active December 25, 2015 13:39
a programming puzzle for learning how to contemplate counting in different bases.
Good afternoon fellow space travelers, thanks for coming along on this mission. We still have about a week
before we arrive at New Zlorpia, so please return your stasis tubes to their original upright position and
prepare for your mission briefing.
We are going to be negotiating a trade agreement with the Zlorpians for their supply of Farkle seeds. They
have a much different way of counting than we do, and I'm concerned that if we don't have a good way to
work with their number system, we'll be at a disadvantage in negotiations. Let me explain:
The zlorpians have a single arm that comes out of their forehead, with a hand that has 3 fingers. As a
result, our base-10 way of counting (based on our ten fingers) is as alien to them as their way is to us.
@csexton
csexton / irc-cheat-sheet.md
Last active December 25, 2015 07:49
IRC Cheat Sheet for #arlingtonruby

So you can be an op, you need to register, you can do that by running this command:

/msg nickserv register your_password your_email_address

To become an operator on #arlingtonruby:

/msg chanserv op #arlingtonruby

To make someone an op:

@cupakromer
cupakromer / books_controller.rb
Last active May 19, 2020 10:20
Rails 4 Standard CRUD Controller
# No flash messages are set with this controller.
#
# This is a fairly basic / bare controller which does only the basic CRUD.
class BooksController < ApplicationController
respond_to :html, :xml, :json
before_action :set_book, only: [:show, :edit, :update, :destroy]
def index
respond_with @books = Book.all
@elefontpress
elefontpress / gist:6159651
Last active June 12, 2024 22:48
This is the contract Bearded uses for client work on a time and materials basis. It's worked for us, but I am not a lawyer, so please run it by yours before you use it! Regardless, do whatever you like with it. Use it, share it, change it ... go nuts. Our original contract from 2008 was for fixed-price projects and was based on Andy Clark'e Cont…

Bearded's Hourly Contract

Date: [[Date of Document]] Between [Our Company] and [Your Company]

Summary

We’re not big on formality, but sometimes it’s best to have a few simple things written down so that we’re all on the same page. In this contract you won’t find complicated legal terms or large passages of unreadable text. We have no desire to trick you into signing something that you might later regret. We do want what’s best for the safety of both parties, now and in the future.