Begin a new Kumite
Search
About
  • Filter by Language:
  • Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.

    You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.

    A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.

import pprint;pprint.pprint(zip(('Byte', 'KByte', 'MByte', 'GByte', 'TByte'), (1 << 10*i for i in xrange(5))))
Code
Diff
  • #!/usr/bin/env python
    
    import re,sys,optparse
    
    def debug(msg):
    	print("[DEBUG]: %s" % msg)
    
    def main():
    	parser = optparse.OptionParser(description="Options of specialness")
    	parser.add_option("-f", "--flags", action="store", dest="flags", default=None, help="Special flags for special people")
    	(opts,args) = parser.parse_args()
    	debug(opts)
    
    if __name__ == "__main__":
        main()
  • 11
    #!/usr/bin/env python
    
    22
    3+
    import re,sys,optparse
    
    4+
    5+
    def debug(msg):
    
    6+
    	print("[DEBUG]: %s" % msg)
    
    33
    44
    def main():
    
    5
        print "hello world"
    
    9+
    	parser = optparse.OptionParser(description="Options of specialness")
    
    10+
    	parser.add_option("-f", "--flags", action="store", dest="flags", default=None, help="Special flags for special people")
    
    11+
    	(opts,args) = parser.parse_args()
    
    12+
    	debug(opts)
    
    66
    77
    if __name__ == "__main__":
    
    88
        main()
    

Recent Moves:

Hello, world! style application, come on folks let's make PHP a cool subject

echo "Hello, PHP folks!";
Code
Diff
  • #!/bin/bash
    
    for arg in "$@"
    do
      printf "Hello %s!\n" arg
    done
  • 11
    #!/bin/bash
    
    2
    printf "Hello %s!\n" "Bash"
    
    2+
    3+
    for arg in "$@"
    
    4+
    do
    
    5+
      printf "Hello %s!\n" arg
    
    6+
    done
    

Recent Moves:

Utilities
Asynchronous
Code
Diff
  • function Chain(){
      this.links = [];
    }
    
    Chain.prototype.link = function link(cb){
      this.links.push(cb);
      return this;
    }
    
    Chain.prototype.run = function run(end){
      var self = this;
      var next = function(i){
        return function(){
          if (i < self.links.length){
            self.links[i](next(i+1), end); // i++ makes it harder to reason about this line
          } else {
          	end() // <-- end will not be called unless the chain is explicitly ended in a link
          }
        }
      };
      next(0)();
    }
  • 99
    1010
    Chain.prototype.run = function run(end){
    
    1111
      var self = this;
    
    1212
      var next = function(i){
    
    1313
        return function(){
    
    1414
          if (i < self.links.length){
    
    15
            self.links[i++](next(i), end);
    
    15+
            self.links[i](next(i+1), end); // i++ makes it harder to reason about this line
    
    16+
          } else {
    
    17+
          	end() // <-- end will not be called unless the chain is explicitly ended in a link
    
    1616
          }
    
    1717
        }
    
    1818
      };
    
    1919
      next(0)();
    
    2020
    }
    
Mathematics
Algorithms
Numbers
Code
Diff
  • ;; very much a golf solution that takes advantage of the sequence characteristics
    
    (reduce + (map / (cycle [4.0 -4.0]) (range 1 1200001 2)))
  • 1
    (->> (iterate inc 0) 
    
    2
         (map #(-> (Math/pow -1 %) (/ (inc (* 2 %))))) 
    
    3
         (take 1200001) 
    
    4
         (reduce +) 
    
    5
         (* 4) 
    
    6
         println)
    
    1+
    ;; very much a golf solution that takes advantage of the sequence characteristics
    
    2+
    3+
    (reduce + (map / (cycle [4.0 -4.0]) (range 1 1200001 2)))