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
# http://codingsteps.com/installing-and-configuring-postgresql-in-amazon-linux-ami/ | |
sudo su - | |
gem install unicorn | |
exit | |
sudo yum -y install nginx | |
sudo yum -y install readline-devel | |
sudo yum -y install zlib-devel | |
wget http://ftp.postgresql.org/pub/source/v9.2.6/postgresql-9.2.6.tar.bz2 |
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
# http://michaelconnor.org/2013/07/install-mongodb-on-amazon-64-bit-linux/ | |
sudo vi /etc/yum.repos.d/10gen.repo | |
# Add all below sans pounds to the file | |
# [10gen] | |
# name=10gen Repository | |
# baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 | |
# gpgcheck=0 |
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
{ | |
"auto_indent": true, | |
"bold_folder_labels": true, | |
"detect_indentation": true, | |
"fade_fold_buttons": false, | |
"font_face": "Fira Mono OT", | |
"font_size": 13.0, | |
"highlight_line": true, | |
"ignored_packages": | |
[ |
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 'csv_class_maker' | |
CsvClassMaker.generate_class('MyTweets', '/Users/mplatt/Downloads/tweets/tweets.csv') | |
curses = Regexp.new('piss|fuck|shit|dick|ass|damn', true) | |
all_tweets_count = MyTweets.all.size | |
my_curses_count = MyTweets.all.select{ |t| t if t.text.match(curses) }.size |
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
# extracted from http://www.thekua.com/atwork/2011/07/ruby-script-to-capture-http-traffic/ | |
require 'webrick' | |
include WEBrick | |
class Simple < WEBrick::HTTPServlet::AbstractServlet | |
def do_POST(request, response) | |
puts "Body: " + request.body | |
puts "Header: " + request.raw_header.to_s | |
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
def variablize(string) | |
sanitized_string = string.chomp('=') | |
sanitized_string = sanitized_string.gsub(/([^a-z0-9_])/i, '_') | |
sanitized_string[0] = sanitized_string[0].downcase.sub(/[0-9]/, '_') | |
sanitized_string | |
end |
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
class ViewModel | |
def initialize(klass) | |
@klass = klass | |
end | |
private | |
attr_accessor :klass | |
def method_missing(method_sym, *arguments, &block) |
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
class BusinessObject | |
class LambdaError < StandardError; end; | |
class NotImplementedError < StandardError; end; | |
def initialize(lambda_hash = {}) | |
post_init(lambda_hash) | |
end | |
def perform | |
raise NotImplementedError, 'must implement perform.' |
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
# http://www.brianstorti.com/implementing-a-priority-queue-in-ruby | |
class PriorityQueue | |
attr_reader :elements | |
def initialize | |
@elements = [nil] | |
end | |
def <<(element) | |
@elements << element |
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
# https://www.youtube.com/watch?v=gRpUfjTwSOo&utm_source=golangweekly&utm_medium=email | |
package main | |
import "fmt" | |
type user struct { | |
name string | |
email string | |
} |