This file contains hidden or 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 drawCharWithInfo = function(base, dataset){ | |
$(base+" > .total.counters > .ways span").html(dataset.length); | |
$(base+" > .total.counters > .searches span").html(get_count_by(dataset, 'x')); | |
drawBarChart(base+" > .ways", dataset); | |
}; | |
var drawBarChart = function(container, dataset){ |
This file contains hidden or 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
fs = require 'fs' | |
{print} = require 'sys' | |
{exec} = require 'child_process' | |
{spawn} = require 'child_process' | |
option '-o', '--output [DIR]', 'output dir' | |
task 'minify', 'Minify mongo production scripts', -> | |
exec 'uglifyjs --overwrite lib/mongo/lib/*.js', (err, stdout, stderr) -> |
This file contains hidden or 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
class @LogsMapReduce extends MapReduce | |
constructor: -> | |
super("logs", "statistics") | |
@init() | |
init: -> | |
@before() | |
@map_reduce() | |
@after() |
This file contains hidden or 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
function getRandomArbitary(min, max) | |
{ | |
return Math.random() * (max - min) + min; | |
} | |
function getRandomInt(min, max) | |
{ | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} |
This file contains hidden or 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
require 'rubygems' | |
require 'RMagick' | |
include Magick | |
def cut_to_cyrcle(path_to_image) | |
folder = path_to_image.split('/')[0..-2].join('/') | |
name = path_to_image.split('/').last.split('.')[0] | |
puts "Trying open #{path_to_image}" |
This file contains hidden or 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
class Hash | |
def group_by_count | |
group = [] | |
i = 0 | |
max = self.values.max | |
sorted = self.sort{|a, b| a[1] <=> b[1] } | |
sorted.each do |k,v| | |
group[i] ||= [] |
This file contains hidden or 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
[[['a', 1], ['b',2], ['c',3]], [['b',2],['a',1],['c',3]], [['c',1], ['a',4], ['b',2]]].uniq{|e| e.sort_by{|l| l.first }.map{|l| l.first }.join('') } | |
# => [[["a", 1], ["b", 2], ["c", 3]]] |
This file contains hidden or 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
namespace :mongo do | |
task :prepare_fixtures do | |
fixtures_base = "spec/mongo/fixtures" | |
Dir.entries("#{fixtures_base}/coffeescript").each do |file| | |
if !['..', '.'].include?(file) and file.split('.')[1] == 'coffee' | |
system "coffee -b -o #{fixtures_base}/javascript -c #{fixtures_base}/coffeescript/#{file} " | |
end | |
end | |
end |
This file contains hidden or 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
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# add local bin path | |
PATH=$HOME/.bin:$PATH | |
PATH=/usr/local/bin:$PATH | |
PATH=/usr/local/sbin:$PATH | |
PATH=/usr/local/mysql/bin:$PATH | |
# don't put duplicate lines in the history |
This file contains hidden or 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
SetLocale(1049) | |
msgBox GetLocale() | |
Dim i, j | |
Dim diagonalMean, mini, maxi, matrix_dim, printMessage | |
printMessage = "" | |
matrix_dim = 3 ' считаем с нуля | |
diagonalMean = 0 | |
mini = 0 |