This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <stdlib.h> | |
#include <list> | |
#include <sstream> | |
using namespace std; | |
void main(int argc, char **argv) | |
{ | |
list<string> l; | |
srand(43242342); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sstream> | |
#include <iostream> | |
#include <fstream> | |
#include <stdexcept> | |
#include <vector> | |
#include <queue> | |
#include <set> | |
#include <strings.h> | |
#include <string.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use List::Util qw(sum); | |
use POSIX qw(floor); | |
# Pricelist | |
%P = ( "A" => [1.25, 3, 3], "B" => 4.25, "C" => [1,6,5], D=> 0.75 ); | |
# Sale scanning | |
$_{$_}++ for split (//,qw(ABCDABA)); | |
# Calculate total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package simplejcqrs.domain; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.Map; | |
import junit.framework.Assert; | |
import org.junit.Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style type="text/css" id="s1" name="s1"> | |
span[class*="row"] { | |
position: absolute; | |
width: 25px; | |
height: 25px; | |
background: #eee; | |
padding: 5px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Collections.Specialized; | |
using System.Linq; | |
using System.Text; | |
using Microsoft.Practices.Unity; | |
namespace ConsoleApplication1 | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use List::Util qw(reduce sum); | |
use POSIX; | |
# Pricelist | |
%P = ( "A" => [1.25, 3, 3], "B" => 4.25, "C" => [1,6,5], D=> 0.75 ); | |
# Sale scanning | |
map { $_{$_}++ } split (//,qw(ABCDABA)); | |
# Calculate total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helper function: | |
Object.prototype.objReduce = function (func,initial) { for(x in this) if (this[x]|0==this[x]) initial = func(x,this[x],initial); return initial; }; | |
var pricelist = { A: { price: 1.25, pack: 3, ppack: 3}, B: { price: 4.25 }, C: { price: 1, pack:6,ppack:5}, D: {price: 0.75} } | |
// Collect array of items into object with fields of items and values of number of selled items. | |
// Example: A A B => { A: 2, B: 1 } | |
var collectItems = function(items) { | |
return items.reduce(function(y,x) { if (y[x]) { y[x]++} else {y[x]=1}; return y;},{}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub readfile | |
{ | |
my $fn = shift; | |
local $/=undef; | |
open FILE, $fn or die "Couldn't open file: $!"; | |
$string = <FILE>; | |
close FILE; | |
return $string; | |
} | |
sub writefile { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
function dir(path, callback) { | |
var promises = 0; | |
var all = []; | |
function _dir(path) { | |
promises++; | |
fs.readdir(path, function(err,files) { | |
promises--; | |
if (err) throw err; |
OlderNewer