Skip to content

Instantly share code, notes, and snippets.

View maxehmookau's full-sized avatar

Max Woolf maxehmookau

View GitHub Profile
@maxehmookau
maxehmookau / test_results_controller.rb
Created July 11, 2017 15:07
Standard Controller Example
class TestResultsController < ApplicationController
def index
@test_results = current_user.test_results
end
end
lock '3.7.2'
set :application, 'my application'
set :repo_url, 'somethingsomething.git'
set :ssh_options, proxy: Net::SSH::Proxy::Command.new("ssh -W %h:%p -q root@proxy_server} -i {private_key_for_proxy} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no")
# All your other configs...
# Note: -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
# This can be potentially unsafe on an unknown network but is helpful for
00:00 git:wrapper
00:00 git:check
00:00 deploy:check:directories
00:00 deploy:check:linked_dirs
00:00 sidekiq:quiet
00:00 git:clone
00:00 git:update
00:00 git:create_release
00:00 deploy:set_current_revision
00:00 deploy:symlink:linked_dirs
@maxehmookau
maxehmookau / from_this.rb
Created January 9, 2017 11:18
Refactoring using Sandi Metz 99 bottles examples for Rails helper
module PlaylistCommentsHelper
def pinning_link(comment)
if comment.pinned?
unpin_link(comment)
else
pin_link(comment)
end
end
def unpin_link(comment)
@maxehmookau
maxehmookau / docker-compose.yml
Created January 5, 2017 09:36
Simple Moodle 3.2 Installation on Docker Compose
version: '2'
services:
moodle:
image: jhardison/moodle
links:
- moodle_db
environment:
MOODLE_URL: "http://0.0.0.0:8080"
DB_PORT_3306_TCP_ADDR: moodle_db
DB_ENV_MYSQL_USER: moodle
require "benchmark"
Benchmark.bmbm do |x|
x.report("min") { (1..10000000).to_a.shuffle.min }
x.report("max") { (1..10000000).to_a.shuffle.max }
end
# Ruby 2.4-rc
user system total real
min 0.750000 0.000000 0.750000 ( 0.756316)
max 0.770000 0.020000 0.790000 ( 0.794998)
@maxehmookau
maxehmookau / main.go
Created October 11, 2016 14:25
Little teabot. My first go.
package main
import (
"fmt"
"os"
)
func main() {
args := os.Args[1:]
name := args[0]
upstream myhealthcare {
server 192.168.12.10:9292;
}
server {
listen 80;
try_files $uri @app;
location @app {
upstream rails_app {
server unix://puma.sock;
}
server {
listen 80;
server_name ip_address;
try_files $uri @app;
upstream app {
server 192.168.12.10:9292;
}
server {
listen 443 ssl;
try_files $uri @app;
location @app {