Skip to content

Instantly share code, notes, and snippets.

View kohgpat's full-sized avatar
🤖
...

Nikolay Burlov kohgpat

🤖
...
  • Russia, Siberia
View GitHub Profile
require 'redis'
require 'json'
require 'celluloid'
require 'celluloid/io'
class RedisAdapter
include Celluloid
def initialize(redis)
@redis = redis
@kohgpat
kohgpat / hash.rb
Created March 29, 2013 02:49
core_ext/hash.rb
class Hash
def symbolize_keys
inject({}) do |options, (key, value)|
options[(key.to_sym rescue key) || key] = value
options
end
end
def symbolize_keys!
self.replace(self.symbolize_keys)
/*
This document has been created with Marked.app <http://markedapp.com>, Copyright 2011 Brett Terpstra
Please leave this notice in place, along with any additional credits below.
---------------------------------------------------------------
Upstanding Citizen by Brett Terpstra
Non-standard fonts used:
* OSPDIN
* League Gothic
* Fjord
* Inconsolata
data:text/html, <html><style> body { font-family: PragmataPro }</style><body contenteditable>
class Finder
def self.find(query)
people = []
conditions = []
words = query.split(' ')
case words.count
when 1
conditions << ["id = ?", query]
@kohgpat
kohgpat / default.vcl.pl
Created November 30, 2012 06:48 — forked from bmarini/default.vcl.pl
A good varnish config for a Rails app
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
# from the cache for up to 1 hour.
# 2. Varnish will pass X-Forwarded-For headers through to the backend
# 3. Varnish will remove cookies from urls that match static content file
# extensions (jpg, gif, ...)
@kohgpat
kohgpat / Rakefile
Created November 13, 2012 13:10
Sequel Rake tasks for a Sinatra app
# change foo to your library name
# change Foo::Database to your Sequel database
namespace :bundler do
task :setup do
require 'rubygems'
require 'bundler/setup'
end
end
@kohgpat
kohgpat / gist:3993186
Created November 1, 2012 11:47 — forked from stepantubanov/gist:3993184
vim 7.3
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
tar -xf vim-7.3.tar.bz2
cd vim73
./configure --prefix=/usr/local --without-x --disable-nls --with-tlib=ncurses --enable-multibyte --enable-rubyinterp --enable-pythoninterp --with-features=huge --enable-gui=gnome2
make
sudo make install
sudo ln -f /usr/local/bin/vim /usr/local/bin/vi
@kohgpat
kohgpat / mohttpd.asm
Created October 30, 2012 23:51
My Own HTTP Daemon by Neill Corlett
;
; My Own HTTP Daemon
; A web server for i386 Linux because I was bored
; Copyright (C) 2012 Neill Corlett
;
; This program is free software: you can redistribute it and/or modify it under
; the terms of the GNU General Public License as published by the Free Software
; Foundation, either version 3 of the License, or (at your option) any later
; version.
;
user jessed staff;
worker_processes 2;
events {
worker_connections 1024;
}
http {
include mime.types;