Skip to content

Instantly share code, notes, and snippets.

View rrrodrigo's full-sized avatar

Marcin Bajer rrrodrigo

View GitHub Profile
These are some snips to help you converting video to flash and thumbnails using ruby and paperclip.
Needed: ffmpeg & flvtool, RVideo gem, paperclip
Converting the video is done using outside of paperclip, as this could take quite a while. Paperclip by default does it's conversions during the request, and the last thing you want is a request hanging for 10minutes while ffmpeg does it's thing. It is advised to do this conversion somewhere in the background using Resque or DelayedJob. (make sure not to run to many conversions at one time on your machine)
Most video thumbnailing solutions out there will create all thumbnails from the video. This solution (on paperclip 2.3.0) however will create one large "temp_thumbnail" once and all consequent thumbnails can use this temporary version.
VideoGeometry will make sure that the target dimensions for ffmpeg are always a multiple of 2 and as close as possible to the desired dimensions without breaking the aspect ratio of the original video.
if Rails.env.production?
module OmniAuth
module Strategy
def full_host
uri = URI.parse(request.url)
uri.path = ''
uri.query = nil
uri.port = (uri.scheme == 'https' ? 443 : 80)
uri.to_s
end
@fguillen
fguillen / git_tips.md
Created December 19, 2010 20:53
Git Tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo

@terrbear
terrbear / write_deploy_log.rb
Created February 23, 2011 17:56
saves the deploy output up to the deployed location
alias :pputs :puts
def puts(str = "")
pputs(str)
$out << "#{str}"
end
STDOUT.instance_eval do
alias :pputs :puts
def puts(str = "")
pputs(str)
@thechrisoshow
thechrisoshow / auto_refresh.js
Created June 15, 2011 09:57
Auto refresh the page
// Ok, document.ready is jQuery - but you get the gist
$(document).ready(function() {
setTimeout(function() {
location.href = location.href;
}, 10000);
// 10000 == 10 seconds
// Change this if you want a different refresh period
});
@karmi
karmi / hook_up_homebrew.sh
Created September 2, 2011 10:24
Hook up your Homebrew installed with curl to your Github fork
# Install Homebrew
#
mkdir -p /usr/local
mkdir -p /usr/local/bin
sudo chown -R $USER /usr/local
cd $HOME && mkdir -p homebrew
curl -L https://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C homebrew
ln -nfs $HOME/homebrew/bin/brew /usr/local/bin/
brew update
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@danielnc
danielnc / Gemfile
Last active February 23, 2024 08:33 — forked from eirc/.rvmrc
Ruby-based Benchmark of MessagePack vs. JSON vs. Yajl vs. Protobuffers vs. MultiJson vs. Marshal vs. YAML vs. BSON
source :rubygems
gem 'bench_press'
gem 'multi_json'
gem 'json'
gem 'yajl-ruby'
gem 'msgpack'
gem 'ruby-protocol-buffers'
gem 'bson'
gem 'bson_ext'
@NickMirnov
NickMirnov / gist:d9417813abaf99f7b7c3
Created September 22, 2014 09:28
Sphinx engine + chinese stemmer/dictonary install (coreseek)
#resource: http://www.coreseek.cn/products-install/install_on_bsd_linux/
#requirements:
# m4 >= 1.4.13
# autoconf >= 2.65
# automake >= 1.11
# libtool >= 2.2.6b
wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz
tar xzvf coreseek-4.1-beta.tar.gz