Skip to content

Instantly share code, notes, and snippets.

View weavermedia's full-sized avatar

Dan Weaver weavermedia

View GitHub Profile
class Zencoder
include HTTParty
headers "Accept" => "application/json", "Content-Type" => "application/json"
base_uri 'https://app.zencoder.com/api'
default_params :api_key => "YOUR-API-KEY-GOES-HERE"
format :json
attr_accessor :job_id
attr_reader :errors
attr_reader :output_url
@Stephenitis
Stephenitis / Gemfile
Last active October 18, 2015 04:46
IronWorker .worker file using ruby and ffmpeg stack
source "http://rubygems.org"
gem "streamio-ffmpeg"
# general ffmpeg wrapper https://github.com/streamio/streamio-ffmpeg
gem "paperclip-ffmpeg"
# video handling to Paperclip via ffmpeg https://github.com/owahab/paperclip-ffmpeg
class Video < ActiveRecord::Base
validates_presence_of :title
named_scope :finished, :conditions => { :encoded_state => "finished" }
has_attached_file :video,
:url => ":class/:id/:style/:basename.:extension",
:path => ":class/:id/:style/:basename.:extension",
:storage => :s3
validates_attachment_presence :video
@bastien
bastien / content.rb
Created July 6, 2012 09:58
Paperclip processor to convert PDF to JPG to go around problems with the old versions of imagemagick and ghostscript available on Heroku. This file is located in [APP_ROOT]/lib/paperclip_processors/ghostscript.rb
# Model using the ghostscript processor
class Content < ActiveRecord::Base
has_attached_file :resource,
:styles => { :preview => ["725x1200>", :jpg], :thumb => ["100x140>", :jpg] },
:processors => [:ghostscript, :thumbnail],
:convert_options => { :all => '-colorspace RGB -flatten -density 300 -quality 100' },
:path => ":page_path/:class/:id/:resource_token/:style/:filename"
end
@heyarne
heyarne / koel-s3-storage.md
Last active October 27, 2018 00:47
How to use Amazon S3 with koel

How to use Amazon S3 for storing your koel media files

In this short tutorial I will show you a (kind of hacky, but working) option to set up your koel instance so that you can store your media files on S3 as provided by Amazon. I will also share some of the insights and experiences I had with the setup. Be aware that it's not officially supported and it might work differently to from what you expect. I myself have not had the setup running for a very long time yet. Feel free to share your thoughts in the comments below or add to the document.

If you feel like supporting me, maybe use my Digital Ocean referral link when signing up. If you do that, please also support the original authors of the various tools. They did the hard work, I just glued it together.

Basic setup

@wetzler
wetzler / gist:6629918
Last active February 23, 2019 21:31
a key with magical powers
d90e5b5598497773de1c57407dd54d65934ba1b5911f6f47311d3c729f510bb5c295284780017a56f17e49234f19c009bfa57f7941413a5dd3c282d7db3692a192b58ea926b637cdcd11377e1e74086641e0672c8b3406aeed49d63ee0a3a3d3751ae7744f08b999df38ca2ccdbb9a2c
@davist11
davist11 / Fancy File Inputs.js
Created October 25, 2010 21:32
Fancy File Inputs
var SITE = SITE || {};
SITE.fileInputs = function() {
var $this = $(this),
$val = $this.val(),
valArray = $val.split('\\'),
newVal = valArray[valArray.length-1],
$button = $this.siblings('.button'),
$fakeFile = $this.siblings('.file-holder');
if(newVal !== '') {
@iloveitaly
iloveitaly / .gitattributes
Last active May 8, 2019 19:31
Snippets for Spree Commerce Development
# with my git configuration the spree repo was giving me issues with line endings
# this fixed the issue for me: marking a file as binary causes git to ignore it completely
core/vendor/assets/javascripts/jquery.alerts/jquery.alerts.css.erb binary
core/vendor/assets/javascripts/jquery.alerts/jquery.alerts.js binary
core/vendor/assets/javascripts/jquery.jstree/themes/apple/style.css binary
sample/db/sample/spree/line_items.yml binary
sample/db/sample/spree/products.yml binary
@JoeRoddy
JoeRoddy / FirebaseToFirestore.js
Created October 18, 2017 16:19
Convert Firebase Database JSON to Firestore Collections
var db = firebase.firestore();
var content = require("./sourceData.json");
content &&
Object.keys(content).forEach(contentKey => {
const nestedContent = content[contentKey];
if (typeof nestedContent === "object") {
Object.keys(nestedContent).forEach(docTitle => {
firebase
.firestore()
@glava
glava / Rakefile
Last active August 8, 2020 12:34
Stop, Start, Restart Rake tasks for Rails
desc 'Stop rails server'
task :stop do
 File.new("tmp/pids/server.pid").tap { |f| Process.kill 9, f.read.to_i }.delete
end
desc 'Starts rails server'
task :start do
Process.exec("rails s puma -d")
end