Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am snooc on github.
  • I am snooc (https://keybase.io/snooc) on keybase.
  • I have a public key ASB_BEbi16OkSu8IBIGbmz2zjMXzUWobMyTD42Sqim1zrgo

To claim this, I am signing this object:

package nettimeout
import (
"net"
"time"
)
// Listener wraps a net.Listener, and gives a place to store the timeout
// parameters. On Accept, it will wrap the net.Conn with our own Conn for us.
type Listener struct {
package main
import (
"net/http"
)
type SingleHost struct {
handler http.Handler
allowedHost string
}
///////
// Warning, code untested
///////
type Thinger interface {
SomeMethod( arg bool ) bool
}
type RealThing struct {
state bool

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'

UIActivityIndicatorView

# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@snooc
snooc / nginx.conf
Last active December 18, 2015 11:29
Install systemwide rbenv and ruby on Ubuntu 13.04
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 1024;
}

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key
MY_GROUP=""
if [ "$MY_GROUP" = "" ] ; then
echo '!!! undefined variable MY_GROUP.'
echo '!!!'
echo '!!! ex.) MY_GROUP=staff'
echo '!!!'
exit 1
fi
cd /usr/local
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/pride'
require 'capybara/rails'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown