Skip to content

Instantly share code, notes, and snippets.

@cutalion
cutalion / README.md
Last active August 29, 2015 13:56
Thumbnail creation with ffmpeg

Processor: Intel Core i3

time ./m_ffmpeg.sh dinner.m4v
./m_ffmpeg.sh dinner.m4v 48,54s user 5,34s system 142% cpu 37,897 total

time ./m_thumbnailer.sh dinner.m4v ./m_thumbnailer.sh dinner.m4v 66,21s user 5,61s system 156% cpu 45,918 total

# How to not use 'before_action :authorize_user!' in controllers
devise_for :users
root to: "home#index"
# this route for signed in users and guests
resources :games, only: [:show]
# create routes with redirect to sign_in for guests
authenticate(:user) do

Usage

require tp_logger in spec_helper and run TPLogger.start The main goal of early start is to catch class definitions. Therefore it is important to start it before loading rails environment and initializers.

require 'tp_logger'
TPLogger.start(filter: 'project_folder_name', dump_path: 'tplogger.csv')
require('coffee-script/register');
module.exports = require('./webpack.config.coffee');
require 'rails_helper'
RSpec.describe UserReport do
# Jun | Aug | Sep
#-----|--|--|--|--|--|--|--> time
# * | * * |
#
# Short periods - weeks
# Stars - timelogs
@cutalion
cutalion / tray.rb
Created April 17, 2011 11:42
Allows add or remove icons to unity panel white-list, so that they can be show on unity panel
require 'rubygems'
require 'json'
def save_settings(settings)
`gsettings set com.canonical.Unity.Panel systray-whitelist "#{settings.to_json.gsub('"', "'")}"`
end
def current_settings
# ./spec/spec_helper.rb
#
# Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
#
#
# Usage:
#
# its(:updated_at) { should be_the_same_time_as updated_at }
#
#
@cutalion
cutalion / action.rb
Created July 13, 2011 14:40
action helper for rspec
#
# Put this file into spec/support/ folder.
#
# Helper +action+ allows you to write something like
#
# describe "GET index" do
# action { get :index }
#
# context 'if user signed in' do
# before { sign_in user }
# Usage
#
# class Rectangle
# include TypeCast
#
# ...
#
# attr_accessor :width, :height, :fill
# type_cast :width, :height, :method => :to_f
# type_cast :fill, :allow_nil => false, :method => lambda { |value| !!value }
@cutalion
cutalion / gist:2889295
Created June 7, 2012 15:06
Rails Meetup - June 2012. Notes

Вопросы от Ивана Линько.

  1. Интересно было бы послушать чем отличается переезд с хероку от обычного деплоя на новый сервер, если чем-то отличается.
  • перенос БД (mongodump/mongorestore)
  • изменение способа хранения настроек
  • настройка почты (Google Apps)