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
C:/Ruby193/bin/ruby.exe extconf.rb | |
>>>>> Creating Makefile for ruby version 1.9.3 <<<<< | |
creating Makefile | |
make | |
generating oj-i386-mingw32.def | |
compiling cache.c | |
cache.c: In function 'oj_cache_new': | |
cache.c:54:5: warning: implicit declaration of function 'bzero' | |
cache.c:54:5: warning: incompatible implicit declaration of built-in function 'bzero' |
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
module BadFlyer | |
def fly | |
puts 'Not a chance' | |
false | |
end | |
end | |
module Runner | |
def run | |
puts 'Run, #{self}! Run!' |
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
def wrong_result(meth, args, expected, real) | |
$stderr.puts "test #{meth}(#{args.map(&:inspect).join(',')}) expected to be #{expected} but was #{real}" | |
end | |
def failed_test(meth, args, expected, exception) | |
$stderr.puts "test #{meth}(#{args.map(&:inspect).join(',')}) expected to be #{expected} but raised an error #{exception}" | |
end | |
def test_method(meth, test_cases) |
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
module DefNil | |
def defnil(meth) | |
self.class.class_eval do | |
alias_method "#{meth}_before_defnil", meth | |
define_method meth do |first_arg, *args, &block| | |
if first_arg | |
send("#{meth}_before_defnil", first_arg, *args, &block) | |
else | |
nil | |
end |
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
# Если ты создаешь новую функцию, а не меняешь старую, то всё проще, конечно. | |
def nillified(&block) | |
->(first_arg, *args) { | |
first_arg ? block.call(first_arg, *args) : nil | |
} | |
end | |
f = nillified{|x,y| x + 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
var emcntnt = '' + | |
'<h2 id = "osemi-header">Рассчитать стоимость услуг</h2>' + | |
'<div class = "emi-form"><table class = "table table-bordered">' + | |
'<tr class = "outstanamount">' + | |
'<td>Количество документов в месяц:</td> ' + | |
'<td>' + | |
'<div> <input type = "text" placeholder = "0.00" id = "outstanding_principle" value = "0" onchange = "calculateEMI();"></div>' + | |
'<div id = "osp_range"></div>' + | |
'</td>' + | |
'</tr>' + |
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
import os, sys | |
currentdir = os.path.dirname(os.path.abspath(__file__)) | |
parentdir = os.path.dirname(currentdir) | |
sys.path.insert(0, parentdir) | |
import wikilib | |
import parsing_dates | |
import apiRequest | |
import parseToDB | |
import sys |
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
def check_sum(xs_head_sum, xs_tail, goal_sum, equation_head): | |
if len(xs_tail) == 0: | |
if xs_head_sum == goal_sum: | |
return '{}={}'.format(equation_head, goal_sum) | |
else: | |
return None | |
result_1 = check_sum(xs_head_sum + xs_tail[0], xs_tail[1:], goal_sum, '{}+{}'.format(equation_head, xs_tail[0])) | |
if result_1: | |
return result_1 | |
result_2 = check_sum(xs_head_sum - xs_tail[0], xs_tail[1:], goal_sum, '{}-{}'.format(equation_head, xs_tail[0])) |
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
#!/bin/bash | |
testfile=`realpath $1` | |
FEATURE=`echo $1 | xargs basename | sed -re 's/\.test\.tsv$//'` | |
CL=`echo $FEATURE | sed -re 's/^([^.]+)\..+$/\1/'` | |
if [ "$CL" == "all" ]; then | |
DIRNAME=`echo $1 | xargs dirname | xargs --replace echo {}/.. | xargs realpath` | |
train_file="${DIRNAME}/train/${FEATURE}.train.tsv" | |
fit_file="${DIRNAME}/fit_chr_not2_9_22/${FEATURE}.fit_chr_not2_9_22.tsv" | |
validation_file="${DIRNAME}/val_chr_2_9_22/${FEATURE}.val_chr_2_9_22.tsv" |
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
import random | |
state = 'start' | |
Tram = 0.5 | |
param = 0.5 | |
pa = 3/8 | |
pam = 5/8 | |
Trym = 2/7 | |
Tyrym = 5/7 | |
pym = 1 |
OlderNewer