Skip to content

Instantly share code, notes, and snippets.

@amalagaura
amalagaura / comments_with_meta
Created January 19, 2015 22:38
comments_with_meta for YoutubeIt
class YouTubeIt::Upload::VideoUpload
def comments_with_meta(video_id_or_url, opts = {})
url = if video_id_or_url.start_with?('http')
video_id_or_url
else
comment_url = "/feeds/api/videos/%s/comments?" % video_id_or_url
comment_url << opts.collect { |k, p| [k, p].join '=' }.join('&')
end
response = yt_session.get(url)
comments = YouTubeIt::Parser::CommentsFeedParser.new(response).parse
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
# Rails 4.2 throws an exception on last test case
@amalagaura
amalagaura / rubyDotNetHash.rb
Created May 9, 2016 16:57
.NET passwords operable in ruby
ruby dotNetHash.rb password123 LU7hUk4MXAvlq6DksvP9SQ==
require "base64"
require “digest”
# Encode password as double-width characters
password_as_text = ARGV.first
double_width_password = []
double_width_password = password_as_text.encode("UTF-16LE").bytes.to_a
# Unencode the salt
---
id: 1
type: book
awards:
books:
- id: 1
title: International Botev
reviewers:
- id: 2
name: PersonB