View user_test.rb
1 2 3 4 5 6 7 8 9 10
require 'test_helper'
 
class UserTest < ActiveSupport::TestCase
 
setup do
@user_from_linkedin = User.from_omniauth(OmniAuth.config.mock_auth[:linkedin])
@user_from_google = User.from_omniauth(OmniAuth.config.mock_auth[:google])
end
 
test "should create new user from omniauth hash" do
View gravatar.rb
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env ruby
require 'digest/md5'
require "addressable/uri"
 
# this is based on gravatar image API
# https://en.gravatar.com/site/implement/images/
# options :
# size : <integer> size of image
# default: <string> url of image if email not found or:
# * 404
View ascii_arty.py
1 2 3 4 5 6 7 8 9 10
#! /usr/bin/env python2
# Requires: PIL, colormath
#
# Improved algorithm now automatically crops the image and uses much
# better color matching
 
from PIL import Image, ImageChops
from colormath.color_objects import RGBColor
import argparse
import math
View rspec.log
1 2 3 4 5 6 7 8 9 10
rspec
I, [2014-01-07T15:09:54.404914 #86163] INFO -- : Not reporting to Code Climate because ENV['CODECLIMATE_REPO_TOKEN'] is not set.
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
 
User
should respond to #password_confirmation
should respond to #company_name
should respond to #name
should respond to #password_reset_token
should respond to #email
View nginx.conf
1 2 3 4 5 6 7 8 9 10
upstream unicorn {
server unix:/tmp/unicorn.blog.sock fail_timeout=0;
}
 
server {
listen 80 default deferred;
# server_name example.com;
root /home/deployer/apps/blog/current/public;
 
location ^~ /assets/ {
View setup_iptables.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/bash
 
# Accept already established connections (so it doesnt drop your current SSH session)
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
 
# Accept SSH connections from anywhere
iptables -A INPUT -p tcp -i eth0 --dport ssh -j ACCEPT
 
# (Optional) Accept HTTP connections from anywhere
iptables -A INPUT -p tcp -i eth0 --dport 80 -j ACCEPT
View colored_logger.rb
1 2 3 4 5 6 7 8 9 10
require 'logger'
class ColoredLogger < Logger
WHITE = "\e[37m"
CYAN = "\e[36m"
MAGENTA = "\e[35m"
BLUE = "\e[34m"
YELLOW = "\e[33m"
GREEN = "\e[32m"
RED = "\e[31m"
BLACK = "\e[30m"
Something went wrong with that request. Please try again.