Skip to content

Instantly share code, notes, and snippets.

View johnpaulashenfelter's full-sized avatar

John Paul Ashenfelter johnpaulashenfelter

View GitHub Profile
Twelve Things This Book Will Do For You
# This section was included in the original 1936 edition as a single page list, which preceded the main content of the book, showing a prospective reader what to expect from it. The 1981 edition omits points 6 to 8 and 11.
# Get you out of a mental rut, give you new thoughts, new visions, new ambitions.
# Enable you to make friends quickly and easily.
# Increase your popularity.
# Help you to win people to your way of thinking.
# Increase your influence, your prestige, your ability to get things done.
# Enable you to win new clients, new customers.
# Increase your earning power.
@johnpaulashenfelter
johnpaulashenfelter / application.rb
Created October 19, 2017 11:13 — forked from shawndrost/application.rb
Single file Rails application
# the new and improved one-file rails app -- now including
require "action_controller/railtie"
class Tester < Rails::Application
config.session_store :cookie_store, :key => '_rails_session'
config.secret_token = '095f674153982a9ce59914b561f4522a'
end
class UsersController < ActionController::Base
@johnpaulashenfelter
johnpaulashenfelter / RunAProxyOnAmazonEC2VPC.md
Created November 30, 2017 14:04 — forked from webinista/RunAProxyOnAmazonEC2VPC.md
Create a proxy server on an Amazon EC2 (VPC) instance

This will create a proxy server in whatever your availability zone your VPC is in. For me, that's us-east-1b. For you, that may be something different. Steps 10+ should more or less work regardless of your provider since those steps cover the setup and configuration of TinyProxy.

  1. Click the Launch Instance button.
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type. This isn't strictly necessary. If you choose another OS, check its documentation for how to install new packages.
  3. On the Choose an Instance Type screen, select t2.micro. It's Free Tier eligible.
  4. Click the Next: ... buttons until you reach the Configure Security Group screen.
    • You may wish to reduce the amount of storage on the Add Storage screen. This is optional.
    • You may wish to add a tag on the Tag Instance screen. This is also optional.
  5. On the Configure Security Group screen:
  • Select Create a new security group.
@johnpaulashenfelter
johnpaulashenfelter / README.md
Last active July 25, 2018 02:05
Quick pairing exercise

Database Server Pairing Exercise

This pairing task was chosen from https://www.recurse.com/pairing-tasks

Initial task

Before your interview, write a program that runs a server that is accessible on http://localhost:4000/. When your server receives a request on http://localhost:4000/set?somekey=somevalue it should store the passed key and value in memory. When it receives a request on http://localhost:4000/get?key=somekey it should return the value stored at somekey.

During your interview, you will pair on saving the data to a file. You can start with simply appending each write to the file, and work on making it more efficient if you have time.

# ~/.ssh/config
```
Include conf.d/*
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
```
@johnpaulashenfelter
johnpaulashenfelter / dollar.rb
Created July 18, 2022 11:39 — forked from JoelQ/dollar.rb
Implementing value object semantics as an RSpec shared_example.
class Dollar
attr_reader :cents
def initialize(cents:)
@cents = cents
end
def hash
[self.class, cents].hash
end