6
votes
3answers
119 views

Placement of Conditionals

I've noticed a tendency towards two styles of conditionally executing methods: Conditional before the call def foo(thing) puts thing end if thing foo(thing) end Conditional within the call ...
4
votes
1answer
137 views

Hangman: Is this small Haskell game clean and idiomatic Haskell code?

I hope this question isn't too general. I've been learning Haskell, and a while ago I created this Hangman game. I've been working on using a library for terminal output, so no more hardcoded escape ...
3
votes
1answer
259 views

Which is better: the short, clever way, or the long, ctrl+c way?

The code below is equivalent. I can see pros and cons for both versions. Which one is better? Short version: character.on("key",function(key){ var action = ({ ...
3
votes
1answer
97 views

How can I improve this python script that counts the number of days worked for all commiters to a git repo?

I wrote this script to collect evidence of the number of days worked for the purpose of claiming some government tax credits. I'm looking for some ways to clean it up, I'm especially wondering if ...
2
votes
4answers
1k views

Binary Multiplication in C

Question:Write an algorithm in C to do integer multiplication without using multiplication nor division operators. Could I get a critique of the doMultiplication function? I know the rest of the code ...
2
votes
1answer
128 views

Which of these implementations is considered cleaner?

I've got a simple sinatra webapp that pulls data from Pinboard's RSS api, parses the info, and re-displays it. There are 4 tasks I need to perform with the data: I need to remove all instances of a ...
2
votes
1answer
107 views

Is this good Ruby?

This is the "codebreaker" game in Ruby, tell me what I can make better! #!/usr/bin/env ruby class Sequence attr_accessor :guess, :code def initialize puts "Type the difficulty level you ...
2
votes
0answers
354 views

Knockout.js: how to enhance the readability of Javascript part

There is no doubt that Knockout.js is a very useful tool, which will save you from a lot of Javascript(Jquery) binding hassle, which will reduce your team's bug ratio concerning this part. But ...
1
vote
2answers
123 views

Ruby implementation of Conway's Game of Life

I'm just starting with Ruby and decided to do two different implementations of Conway's Game of Life. In this first one I'm not using cells as a separate class and instead just track everything as a ...
1
vote
1answer
220 views

Review my prolog code for bibtex reader

I am trying to learn Prolog, and wrote a bibtex reader using gnu prolog. I would like some feed back on my code in terms of: the way I write Prolog, and how it can be improved. I am new here, and ...
1
vote
1answer
43 views

Create palindrome by rearranging letters of a word

Inspired by a recent question that caught my interest, I wrote a function in Python 3.3 to rearrange the letters of a given string to create a (any!) palindrome: Count the occurrences of each letter ...
1
vote
1answer
110 views

Multiple jQuery events on one element with different functions and target selectors

According to this two questions: [1] and [2] I need a way to combine these two methods of handling the event attachment in jQuery. $('selector').on({ mouseenter: function() {}, mouseleave: ...
1
vote
1answer
125 views

How Can I improve This Level Parser?

The code for the LevelParser is shown below. It is also documented using Java-doc, the docs are in the project directory. Now by improving this piece of code, I do not mean optimizing it to ...
0
votes
1answer
56 views

Perl project review - Word counter

I wrote this perl script that analizes a text and plot out a bar graph of the word occurrences during the text. Since come mainly from Javascript and PHP, i would like to know how bad is this code ...