Skip to content

Instantly share code, notes, and snippets.

View noniq's full-sized avatar

Stefan Daschek noniq

View GitHub Profile
% 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) :-
@noniq
noniq / convert.rb
Created February 24, 2013 15:01
Convert print dumpfile from VICE C64 emulator to a real image.
#!/usr/bin/env ruby
require "logger"
require "rmagick"
class Input
attr_reader :filename
def initialize(filename)
@filename = filename
<?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>
module FlowdockNotification
class SubmissionCompleted < Base
def submission
data[:submission]
end
def api_token
"foobarbaz"
end
@noniq
noniq / human_nr.html
Last active December 21, 2015 16:28
Convert numbers from 1 to 999999 into german strings. Script should prompt for a number and show result using an JavaScript-alert. Must run in Chrome out of the box, just by loading the HTML file.
<pre>
<script>
function human_nr(n){
// Make `prompt` and `alert` no-ops when run in test mode
prompt = function() { return n };
alert = function() {};
// To extract the bare, minimized, executable script:
// * Copy the lines between the markers into a new file
@noniq
noniq / gist:9282811
Created March 1, 2014 00:32
Fun with dates.
gem "rails", "~> 3.2" # It’s fixed in Rails 4, btw :)
gem "timecop", "~> 0.7"
require "action_view"
require "active_support/core_ext"
require "timecop"
extend ActionView::Helpers::DateHelper
Time.zone = "CET"
Timecop.travel("2014-03-01 00:30 CET")
@noniq
noniq / gist:9289157
Last active August 29, 2015 13:56
RSpec + Capybara: Include link to saved HTML and screenshot for failed examples.
# Add this to your spec_helper.rb (needs Ruby 2 because of `Module#prepend`)
#
# It does two things:
#
# 1. For each failed feature spec, save the HTML page and (if possible) a screenshot
# to "#{Rails.root}/tmp/capybara/".
#
# 2. Extend RSpec’s HTML output to include links to the saved HTML page and screenshot
# for failed examples. Works with both the regular HTML formatter and the TextMate
# formatter.
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.1)
actionpack (= 4.1.1)
actionview (= 4.1.1)
mail (~> 2.5.4)
actionpack (4.1.1)
actionview (= 4.1.1)
activesupport (= 4.1.1)
@noniq
noniq / gist:06599767a2e6e99409cb
Created August 21, 2014 11:54
Oh Austria, you really love your titles, don’t you?
TITLE_GENDER_SUFFIX_REGEXP = %r{
(?<= Mag\. ) (a) |
(?<= ADir\. | Dipl\.-Ing\. | Dipl\.-Päd\. | Dr\. | FInsp\. | FOInsp\. | Ing\. | OKontr\. ) (in) |
(?<= AL | AR | HR | IR | MinR | OR | OStR | RL | RgR | SektChef) (in)
}x
Return-Path: <[email protected]>
Delivered-To: <XXXXXXXXXXXXXXX>
Received: from mail.die-antwort.eu
by die-antwort.eu (Dovecot) with LMTP id 0G9bCjrWeVSBLwAAot0D+g
for <XXXXXXXXXXXXXXX>; Sat, 29 Nov 2014 15:20:42 +0100
X-Envelope-To: <XXXXXXXXXXXXXXX>
Received: from mogw0133.ocn.ad.jp (mogw0133.ocn.ad.jp [118.23.109.107])
by mail.die-antwort.eu (Postfix) with ESMTP id 6F60219F96B9
for <XXXXXXXXXXXXXXX>; Sat, 29 Nov 2014 15:20:40 +0100 (CET)
Received: from mv-osn-hkg002.ocn.ad.jp (mv-osn-hkg002.ocn.ad.jp [122.28.30.180])