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
# -*- coding: utf-8 -*- | |
#This code gets all the comic strips from the webcomic | |
#Saturday Morning Breakfast Cereal (SMBC) and downloads them to a local folder | |
#Tobias Rusås Olsen (& Bjørn Arild Mæland) - © 2008. | |
require 'date' | |
require 'net/http' | |
STARTDATE = "2008-08-20" | |
TARGETDIR = "bilder/" |
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
# -*- coding: utf-8 -*- | |
#This code gets all the comic strips from the webcomic | |
#Saturday Morning Breakfast Cereal (SMBC) and downloads them to a local folder | |
#Tobias Rusås Olsen (& Bjørn Arild Mæland) - © 2008. | |
require 'rubygems' | |
require 'net/http' | |
require 'active_support' | |
STARTDATE = "2008-08-31" |
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 consistent?(phone_numbers) | |
phone_numbers.each do |num| | |
phone_numbers - [ num ].each { |o| return "NO" if %r{^#{num}}.match(o) } | |
end | |
"YES" | |
end | |
gets.to_i.times do | |
num_array = [] | |
gets.to_i.times { num_array << gets.chomp } |
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 max_discount(prices) | |
prices = prices.sort.reverse | |
discount = 0 | |
while prices != [] | |
discount += prices[0..2].min | |
prices = prices[3..-1] | |
end | |
discount | |
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
def hashing_necessary? numwords, hashkeys | |
numkeys = hashkeys.flatten.uniq.size | |
(numkeys < numwords) ? "rehash necessary" : "successful hashing" | |
end | |
puts hashing_necessary? 3, [[0, 1], [1, 2], [2, 0]] | |
puts hashing_necessary? 6, [[2, 3], [3, 1], [1, 2], [5, 1], [2, 5]] |
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
Opg 1. | |
Action(move(X, Y), | |
Precond: blank(X) ^ tile(Y) ^ adjacent(X, Y) | |
Effect: blank(Y) ^ tile(X) | |
Opg 2. | |
1) | |
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 python | |
r""" | |
================= | |
snippet_copier.py | |
================= | |
A script which downloads snippets from bundles in the `TextMate`_ `svn repo`_ | |
and attempts to create duplicate `YASnippets`_, written by `Jeff Wheeler`_. | |
Synopsis |
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
;; This buffer is for notes you don't want to save, and for Lisp evaluation. | |
;; If you want to create a file, visit that file with C-x C-f, | |
;; then enter the text in that file's own buffer. | |
(require 'htmlize) |
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 python | |
# -*- coding: utf-8 -*- | |
# | |
# NLTK test-suite runner | |
# | |
# Author: Bjørn Arild Mæland <[email protected]> | |
# | |
import os, sys | |
import doctest_driver |
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 "rton" | |
include Automaton | |
pda = Automaton.setup(:pda) do | |
initial_state :q0 do | |
transition ['a', EMPTY], [:q0, 'A'] | |
transition ['b', 'A'], [:q1, EMPTY] | |
end |
OlderNewer