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
module FlowdockNotification | |
class SubmissionCompleted < Base | |
def submission | |
data[:submission] | |
end | |
def api_token | |
"foobarbaz" | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>changed</key> | |
<dict> | |
<key>inputFormat</key> | |
<string>text</string> | |
<key>outputCaret</key> | |
<string>afterOutput</string> |
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
#!/usr/bin/env ruby | |
require "logger" | |
require "rmagick" | |
class Input | |
attr_reader :filename | |
def initialize(filename) | |
@filename = filename |
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
% Das Codewort besteht aus 5 Buchstaben. | |
% (swi-prolog) | |
letter(a). letter(b). letter(c). letter(d). letter(e). letter(f). | |
letter(g). letter(h). letter(i). letter(j). letter(k). letter(l). | |
letter(m). letter(n). letter(o). letter(p). letter(q). letter(r). | |
letter(s). letter(t). letter(u). letter(v). letter(w). letter(x). | |
letter(y). letter(z). | |
code(Xs) :- |
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
% Wer (Vorname) hasst am Inselleben was besonders, und was vermisst er am meisten? | |
% | |
% Vornamen: Bernd, Dirk, Jens, Hubert, Sascha, Thomas | |
% Gehasst werden: Früchte, Rauschen des Meeres, Sand, Schlangen, Skorpione, Wetter | |
% Vermisst werden: Auto, Bier, Ehefrau, Fernsehen, Kinder, Kumpels. | |
loesung(Vornamen, Hasst, Vermisst) :- | |
% 1. Der Mann auf Position 5 vermisst seine Kinder. | |
nth(5, Vermisst, kinder), |
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
% Succeeds if `Lines` represents the nonogram specified by `ColumnSpecs` and | |
% `LineSpecs`. For example: | |
%nonogram | |
% 1 | |
% 2 1 2 | |
% +------ | |
% 1 | . # . ColumnSpecs = [[2], [1,1], [2]] | |
% 1 1 | # . # LineSpecs = [[1], [1,1], [3]] | |
% 3 | # # # Lines = [[0,1,0], [1,0,1], [1,1,1]] | |
nonogram(ColumnSpecs, LineSpecs, Lines) :- |
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
# Browsers send newlines from textareas as "\r\n", thus each newline is counted | |
# as two chars when using Rails’ default LengthValidator. | |
# | |
# Of course it would also be possible to convert "\r\n" to "\n" in the controller | |
# or model, but in my app it’s simpler do use a custom validator. | |
class LengthCountingNewlinesAsOneValidator < ActiveModel::Validations::LengthValidator | |
def validate_each(record, attribute, value) | |
value = value.gsub("\r\n", "\n") | |
super | |
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
1) Failure: | |
test_delocalizes_localized_date_without_year(DelocalizeActiveRecordTest) [delocalize/test/delocalize_test.rb:53]: | |
<Mon, 19 Oct 2009> expected but was | |
<Fri, 19 Oct 2012>. | |
2) Failure: | |
test_delocalizes_localized_time_(DST)(DelocalizeActiveRecordTest) [delocalize/test/delocalize_test.rb:79]: | |
<Sun, 01 Mar 2009 09:00:00 CET +01:00> expected but was | |
<Fri, 06 Apr 2012 09:00:00 CEST +02:00>. |
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
def validate_inputs | |
self.form.descendants.any_in(:html_tag => ["input", "select", "textarea"]).excludes("html_attributes.type" => "submit").each do |element| | |
attr = "input_" + element.html_attributes["name"] | |
element.errors.add(:attr, " muss ausgefüllt werden") if element[attr].blank? && element["required"] | |
... | |
end | |
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
# Usage: | |
# ruby concat.rb /path-to-compass-gem/frameworks/compass/stylesheets/_compass.scss > compass-all.scss | |
@seen = [] | |
def concat(file) | |
File.foreach(file) do |line| | |
if line =~ /^\s?@import "(.+?)";/ | |
import = $1 | |
unless @seen.include?(import) |