Skip to content

Instantly share code, notes, and snippets.

View denyago's full-sized avatar
🤠

Denys Yahofarov denyago

🤠
View GitHub Profile
en:
errors:
messages:
wrong_content_type: "is the wrong content type"
@denyago
denyago / gist:1521093
Created December 26, 2011 13:05
Insatall ruby-debug19 on ruby 1.9.3-p0 and Rails 3.1

Patch for load speed: https://gist.github.com/1484985

cd /tmp
git clone git://gist.github.com/1484985.git
rvm install ruby-1.9.3-p0 --patch /tmp/1484985/cached_lp_sorted_lf.patch -n patched

Download fresh ruby-debug19

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {
source :rubygems
gem 'pg'
gem 'activesupport'
gem "debugger"
# DM2 staff
gem 'dm-mapper', git: "https://github.com/solnic/dm-mapper.git"
@denyago
denyago / Gemfile
Created August 23, 2012 09:05
Add belongs_to_remote to preload collections of ActiveResources without N+1 requests
source :rubygems
gem 'pg'
gem "hashie"
gem 'activerecord', require: 'active_record'
gem 'activesupport'
gem 'activeresource', :require => 'active_resource'
gem "debugger"
@denyago
denyago / result.bash
Created December 13, 2012 10:53
Compilation of performance of comparations
      user     system      total        real
Date 38.260000   0.290000  38.550000 ( 39.010656)
Bool  2.180000   0.000000   2.180000 (  2.197462)
=> [ 38.260000   0.290000  38.550000 ( 39.010656)
,
  2.180000   0.000000   2.180000 (  2.197462)
]
@denyago
denyago / list.rb
Created March 2, 2013 10:49
List all models and their DB columns
# Load models
Dir.foreach("app/models") { |f| require f if f =~ /rb$/ }
ActiveRecord::Base.descendants.each do |klass|
next if klass == "Rack::OAuth2::Server::Issuer".safe_constantize or klass == "Rack::OAuth2::Server::ActiveRecord".safe_constantize
begin
klass.columns.each_with_index {|c, i| printf "%-20s | %-19s | %-29s | %-10s\n", (i==0 ? klass.name : ''), c.name, c.sql_type, (c.null ? '' : 'not null') }
rescue => e
puts "*"*10
puts "Error getting columns for #{klass}: #{e}"
@denyago
denyago / helper.rb
Created April 25, 2013 13:27
Unset Ruby constant
##
# Unsets constant `const_name` from all available Modules.
# Will not do anything, if constant not constantizable.
#
# Params:
# - const_name {Symbol} or {String} name of constant,
# able to be constantized
#
# Returns {Boolean} as a result of unsetting
def unset_const!(const_name)

Compile FFmpeg on Ubuntu

This guide supports Ubuntu Precise Pangolin 12.04, Ubuntu Oneiric Ocelot 11.10, Ubuntu Natty Narwhal 11.04, and Ubuntu Maverick Meerkat 10.10. Separate guides are available for Ubuntu Lucid Lynx 10.04 and Ubuntu Hardy Heron 8.04. This guide will enable several external encoding and decoding libraries: libfaac (AAC encoder), libfdk-aac (AAC encoder), libmp3lame (MP3 encoder), libopencore-amr (AMR encoder/decoder), librtmp (for additional RTMP protocols), libtheora (Theora encoder), libvorbis (Vorbis encoder), libvpx (VP8 encoder/decoder), and libx264 (H.264 encoder). These are optional and may be omitted if desired. This guide will also install many filters (see the filter list in the [Filtering Guide](https://ffmpeg.org/trac/ffmpeg/wiki/Fi

#TODO:
# 1. Set up unicorn as service
# 2. Set nginx config
# 3. Create deploy
require "debugger"
$:<< File.join(File.dirname(__FILE__), 'stack')
$:<< File.join(File.dirname(__FILE__), 'lib')
require "capistrano_vars"