Skip to content

Instantly share code, notes, and snippets.

View druttka's full-sized avatar

David Ruttka druttka

View GitHub Profile
@druttka
druttka / cradle-to-philbin.md
Last active November 7, 2021 18:01
A playlist from Regis Philbin to Cradle of Filth

What is this?

I once (c. 2010) built a terribly architected, horribly inefficent solution to create playlists which smoothly transition between extremely different artists.

Here's what it did when I asked it to go from Cradle of Filth to Regis Philbin. It took a long and winding road, but we got there!

I later tweaked some of the logic, and tried less extreme endpoints, and got slightly more reasonable results.

Results

@druttka
druttka / artist_paths.md
Last active November 7, 2021 19:08
Some more paths between related artists from an April 2010 side project

Pearl Jam to Lady Gaga

  • Pearl Jam
  • Nirvana
  • Hole
  • No Doubt
  • Gwen Stefani
  • Madonna
  • Britney Spears
  • Lady Gaga
@druttka
druttka / cradle_of_filth_to_regis_philbin.md
Last active June 15, 2018 20:42
Smoothly transition from Cradle of Filth to Regis Philbin

The following list of artists was determined to be a smooth transition from Cradle of Filth to Regis Philbin by a side project in April 2010. At the time, I noted,

!!! it took the long way around at one point...

  • Cradle of Filth
  • Dimmu Borgir
  • Old Man's Child
  • Hecate Enthroned
  • Anorexia Nervosa
  • Agathodaimon
  • Cryptic Wintermoon
{% capture canonical %}{% if page.canonical %}{{ page.canonical }}{% else %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endif %}{% endcapture %}
desc "Begin a new draft in #{source_dir}/#{drafts_dir}"
task :new_draft, :title do |t, args|
title = args.title || get_stdin("Enter a title for the draft: ")
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
mkdir_p "#{source_dir}/#{drafts_dir}"
filename = "#{source_dir}/#{drafts_dir}/#{title.to_url}.#{new_post_ext}"
if File.exist?(filename)
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
end
puts "Creating new draft: #{filename}"
drafts_dir = "_drafts" # directory for blog draft files
desc "post drafts"
task :post_drafts do
Dir.foreach("#{source_dir}/#{drafts_dir}") do |item|
itemDate = /(\d{4}-\d{2}-\d{2})-.*.markdown/.match(item)
next unless itemDate
system "mv #{source_dir}/#{drafts_dir}/#{item} #{source_dir}/#{posts_dir}" if Date.strptime(itemDate[1],'%Y-%m-%d') <= Date.today
end
end
desc "pull"
task :pull do
system 'git pull bitbucket source'
system 'cd _deploy && git pull origin master'
system 'cd ..'
end
// I described the thought processes (SOLID violations, which to fix, how and why)
// in my post at http://thedevstop.wordpress.com/2013/03/07/roy-osheroves-solid-katastring-calculator-redux/
// Note that I did this in LINQPad and so instead of NUnit tests, I dumped failures
// If I was to do this again, I'd either do it in VS with a test runner.
void Main()
{
var parser = new IntsFromCommaSeparatedString();
var none = parser.Parse("").ToArray();
@druttka
druttka / robot.js
Created December 3, 2012 16:45
CodeFist
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {};
var target = null;
var intelAge = 0;
function log1(value, caption)
{
@druttka
druttka / gist:1679190
Created January 25, 2012 22:14
Absolute URL given HttpContext, action, and controller
// Assuming you have an HttpContext named httpContext
var urlHelper = new UrlHelper(httpContext.Request.RequestContext, RouteTable.Routes);
var url = urlHelper.Action("ActionName", "ControllerName");
// Or you can get really explicit and include the scheme and host
url = urlHelper.Action("ActionName", "ControllerName", null, httpContext.Request.Url.Scheme, httpContext.Request.Url.Host);