Skip to content

Instantly share code, notes, and snippets.

@epipheus
epipheus / micropost.rb
Created July 27, 2011 04:40
Refactor Microposts so that I don't have ugly SQL
class Micropost < ActiveRecord::Base
attr_accessible :content
belongs_to :user
validates :content, :presence => true, :length => { :maximum => 140 }
validates :user_id, :presence => true
paginates_per 10
default_scope :order => "microposts.created_at DESC"
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
click_link 'My HomeMarks'
within '#login_area' do
fill_in 'email', with: '[email protected]'
fill_in 'password', with: 'test'
@epipheus
epipheus / get_ruby_for_chef
Created August 23, 2013 17:01
Debian 7 basic install of ruby for chef. Application's rubies will be install to app user and via rbenv
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
assets_path = File.expand_path("~/projects/rails/scout/public")
log_path = File.expand_path "~/assets.txt"
temp_requested_files_path = File.expand_path "~/processed_assets.txt"
ignore_pattern = /sparkline|datejs/
known_used =[
"javascripts/jquery-1.7.1.min.js",
"javascripts/jquery.extensions.js",
"javascripts/application.js",
"stylesheets/default.css",
upstream app {
server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.app.com;
rewrite ^/(.*) http://app.com/$1 permanent;
}
server {
assets_path = File.expand_path("~/projects/rails/scout/public")
log_path = File.expand_path "~/assets.txt"
temp_requested_files_path = File.expand_path "~/processed_assets.txt"
ignore_pattern = /sparkline|datejs/
known_used =[
"javascripts/jquery-1.7.1.min.js",
"javascripts/jquery.extensions.js",
"javascripts/application.js",
"stylesheets/default.css",

Setting Up an Multi-Applications Rails Server on Ubuntu

Using RVM, PostgreSQL, NGINX, Unicorn and Capistrano

Today I will cover how to setup a multi-application Ruby on Rails server with RVM, NGINX, Unicorn, Capistrano and PostgreSQL on a fresh virtual private server running Linux Ubuntu Server 14.04. I will be using Rails 4.2.0 new applications as examples.

My current company asked me to configure this setup, they're using the IBM's Softlayer as the main datacenter, so the server that I am playing with is a Softlayer. Nothing special about it, but in this case I have decided to don't use Chef or anything like that, but to make the entire server by hand, because it's funnier, right? Let's go.

####Creating the first user and SSH security configurations

@epipheus
epipheus / yardoc_cheatsheet.md
Created December 16, 2017 05:45 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP

@epipheus
epipheus / steps.md
Created May 6, 2018 17:39 — forked from cgcardona/steps.md
Steps for running a Bitcoin Cash (ABC) node on digital ocean. Forked from these steps: https://medium.com/signal-chain-weekly/how-im-running-a-bitcoin-full-node-on-digital-ocean-for-40-a-month-dfc328ba9604

Setup

  1. Ubuntu 16.04.3 x64
  2. 2 GB Memory / 60 GB Disk
  3. 200 GB block storage volume

Create user

get ip-address from digital ocean

@epipheus
epipheus / iterm2-solarized.md
Created November 13, 2019 07:57 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k