View gist:6a0b65eba6bbb0d49ce177ec98fca6c8
Version info
qutebrowser v0.10.1
Git commit:
Backend: QtWebEngine
CPython: 3.5.2
Qt: 5.8.0
PyQt: 5.8.2
View screenshot_upload_to_s3.rb
#!/usr/bin/ruby
bucket_name = 's3_bucket_name'
region = 's3_region'
images_dir = "#{Dir.home}/Pictures/screenshots/*"
newest_file = Dir.glob(images_dir).max_by { |f| File.mtime(f) }
filename = File.basename(newest_file)
cmd = "aws s3 cp #{newest_file} s3://#{bucket_name}/#{filename} --region #{region} --acl public-read"
View yardoc_cheatsheet.md
View .pryrc
def formatted_env
case Rails.env
when 'production'
bold_upcased_env = Pry::Helpers::Text.bold(Rails.env.upcase)
Pry::Helpers::Text.red(bold_upcased_env)
when 'staging'
Pry::Helpers::Text.yellow(Rails.env)
when 'development'
Pry::Helpers::Text.green(Rails.env)
else
View association_testcase.rb
# Run with `ruby association_testcase.rb`
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"
View uniqueness_validation.rb
# Had to do this for an importer tool that was being converted to a three-step validation-feedback-persist process
# Rails does not support uniqueness validation for a custom collection of unsaved ActiveRecord models
# Maybe someone finds this useful
def validate_uniqueness
ActiveRecord::Base.transaction do
@unsaved_entities.each do |entity|
entity.object.save # Executes validations/callbacks
entity.successful = entity.object.valid?
end
View stuff.rb
text_styles = %w(code del em ins sub sup strong)
text_styles.each do |m|
para = app.app.para(app.app.send(m, m, stroke: '#ccc'))
expect(para.text).to eq(m)
end
View gist:8617494
$ bin/shoes samples/class-book.rb
NoMethodError: undefined method `[]' for #<Shoes::Link:0x1304ff98>
normalize_style at /home/philipp/code/shoes4/lib/shoes/dsl.rb:75
each at org/jruby/RubyArray.java:1613
normalize_style at /home/philipp/code/shoes4/lib/shoes/dsl.rb:74
span at /home/philipp/code/shoes4/lib/shoes/dsl.rb:463
method_missing at /home/philipp/code/shoes4/lib/shoes/url.rb:22
table_of_contents at /home/philipp/code/shoes4/samples/class-book.rb:21
incident at /home/philipp/code/shoes4/samples/class-book.rb:32
call at org/jruby/RubyProc.java:271
View jekyll-mentos-error.md

Jekyll failing with:

Liquid Exception: Failed to get header. in _posts/filename.md/#excerpt
/home/philipp/.rvm/gems/ruby-2.0.0-p247@global/gems/pygments.rb-0.5.0/lib/pygments/popen.rb:358:in `rescue in get_header': Failed to get header. (MentosError)
        from /home/philipp/.rvm/gems/ruby-2.0.0-p247@global/gems/pygments.rb-0.5.0/lib/pygments/popen.rb:338:in `get_header

Tracked it down to mentos.py. Running mentos.py gave me the following error:

$ python mentos.py