So for some reason, attach_file is not setting the content_type when uploading .ics files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Philipp Hansch | |
# | |
# This script assumes Linux Mint 15 Xfce as a base distribution | |
# Make sure you have access to this script when you setup your system | |
# Use at your own risk. | |
aptget='sudo apt-get' | |
gh_user='phansch' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shorten-path([string] $path) { | |
$loc = $path.Replace($HOME, '~') | |
# remove prefix for UNC paths | |
$loc = $loc -replace '^[^:]+::', '' | |
# make path shorter like tabs in Vim, | |
# handle paths starting with \\ and . correctly | |
return ($loc -replace '\\(\.?)([^\\])[^\\]*(?=\\)','\$1$2') | |
} | |
function prompt { |
NewerOlder