Skip to content

Instantly share code, notes, and snippets.

View svenfuchs's full-sized avatar

Sven Fuchs svenfuchs

View GitHub Profile
Some notes on remote debugging mac builds on Travisci. It's hard to tell when something hangs what the cause it. Trial and error via commits is tedious. And on Mac , sometimes it's the gui asking for input. So I worked my around to get the access I needed for faster debugging a build.
#################################################
# Enable remote ssh access to travisci build for debugging
#################################################
# Add a key so we can login to travisci vm
- cat ssh/travisci.pub >> ~/.ssh/authorized_keys
- chmod 600 ssh/travisci
# Install netcat
@svenfuchs
svenfuchs / csv2md
Last active August 29, 2015 14:14
convert csv to markdown
#!/usr/bin/env ruby
require 'csv'
filename = ARGV.shift
def format(questions, answers)
answers.map.with_index do |answer, ix|
"##### #{questions[ix]}\n\n#{answer}\n\n"
end
def translate(locale, key, options = {})
# ...
entry = lookup(locale, key, scope) || resolve(locale, key, default, options) || raise(I18n::MissingTranslationData.new(locale, key, options))
# ...
end
def localize(locale, object, format = :default)
raise ArgumentError, "Object must be a Date, DateTime or Time object. #{object.inspect} given." unless object.respond_to?(:strftime)
if Symbol == format
class Locale # is this a String? maybe not.
attr :language, :script, :region, :variant, :extension, :private_use
def valid?
# validate against RFC4646
end
def parent
# return 'en' for 'en-US' etc.
end
end

Keybase proof

I hereby claim:

  • I am svenfuchs on github.
  • I am svenfuchs (https://keybase.io/svenfuchs) on keybase.
  • I have a public key whose fingerprint is FEB0 A93F B199 EB4C CE1C B79B 60B8 9DF8 875A 4114

To claim this, I am signing this object:

activerecord.errors.models.content.attributes.topic.invalid
activerecord.errors.models.content.invalid
activerecord.errors.messages.invalid
# with STI
activerecord.errors.models.post.attributes.topic.invalid # Topic is invalid for post
activerecord.errors.models.post.invalid # Post is invalid
activerecord.errors.models.content.attributes.topic.invalid # Topic is invalid for content
activerecord.errors.models.content.invalid # Content is invalid
activerecord.errors.messages.invalid # This is invalid
Who's up to a post-railsconfeu08-coolest-quotes-tshirt-site?
Rails doesn't scale! (Oscar Wilde)
Look at all the things I'm not doing! (DHH)
Most people don't need Zulu on your website. (Josh Harvey)
t :rails (Sven Fuchs)
That is sooo "Linux"! (Jeremy Kemper)
Java is to Javascript what car is to carpet (at BoF "Xing on Rails")
No suitable for a t-shirt but still noteworthy:
# see http://pastie.org/274816 and http://pastie.org/274829
# I have: "foo"
# I need: ['f', 'fo', 'foo']
require 'benchmark'
def using_split(str)
str.split(//mu).inject([]) do |arr, char|
arr << arr[-1].to_s + char.to_s
end
// line 272 and following - seems to work for me, at least i can drag across multiple tbodys
if (movingDown && jQuery.tableDnD.dragObject != currentRow) {
currentRow.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling);
} else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) {
currentRow.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow);
}
describe "POST to :create" do
action { post :create, @params }
all_with :an_empty_blog
it_assigns :article
with :login_as_admin do
it "succeeds", with => :valid_article_params do
it_saves :article
it_assigns :flash :notice => :not_nil