query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Set the type of the Iq stanza (chainingfriendly) v:: [Symbol] or nil | def set_type(v)
self.type = v
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type=(type); end",
"def set_type\n end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type(val); @type = val; self; end",
"def type=(val)\n case val\n when :error then super('error')\n when :probe then super(... | [
"0.6026808",
"0.5948321",
"0.594715",
"0.594715",
"0.594715",
"0.594715",
"0.594715",
"0.5889045",
"0.58708346",
"0.5870461",
"0.58276063",
"0.57351464",
"0.5718711",
"0.57041264",
"0.5682197",
"0.5648664",
"0.56269836",
"0.56218255",
"0.5598361",
"0.5564985",
"0.55600333",
... | 0.60567546 | 0 |
Returns the iq's query child, or nil result:: [IqQuery] | def query
first_element('query')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_question\n return nil unless is_sq?\n @parent_question ||= lime_group.lime_questions.find{|question|question.qid==parent_qid}\n end",
"def query\n unless @query\n parse_query()\n end\n @query\n end",
"def parent_rmq\n @_parent_rmq\n end",
"def q\n self\... | [
"0.58993775",
"0.5887053",
"0.5784862",
"0.5716823",
"0.5713628",
"0.5713628",
"0.5713628",
"0.5711176",
"0.5588036",
"0.5520873",
"0.55024445",
"0.5483394",
"0.5431771",
"0.54214126",
"0.53631604",
"0.53083885",
"0.53028256",
"0.527592",
"0.5246575",
"0.52173537",
"0.521533"... | 0.57244396 | 3 |
Delete old elements named newquery.name newquery:: [REXML::Element] will be added | def query=(newquery)
delete_elements(newquery.name)
add(newquery)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_by_query(queries)\n queries = [queries] unless queries.is_a?(Array)\n build do |xml|\n xml.delete do |delete_node|\n queries.each { |query| delete_node.query query }\n end\n end\n end",
"def delete_by_query query, opts = {}\n update opts.merge(:data => xml.delete_by_query... | [
"0.6609964",
"0.5961317",
"0.5631487",
"0.55475813",
"0.5470925",
"0.54295766",
"0.5419503",
"0.53961045",
"0.53300124",
"0.52318823",
"0.52173513",
"0.51731414",
"0.5161339",
"0.5124656",
"0.50857574",
"0.50843495",
"0.50525343",
"0.50003606",
"0.49995553",
"0.49843356",
"0.... | 0.6704397 | 0 |
Returns the iq's query's namespace, or nil result:: [String] | def queryns
e = first_element('query')
if e
return e.namespace
else
return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespace\n @namespace ||= schema.attributes['Namespace'].value\n end",
"def namespace\n @namespace.ns\n end",
"def namespace\n @namespace ||= metadata.xpath('//Schema').first.attributes['Namespace'].value\n end",
"def namespace\n nil\n end",
"def namespace(ns)\n ns.bla... | [
"0.62251186",
"0.61939293",
"0.6178149",
"0.61747146",
"0.6174442",
"0.6170957",
"0.61697423",
"0.613811",
"0.613811",
"0.5976586",
"0.59408724",
"0.5939381",
"0.589501",
"0.58919036",
"0.58858776",
"0.58840847",
"0.587895",
"0.57759184",
"0.5766562",
"0.57509565",
"0.5745048... | 0.79844165 | 0 |
Returns the iq's child, or nil result:: [IqVcard] | def vcard
first_element('vCard')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def child\n children[0]\n end",
"def child\n\t\tif is_child?\n\t\t\tself\n\t\telse\n\t\t\tif !familyid.blank?\n\t\t\t\tStudySubject.children.with_subjectid(familyid).first\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\tend\n\tend",
"def child_get(name)\n child = @children.select{ |elem| name.eql?(... | [
"0.62767905",
"0.62528",
"0.6244299",
"0.59539664",
"0.5777264",
"0.57606936",
"0.5744211",
"0.57117647",
"0.5561242",
"0.55520594",
"0.5542936",
"0.5532454",
"0.54867166",
"0.5435797",
"0.5419696",
"0.5411339",
"0.53962016",
"0.53815913",
"0.53410137",
"0.5336304",
"0.532095... | 0.54489356 | 13 |
Add an element to the Iq stanza element:: [REXML::Element] Element to add. Will be automatically converted (imported) to a class registered with add_elementclass | def typed_add(element)
if element.kind_of?(REXML::Element) && @@element_classes.has_key?(element.name)
super(@@element_classes[element.name]::import(element))
else
super(element)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def <<(element)\n @elements << element\n self\n end",
"def element_add\r\n @env.issue.element_add @meta.element_add ElementAdd.new(@env).insert @is.element_add\r\n end",
"def << elem\n unless @element_type.nil? or elem.is_a?(@element_type)\n raise TypeError.new(\"Cannot add e... | [
"0.6366394",
"0.63614696",
"0.62773705",
"0.62410116",
"0.61146027",
"0.61146027",
"0.61146027",
"0.61146027",
"0.61146027",
"0.61146027",
"0.6065162",
"0.5983684",
"0.5965557",
"0.5958431",
"0.5924581",
"0.59024113",
"0.58999926",
"0.589973",
"0.5877168",
"0.5833075",
"0.579... | 0.65134525 | 0 |
Iterates the given block for each RDF statement in the input. | def each_statement(&block)
@callback = block
parse(@input, START.to_sym, @options.merge(:branch => BRANCH,
:first => FIRST,
:follow => FOLLOW)
) do |context, *data|
loc = data.shift
case context
when :statement
add_statement(loc, RDF::Statement.from(data))
when :trace
debug(loc, *data)
end
end
rescue RDF::LL1::Parser::Error => e
debug("Parsing completed with errors:\n\t#{e.message}")
raise RDF::ReaderError, e.message if validate?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_statement(&block)\n if block_given?\n @input.rewind\n sample = @input.read(1000)\n if sample.match(%r(<html)i)\n # If it's HTML, parse it to improve detection\n @input.rewind\n sample = @input = ::Nokogiri::HTML.parse(@input)\n ... | [
"0.78742886",
"0.7744474",
"0.7542271",
"0.7003516",
"0.6743582",
"0.67221117",
"0.65967774",
"0.6593459",
"0.6517501",
"0.6395181",
"0.63136494",
"0.63123786",
"0.63123786",
"0.624668",
"0.6219534",
"0.61793005",
"0.6175033",
"0.615955",
"0.6156915",
"0.6089419",
"0.60851973... | 0.7401051 | 3 |
Iterates the given block for each RDF quad in the input. | def each_quad(&block)
each_statement do |statement|
block.call(*statement.to_quad)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_quad(&block)\n if block_given?\n each_statement do |statement|\n block.call(*statement.to_quad)\n end\n end\n enum_for(:each_quad)\n end",
"def each(solutions:, &block)\n super do |stmt|\n block.call(RDF::Statement.from(stmt.to_quad))\n ... | [
"0.7068529",
"0.66853106",
"0.6563826",
"0.637273",
"0.63396627",
"0.61988866",
"0.61057884",
"0.6056404",
"0.60215825",
"0.6017053",
"0.6017053",
"0.6000423",
"0.5961103",
"0.59479266",
"0.594221",
"0.59064204",
"0.5891409",
"0.5873933",
"0.5841416",
"0.5818396",
"0.58069956... | 0.7171513 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_comments
@picture = Picture.find(params[:picture_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def comment_params
params.require(:comment).permit(:name, :comment, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Set all the level names at once and saves the object. ===Params: levels:: An array containing every level name. A rubric criterion contains RUBRIC_LEVELS levels. If the array is smaller, only the first levels are set. If the array is bigger, higher indexes are ignored. ===Returns: Whether the save operation was successful or not. | def set_level_names(levels)
levels.each_with_index do |level, index|
self['level_' + index.to_s + '_name'] = level
end
save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def levels=(levels)\n @levels = levels\n clear_levels_cache!\n end",
"def input_dosing_levels(levels)\n my_levels = levels.split(',')\n for i in 0..my_levels.size()-1\n add_level.click if i > 1\n dosing_factor_levels[i].set my_levels[i]\n end\n end",
"def levels(lev... | [
"0.71385366",
"0.62222093",
"0.6181587",
"0.59082156",
"0.56003654",
"0.55802184",
"0.55802184",
"0.55479366",
"0.55303395",
"0.55172014",
"0.54905945",
"0.54611444",
"0.5395873",
"0.5388535",
"0.536256",
"0.5360733",
"0.531737",
"0.5310692",
"0.52956796",
"0.5260223",
"0.525... | 0.75213766 | 0 |
before_create :build_image def start_generation MiddleMan.worker(:snap_generator_worker).async_generate(:arg => self.id) end | def start_generation
Nanite.request("/nanny/generate", self.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n GenerateThumbnailsJob.perform_later(@image.id)\n\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @ima... | [
"0.6473505",
"0.6185129",
"0.6088528",
"0.6026558",
"0.59738034",
"0.5969435",
"0.5946117",
"0.5837913",
"0.5803837",
"0.57497644",
"0.5741899",
"0.5731147",
"0.57152545",
"0.56883013",
"0.5672436",
"0.56591755",
"0.56484574",
"0.5623527",
"0.56118107",
"0.5593125",
"0.558440... | 0.6741161 | 0 |
not currently working (needs exact match) | def search
@maps = Map.find_map_by_input(@maps, params[:name])
render json: @maps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match; end",
"def match; end",
"def case_insensitive_match; end",
"def match(p0) end",
"def match(p0) end",
"def case_insensitive_match=(_arg0); end",
"def pre_match() end",
"def test_strict_match_criteria\n entry = BigramEntry.new\n entry.parse_line(\"8\t工作\t18904\t6.89133239246\t213454\")... | [
"0.7495227",
"0.7495227",
"0.7449106",
"0.7285074",
"0.7285074",
"0.718046",
"0.70803255",
"0.7033444",
"0.7021869",
"0.7007506",
"0.69651055",
"0.69651055",
"0.6934304",
"0.6929482",
"0.68655473",
"0.686213",
"0.67753726",
"0.6746277",
"0.6746277",
"0.6727391",
"0.670263",
... | 0.0 | -1 |
Initialize from an XML element (from REXML). | def initialize(xml_elem)
@name = xml_elem.attributes['name']
@num_bins = xml_elem.attributes['num-bins'].to_i
@range_min = xml_elem.attributes['min'].to_f
@range_max = xml_elem.attributes['max'].to_f
@title = xml_elem.attributes['title']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_from_element!\n end",
"def initialize(*args)\n\t\t\t@elements = []\n\t\t\tload_xml(args[0]) if args[0].kind_of? REXML::Element\n\t\tend",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n ... | [
"0.74032336",
"0.7217232",
"0.6988989",
"0.6988989",
"0.6988989",
"0.69343686",
"0.6855485",
"0.6804757",
"0.6799742",
"0.6736154",
"0.6673041",
"0.66329205",
"0.6624914",
"0.65383434",
"0.6500895",
"0.64715695",
"0.644519",
"0.64287573",
"0.6375737",
"0.6360501",
"0.6293038"... | 0.7086324 | 2 |
Returns the bin index corresponding to _value_. | def bin_index(value)
return -1 if(value < @range_min or value > @range_max)
(@num_bins*(value - @range_min)/(@range_max - @range_min)).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_search(value)\n search_result = binary_search_internal(value)\n return search_result[0] ? search_result[1] : -1\n end",
"def raw_count(value)\n @bins[value] || 0\n end",
"def value(bin_index)\n @range_min + (bin_index + 0.5)*(@range_max - @range_min)/@num_bins.to_f\n end",
"... | [
"0.6910767",
"0.67883694",
"0.62572676",
"0.6224203",
"0.6101795",
"0.6090049",
"0.596754",
"0.5899062",
"0.5862317",
"0.5853283",
"0.584395",
"0.58358526",
"0.5833961",
"0.57845455",
"0.57845455",
"0.5701703",
"0.5691766",
"0.5652859",
"0.56436414",
"0.562319",
"0.559947",
... | 0.8275749 | 0 |
Returns the mean value of bin _bin_index_. | def value(bin_index)
@range_min + (bin_index + 0.5)*(@range_max - @range_min)/@num_bins.to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean\n return 0.0 if @count.zero?\n return @sum / @count\n end",
"def mean\n @sum / @count\n end",
"def mean\n stats.mean\n end",
"def mean\n sum / count.to_f\n end",
"def mean\n @cleaned_data.map(&:to_f).sum / n.to_f\n end",
"def mean\n get_mean\n e... | [
"0.645113",
"0.62902164",
"0.6277264",
"0.6002737",
"0.59984004",
"0.59034187",
"0.58576417",
"0.5840206",
"0.5817501",
"0.5807346",
"0.57853055",
"0.5761594",
"0.5751396",
"0.57219946",
"0.5708449",
"0.5659274",
"0.56562865",
"0.5637644",
"0.56335825",
"0.56172955",
"0.55988... | 0.6714202 | 0 |
Initialize from an XML file. | def initialize(xml_file_name)
@xml_file_name = xml_file_name
@kinvars = Array.new
doc = REXML::Document.new(File.new(xml_file_name))
kv_elem = doc.elements['kinematic-variables']
kv_elem.elements.each('kinvar'){|kv| @kinvars.push Kinvar.new(kv)}
@data_file = kv_elem.elements['dat-file'].attributes['file']
@file = File.new(@data_file,'rb')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(path)\n @filename = path\n file = nil\n file = open(path)\n @errors = [] \n \n @document = Nokogiri::XML(file)\n @document.remove_namespaces!\n @node = @document.root\n unless self.valid?\n self.errors << {:xml => 'invalid xml passed in'}\n ... | [
"0.75647366",
"0.75392306",
"0.74263066",
"0.735098",
"0.73483664",
"0.7246494",
"0.7193181",
"0.7160576",
"0.7109422",
"0.7074879",
"0.7071975",
"0.70292604",
"0.70292604",
"0.70292604",
"0.69244003",
"0.6913879",
"0.6911274",
"0.68244284",
"0.6816221",
"0.6794409",
"0.67902... | 0.72503155 | 5 |
Returns the Kinvar object w/ name _kinvar_ | def [](kinvar)
@kinvars.each{|kv| return kv if(kv.name == kinvar)}; nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_variable(name)\n NetCDF::Variable.new(@netcdf_elmt.findVariable(name))\n end",
"def variable(name)\n var = nc.var(name) # NetCDFVar\n get(var)\n end",
"def to_nvar(name)\n self.class.to_nvar(name)\n end",
"def ivg(o,vn)\n o.instance_variable_get(vn.to_s)\nend",
"d... | [
"0.5574428",
"0.555881",
"0.54744893",
"0.53321457",
"0.52964014",
"0.528263",
"0.5251821",
"0.5219873",
"0.519401",
"0.5190307",
"0.5189282",
"0.5126412",
"0.5079791",
"0.50745654",
"0.50486016",
"0.50392187",
"0.5038823",
"0.5004229",
"0.49497256",
"0.4946956",
"0.4941458",... | 0.73486245 | 0 |
Have we reached the end of the file? | def eof; @file.eof; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @read >= @size\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\r\n false\r\n end",
"def ... | [
"0.79996926",
"0.79996926",
"0.79996926",
"0.79753065",
"0.79573554",
"0.79573554",
"0.79573554",
"0.793477",
"0.7917818",
"0.7914348",
"0.7839148",
"0.7798828",
"0.7794142",
"0.7794142",
"0.7794142",
"0.77890694",
"0.77488196",
"0.7737597",
"0.77373433",
"0.7709795",
"0.7709... | 0.7688012 | 23 |
Read the next event's kinematic variables (returns their values via Hash) | def read
num_kv = @kinvars.length
unpck = String.new
num_kv.times{unpck += 'd'}
vals = @file.read(num_kv*8).unpack(unpck)
vals_hash = Hash.new
num_kv.times{|kv| vals_hash[@kinvars[kv].name] = vals[kv]}
vals_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vars\n @vars ||= soln.keys\n @vars\n end",
"def data\r\n @obj.read_var(@name)\r\n end",
"def values\n @values ||= keys.map do |key|\n request_context.params[\"ks_prev_#{key}\".to_sym]\n end\n end",
"def read_player_info_block\n keys, ret = [],... | [
"0.5379749",
"0.52060366",
"0.5157811",
"0.515696",
"0.5100735",
"0.5043836",
"0.50337374",
"0.5033514",
"0.5022739",
"0.4956222",
"0.4904913",
"0.48614565",
"0.48614565",
"0.48283133",
"0.4802302",
"0.4792526",
"0.47711322",
"0.47711322",
"0.4757023",
"0.47393623",
"0.472951... | 0.5852097 | 0 |
Renders current grid state. | def render(reveal = false)
alphabet = ("A".."Z").to_a
print SQUARE_EMPTY
for x in 1..@grid.size
print " #{x} "
end
puts
for y in 0..@grid.size - 1
print " #{alphabet[y]} "
for x in 0..@grid.size - 1
coordinates = Game::Grid::Coordinates.new(x, y)
if reveal
if @grid.ship?(coordinates)
print SQUARE_HIT
else
print SQUARE_EMPTY
end
else
if @grid.ship?(coordinates)
@grid.ship_at(coordinates) { |ship|
segment = Utils::Calculator.ship_segment_from_coordinates(ship, coordinates)
if ship.hit?(segment)
print SQUARE_HIT
else
print SQUARE_UNKNOWN
end
}
else
if @missed.include? coordinates
print SQUARE_MISS
else
print SQUARE_UNKNOWN
end
end
end
end
puts
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render\n puts \"-------------------------------------\"\n @grid.each do |row| \n puts \"| \" + row.map(&:to_s).join(\" | \") + \" |\"\n puts \"-------------------------------------\"\n end\n end",
"def render\n #puts \"current state of the grid:\"\n grid.ea... | [
"0.72304994",
"0.7206337",
"0.70700365",
"0.70438075",
"0.69868636",
"0.68171823",
"0.676829",
"0.67381376",
"0.6724603",
"0.6667249",
"0.6667249",
"0.6661648",
"0.65830845",
"0.65780807",
"0.6576031",
"0.649558",
"0.6399635",
"0.6392365",
"0.62914515",
"0.6261261",
"0.624086... | 0.5515794 | 88 |
5 points Extend your previous program to act like a smart grandfather clock. Given both the hour of the day and a sound, your program will display the sound that many times. For example: $ ruby exercise6.rb 4 GONGGG! GONGGG! GONGGG! GONGGG! GONGGG! | def grandfather_clock(hour, sound, &block)
hour.times do
block.call(sound)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speak(number_of_times)\n\t\tindex = 0\n\t\tuntil number_of_times == index \n\t\t\tputs \"Ho, ho, ho!, Haaaappy holidays!\"\n\t\t\tindex +=1\n\t\tend \n\tend",
"def speak(repetitions)\n repetitions.times {puts \"Woof!\"}\n end",
"def mayday\n\tprint \"Les ennemis attaquent \"\n\t\t3.times do\n\t\tsleep(... | [
"0.6780683",
"0.6447429",
"0.63293344",
"0.6293141",
"0.62922144",
"0.62651974",
"0.62627226",
"0.6220753",
"0.6175988",
"0.61480397",
"0.6140392",
"0.613198",
"0.6079507",
"0.60727185",
"0.6062683",
"0.60451233",
"0.6015646",
"0.60102326",
"0.5997692",
"0.5988598",
"0.598111... | 0.7293099 | 0 |
yaml and marshal i/o | def loadyaml(filename) YAML.load_file(filename) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_yaml() end",
"def y(obj)\n puts obj.to_yaml\nend",
"def y(obj)\n puts obj.to_yaml\nend",
"def to_yaml\n # write yaml\n end",
"def paml(x)\n\n puts(YAML.dump(x))\nend",
"def yaml_content() = JSON.parse(content.to_json).to_yaml",
"def to_yaml(opts_={})\n data_ = marshal_dump\n ... | [
"0.77047825",
"0.7329348",
"0.7329348",
"0.7229099",
"0.71335256",
"0.7013666",
"0.6907123",
"0.67749083",
"0.6761539",
"0.6701907",
"0.668908",
"0.6663233",
"0.6635896",
"0.66057444",
"0.6585543",
"0.6585543",
"0.6585543",
"0.6585543",
"0.6585543",
"0.6585543",
"0.6585543",
... | 0.0 | -1 |
Why's aorta method to edit an object in YAML, awesome! Source: | def aorta( obj )
tempfile = File.join('/tmp',"yobj_#{ Time.now.to_i }")
File.open( tempfile, 'w' ) { |f| f << obj.to_yaml }
system( "#{ ENV['EDITOR'] || 'vi' } #{ tempfile }" )
return obj unless File.exists?( tempfile )
content = YAML::load( File.open( tempfile ) )
File.delete( tempfile )
content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y(obj)\n puts obj.to_yaml\nend",
"def y(obj)\n puts obj.to_yaml\nend",
"def edit_yaml(yaml_location, &block)\n d = YAML.load_file(yaml_location)\n block.call(d)\n File.open(yaml_location, 'w') {|f| f.write d.to_yaml }\n end",
"def yaml(object) \n title = split(object)\n category... | [
"0.65748596",
"0.65748596",
"0.64384025",
"0.64170545",
"0.63207906",
"0.6252102",
"0.6248266",
"0.6248266",
"0.6248266",
"0.6248266",
"0.6248266",
"0.6248266",
"0.6248266",
"0.6228083",
"0.60380065",
"0.60380065",
"0.5968703",
"0.5968123",
"0.5836689",
"0.5795446",
"0.579061... | 0.7580655 | 0 |
GET /definitions GET /definitions.json | def index
@definitions = Definition.order('created_at desc')
respond_to do |format|
format.html # index.html.erb
format.json { render json: @definitions }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def definitions\n @definitions ||= { responses: {} }\n end",
"def definitions() return @definitions end",
"def index\n @definitions = Definition.all\n end",
"def definitions\n # Some httparty work to fetch definitions from Websters\n end",
"def definitions\n definitions_reposit... | [
"0.71696943",
"0.7035405",
"0.69830155",
"0.6952514",
"0.68399847",
"0.6793316",
"0.6740609",
"0.65474063",
"0.6519796",
"0.64545053",
"0.64442104",
"0.64051026",
"0.6389717",
"0.63701975",
"0.63386023",
"0.63142693",
"0.6281907",
"0.6281907",
"0.62501967",
"0.6196053",
"0.61... | 0.6830788 | 5 |
GET /definitions/1 GET /definitions/1.json | def show
@definition = Definition.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @definition }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @definitions = Definition.order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def index\n @definitions = Definition.all\n end",
"def index\n\n @definitions = Definition.find(:all)\n\... | [
"0.6423631",
"0.6383879",
"0.6200107",
"0.6055134",
"0.6040642",
"0.6014104",
"0.58885425",
"0.58833396",
"0.5860071",
"0.58480954",
"0.58480954",
"0.5817164",
"0.581531",
"0.57763374",
"0.5767419",
"0.5749257",
"0.57099915",
"0.5693339",
"0.5589913",
"0.55643064",
"0.5544749... | 0.6233283 | 3 |
GET /definitions/new GET /definitions/new.json | def new
@definition = Definition.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @definition }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @import_def = ImportDef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import_def }\n end\n end",
"def new\n\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml =... | [
"0.6930692",
"0.68009335",
"0.6758711",
"0.67394155",
"0.65274596",
"0.6403782",
"0.6383718",
"0.6373029",
"0.6325937",
"0.63258094",
"0.6313153",
"0.6310018",
"0.63092446",
"0.6306276",
"0.62651294",
"0.6259509",
"0.62584955",
"0.62469876",
"0.6246857",
"0.62422776",
"0.6231... | 0.7344656 | 1 |
POST /definitions POST /definitions.json | def create
@definition = Definition.new(params[:definition])
respond_to do |format|
if @definition.save
if user_signed_in?
format.html { redirect_to action: "confirm", :code => @definition.code }
else
UserMailer.confirm_definition_email(@definition.email, @definition.word, @definition.code).deliver
format.html { redirect_to action: "thanks" }
end
else
format.html { render action: "new" }
format.json { render json: @definition.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @definition = Definition.new(params[:definition])\n\n respond_to do |format|\n if @definition.save\n format.html { redirect_to @definition, notice: 'Definition was successfully created.' }\n format.json { render json: @definition, status: :created, location: @definition }\n ... | [
"0.6339699",
"0.6263143",
"0.6234217",
"0.6203598",
"0.6068313",
"0.60348904",
"0.60322946",
"0.5752607",
"0.5720249",
"0.57096803",
"0.57054526",
"0.5700437",
"0.5660487",
"0.55631375",
"0.55631375",
"0.552386",
"0.551596",
"0.5499564",
"0.54778045",
"0.54729086",
"0.546584"... | 0.0 | -1 |
PUT /definitions/1 PUT /definitions/1.json | def update
@definition = Definition.find(params[:id])
respond_to do |format|
if @definition.update_attributes(params[:definition])
format.html { redirect_to @definition, notice: 'Definition was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @definition.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @definition = Definition.find(params[:id])\n @definition.update_attributes(params[:definition])\n respond_with @definition\n end",
"def update!(**args)\n @object_definitions = args[:object_definitions] if args.key?(:object_definitions)\n @operati... | [
"0.5903674",
"0.5877338",
"0.5877338",
"0.581707",
"0.57526803",
"0.5628275",
"0.5628275",
"0.56269014",
"0.56230676",
"0.56042856",
"0.55740964",
"0.55352575",
"0.55137587",
"0.5510303",
"0.5502335",
"0.54641503",
"0.54230094",
"0.5415794",
"0.5392939",
"0.53609145",
"0.5343... | 0.56980634 | 6 |
DELETE /definitions/1 DELETE /definitions/1.json | def destroy
@definition = Definition.find(params[:id])
@definition.destroy
respond_to do |format|
format.html { redirect_to definitions_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to(definitions_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @definition.destroy\n respond_to do |forma... | [
"0.7056711",
"0.6766232",
"0.6750174",
"0.6583348",
"0.64048374",
"0.63863593",
"0.6327638",
"0.63005626",
"0.6287216",
"0.6265741",
"0.62635624",
"0.62557954",
"0.625193",
"0.623278",
"0.62260133",
"0.61956036",
"0.6157464",
"0.6146882",
"0.6141673",
"0.6134758",
"0.6134758"... | 0.6924805 | 2 |
verify definitions match the code submitted by user | def confirm
@definition = Definition.where(:code => params[:code]).first
if @definition
@definition.status = 'confirmed'
@definition.save!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify\n end",
"def check_definition(definition, current_expected, current_key = nil)\n definition.each do |error_key, match_def|\n if match_def.is_a? Hash\n key = [current_key, error_key].compact.join('.')\n check_each(key, match_def, current_expected)\n else\n ... | [
"0.59838855",
"0.5980834",
"0.5912073",
"0.5912073",
"0.58902836",
"0.58552635",
"0.5796245",
"0.577791",
"0.5761025",
"0.5747396",
"0.57382065",
"0.5723976",
"0.57199097",
"0.566797",
"0.5651127",
"0.56187266",
"0.56187266",
"0.5617139",
"0.560949",
"0.5591947",
"0.5587925",... | 0.0 | -1 |
human readable description of modeling approach | def modeler_description
return 'Find the exterior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high). Find the desing level and multiplier for each category of the exterior lighting definition. Apply the lighting upgrades by reducing the design level associated with each outdoor lighting category by a percent (depends on starting and target efficiency levels).'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end",
"def m... | [
"0.7709525",
"0.7614442",
"0.7592187",
"0.7401259",
"0.72999185",
"0.7295701",
"0.7278094",
"0.7190962",
"0.719084",
"0.719084",
"0.7099756",
"0.7096957",
"0.7061509",
"0.70443124",
"0.7042815",
"0.7039971",
"0.70394796",
"0.70316714",
"0.70253843",
"0.70177025",
"0.6986074",... | 0.6723864 | 55 |
define the arguments that the user will input | def arguments(model)
args = OpenStudio::Measure::OSArgumentVector.new
# make choice argument for target_efficiency_level
choices = OpenStudio::StringVector.new
choices << 'Medium'
choices << 'High'
target_efficiency_level = OpenStudio::Measure::OSArgument.makeChoiceArgument('target_efficiency_level', choices, true)
target_efficiency_level.setDisplayName('Target Efficiency Level')
args << target_efficiency_level
return args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end... | [
"0.73753476",
"0.73753476",
"0.73753476",
"0.70890766",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",... | 0.0 | -1 |
define what happens when the measure is run | def run(model, runner, user_arguments)
super(model, runner, user_arguments)
# use the built-in error checking
if !runner.validateUserArguments(arguments(model), user_arguments)
return false
end
# get arguments
target_efficiency_level = runner.getStringArgumentValue('target_efficiency_level', user_arguments)
# get interior lighting template for model to determine starting efficiency level
properties = model.getBuilding.additionalProperties
ext_lighting_template = properties.getFeatureAsString('exterior_lighting_template').to_s
case ext_lighting_template
when 'DOE Ref Pre-1980', 'DOE Ref 1980-2004', 'ComStock DOE Ref Pre-1980', 'ComStock DOE Ref 1980-2004'
starting_efficiency_level = 'Very Low'
old_large_fixture_type = 'Metal Halide Fixture (458W)'
old_large_fixture_w = 458.0
old_small_fixture_type = 'Incandescent Fixture (114W)'
old_small_fixture_w = 114.0
when '90.1-2004', '90.1-2007', 'ComStock 90.1-2004', 'ComStock 90.1-2007'
starting_efficiency_level = 'Low'
old_large_fixture_type = 'Metal Halide Fixture (458W)'
old_large_fixture_w = 458.0
old_small_fixture_type = 'Halogen Fixture (82W)'
old_small_fixture_w = 82.0
when '90.1-2010', '90.1-2013', 'ComStock 90.1-2010', 'ComStock 90.1-2013'
starting_efficiency_level = 'Medium'
old_large_fixture_type = 'Pulse Start Metal Halide Fixture (365W)'
old_large_fixture_w = 365.0
old_small_fixture_type = 'CFL Fixture (28W)'
old_small_fixture_w = 28.0
else
runner.registerError("interior_lighting_template '#{ext_lighting_template}' not recognized")
return false
end
runner.registerInitialCondition("Starting efficiency level is '#{starting_efficiency_level}' and target efficiency level is '#{target_efficiency_level}'.")
# determine if the target efficiency level exceeds the starting efficiency level
case target_efficiency_level
when 'Medium'
new_large_fixture_type = 'Pulse Start Metal Halide Fixture (365W)'
new_large_fixture_w = 365.0
new_small_fixture_type = 'CFL Fixture (28W)'
new_small_fixture_w = 28.0
when 'High'
new_large_fixture_type = 'LED Fixture (220W)'
new_large_fixture_w = 220.0
new_small_fixture_type = 'LED Fixture (20W)'
new_small_fixture_w = 20.0
end
if old_small_fixture_w <= new_small_fixture_w
runner.registerAsNotApplicable("The target efficiency level '#{target_efficiency_level}' is the same or lower than the starting efficiency level '#{starting_efficiency_level}' in the model. Lighting upgrade is not applicable.")
return false
end
runner.registerInitialCondition("Starting efficiency level is '#{starting_efficiency_level}' and target efficiency level is '#{target_efficiency_level}'.")
# make variable to track total number of fixtures changed when looping through space types
total_num_large_fixtures_changed = 0
total_num_small_fixtures_changed = 0
# loop through exterior lights definitions and get design level and multiplier
model.getFacility.exteriorLights.each do |ext_lights|
old_design_level = ext_lights.exteriorLightsDefinition.designLevel
multiplier = ext_lights.multiplier
next if multiplier.zero?
lighting_power_w = old_design_level * multiplier
# determine old and new bulbs by separate exterior lighting categories by units
if ['Parking Areas and Drives'].include?(ext_lights.name.to_s)
old_fixture_type = old_large_fixture_type
old_fixture_w = old_large_fixture_w
new_fixture_type = new_large_fixture_type
new_fixture_w = new_large_fixture_w
fixture_class = 'large'
elsif ['Building Facades', 'Entry Canopies', 'Emergency Canopies', 'Main Entries', 'Other Doors', 'Drive Through Windows'].include?(ext_lights.name.to_s)
old_fixture_type = old_small_fixture_type
old_fixture_w = old_small_fixture_w
new_fixture_type = new_small_fixture_type
new_fixture_w = new_small_fixture_w
fixture_class = 'small'
else
runner.registerWarning("Exterior lights '#{ext_lights.name}' is not a recognized exterior lighting type. Cannot determine if large or small fixture.")
next
end
# calculate power reduction
num_fixtures = (lighting_power_w / old_fixture_w).ceil
total_num_large_fixtures_changed += num_fixtures if fixture_class == 'large'
total_num_small_fixtures_changed += num_fixtures if fixture_class == 'small'
reduction_fraction = (old_fixture_w - new_fixture_w) / old_fixture_w
new_design_level = old_design_level * (1 - reduction_fraction)
ext_lights.exteriorLightsDefinition.setDesignLevel(new_design_level)
runner.registerInfo("For '#{ext_lights.name}' exterior lighting, #{num_fixtures} fixtures were changed from #{old_fixture_type} to #{new_fixture_type}. The exterior lighting design level for #{ext_lights.name} was reduced from #{old_design_level.round(4)} to #{new_design_level.round(4)}.")
end
runner.registerValue('light_outdoor_num_large_fixtures_changed', total_num_large_fixtures_changed)
runner.registerValue('light_outdoor_num_small_fixtures_changed', total_num_small_fixtures_changed)
runner.registerFinalCondition("A total of #{total_num_large_fixtures_changed} large and #{total_num_small_fixtures_changed} small outdoor fixtures and were upgraded.")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure; end",
"def measure=(_arg0); end",
"def measure\n\t\t1\n\tend",
"def measure(*args, &b)\n end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def called\n self.measurement.called\n end",
"def measure\n ... | [
"0.79848564",
"0.7639647",
"0.76355976",
"0.7170129",
"0.66926914",
"0.66926914",
"0.66718984",
"0.66311747",
"0.6599127",
"0.65870225",
"0.65324444",
"0.6481582",
"0.6405596",
"0.64028287",
"0.6333309",
"0.6283632",
"0.6283632",
"0.6283632",
"0.6281165",
"0.6269874",
"0.6242... | 0.0 | -1 |
Build the url to be called using this class' +base_url+ and a +word+. Returns an url to where +word+'s synonyms can be obtained. | def build_call_url(word)
URI.parse(URI.escape(base_url + word))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_lesson_word_synonym\n begin\n @course = Course.find(params[:course_id])\n @lesson = Lesson.find(params[:lesson_id])\n @lesson_word_synonym = LessonWordSynonym.find_by!(synonym_id: params[:synonym_id], lesson_word_id: params[:lesson_word_id])\n end\n end",
"def base_url\n 'htt... | [
"0.5757154",
"0.57283103",
"0.55813503",
"0.55706763",
"0.545224",
"0.54491234",
"0.54320055",
"0.53744864",
"0.5324914",
"0.5320462",
"0.5312278",
"0.52938926",
"0.52938926",
"0.52938926",
"0.5291178",
"0.52752894",
"0.5244829",
"0.5220654",
"0.5218501",
"0.5127033",
"0.5120... | 0.6646363 | 0 |
Obtain synonyms of a +word+ from Educalingo. | def synonyms(word, options = {})
response = call(word)
doc = Nokogiri.HTML(response)
synonyms = Array.new
doc.css('#wordcloud1 > span').each do |synonym|
score = Integer(synonym.values[0])
synonyms.push({
word: synonym.inner_html,
score: score
}) unless score < 75
# A minimum score of 75 is considered because educalingo
# tends to have completely unrelated words around this score
end
return synonyms
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def synonyms\n @synonyms ||= {\n /^awesome$/i => %w[great excellent cool awesome splendid],\n /^okay$/i => %w[okay great alright],\n /^hello$/i => %w[hello hi greetings],\n /^yes$/i => %w[yes affirmative definitely correct certainly],\n /^no$/i => %w[... | [
"0.6837809",
"0.683243",
"0.65248585",
"0.65157163",
"0.6513385",
"0.6448367",
"0.64279884",
"0.64008737",
"0.6371983",
"0.6346837",
"0.63074297",
"0.62453896",
"0.6231569",
"0.6192896",
"0.6081743",
"0.6066702",
"0.6061148",
"0.60483044",
"0.60175085",
"0.59807175",
"0.59734... | 0.7307483 | 0 |
GET /byoins/1 GET /byoins/1.json | def show
@byoin = Byoin.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @byoin }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def index\n @dinos = Dino.where(query_params)\n render... | [
"0.6513531",
"0.6388622",
"0.6372817",
"0.63000786",
"0.6272199",
"0.6264514",
"0.62585986",
"0.6224663",
"0.6191145",
"0.6146437",
"0.613376",
"0.61313856",
"0.6099681",
"0.6079414",
"0.60769194",
"0.60614854",
"0.60572386",
"0.6053703",
"0.6046992",
"0.60383904",
"0.6037119... | 0.66625655 | 0 |
GET /byoins/new GET /byoins/new.json | def new
@byoin = Byoin.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @byoin }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @inning = Inning.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inning }\n end\n end",
"def new\n @ongoing = Ongoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ongoing }\n en... | [
"0.74631023",
"0.72607964",
"0.7131678",
"0.7076896",
"0.7056005",
"0.70374966",
"0.7020581",
"0.69768405",
"0.696636",
"0.69607735",
"0.6946114",
"0.69424623",
"0.6937767",
"0.6930798",
"0.6920706",
"0.6919153",
"0.69183034",
"0.6918192",
"0.69159484",
"0.68863875",
"0.68857... | 0.7550706 | 0 |
POST /byoins POST /byoins.json | def create
@byoin = Byoin.new(params[:byoin])
respond_to do |format|
if @byoin.save
format.html { redirect_to @byoin, notice: 'Byoin was successfully created.' }
format.json { render json: @byoin, status: :created, location: @byoin }
else
format.html { render action: "new" }
format.json { render json: @byoin.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @yaopin = Yaopin.new(params[:yaopin])\n\n respond_to do |format|\n if @yaopin.save\n format.html { redirect_to @yaopin, notice: 'Yaopin was successfully created.' }\n format.json { render json: @yaopin, status: :created, location: @yaopin }\n else\n format.html { r... | [
"0.57724303",
"0.5531953",
"0.543413",
"0.5430458",
"0.5376896",
"0.53581923",
"0.5354088",
"0.53494644",
"0.53471196",
"0.5323087",
"0.5304842",
"0.52863526",
"0.5217852",
"0.51786345",
"0.51729107",
"0.5149248",
"0.51343036",
"0.5129744",
"0.51244557",
"0.51180446",
"0.5102... | 0.56098133 | 1 |
PUT /byoins/1 PUT /byoins/1.json | def update
@byoin = Byoin.find(params[:id])
respond_to do |format|
if @byoin.update_attributes(params[:byoin])
format.html { redirect_to @byoin, notice: 'Byoin was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @byoin.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def put(*args)\n request :put, *args\n end",
"def update\n @yaopin = Yaopin.find(params[:id])\n\n respond_to do |format|\n if @yaopin.update_attributes(params[:yaopin])\n format.html {... | [
"0.61012685",
"0.6011096",
"0.59603673",
"0.5956994",
"0.5943289",
"0.59146076",
"0.59111",
"0.58982176",
"0.58756256",
"0.58387744",
"0.57933974",
"0.5760879",
"0.5687984",
"0.56679493",
"0.56552255",
"0.56528986",
"0.5633129",
"0.56303215",
"0.56303215",
"0.55878145",
"0.55... | 0.5905801 | 7 |
DELETE /byoins/1 DELETE /byoins/1.json | def destroy
@byoin = Byoin.find(params[:id])
@byoin.destroy
respond_to do |format|
format.html { redirect_to byoins_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circl... | [
"0.71535367",
"0.6996581",
"0.69334257",
"0.6872575",
"0.6849983",
"0.6773241",
"0.67722857",
"0.6752195",
"0.6746345",
"0.6733793",
"0.6733225",
"0.673185",
"0.673185",
"0.673185",
"0.673185",
"0.67070353",
"0.67050636",
"0.66941684",
"0.66412836",
"0.66408604",
"0.66259706"... | 0.69972354 | 1 |
Search params : byoinNm | def search
#conditions = Byoin.where("\"byoinCd\" NOT ?", nil)
conditions = Byoin.where("1 = ?", 1)
conditions = conditions.where("\"byoinNm\" LIKE ?", params[:byoinNm] + "%") if params[:byoinNm] != ""
logger.debug(conditions)
records = conditions.count
limit = params[:rows].to_i
page = params[:page].to_i
if records > 0
n = records.quo(limit)
total_pages = n.ceil
else
total_pages = 0
end
start = limit * page - limit;
@byoins = conditions.find(
:all,
:offset => start,
:limit => limit,
:order => "\"byoinCd\" DESC")
@responce = {
total: total_pages.to_s,
page: params[:page],
records: records.to_s,
rows: @byoins
}
#logger.debug(@responce)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @responce }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(arg, by: nil)\n\t\t\tr={type: \"search\", arg: arg}\n\t\t\tr[:by]=by if by\n\t\t\t# if :by is not specified, aur defaults to name-desc\n\t\t\tself.query(r)\n\t\tend",
"def search(criteria = {})\r\n \r\n end",
"def search_params\n params.require(:search).permit(:result_no, :generate_no, ... | [
"0.71156377",
"0.7031753",
"0.69069177",
"0.6891742",
"0.67376006",
"0.67093253",
"0.66832936",
"0.6678318",
"0.66602284",
"0.6644997",
"0.6616747",
"0.6605426",
"0.65893465",
"0.6588739",
"0.65704",
"0.6560714",
"0.65601283",
"0.65523684",
"0.6551555",
"0.6551555",
"0.655155... | 0.7040071 | 1 |
GET /connpasses GET /connpasses.json | def index
@connpasses = Connpass.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def passes\n command = RequestPasses.call(@current_user, serialNumbers)\n if command.success?\n @passes = command.result\n render 'passes.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end",
"... | [
"0.66384435",
"0.63989335",
"0.633204",
"0.6001866",
"0.56572056",
"0.5623348",
"0.562248",
"0.55092794",
"0.5311898",
"0.5266798",
"0.5261784",
"0.5215726",
"0.5214483",
"0.5211567",
"0.5207906",
"0.5153614",
"0.51375157",
"0.5136857",
"0.5130621",
"0.51173353",
"0.5087707",... | 0.70516884 | 0 |
GET /connpasses/1 GET /connpasses/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @connpasses = Connpass.all\n end",
"def index\n @passes = Pass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @passes }\n end\n end",
"def index\n \n if params[:fly_id]\n @passes = Fly.find(params[:fly_id]).passes\n e... | [
"0.7016647",
"0.6601232",
"0.6458856",
"0.6336865",
"0.60618556",
"0.60514593",
"0.5785612",
"0.56928915",
"0.566608",
"0.5660947",
"0.55345917",
"0.546456",
"0.5395068",
"0.53315717",
"0.5319105",
"0.52863014",
"0.5228195",
"0.5223131",
"0.52011436",
"0.5183974",
"0.5164278"... | 0.0 | -1 |
POST /connpasses POST /connpasses.json | def create
@connpass = Connpass.new(connpass_params)
respond_to do |format|
if @connpass.save
format.html { redirect_to @connpass, notice: 'Connpass was successfully created.' }
format.json { render :show, status: :created, location: @connpass }
else
format.html { render :new }
format.json { render json: @connpass.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def passes\n command = RequestPasses.call(@current_user, serialNumbers)\n if command.success?\n @passes = command.result\n render 'passes.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end",
"... | [
"0.6327074",
"0.6069031",
"0.58198714",
"0.5750625",
"0.56613624",
"0.5652071",
"0.54286885",
"0.53455895",
"0.5343968",
"0.5333515",
"0.53334546",
"0.518195",
"0.51461405",
"0.51389295",
"0.5119878",
"0.5071819",
"0.50663686",
"0.506427",
"0.49650648",
"0.49422172",
"0.49315... | 0.61146283 | 1 |
PATCH/PUT /connpasses/1 PATCH/PUT /connpasses/1.json | def update
respond_to do |format|
if @connpass.update(connpass_params)
format.html { redirect_to @connpass, notice: 'Connpass was successfully updated.' }
format.json { render :show, status: :ok, location: @connpass }
else
format.html { render :edit }
format.json { render json: @connpass.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#... | [
"0.61746484",
"0.61034566",
"0.61034566",
"0.60805917",
"0.6055846",
"0.59964377",
"0.584302",
"0.5830509",
"0.5824125",
"0.5795116",
"0.5734334",
"0.5730964",
"0.5723088",
"0.5688998",
"0.5635366",
"0.5634619",
"0.5628341",
"0.55758846",
"0.5560144",
"0.5532608",
"0.5515663"... | 0.6090453 | 3 |
DELETE /connpasses/1 DELETE /connpasses/1.json | def destroy
@connpass.destroy
respond_to do |format|
format.html { redirect_to connpasses_url, notice: 'Connpass was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @pass = Pass.find(params[:id])\n @pass.destroy\n\n respond_to do |format|\n format.html { redirect_to passes_url }\n format.json { head :no_content }\n end\n end",
"def d... | [
"0.6568274",
"0.6541548",
"0.6541548",
"0.64127207",
"0.6385443",
"0.6331785",
"0.63183075",
"0.6239806",
"0.6233033",
"0.6220353",
"0.62014693",
"0.61795956",
"0.61683464",
"0.61445504",
"0.609677",
"0.6096424",
"0.60917306",
"0.60782784",
"0.6069781",
"0.60662496",
"0.60655... | 0.70593244 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_connpass
@connpass = Connpass.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def connpass_params
params[:connpass]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
POST /listings POST /listings.json | def create
@listing = Listing.new(params[:listing])
if @listing.save
@listing.listing_nugget.update_attribute(:listing_extracted, true)
#if attachments are an broker email attachment
if params["email_attachment_ids"] && params["email_attachment_ids"].strip != ""
arr = params["email_attachment_ids"].split(";")
arr.each do |a|
email_attachment = BrokerEmailAttachment.find(a)
if Rails.env.development? || Rails.env.test?
attachment = ListingAttachmentUploader.new
attachment.cache!(File.open("#{email_attachment.file.current_path}"))
attach = ListingAttachment. create(
:listing_id=> @listing.id,
:file=> attachment
)
else
attachment = @listing.listing_attachments.new
attachment.remote_file_url = email_attachment.file.url
attachment.save
end
end
# if attachments are nugget attachments
elsif params["nugget_attachment_ids"] && params["nugget_attachment_ids"].strip != ""
arr = params["nugget_attachment_ids"].split(";")
arr.each do |a|
nugget_signage = NuggetSignage.find(a)
if Rails.env.development? || Rails.env.test?
attachment = ListingAttachmentUploader.new
attachment.cache!(File.open("#{nugget_signage.signage.current_path}"))
attach = ListingAttachment. create(
:listing_id=> @listing.id,
:file=> attachment
)
else
attachment = @listing.listing_attachments.new
attachment.remote_file_url = nugget_signage.signage.url
attachment.save
end
end
end
end
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n @listing = Listing.new(listing_params)\n\n @listing.save\n\n render json: @listing\n redirect_to listings_path # redirect to home page\n end",
"def index\n @listings = Listing.all\n render json: @listings\n end",
"def create\n #debugger\n #TODO: DELETE A... | [
"0.7446066",
"0.7005275",
"0.6834559",
"0.6828408",
"0.6827981",
"0.6775853",
"0.6734454",
"0.6723492",
"0.6723492",
"0.6673963",
"0.6612273",
"0.66121864",
"0.6581905",
"0.6568161",
"0.65660554",
"0.6559053",
"0.6555972",
"0.65158397",
"0.6491164",
"0.6446251",
"0.6435303",
... | 0.0 | -1 |
DELETE /listings/1 DELETE /listings/1.json | def destroy
@listing = Listing.find(params[:id])
@listing.destroy
respond_to do |format|
format.html { redirect_to :back }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n api_delete(\"/listings/#{@listing_id}\")\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listi... | [
"0.8234062",
"0.74533904",
"0.74533904",
"0.74533904",
"0.74533904",
"0.74533904",
"0.7325798",
"0.7325798",
"0.7325798",
"0.7325798",
"0.7325798",
"0.7303547",
"0.729347",
"0.72206295",
"0.72045994",
"0.71954113",
"0.71954113",
"0.71954113",
"0.71435225",
"0.7079359",
"0.707... | 0.7182406 | 18 |
Description: This method process get lastest roadmap | def get_lastest_roadmaps(user_id)
UserCategory.where(user_id: user_id).order_by(created_at: -1).limit(ITEM_PER_PAGE)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_new_road\n return nil if finding_new_road?\n return nil if Params::NEW_ROOT_FIND_PERCENTAGE < rand(Params::PERCENT_DENOMINATOR)\n\n found_mini_map_ids = mini_map_roads.collect{|r| r.end_mini_map_id}\n found_mini_map_ids << id\n not_found_mini_map_ids = MiniMap.all.collect{|m| m.id} - found_... | [
"0.6195852",
"0.58092445",
"0.5718303",
"0.5710238",
"0.5674145",
"0.56470186",
"0.5635778",
"0.55787253",
"0.54382527",
"0.54308456",
"0.5414753",
"0.54028016",
"0.54028016",
"0.53753495",
"0.53672177",
"0.5356196",
"0.530149",
"0.5286058",
"0.525225",
"0.5235575",
"0.519769... | 0.6390302 | 0 |
::: bp_class ::: 31/05/2012 ................................................................................................... Format and clean class strings | def bp_class class_param
class_param.blank? ? '' : class_param.strip().html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_class_name(name)\n name.gsub(/[^_0-9A-Za-z:]/, '')\n end",
"def safe_class_name()\n self.class.name.downcase.gsub(/[^\\d\\w]/, '_')\n end",
"def formatClass(theLines)\n\n\treplaceVoids(\t\ttheLines);\n\tspaceMethods(\t\ttheLines);\n\tindentMembers(\t\ttheLines);\n\t... | [
"0.65835106",
"0.635127",
"0.62413734",
"0.62387645",
"0.6185513",
"0.613174",
"0.6123613",
"0.60226506",
"0.6001884",
"0.59962213",
"0.5991192",
"0.5987389",
"0.5956613",
"0.59025335",
"0.59025335",
"0.58830607",
"0.5874535",
"0.5852366",
"0.5786725",
"0.5786725",
"0.5760469... | 0.6800241 | 0 |
::: bp_html_print ::: 31/05/2012 ................................................................................................... Format and print final HTML code Supports: crude html code Returns: Safe html without spaces | def bp_html_print html
if html.blank?
out = 'The helper <b>bp_html_print</b> received <b>empty</b> or <b>null</b>.'
else
out = html.gsub(/ /, ' ')
out = out.gsub('id=""', '')
out = out.gsub('class=""', '')
out = out.gsub('style=""', '')
end
out.try(:html_safe)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lstrip_html\n return if self.blank?\n\n m = self.match(/\\A(\\s*?[^<]|(.*?)>\\s*[^<])/) #Find first printing character\n return self unless m\n \n ldr = m[0]\n ldr_last = ldr.slice(ldr.size-1, ldr.size)\n ldr = ldr.slice(0,ldr.size-1) # portion up to the first printing character\n bdy =... | [
"0.67625797",
"0.6468834",
"0.64069545",
"0.6398988",
"0.6371578",
"0.63500065",
"0.6339608",
"0.6325233",
"0.6299458",
"0.62365186",
"0.62347203",
"0.6229011",
"0.6223172",
"0.62172127",
"0.6183147",
"0.6183147",
"0.6183147",
"0.6183147",
"0.61737597",
"0.6169585",
"0.615587... | 0.82362944 | 0 |
::: bp_buttons ::: 18/03/2013 ................................................................................................... Creates a space for buttons | def bp_buttons(*args, &block)
if block_given?
options = args.first || {}
html_options = args.second
bp_buttons(capture(&block), options, html_options)
else
html_buttons = args.first
options = args.second || {}
options_hash = options
options_hash[:class] = options[:class].blank? ? 'bp-box-buttons' : bp_class("bp-box-buttons #{options[:class]}")
label = options[:label].blank? ? '' : content_tag(:div, bp_html_print(options[:label]), :class=>'label')
out = label
out += html_buttons
content_tag :div, bp_html_print(out), options_hash
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buttons; end",
"def buttons(&block)\n content = @template.capture(self, &block)\n @template.concat '<div class=\"buttons\">'\n @template.concat content\n @template.concat '</div>'\n end",
"def how_to_create_buttons args\n # Define a button style\n args.state.button_style ... | [
"0.7562014",
"0.66310906",
"0.65998024",
"0.657379",
"0.6533267",
"0.64901876",
"0.6487519",
"0.64841187",
"0.64364743",
"0.64025056",
"0.6322279",
"0.63198626",
"0.6283257",
"0.626846",
"0.6196367",
"0.6170193",
"0.61690426",
"0.6159591",
"0.61555356",
"0.6129072",
"0.612907... | 0.6308454 | 12 |
::: bp_button ::: ................................................................................................... Default button helper | def bp_button(*args, &block)
if block_given?
options = args.first || {}
html_options = args.second
bp_button(capture(&block), options, html_options)
else
label = args.first
href = args.second || '#'
options = args.third || {}
options_hash = options
options_hash[:class] = options[:class].blank? ? 'btn' : bp_class("btn #{options[:class]}")
out = label
out += '<i></i>'.html_safe
content_tag :div, link_to(bp_html_print(out), href), options_hash
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def button\n options.fetch(:button, false)\n end",
"def buttons; end",
"def make_default_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-makedefaultbtn\")), format_method(__method__))\n end",
"def rende... | [
"0.7479003",
"0.7195787",
"0.70887244",
"0.7085129",
"0.7063926",
"0.7051321",
"0.70164204",
"0.69971424",
"0.69842225",
"0.6931993",
"0.6925709",
"0.69242513",
"0.6917327",
"0.69007224",
"0.6882008",
"0.6875467",
"0.6861053",
"0.6857063",
"0.68503994",
"0.68345666",
"0.68345... | 0.7099949 | 2 |
::: bp_submit ::: ................................................................................................... | def bp_submit(*args, &block)
if block_given?
"No admite &block"
else
label = args.first
options = args.second || {}
#options_hash = options # Para que reciba cualquier atributo (sin filtrar)
options_hash = {}
options_hash[:class] = options[:class].blank? ? "btn" : bp_class("btn #{options[:class]}")
if !options[:id].blank?
options_hash[:id] = options[:id]
end
if options[:input_id].blank?
input_id = options_hash[:id].blank? ? "" : "input_#{options_hash[:id]}"
else
input_id = options[:input_id]
end
input_hash = {}
input_hash[:id] = input_id
content_tag :div, options_hash do
submit_tag label, input_hash
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit; end",
"def submits; end",
"def submit\n end",
"def submit!\n\tend",
"def click_submit\n end",
"def submit\n click_button 'SEND'\n self\n end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def submit\r\n assert_exists\r\n submit... | [
"0.80355066",
"0.7817041",
"0.77582574",
"0.7633236",
"0.70371556",
"0.7000825",
"0.69059414",
"0.677857",
"0.6539885",
"0.6520481",
"0.6520481",
"0.650785",
"0.64872897",
"0.6464555",
"0.6443382",
"0.6443382",
"0.6436988",
"0.6436988",
"0.6335963",
"0.63290006",
"0.6257416",... | 0.65491086 | 8 |
::: bp_group :: (ANTES group_inputs_form) ................................................................................................... Agrupar elementos Admite: Label, ID y Class | def bp_group options, &block
label = options[:label].blank? ? "" : options[:label]
id = options[:id].blank? ? "" : options[:id]
style = options[:style].blank? ? "" : options[:style]
out = content_tag :li, :class => bp_class("group #{options[:class]}"), :id => "#{id}", :style => style do
content_tag :fieldset do
fieldset = label.blank? ? "" : content_tag(:legend, label, :class => "label")
fieldset += content_tag(:ol, capture(&block))
fieldset.html_safe
end
end
bp_html_print out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_text_group(name, values = [])\n field = field_content(name)\n field_name = prop(field, 'name') || name\n group = {}\n unless field.nil?\n group[:legend] = prop(field, 'label')\n group[:description] = prop(field, 'description')\n group[:description_id] = \"label-description-#{na... | [
"0.69598037",
"0.681094",
"0.6604592",
"0.6582853",
"0.6241212",
"0.6157816",
"0.6093225",
"0.6055335",
"0.6012496",
"0.5998035",
"0.5973409",
"0.59482056",
"0.5943536",
"0.59414554",
"0.59224075",
"0.59200114",
"0.59200114",
"0.5899451",
"0.5890195",
"0.5889951",
"0.58669263... | 0.682712 | 1 |
::: bp_inline :: (ANTES inline_inputs_form) ................................................................................................... Campos en linea Admite: Label, ID y Class | def bp_inline options, &block
label = options[:label].blank? ? "" : options[:label]
not_label = label.blank? ? "not-label" : ""
id = options[:id].blank? ? "" : "id='#{options[:id]}'"
cols = options[:cols].blank? ? "" : "cols-#{options[:cols]}"
msgerr = cols.blank? ? "No se ha definido el numero de columnas <b>:cols</b>" : ""
unless msgerr.blank?
out = msgerr
else
out = content_tag :li, :class => bp_class("inline #{cols} #{not_label} #{options[:class]}"), :id => "#{id}" do
content_tag :fieldset do
fieldset = label.blank? ? "" : content_tag(:legend, label, :class => "label")
fieldset += content_tag :ol, capture(&block)
fieldset = fieldset.html_safe
end
end
end
bp_html_print out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inline(label = nil, &block)\n template.content_tag(:div) do\n template.concat template.content_tag(:label, label) if label.present?\n template.concat template.content_tag(:div, :class => 'input') {\n template.content_tag(:div, :class => 'inline-inputs') do\n template.fields_for(\n ... | [
"0.7214832",
"0.606171",
"0.6002291",
"0.59069973",
"0.5879961",
"0.58013624",
"0.5620312",
"0.55915844",
"0.55696326",
"0.55614364",
"0.55156434",
"0.55125856",
"0.55068195",
"0.54988736",
"0.5491041",
"0.5444681",
"0.54299146",
"0.5392373",
"0.53789926",
"0.53639644",
"0.53... | 0.6378602 | 1 |
::: action_button ::: ................................................................................................... Boton de estilo Accion (accion positiva) Muestra un enlace A con estilo Accion Admite: Label, URL y clases adicionales | def action_button_form options
label = options[:label] ? options[:label] : "Boton"
url = options[:url] ? options[:url] : "#"
myclass = options[:class] ? "btn-action #{options[:class]}" : "btn-action"
"<li><div class='#{myclass}'>#{link_to(label, url)}</div></li>".html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_click\n\t\tend",
"def edit(action = 'Objective Action')\n click_on(SELECTOR_MAPPING[action]['Edit']['button'][$janus::ELEMENT])\n end",
"def add_actions; end",
"def aide2()\n indice = IndiceMoyen.create(@map)\n res = indice.envoyerIndice.indice.split(\"-\")\n\n x=res[0].to_i\n y=re... | [
"0.5849234",
"0.5811676",
"0.572514",
"0.56416357",
"0.5608865",
"0.55964136",
"0.55945385",
"0.5587969",
"0.5579181",
"0.55044335",
"0.546723",
"0.5453149",
"0.54288894",
"0.5420646",
"0.5381472",
"0.53785914",
"0.53780025",
"0.53739834",
"0.53295493",
"0.5313517",
"0.531268... | 0.58680916 | 0 |
::: cancel_button ::: ................................................................................................... Boton de estilo Cancelar (accion negativa) Muestra un enlace A con estilo Cancelar y el texto Cancelar Admite: Label, URL y clases adicionales | def cancel_button_form options
label = options[:label] ? options[:label] : "Cancelar"
url = options[:url] ? options[:url] : "#"
myclass = options[:class] ? "btn-action btn-cancel #{options[:class]}" : "btn-action btn-cancel"
link = options[:fancybox] ? link_to_function(label, "$.fancybox.close()") : link_to(label, url)
"<li><div class='#{myclass}'>#{link}</div></li>".html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_button(destination_path)\n @template.link_to I18n.t('form.cancel'), destination_path,\n class: \"btn btn-default\"\n end",
"def cancel\n begin\n $results.log_action(\"button(#{@params[0]})\")\n # Cancel button can be either a link or an actu... | [
"0.7338342",
"0.7240847",
"0.71911776",
"0.7064689",
"0.7005302",
"0.6996349",
"0.6884849",
"0.68608487",
"0.68578446",
"0.685243",
"0.68412924",
"0.68083453",
"0.6783445",
"0.66754204",
"0.66505146",
"0.6648982",
"0.6630894",
"0.6558211",
"0.65406394",
"0.65252507",
"0.65203... | 0.70672107 | 3 |
::: custom_item ::: ................................................................................................... Elemento personalizado: texto, link,... Admite: ID, label, hint, HTML Ejemplo: custom_item_form :label => 'Visita mi web', :html => link_to('miweb.es',' | def custom_item_form options
group_html = "<li id='#{options[:id]}' class='p'>"
group_html += options[:label] ? "<label for='#{options[:id]}'>#{options[:label]}</label>" : ""
group_html += "<div class='wrap-custom-html'>#{options[:html]}</div>"
group_html += options[:hint] ? "<p class='inline-hints'>#{options[:hint]}</p>" : ""
group_html += "</li>"
group_html.html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mostrar_item(menu)\n\n\t\t# Si el item tiene url, controlador o accion, arma link, sino solo label\n\t\tif (menu.controller != '') or (menu.action != '') or (menu.url != '')\n\t\t\tif menu.url != ''\n\t\t\t\tlink_to menu.nombre, menu.url\n\t\t\telse\n\t\t\t\tlink_to menu.nombre, :controller => menu.controller,... | [
"0.62943274",
"0.6286281",
"0.61402404",
"0.6097704",
"0.60930884",
"0.60856867",
"0.6066599",
"0.59867543",
"0.5954744",
"0.59289163",
"0.5901942",
"0.58983815",
"0.58983815",
"0.5868188",
"0.5823106",
"0.58228856",
"0.5783654",
"0.57812494",
"0.5779564",
"0.57718223",
"0.57... | 0.69687176 | 0 |
::: bp_directory_index ::: Muestra un arbol de carpetas y vistas en funcion del path del request | def bp_directory_index
tree_hash = BP.same_level_views("/base_project#{request.env['PATH_INFO']}")
p tree_hash
out = "<ul>"
tree_hash.keys.each do |tree_hash_key|
thk = tree_hash_key.gsub(".html.erb", "")
thk = thk.gsub("/mocks", "")
out += content_tag :li, thk.gsub("/", "")
out += "<ul>"
tree_hash[tree_hash_key].each do |tree_hash_value|
thv = tree_hash_value.gsub(".html.erb", "")
if thv != "index"
out += content_tag :li, link_to("#{thv}", "/mocks?t=#{thk}/#{thv}")
end
end
out += "</ul>"
out += "</li>"
end
out += "</ul>"
out.html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directory_index\n end",
"def path(*) end",
"def bp_mock_directory_index\n\n tree_hash = BP.same_level_views(\"/mocks\")\n\n out = \"<ul>\"\n\n tree_hash.keys.each do |tree_hash_key|\n thk = tree_hash_key.gsub(\".html.erb\", \"\")\n thk = thk.gsub(\"/mocks\", \"\")\n\n out += content_tag :li,... | [
"0.75283045",
"0.6429611",
"0.62999487",
"0.6243415",
"0.61129963",
"0.6066627",
"0.60164326",
"0.5972681",
"0.5972681",
"0.5972681",
"0.5968441",
"0.5968441",
"0.5949979",
"0.5949979",
"0.5946509",
"0.5946509",
"0.5946509",
"0.59423995",
"0.59423995",
"0.59423995",
"0.594239... | 0.67258483 | 1 |
::: bp_mock_directory_index ::: Muestra un arbol de carpetas y vistas dentro de la carpeta mocks | def bp_mock_directory_index
tree_hash = BP.same_level_views("/mocks")
out = "<ul>"
tree_hash.keys.each do |tree_hash_key|
thk = tree_hash_key.gsub(".html.erb", "")
thk = thk.gsub("/mocks", "")
out += content_tag :li, thk.gsub("/", "")
out += "<ul>"
tree_hash[tree_hash_key].each do |tree_hash_value|
thv = tree_hash_value.gsub(".html.erb", "")
if thv != "index"
out += content_tag :li, link_to("#{thv}", "/mocks/no_layout?t=#{thk}/#{thv}")
end
end
out += "</ul>"
out += "</li>"
end
out += "</ul>"
out.html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directory_index\n end",
"def test_directory_with_index\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, nil ], \"/directory/\"\n end",
"def bp_directory_index\n tree_hash = BP.same_level_views(\"/base_project#{request.env['PATH_INFO']}\")\n\n p tree_hash\n\n out = \"<ul>\"\n\n tree_h... | [
"0.6691094",
"0.66083425",
"0.6074296",
"0.60325736",
"0.59579116",
"0.5950772",
"0.58903176",
"0.58669245",
"0.586233",
"0.5782827",
"0.5778735",
"0.5760948",
"0.5714595",
"0.56046224",
"0.56026816",
"0.5549639",
"0.55079776",
"0.5466253",
"0.54230106",
"0.5415844",
"0.54143... | 0.6713913 | 0 |
::: bp_meta_tags ::: 31/05/2012 ................................................................................................... Add baseproject meta tags | def bp_meta_tags
"<meta name='base-project-version' content='#{bp_version}'>".html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_meta_tags_title\n set_meta_tags site: 'benradler.com'\n end",
"def set_meta_tags(meta_tags)\n self.meta_tags.update(meta_tags)\n end",
"def add_tags\n raise NotImplementedError\n end",
"def render_custom(tags)\n meta_tags.meta_tags.each do |name, data|\n Array(data).ea... | [
"0.66166747",
"0.64490247",
"0.6427762",
"0.63269556",
"0.63182783",
"0.63060045",
"0.62989634",
"0.61403334",
"0.61169416",
"0.6104548",
"0.6090257",
"0.6070195",
"0.6065026",
"0.60502315",
"0.6030636",
"0.60273206",
"0.60210395",
"0.60089767",
"0.5995537",
"0.59758747",
"0.... | 0.66026044 | 1 |
filter by post type. TODO | def by_type
filter(:type) do |post, type|
post.post_type.casecmp(type).zero?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_post_types(args = {}, output = 'names', operator = 'and')\n field = ( 'names' == output ) ? 'name' : false\n\n wp_filter_object_list(Railspress.GLOBAL.wp_post_types, args, operator, field)\n end",
"def index\n \n @post_type = params[:type] \n the_posts = Post.all\n if !@post_type.bl... | [
"0.6780538",
"0.6536971",
"0.64968675",
"0.6395417",
"0.6232085",
"0.6226156",
"0.62162143",
"0.6113875",
"0.6113875",
"0.60949653",
"0.6090159",
"0.60430235",
"0.5985461",
"0.597882",
"0.5977049",
"0.59760654",
"0.59688866",
"0.59646165",
"0.59646165",
"0.5956579",
"0.594894... | 0.8877474 | 0 |
GET /schmos GET /schmos.json | def index
@schmos = Schmo.all
@notes = Note.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cmms = Cmm.all\n render json: @cmms\n end",
"def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end",
"def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html... | [
"0.6287215",
"0.6146774",
"0.6007942",
"0.59525365",
"0.5948356",
"0.59110683",
"0.58844894",
"0.5833501",
"0.580308",
"0.5789356",
"0.57869834",
"0.5767391",
"0.5719861",
"0.5718146",
"0.57129455",
"0.56987226",
"0.5695464",
"0.5675094",
"0.5659954",
"0.56318706",
"0.5610547... | 0.60849845 | 2 |
GET /schmos/1 GET /schmos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end",
"def index\n @cmms = Cmm.all\n render json: @cmms\n end",
"def show\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n ... | [
"0.64544874",
"0.6269609",
"0.61858207",
"0.61826146",
"0.6130916",
"0.61101973",
"0.6033174",
"0.59969854",
"0.598803",
"0.5985184",
"0.59719825",
"0.5898784",
"0.58714503",
"0.5871348",
"0.58592427",
"0.58543295",
"0.58455735",
"0.5834173",
"0.58272785",
"0.5826233",
"0.582... | 0.0 | -1 |
POST /schmos POST /schmos.json | def create
@schmo = Schmo.new(schmo_params)
respond_to do |format|
if @schmo.save
format.html { redirect_to @schmo, notice: 'Schmo was successfully created.' }
format.json { render :show, status: :created, location: @schmo }
else
format.html { render :new }
format.json { render json: @schmo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @swm = Swm.new(swm_params)\n\n respond_to do |format|\n if @swm.save\n format.html { redirect_to @swm, notice: 'Swm was successfully created.' }\n format.json { render :show, status: :creat... | [
"0.58984995",
"0.550309",
"0.5471433",
"0.5392018",
"0.5322792",
"0.53135544",
"0.53125525",
"0.5302609",
"0.5298284",
"0.5283186",
"0.52796805",
"0.52739847",
"0.5272804",
"0.5253575",
"0.5250156",
"0.5247957",
"0.5247251",
"0.5244934",
"0.52402085",
"0.52375656",
"0.5232637... | 0.6403342 | 0 |
PATCH/PUT /schmos/1 PATCH/PUT /schmos/1.json | def update
respond_to do |format|
if @schmo.update(schmo_params)
format.html { redirect_to @schmo, notice: 'Schmo was successfully updated.' }
format.json { render :show, status: :ok, location: @schmo }
else
format.html { render :edit }
format.json { render json: @schmo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts p... | [
"0.60670775",
"0.60602576",
"0.60271037",
"0.59614265",
"0.594393",
"0.59209156",
"0.5903024",
"0.5900323",
"0.58891106",
"0.5885256",
"0.588278",
"0.58802676",
"0.586252",
"0.5852165",
"0.58440155",
"0.5823932",
"0.582176",
"0.58198524",
"0.58171576",
"0.58167857",
"0.581063... | 0.62560153 | 0 |
DELETE /schmos/1 DELETE /schmos/1.json | def destroy
@schmo.destroy
respond_to do |format|
format.html { redirect_to schmos_url, notice: 'Schmo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @sm = Sm.find(params[:id])\n @sm.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n ... | [
"0.6819303",
"0.68119663",
"0.6769391",
"0.6734435",
"0.67130286",
"0.66772836",
"0.66752416",
"0.6663666",
"0.66578764",
"0.6643312",
"0.66416097",
"0.6622077",
"0.6617451",
"0.6602217",
"0.6601949",
"0.659684",
"0.6590565",
"0.65671605",
"0.65500444",
"0.6539571",
"0.653761... | 0.71664554 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_schmo
@schmo = Schmo.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def schmo_params
params.require(:schmo).permit(:name, :address, :ph, :email, :balance)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Area of the rectangle | def calculateArea
return @length * @breadth
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area; rect size; end",
"def area_of_rect(l, w)\n return l * w\nend",
"def area_of_rectangle(width, length)\n width*length\nend",
"def getArea()\n getWidth() * getHeight()\n end",
"def getArea\n getWidth() * getHeight\n end",
"def rectangle_area(width, height)\n area = width * hei... | [
"0.8737281",
"0.85755885",
"0.85345465",
"0.8389151",
"0.8362794",
"0.8357164",
"0.8352748",
"0.8352748",
"0.8333851",
"0.83041334",
"0.82851213",
"0.8284972",
"0.827472",
"0.81114954",
"0.7995751",
"0.7797921",
"0.77665716",
"0.7748925",
"0.7668848",
"0.76174223",
"0.7613669... | 0.7032526 | 57 |
write chain index to file. The file is a binary file, and payload of +block_list+ and +newest_block+ are stored. | def write_to_file
File.open(config.block_list_path, 'a') do |f|
block_count = old_newest_block ? (block_list.size - old_newest_block.height - 1) : block_list.size
block_list = self.block_list.sort{|(k1, v1), (k2, v2)| v1.height <=> v2.height}
block_list = block_list[(old_newest_block.height + 1)..-1] if old_newest_block
block_list.each_with_index do |(k, b), index|
f.write(b.to_payload)
f.flush
print "\r#{(((index + 1).to_f / block_count) * 100).to_i}% done write parsed block to #{config.block_list_path}."
end
f.write(newest_block.to_payload)
puts
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_block(type,index,payload)\n return Logfiles.write_block(wio,type,index,payload)\n end",
"def save\n File.open(@index_file, 'wb') do |f|\n f.puts Marshal::dump([@terms, @index])\n end\n end",
"def save\n File.open(@index_file, 'wb') do |f|\n Marshal.dump([@terms, ... | [
"0.6083968",
"0.58898723",
"0.5857545",
"0.58295625",
"0.5742699",
"0.5708285",
"0.5688307",
"0.56623816",
"0.5633655",
"0.5600889",
"0.55661744",
"0.5563343",
"0.5554566",
"0.54835206",
"0.54814553",
"0.5410083",
"0.5393533",
"0.530612",
"0.52935255",
"0.5284443",
"0.5175669... | 0.7374174 | 0 |
GET /spells, GET / | def spells
get_schools
get_classes
respond_to do |format|
format.json {
get_all_spells
render json: @spells.sort_by {|k, v| v['name']}.to_json
}
format.html {}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @spells = Spell.all\n end",
"def index\n\t\t@player_spells = PlayerSpell.all\n\tend",
"def spell\n fetch('harry_potter.spells')\n end",
"def index\n @class_spells = ClassSpell.all\n end",
"def index\n @prepared_spells = PreparedSpell.all\n end",
"def show\n resp... | [
"0.7501938",
"0.71436214",
"0.70778805",
"0.6834009",
"0.6431804",
"0.6240029",
"0.5946355",
"0.5910445",
"0.5861392",
"0.5855386",
"0.56545186",
"0.5642606",
"0.5577761",
"0.55225134",
"0.5487532",
"0.546907",
"0.54669714",
"0.5465389",
"0.54424864",
"0.54284704",
"0.5420462... | 0.76316035 | 0 |
update /etc/instancecontroller/logs.json for uploading presto logs to s3 | def s3LogJsonUpdate(presto_log_dir)
println "presto log dir : #{presto_log_dir}"
logs_json_path = "/etc/instance-controller/logs.json"
println "Updating #{logs_json_path}"
json_obj=JSON.parse(File.read("#{logs_json_path}"));
sections = json_obj["logFileTypes"]
sections.each { |section|
if section['typeName'] == 'SYSTEM_LOG' then
user_log = section['logFilePatterns']
user_log << {
"fileGlob" => "#{presto_log_dir}/var/log/(.*)",
"s3Path" => "node/$instance-id/apps/presto/$0",
"delayPush" => "true"
}
break
end
}
new_json=JSON.pretty_generate(json_obj)
File.open('/tmp/logs.json','w') do |file_w|
file_w.write("#{new_json}")
end
sudo "mv /tmp/logs.json #{logs_json_path}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def s3LogJsonUpdate(kafka_log_dir)\n println \"kafka log dir : #{kafka_log_dir}\"\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sections.each { |section|\n ... | [
"0.81232107",
"0.7113302",
"0.66561186",
"0.64058024",
"0.63489264",
"0.6261095",
"0.61307114",
"0.6074673",
"0.59518933",
"0.5686657",
"0.56133616",
"0.556654",
"0.55525357",
"0.5549918",
"0.5539249",
"0.55168897",
"0.5476781",
"0.5461878",
"0.5405351",
"0.54021746",
"0.5399... | 0.8267899 | 0 |
parses the configurable options given with the bootstrap action. All are optional | def parseOptions
configurable_options = {
:s3_path_to_presto_server_bin => "s3://support.elasticmapreduce/bootstrap-actions/presto/presto-server-0.78.tar.gz",
:s3_path_to_presto_cli => "s3://support.elasticmapreduce/bootstrap-actions/presto/presto-cli-0.78-executable.jar",
:hive_metastore_port => "9083"
}
opt_parser = OptionParser.new do |opt|
opt.banner = "Usage: install_presto [OPTIONS]"
opt.on("-s",'--s3-path-to-presto-server-bin [S3_PATH_TO_PRESTO_SERVER_BIN]',
"Ex : s3://path/to/bin/presto-server-[version_number].tar.gz") do |s3_path_to_presto_server_bin|
configurable_options[:s3_path_to_presto_server_bin] = s3_path_to_presto_server_bin
end
opt.on("-c",'--s3-path-to-presto-cli [S3_PATH_TO_PRESTO_CLI]',
"Ex : s3://path/to/bin/presto-cli-executible-[version_number].jar") do |s3_path_to_presto_cli|
configurable_options[:s3_path_to_presto_cli] = s3_path_to_presto_cli
end
opt.on("-m",'--s3-path-to-master-config [S3_PATH_TO_MASTER_CONFIG]',
"Ex : s3://path/to/config/dir/master.config )") do |s3_path_to_master_config|
configurable_options[:s3_path_to_master_config] = s3_path_to_master_config
end
opt.on("-w",'--s3-path-to-worker-config [S3_PATH_TO_WORKER_CONFIG]',
" EX : s3://path/to/config/dir/worker.config)") do |s3_path_to_worker_config|
configurable_options[:s3_path_to_worker_config] = s3_path_to_worker_config
end
opt.on("-p",'--hive-metastore-port [HIVE_METASTORE_PORT]',
" Defaults to 9083)") do |hive_metastore_port|
configurable_options[:hive_metastore_port] = hive_metastore_port
end
opt.on('-h', '--help', 'Display this message') do
puts opt
exit
end
end
opt_parser.parse!
return configurable_options;
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_options! #:nodoc:\n @options = { :recipes => [], :actions => [],\n :vars => {}, :pre_vars => {},\n :sysconf => default_sysconf, :dotfile => default_dotfile }\n\n if args.empty?\n warn \"Please specify at least one action to execute.\"\n warn option_parser... | [
"0.63154054",
"0.62293816",
"0.6156556",
"0.6120439",
"0.60153794",
"0.59768057",
"0.59768057",
"0.59768057",
"0.595287",
"0.595287",
"0.59414697",
"0.59384495",
"0.59039927",
"0.58953375",
"0.584661",
"0.57980955",
"0.5793433",
"0.5727997",
"0.57268226",
"0.56894016",
"0.567... | 0.5874498 | 14 |
write /etc/init.d/prestolauncher & /etc/servicenanny/presto.conf for servicenanny to monitor | def writePrestoFilesForServiceNanny
println "Making /etc/init.d/presto-launcher"
File.open('/tmp/presto-launcher', 'w') do |f|
f.write(<<EOF
/home/hadoop/presto-server/bin/launcher $@
EOF
)
end
sudo "mv /tmp/presto-launcher /etc/init.d/presto-launcher && chmod a+x /etc/init.d/presto-launcher"
println "Making /etc/service-nanny/presto.conf"
File.open('/tmp/presto.conf', 'w') do |f|
f.write(<<EOF
[
{
"name": "run-presto-server",
"type": "file",
"file": "#{$presto_run_dir}/run-presto-server",
"pattern": "1"
},
{
"name": "presto-server",
"type": "process",
"start": "/etc/init.d/presto-launcher start",
"stop": "/etc/init.d/presto-launcher stop",
"pid-file": "#{$presto_run_dir}/presto-server.pid",
"pattern": "presto-server",
"depends": ["run-presto-server"]
}
]
EOF
)
end
sudo "mv /tmp/presto.conf /etc/service-nanny/presto.conf"
sudo "echo '1' >/tmp/run-presto-server"
sudo "mv /tmp/run-presto-server /mnt/var/run/presto/run-presto-server"
sudo "chmod +x /etc/service-nanny/presto.conf"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_server(type, date)\n Shell.execute \"start #{upstart_script_filename(type, date).gsub(/^#{script_directory}\\//, '').gsub(/\\.conf$/, '')}\"\n end",
"def configureStartup\n `chkconfig --add nagios`\n `chkconfig --level 35 nagios on`\n `chkconfig --add httpd`\n `chkconfig --l... | [
"0.5744976",
"0.5652129",
"0.5627625",
"0.55946445",
"0.555321",
"0.5506026",
"0.5491714",
"0.5488017",
"0.5487081",
"0.54798007",
"0.547484",
"0.54664207",
"0.54534304",
"0.54130334",
"0.5410498",
"0.5402819",
"0.5366143",
"0.5358174",
"0.53487986",
"0.53475213",
"0.5308171"... | 0.7807695 | 0 |
The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is repeated exactly k times. Note: k is guaranteed to be a positive integer. For s = "4[ab]", the output should be decodeString(s) = "abababab" For s = "2[b3[a]]", the output should be decodeString(s) = "baaabaaa" Note: this solution only works with 2 levels of nested square brackets | def replace_encoded(str, regex)
str.scan(regex).each do |x|
str = str.sub("#{x[0]}[#{x[1]}]", x[1] * x[0].to_i)
end
str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decodeString(s)\n 1 while s.gsub!(/(\\d+)\\[([a-z]*)\\]/) { $2 * $1.to_i }\n s\nend",
"def decode(str)\n result = \"\"\n str.chars.each_with_index do |el, idx|\n if idx % 2 == 0\n key = str[idx + 1].to_i\n key.times do\n result += el\n end\n end\n end\n result\nend",
"def ... | [
"0.6898236",
"0.6306968",
"0.60266685",
"0.5889764",
"0.5884756",
"0.58447295",
"0.5842954",
"0.57571685",
"0.57510453",
"0.5747148",
"0.57404965",
"0.5733972",
"0.5673546",
"0.55976033",
"0.5591977",
"0.55680484",
"0.55677277",
"0.55655986",
"0.5551104",
"0.54930174",
"0.549... | 0.5270216 | 41 |
Turns query results into a hash keyed by event name, values are a set of unique user IDs for that event | def data
@data ||= begin
event_users = Hash.new do |h, uuid|
h[uuid] = Set.new
end
# IDEA: maybe there's a block form if this we can do that yields results as it loads them
# to go slightly faster
fetch_results.each do |row|
event_users[row['name']] << row['user_id']
end
event_users
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data\n @data ||= begin\n event_users = Hash.new do |h, event_name|\n h[event_name] = Set.new\n end\n\n # IDEA: maybe there's a block form if this we can do that yields results as it loads them\n # to go slightly faster\n fetch_results.each do |row|\n ev... | [
"0.7278814",
"0.6213512",
"0.6115961",
"0.6013456",
"0.5996851",
"0.59955543",
"0.59932077",
"0.5943491",
"0.59336543",
"0.5907099",
"0.58147174",
"0.5800028",
"0.57987255",
"0.57955736",
"0.57641184",
"0.57549167",
"0.5732454",
"0.5695671",
"0.5689444",
"0.5679773",
"0.56595... | 0.72536796 | 1 |
Directory of the input file | def input_dir
ENV['mapred_input_dir']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directory\n @directory ||= File.expand_path(File.dirname(file))\n end",
"def directory\n File.dirname @path\n end",
"def dir_name\n File.dirname(file_name)\n end",
"def directory\n File.dirname(@path) + '/'\n end",
"def dir\n calc_dir(@basename)\n end",
"def directory;... | [
"0.7256849",
"0.6994249",
"0.6786726",
"0.67843723",
"0.67690074",
"0.6702588",
"0.6702588",
"0.66673404",
"0.6648779",
"0.6620506",
"0.65500283",
"0.654608",
"0.6544043",
"0.6517264",
"0.65160245",
"0.6514815",
"0.6511904",
"0.65039927",
"0.64834625",
"0.64830095",
"0.643710... | 0.6922755 | 3 |
Offset of this chunk within the input file | def map_input_start_offset
ENV['map_input_start']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offset\n fil_header[:offset]\n end",
"def tell\n @offset\n end",
"def offset\n\t\t\t@position + @offset\n\t\tend",
"def byte_offset(loc) loc.y * line_byte_size + loc.x * pixel_byte_size; end",
"def lines_offset\n @starting_line - 1\n end",
"def offset; end",
"def offset; end... | [
"0.7363777",
"0.69336796",
"0.6904988",
"0.68578357",
"0.6818189",
"0.6736505",
"0.6736505",
"0.6736505",
"0.6667908",
"0.6655746",
"0.6645607",
"0.65575856",
"0.65435386",
"0.65065265",
"0.6461156",
"0.64482814",
"0.64155257",
"0.6406651",
"0.6400084",
"0.6391224",
"0.639122... | 0.59268326 | 67 |
length of the mapper's input chunk | def map_input_length
ENV['map_input_length']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunk_size()\n #This is a stub, used for indexing\n end",
"def length\n @length ||= (count.to_f / @per_chunk).ceil\n end",
"def total_in\n\t\t@input_buffer.length\n\tend",
"def input_size\n return input.first.command.size\n end",
"def total_in\n\t... | [
"0.7429016",
"0.7147109",
"0.7025619",
"0.6910388",
"0.6899956",
"0.6749689",
"0.6748568",
"0.67353404",
"0.671725",
"0.6675055",
"0.6656098",
"0.6626331",
"0.66145796",
"0.6611001",
"0.65860945",
"0.65526867",
"0.65507597",
"0.6525423",
"0.6525423",
"0.6475778",
"0.6461294",... | 0.71080923 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_transfer
@transfer = Transfer.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def transfer_params
params.require(:transfer).permit(:nama_pengirim, :nama_penerima, :no_rek, :nominal, :keterangan)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Initializes a new ZAP request. The security mechanism is set to CURVE (can be changed later). | def initialize(domain, credentials = [], mechanism: Mechanisms::CURVE)
@domain = domain
@credentials = credentials
@mechanism = mechanism
@version = VERSION
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(request_url, params, client, options = {})\n if params.is_a?(String)\n @string_params = params\n @hash_params = Hash.from_url_params(params)\n else\n unless options.kind_of?(Hash)\n options = {}\n end\n options[:skip_param_keys] ||= []\n #... | [
"0.65169096",
"0.6432653",
"0.6423272",
"0.6330767",
"0.625545",
"0.6215072",
"0.620527",
"0.6179301",
"0.6094011",
"0.6089483",
"0.60330904",
"0.5964824",
"0.5963675",
"0.59556985",
"0.59450173",
"0.5943401",
"0.59270114",
"0.59189355",
"0.590537",
"0.58905476",
"0.58703446"... | 0.0 | -1 |
Initializes a new response. | def initialize(status_code)
@status_code = status_code.to_s
raise ArgumentError unless ALL.include?(@status_code)
@version = VERSION
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response = response\n end",
"def initialize(response)\n @response =... | [
"0.79767466",
"0.7945351",
"0.7945351",
"0.7945351",
"0.7945351",
"0.78197616",
"0.75888395",
"0.7543758",
"0.75101167",
"0.7480676",
"0.7475213",
"0.7427679",
"0.74167264",
"0.7406836",
"0.72920525",
"0.7213491",
"0.7206326",
"0.7163924",
"0.7102348",
"0.70998394",
"0.709048... | 0.0 | -1 |
Returns the user ID, if authentication was successful. | def user_id
return nil unless success?
@user_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_user_id\n session[:current_user_id] unless session[:current_user_id].nil?\n end",
"def auth_user_id\n auth[:user_id]\n end",
"def get_authenticated_user # rubocop:disable Style/AccessorMethodName\n @user_id = YourMembership::Member.isAuthenticated(self)\n end",
"def user_id\n ... | [
"0.74364185",
"0.7347219",
"0.7345716",
"0.7201236",
"0.68811125",
"0.68785864",
"0.6862121",
"0.67895925",
"0.67840147",
"0.6758222",
"0.67141813",
"0.6712152",
"0.6667868",
"0.66666687",
"0.6646331",
"0.6638658",
"0.6637823",
"0.66047096",
"0.6556569",
"0.6555979",
"0.65470... | 0.7841099 | 0 |
Returns the meta data, if authentication was successful. | def meta_data
return nil unless success?
@meta_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metadata\n @meta_data\n end",
"def meta_data\n @meta_data ||= params['metaData']\n end",
"def user_info\n auth_hash['user_info']\n end",
"def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end",
"def metadata\n r... | [
"0.65194994",
"0.6234556",
"0.61730164",
"0.61438113",
"0.61438113",
"0.6120869",
"0.6114129",
"0.6085272",
"0.6083562",
"0.59939694",
"0.5990944",
"0.5949814",
"0.5948992",
"0.5938612",
"0.5899271",
"0.58932984",
"0.5873987",
"0.585858",
"0.58571815",
"0.5852336",
"0.5828417... | 0.7379037 | 0 |
Calculates a notched path that flows between the outer edge of the box (outside_line) and inner (inside_line). Relative location of these lines also defines the direction and orientation of the box, and hence the notches. We always want to create a symmetric path that has a notch in the middle (for center_out = true) or dip in the middle (center_out = false) | def path(edge)
shifts = define_shifts(edge)
path = NotchedPath.new
if fill_corners
r1 = Geometry::Rect.new(edge.inside.p1, edge.outside.p1)
r2 = Geometry::Rect.new(edge.inside.p2, edge.outside.p2)
path.corner_boxes << r1
path.corner_boxes << r2
end
point = edge.inside.p1.clone
vertices = [point]
shifts.each do |shift|
point = shift.next(point)
vertices << point
end
path.vertices = vertices
path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_path\n nodes = []\n angle = 2 * Math::PI / @sides\n theta = angle / 2 + Math::PI / 2\n @sides.times do |n|\n nodes[n] = []\n nodes[n][0] = @radius * Math.cos(angle * n + theta) + @x\n nodes[n][1] = @radius * Math.sin(angle * n + theta) + @y\n end... | [
"0.511261",
"0.4895138",
"0.47951463",
"0.47733837",
"0.47640806",
"0.47473344",
"0.4678335",
"0.46684912",
"0.46418127",
"0.4598969",
"0.45607543",
"0.45571336",
"0.45404562",
"0.44949138",
"0.4469788",
"0.44570097",
"0.44404832",
"0.44040582",
"0.44034803",
"0.43955457",
"0... | 0.5554023 | 0 |
This method has the bulk of the logic: we create the list of path deltas to be applied when we walk the edge next. | def define_shifts(edge)
along_iterator, across_iterator = define_shift_iterators(edge)
shifts = []
shifts << across_iterator.next if edge.add_across_line?(center_out)
(1..edge.notch_count).to_a.each do |count|
shifts << along_iterator.next
shifts << across_iterator.next unless count == edge.notch_count
end
shifts << across_iterator.next if edge.add_across_line?(center_out)
shifts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_edges(edges, l_act_edge)\n prev_edge = Edge.new\n\n prev_edge = edges;\n\n begin\n edges = prev_edge.next\n if (edges.delta_y > 1)\n edges.delta_y -= 1\n edges.x_int = edges.x_int - edges.delta_x\n prev_edge = edges\n else\n prev_ed... | [
"0.62411374",
"0.62360907",
"0.6047809",
"0.5985783",
"0.5910766",
"0.5830609",
"0.5825539",
"0.5752207",
"0.5711932",
"0.5674154",
"0.5651939",
"0.5651901",
"0.56508017",
"0.5612326",
"0.559967",
"0.55041397",
"0.54917574",
"0.54699093",
"0.54525536",
"0.54443985",
"0.541241... | 0.0 | -1 |
Pass a module with filter methods which should be available to all liquid views. Good for registering the standard library | def register_filter(mod)
StrainerFactory.add_global_filter(mod)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_filter(mod); end",
"def liquid_view_filters\n []\n end",
"def register_filter(mod)\n Strainer.global_filter(mod)\n end",
"def global_filter; end",
"def liquid_filters\n [\n DesignResourceFilter,\n AttributeFilter\n ]\n end",
"def filters\n end",
"def str... | [
"0.73041373",
"0.70516306",
"0.6754991",
"0.6663812",
"0.64085996",
"0.63994825",
"0.63458514",
"0.6318249",
"0.6304594",
"0.6304594",
"0.6298182",
"0.62399083",
"0.6151061",
"0.61330354",
"0.60169584",
"0.59143984",
"0.5905858",
"0.5815468",
"0.58137256",
"0.5809609",
"0.580... | 0.6782252 | 2 |
creates a new Template object from liquid source code To enable profiling, pass in profile: true as an option. See Liquid::Profiler for more information | def parse(source, options = {})
new.parse(source, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(source)\n template = Template.new\n template.parse(source)\n template\n end",
"def precompiled_template(locals = {})\n @src\n end",
"def precompiled_template(locals = {})\n @src\n end",
"def prepare_liquid_template(template)\n end",
"def template\n... | [
"0.6989701",
"0.6673587",
"0.6640795",
"0.659774",
"0.6570216",
"0.64499366",
"0.63201684",
"0.6280336",
"0.6280336",
"0.6213447",
"0.61703104",
"0.6081682",
"0.60626763",
"0.60047144",
"0.5979331",
"0.5972156",
"0.5955563",
"0.5952048",
"0.5948702",
"0.5907529",
"0.58913994"... | 0.0 | -1 |
Parse source code. Returns self for easy chaining | def parse(source, options = {})
parse_context = configure_options(options)
tokenizer = parse_context.new_tokenizer(source, start_line_number: @line_numbers && 1)
@root = Document.parse(tokenizer, parse_context)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(source); end",
"def parse(source)\n Parser.parse(source)\n end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def parse(source)\n @parser.parse(@scanner.scan(source))\n end",
"def parse(source, options = {})\n new.p... | [
"0.8080453",
"0.7659636",
"0.74575233",
"0.74575233",
"0.74575233",
"0.73705333",
"0.7295878",
"0.70985526",
"0.70657474",
"0.7049437",
"0.6974573",
"0.6964625",
"0.6756798",
"0.6689205",
"0.66773313",
"0.6665027",
"0.6665027",
"0.6647752",
"0.66167814",
"0.6578629",
"0.65759... | 0.6411166 | 25 |
Render takes a hash with local variables. if you use the same filters over and over again consider registering them globally with Template.register_filter if profiling was enabled in Templateparse then the resulting profiling information will be available via Templateprofiler Following options can be passed: filters : array with local filters registers : hash with register variables. Those can be accessed from filters and tags and might be useful to integrate liquid more with its host application | def render(*args)
return '' if @root.nil?
context = case args.first
when Liquid::Context
c = args.shift
if @rethrow_errors
c.exception_renderer = Liquid::RAISE_EXCEPTION_LAMBDA
end
c
when Liquid::Drop
drop = args.shift
drop.context = Context.new([drop, assigns], instance_assigns, registers, @rethrow_errors, @resource_limits)
when Hash
Context.new([args.shift, assigns], instance_assigns, registers, @rethrow_errors, @resource_limits)
when nil
Context.new(assigns, instance_assigns, registers, @rethrow_errors, @resource_limits)
else
raise ArgumentError, "Expected Hash or Liquid::Context as parameter"
end
output = nil
case args.last
when Hash
options = args.pop
output = options[:output] if options[:output]
static_registers = context.registers.static
options[:registers]&.each do |key, register|
static_registers[key] = register
end
apply_options_to_context(context, options)
when Module, Array
context.add_filters(args.pop)
end
# Retrying a render resets resource usage
context.resource_limits.reset
if @profiling && context.profiler.nil?
@profiler = context.profiler = Liquid::Profiler.new
end
context.template_name ||= name
begin
# render the nodelist.
@root.render_to_output_buffer(context, output || +'')
rescue Liquid::MemoryError => e
context.handle_error(e)
ensure
@errors = context.errors
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(options = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def render_with(**locals)\n render_with_template(locals: locals)\n end",
"def render_with_liquid?; end",
"def render_with_liquid?; end",
"def filter\n setup_instance_variables\n render 'index'\n end",
"def liqu... | [
"0.6587153",
"0.6435948",
"0.6266756",
"0.6266756",
"0.6231331",
"0.6202872",
"0.6126336",
"0.61160755",
"0.61154157",
"0.6087228",
"0.6087228",
"0.60227185",
"0.6012561",
"0.596274",
"0.595769",
"0.5915394",
"0.5913533",
"0.5877454",
"0.5868317",
"0.586287",
"0.58627385",
... | 0.6030842 | 11 |
Ensures submitted year string is reasonably sane | def valid_year?
oldest_year = Time.zone.now.year - 5
latest_year = Time.zone.now.year + 5
return if (oldest_year..latest_year).cover?(graduation_year.to_i)
errors.add(:graduation_year, 'Invalid graduation year')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_year(input, year)\n max_year = Date.today.year + 2\n year <= max_year && year >= 1900\n end",
"def year_via_ruby_parsing\n return unless orig_date_str =~ /\\d\\d/ # need at least 2 digits\n # need more in string than only 2 digits\n return if orig_date_str.match... | [
"0.7775211",
"0.74850935",
"0.7367469",
"0.7285616",
"0.72610676",
"0.7204691",
"0.7170564",
"0.711654",
"0.7113549",
"0.7100703",
"0.7014206",
"0.6982753",
"0.6952954",
"0.69509053",
"0.6944325",
"0.69417006",
"0.6921422",
"0.69123244",
"0.68944335",
"0.686884",
"0.68502474"... | 0.66610974 | 26 |
Combine the UI supplied month and year into a datetime object | def combine_graduation_date
self.grad_date = Time.zone.local(graduation_year.to_i,
Date::MONTHNAMES.index(graduation_month))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_date_from_year_month(data)\n dt = data['year']\n if data['month']\n dt += '-' + data['month'] + '-1'\n end\n dt\n end",
"def publish_month_and_year\n [publish_on.month, publish_on.year]\n end",
"def month_of_year(*months)\n merge(month: months)\n end",
"de... | [
"0.7293942",
"0.659538",
"0.6460824",
"0.6379645",
"0.63769686",
"0.6356399",
"0.63150215",
"0.6196625",
"0.6192206",
"0.6192206",
"0.6167933",
"0.61219156",
"0.6070553",
"0.6022769",
"0.6014927",
"0.59764045",
"0.5960195",
"0.5943031",
"0.59141576",
"0.58931035",
"0.5892424"... | 0.0 | -1 |
THIS IS A TOTAL HACK. Trying to scope where to look on the page. This will make the original step, without the "within subheading" part | def reconstitute_step(step_text, table)
@keep_hold_of_raw_table = table
step_text+":"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cur_heading\n $HEADINGS[0]\nend",
"def places_of_interest\n capture_haml do\n haml_tag :div, class: 'poi' do\n expander\n bar\n end\n end\n end",
"def build_heading level\n heading = super\n\n @section = heading.text\n\n heading\n end",
... | [
"0.5959006",
"0.5889816",
"0.58803445",
"0.56940585",
"0.5659796",
"0.5484181",
"0.54713124",
"0.54327184",
"0.5417966",
"0.5381293",
"0.537121",
"0.5362003",
"0.53132457",
"0.52892685",
"0.5285967",
"0.52847797",
"0.5264387",
"0.5253439",
"0.5250011",
"0.5247662",
"0.5247014... | 0.0 | -1 |
to print "Hello!" twice. | def greeting
puts "Hello!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def this_output_twice\n print \"Calling print or puts\"\nend",
"def hello\n puts \"Hello Dude!!!\"\n puts \"Hellod Douchebag!!!\"\nend",
"def print_two_again(arg1, arg2) \r\n \tputs \"arg1: #{arg1}, arg2: #{arg2}\"\r\n end",
"def say_hello_ten_times #method signature\n phrase = \"Hello World\"\n p... | [
"0.7479575",
"0.6763845",
"0.6730663",
"0.66267717",
"0.66137666",
"0.6577955",
"0.65751195",
"0.65721506",
"0.65721506",
"0.65721506",
"0.65721506",
"0.65710735",
"0.6551262",
"0.65293473",
"0.65293473",
"0.65293473",
"0.65293473",
"0.65293473",
"0.65293473",
"0.65293473",
"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.