Skip to content

Instantly share code, notes, and snippets.

View glebm's full-sized avatar

Gleb Mazovetskiy glebm

View GitHub Profile
@glebm
glebm / gist:9665022
Created March 20, 2014 14:32
mailgun dkim bug
Delivered-To: glex.spb@gmail.com
Received: by 10.52.103.9 with SMTP id fs9csp318329vdb;
Thu, 20 Mar 2014 07:31:14 -0700 (PDT)
X-Received: by 10.52.8.225 with SMTP id u1mr556372vda.64.1395325873937;
Thu, 20 Mar 2014 07:31:13 -0700 (PDT)
Return-Path: <bounce+f7da5c.ff052-glex.spb=gmail.com@itbyen.no>
Received: from mail-s77.mailgun.info (mail-s77.mailgun.info. [184.173.153.205])
by mx.google.com with ESMTP id of4si455498vcb.175.2014.03.20.07.31.09
for <glex.spb@gmail.com>;
@glebm
glebm / object_enumerable.rb
Last active August 29, 2015 14:00
make all Ruby things Enumerable
class Object
def each(&block)
return to_enum(:each) { 1 } unless block
[self].each(&block)
end
include Enumerable
end
class NilClass
def each(&block)
class NewsStory < ActiveRecord::Base
has_many :comments, :as => :commentable, :dependent => :destroy
belongs_to :user
validates_presence_of :body, :title
end
source :gemcutter
gem "rack"
gem "rake"
gem "rails", "~> 3", :require => nil
gem 'enumerated_attribute'
gem 'gravtastic'
gem 'devise', :git => 'http://github.com/plataformatec/devise.git'
gem 'RedCloth'
require File.expand_path('../boot', __FILE__)
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_record/railtie"
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
@glebm
glebm / .bashrc
Created February 21, 2011 15:52
tee -a
export EDITOR=`which vim`
#-----------------------------------------------------------------------------
# Prompts
#-----------------------------------------------------------------------------
set_prompts() {
# regular colors
local DEFAULT="\[\033[0m\]" # standard terminal fg color
local BLACK="\[\033[0;30m\]"
local RED="\[\033[0;31m\]"
@glebm
glebm / rideshare.md
Created July 13, 2012 18:57 — forked from mraaroncruz/rideshare.md
Renfe AVE rideshare app

Renfe AVE (high speed train) rideshare app

  • There are huge discounts on purchasing 4 seats

From @glebm

I'm thinking that we could take the money upfront when you join a departure (datetime, from station, to station) The hold gets charged to a group of 4 when the group 4 if full, and the user receives a confirmation email (i18n en, es, etc. would be great) If the group is not full at N hours before departure, the money is returned, and the user is notified

We would need to get data from renfe (no api) for schedule and ticket availability

@glebm
glebm / gitlab.pill
Created August 4, 2012 00:10
Gitlab Bluepill: Unicorn + Resque
#!/bin/sh
### BEGIN INIT INFO
# Provides: bluepill
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: bluepill daemon, providing process monitoring
# Description: bluepill is a monitoring tool. More info at http://github.com/arya/bluepill.
@glebm
glebm / ruby.yml
Created October 24, 2012 15:55
RVM setup
# script/setup/rvm.rb to install
default: &default
name: 1.9.3-perf
patch: falcon # about this patch: https://gist.github.com/1688857
gemset: my_app_gemset
env:
RUBY_HEAP_MIN_SLOTS: 1600000
RUBY_GC_MALLOC_LIMIT: 100000000
RUBY_HEAP_FREE_MIN: 500000
@glebm
glebm / deploy.rb
Created October 24, 2012 16:08
Capistrano commands (rainbows + rvm)
namespace :deploy do
task :restart_web, role: :web do
pid_path = "#{current_path}/tmp/pids/server.pid"
run "[[ -s #{pid_path} ]] && (cat #{pid_path} | xargs kill -USR2) || sudo service jl-web start", shell: 'bash'
end
end