def cart(*lists):
if not lists:
for x in L:
...
Python On Permutation of values
by Maciej Piechotka,
October 07, 2008 14:34
You looking for cartesian p...
Ruby On Conditional Assignment
by Maciej Piechotka,
September 21, 2008 23:45
@danielharan:
Well - -100...
#include <stdlib.h> #include <string.h> ...
C On A Java-like function split
by Maciej Piechotka,
September 16, 2008 10:42
YAR - it ommits the separat...
#include <stdlib.h> #include <string.h> ...
C On A Java-like function split
by Maciej Piechotka,
September 16, 2008 10:06
May be something like that?...
private static boolean areSame(File f1, File f2) throws IOException
{
if(f1 == f2)
...
Java On fileContentsEquals
by Maciej Piechotka,
August 19, 2008 08:14
I'm tring once more - I've ...
public static boolean fileContentsEquals(File file1, File file2) throws IOException {
ByteBuffer buf1 = new FileInputStream(file1).getChannel().map(MapMode.READ_ONLY, 0, file1.length());
ByteBuffer buf2 = new FileInputStream(file2).getChannel().map(MapMode.READ_ONLY, 0, file2.length());
...
Java On fileContentsEquals
by Maciej Piechotka,
August 18, 2008 10:40
1. Yes. It will work on byt...
require 'enumerator' def fix_send_to_array(array) ...
Ruby On CSV turn in to an array of ...
by Maciej Piechotka,
August 15, 2008 08:47
May be something like that:
artists = [1, 2, 3] column_1 = artists[0...(artists.size/2.0).ceil] column_2 = artists[(artists.size/2.0).ceil...artists.size]
artists = [1, 2, 3] column_1 = artists[0, artists.size/2] column_2 = artists[artists.size/2...artists.size]
Ruby On Split an array into half
by Maciej Piechotka,
August 14, 2008 13:41
Something like that (a bit ...
%w{user network thumbnail}.each do |obj|
module_eval <<-"EOS", __FILE__, __LINE__
def #{obj}_path(path)
...
Ruby On Same function repeated but ...
by Maciej Piechotka,
August 08, 2008 21:39
May be something like that:...
class UsersController < ApplicationController ...
Ruby On showing records in Ascendin...
by Maciej Piechotka,
August 06, 2008 14:00
Why you don't use JavaScrip...
Ruby On showing records in Ascendin...
by Maciej Piechotka,
August 06, 2008 13:54
Why you don't use JavaScrip...
require 'FileUtils' ...
Ruby On Rails - Multiple instances ...
by Maciej Piechotka,
August 03, 2008 09:02
May be something like that?...
pools = {1 => [1,2,3], 2=> [3,4,5], 3=> [5,6,7]}
rej = Hash.new {0}
pools.values.flatten.reject! {|elem| rej[elem]++ != 1}
Ruby On Find the Intersection of Ar...
by Maciej Piechotka,
August 01, 2008 07:03
The sort is unnecessary in ...
pools = {1 => [1,2,3], 2=> [3,4,5], 3=> [5,6,7]}
rej = Hash.new {0}
pools.values.flatten.sort.reject! {|elem| rej[elem]++ != 1}
Ruby On Find the Intersection of Ar...
by Maciej Piechotka,
July 31, 2008 22:03
May be something like that
# generate_bf.rb # (copyleft) Matt Gauger 2008 # Randomly generates a brainfuck program ...
Ruby On Brainfuck Generator in Ruby
by Maciej Piechotka,
July 31, 2008 20:31
A little bit different work...
Ruby On Exercise: Deaf Grandma
by Maciej Piechotka,
July 30, 2008 18:55
@Wolfbyte - to keep the rub...
class Invitation include Validatable ...
Ruby On Contoller refactoring
by Maciej Piechotka,
July 30, 2008 11:46
Do it RESTful. Use fat mode...
count_bye = 0 loop do word = gets.chomp ...
Ruby On Exercise: Deaf Grandma
by Maciej Piechotka,
July 29, 2008 20:28
Only what within the task. ...
Ruby On Constructing a search query
by Maciej Piechotka,
July 07, 2008 14:55
DON'T DO IT!
It is broken b...
