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 'socket' | |
NOT_FOUND = "HTTP/1.1 404 Not Found\nContent-Length: 9\n\nNot Found" | |
OK = "HTTP/1.1 200 OK\n" | |
socket = Socket.new(:INET, :STREAM) | |
sockaddr = Socket.sockaddr_in(11080, '127.0.0.1') | |
socket.bind(sockaddr) | |
socket.listen(5) |
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
# The main parse method is mostly borrowed from a tweet by @JEG2 | |
class StrictTsv | |
attr_reader :filepath | |
def initialize(filepath) | |
@filepath = filepath | |
end | |
def parse | |
open(filepath) do |f| | |
headers = f.gets.strip.split("\t") |
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
#!/bin/bash | |
DATE=`date +"%a"` | |
DVOLNAME=datalv | |
LVOLNAME=journallv | |
VOLGR=datavg | |
DVOLPATH=/dev/$VOLGR/$DVOLNAME | |
LVOLPATH=/dev/$VOLGR/$LVOLNAME | |
DSNAME=`echo ${DVOLNAME}_ss_${DATE} | tr '[A-Z]' '[a-z]'` | |
LSNAME=`echo ${LVOLNAME}_ss_${DATE} | tr '[A-Z]' '[a-z]'` |
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
postgres=# \dx | |
List of installed extensions | |
Name | Version | Schema | Description | |
---------+---------+------------+------------------------------ | |
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language | |
(1 row) | |
postgres=# \dx+ | |
Objects in extension "plpgsql" | |
Object Description |
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
## Prepare ################################################################### | |
# Remove RVM | |
rvm implode | |
# Ensure your homebrew is working properly and up to date | |
brew doctor | |
brew update | |
## Install ################################################################### |
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
#!/bin/sh | |
# Just copy and paste the lines below (all at once, it won't work line by line!) | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
function abort { | |
echo "$1" | |
exit 1 | |
} | |
set -e |
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
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
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
# controller | |
def proc_csv | |
import = Import.find(params[:id]) | |
if import.load_csv | |
flash[:notice] = "woo" | |
redirect_to some_url | |
else | |
flash[:error] = "ohoh" | |
end | |
end |
NewerOlder