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
# Add to `spec/support/database_state_loader.rb` | |
class DatabaseStateLoader | |
class EnvironmentError < RuntimeError; end | |
def self.load(path) | |
new(path).load | |
end | |
def initialize(path) |
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
# rails console test | |
# # or | |
# RAILS_ENV=test rails console | |
require 'capybara/dsl' | |
Capybara.app = app.instance_variable_get("@app") | |
cap = Object.new.instance_eval { extend Capybara::DSL; self } | |
# cap.visit '/' | |
# cap.page.find 'h1' |
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
####################### | |
## BUILD BASE | |
# Small image | |
FROM alpine:3.5 | |
# or | |
FROM ubuntu:16.04 | |
# LTS |
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
mysql.server stop # kill the process if it fails | |
brew uninstall mysql56 | |
brew update | |
brew install mysql@5.7 | |
brew link mysql@5.7 --force | |
mysql.server stop | |
brew services start mysql # don't run via tmux | |
mysql_upgrade -u root --force | |
brew services restart mysql # don't run via tmux | |
cd ~/Code/17hats/17hats |
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
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin` | |
# Be sure to have rails and thin installed. | |
require "rubygems" | |
require "rails" | |
# Let's load only action controller. If you want | |
# to use active record, just require it as well. | |
require "action_controller/railtie" | |
class MyApp < Rails::Application |
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
#!/usr/bin/php | |
<?php | |
$input = file_get_contents('php://stdin'); | |
preg_match('|^To: (.*)|', $input, $matches); | |
$filename = tempnam('/var/log/mail', date('ymd-his-') . $matches[1] . '.'); | |
file_put_contents($filename, $input); |
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
// originally by Camden Ross. Thanks | |
/* bypass wordpress are you sure you want to logout screen when logging out of an already logged out account. */ | |
function smart_logout() { | |
if (!is_user_logged_in()) { | |
$smart_redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '/'; | |
wp_safe_redirect( $smart_redirect_to ); | |
exit(); | |
} else { | |
check_admin_referer('log-out'); |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |