More Than Just Bacon

More than the sum of its bacon-bits.

Setting Up Heroku Deploys on Octopress

Octopress does a great job in setting you up to use heroku to host your site. Details for the almost trivial set up can be found here. To summarize, after installing and setting up Heroku, create a Heroku repository as per usual:

1
heroku create

Edit the .gitignore file and remove public so that the it is included with git changes and then run the following:

1
2
3
4
rake generate
git add .
git commit -m 'site updated'
git push heroku master

You will need to run the above every time you add a new post so to make things easier, you can add a rake task to the Rakefile to handle the less exciting bits for you. Mine looks like:

rake task to deploy to heroku
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
desc "Deploy website via Heroku"
task :heroku, :commit_message do |t, args|
  if args.title
    message = args.commit_message
  else
    message = get_stdin("What updates are you pushing? ")
  end

  Rake::Task[:generate].execute

  puts "## Deploying website via Heroku"
  system "git add ."
  system "git commit -m \"#{message}\""

  puts "## pushing updtates: head ---> origin"
  system "git push origin head"

  puts "## pushing updtates: master ---> heroku"
  system "git push heroku master"
end

And with that, all I have to do new after editing or creating a post is simply run:

1
rake heroku

And life is good.

Am I Done With 2048?

A few days ago I came across the webgame 2048. It was simple enough, all you have to do was use the arrow keys to move tiles on the page combining matching tiles, that exist in powers of 2, with the goal of getting a tile to display the value 2048.

After several days of furious attempts I finally hit jackpot…and for those non-believers, here’s proof: For the win

Hopefully this will put an end to my rather charged few days as I worked on forming an algorithm, went through all the steps I usually go through:

  • Forming and follwing patterns.
  • Randomly guessing what to do next
  • Cycling the arrow keys
  • Throwing hail mary’s.
  • Trying to have some sort of adaptive system by combiningin all the above

Finally realized that I should be using only three of the arrow keys (avoided using the up arrow) and keeping the highest scored tiles in the bottom row preferrably the corner…and boom, solved, queue victory dance, and I’m off the website. With my pride, somewhat and very embarrassingly, satisfied I closed the webpage and strolled out to what initally looked pleasant but was in fact uncomfortably cold weather. After rushing back in and warming myslef up I started wondering whether the algorithm I had stumbled across was a fluke…post on facebook or try to prove it?