Skip to content

Instantly share code, notes, and snippets.

View georgismitev's full-sized avatar

Georgi Mitev georgismitev

  • Zurich, Switzerland
View GitHub Profile
require 'pry'
umgi_dir = "/Volumes/OS/interlaced"
files = Dir.glob("#{umgi_dir}/**/*.mp4")
files.each do |f|
result = [f]
ffmpeg_command = "ffmpeg -filter:v idet -frames:v 500 -an -f rawvideo -y /dev/null -i #{f} 2>&1 | awk -F 'detection: ' '/detection/ { print $2 }'"
ffmpeg_result = `#{ffmpeg_command}`
if ffmpeg_result
result_lines = ffmpeg_result.split("\n")
result_lines.each do |l|
/Volumes/OS/interlaced/1/UMG_vidtrk_00602537824199_01_001_20604.mp4 TFF:3 BFF:4 Progressive:12 Undetermined:84 TFF:0 BFF:47 Progressive:45 Undetermined:11
/Volumes/OS/interlaced/2/UMG_vidtrk_00602498883358_01_001_20604.mp4 TFF:90 BFF:2 Progressive:11 Undetermined:0 TFF:86 BFF:0 Progressive:17 Undetermined:0
/Volumes/OS/interlaced/3/UMG_vidtrk_00602498883280_01_001_20604.mp4 TFF:91 BFF:0 Progressive:12 Undetermined:0 TFF:88 BFF:0 Progressive:15 Undetermined:0
/Volumes/OS/interlaced/4/UMG_vidtrk_00602498763469_01_001_20604.mp4 TFF:34 BFF:0 Progressive:69 Undetermined:0 TFF:34 BFF:0 Progressive:69 Undetermined:0
/Volumes/OS/interlaced/5/UMG_vidtrk_00602498644546_01_001_20604.mp4 TFF:50 BFF:4 Progressive:11 Undetermined:38 TFF:67 BFF:12 Progressive:21 Undetermined:3
/Volumes/OS/interlaced/6/ES19X1400059_15320.mp4 TFF:0 BFF:0 Progressive:63 Undetermined:39 TFF:0 BFF:0 Progressive:78 Undetermined:24
umgi_dir = "/Volumes/OS/interlaced"
files = Dir.glob("#{umgi_dir}/**/*.mp4")
files.each do |f|
ffmpeg_command = "ffmpeg -filter:v idet -frames:v 100 -an -f rawvideo -y /dev/null -i #{f} 2>&1 | awk -F 'detection: ' '/detection/ { print $2 }'"
result_lines = `#{ffmpeg_command}`.split("\n")
puts [f].concat(result_lines).join("\t")
end
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')

This is for those having trouble with the 'designmodo-flatuipro-rails' gem in a rails app when using Capistrano for deployment.

This gem required that we use the 'less' gem in conjunction with the 'bootstrap-on-rails' gem. This bootstrap gem is the Less version.

The error we are dealing with is this: couldn't find file 'jquery.ui.touch-punch.min'

All of the work will be done in the 'config/deploy.rb' file

after "deploy:bundle_gems", "deploy:flat_ui"
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
:set nocompatible " Use Vim defaults (much better!)
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh [email protected]

Add ssh fingerprint and enter password provided in email

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.