Skip to content

Instantly share code, notes, and snippets.

View zaiste's full-sized avatar
🌀
Loading...

Jakub Neander zaiste

🌀
Loading...
View GitHub Profile
@zaiste
zaiste / symbolize_gem.rb
Created April 22, 2012 08:40
FooBar with symbolize gem
class FooBar
symbolize :quux,
in: [:great, :lesser, :mediocre, :micro],
default: :great
scope: true,
allow_blank: true # false by default
methods: true
symbolize :operation
in: [:cdr, :car]
@zaiste
zaiste / gist:2522546
Created April 28, 2012 23:03 — forked from zolrath/gist:2305333
tmux status line from wemux example.

For a tmux status line as seen in the example image for the wemux project: wemux

The session on the left in the example screen shot uses a patched font from the vim-powerline project. Inconsolata-dz, you beautiful creature.

To duplicate the left status line add the following lines to your ~/tmux.conf

set -g status-left-length 32
set -g status-right-length 150
@zaiste
zaiste / ring_middleware_order.clj
Created May 26, 2012 15:04
Ring Middleware Order
(defn handler [request]
{:status 200
:headers {"Content-Type" "text/plain"}
:body "Hello, Ring!"})
(defn show-params [handler]
(fn [request]
(let [response (handler request)]
(println (str request))
response)))
@zaiste
zaiste / 0-readme.md
Created October 29, 2012 13:14 — forked from burke/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

Overview

This script installs a patched version of ruby 1.9.3-p194 with boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Many thanks to funny-falcon for the performance patches.

@zaiste
zaiste / env-inspect.rb
Created December 12, 2012 23:36
Rack env
{
"SERVER_SOFTWARE"=>"thin 1.5.0 codename Knife",
"SERVER_NAME"=>"localhost",
"rack.input"=>#<Rack::Lint::InputWrapper:0x007ffdec490218 @input=#<StringIO:0x007ffdec4ccc18>>,
"rack.version"=>[1, 0],
"rack.errors"=>#<Rack::Lint::ErrorWrapper:0x007ffdec490128 @error=#<IO:<STDERR>>>,
"rack.multithread"=>false,
"rack.multiprocess"=>false,
"rack.run_once"=>false,
"REQUEST_METHOD"=>"GET",
...
include sites-enabled/*.dev;
server {
listen 80;
server_name app localhost .dev;
set $basepath "/Users/zaiste/code";
upstream APP_thin {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name APP.dev;
root /Users/zaiste/code/APP/public;
try_files $uri/index.html $uri.html $uri @app;
@zaiste
zaiste / iptables.firewall.rules
Created April 21, 2013 05:18
sudo vim /etc/iptables.firewall.rules
*filter
# Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT -d 127.0.0.0/8 -j REJECT
# Accept all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all outbound traffic - you can modify this to only allow certain traffic
@zaiste
zaiste / README.md
Last active December 16, 2015 14:19

Nginx, Unicorn

development:
adapter: postgresql
host: localhost
encoding: unicode
database: YOUR_DB_NAME_development
pool: 5
username: YOUR_DB_USER
password: YOUR_DB_PASSWORD
template: template0