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 |
|---|---|---|---|---|---|---|
DELETE /minumen/1 DELETE /minumen/1.json | def destroy
@minuman.destroy
respond_to do |format|
format.html { redirect_to minumen_url, notice: 'Minuman was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to ... | [
"0.692041",
"0.6753942",
"0.66980445",
"0.6630836",
"0.66298884",
"0.6552481",
"0.6537767",
"0.65110785",
"0.6494982",
"0.6473316",
"0.6466775",
"0.6460174",
"0.645114",
"0.64442205",
"0.6435797",
"0.6431703",
"0.64227897",
"0.64171326",
"0.63979447",
"0.639683",
"0.63965845"... | 0.6596285 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_minuman
@minuman = Minuman.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 |
Never trust parameters from the scary internet, only allow the white list through. | def minuman_params
params.fetch(:minuman, {})
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.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
attempting to connect login to users | def login_is_valid
username = params["uname"]
password = params["psw"]
if username == "admin" && password == "password"
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_to_login\n User.login(self.name, self.password)\n end",
"def login; end",
"def login\n end",
"def login\n client.login(\n params[:user],\n params[:password],\n authParams: {\n scope: 'openid name email'\n },\n connection: 'Username-Password-Authentication'\n ... | [
"0.7239709",
"0.72365034",
"0.7222955",
"0.7163254",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.71093374",
"0.71093374",
"0.7049157",
"0.6981573",
"0.6962475",
"0.6932809",
"0.69017315",
"0.68457365"... | 0.0 | -1 |
Here's a handy guide: The major takeaway for being able to read this code is to understand that these things, called symbols, are essentially global constants. They cannot be declared or assigned. They are referenced by a string representation preceded by a colon. All symbols with the same string representation are the SAME OBJECT. Above, we were using the symbols as an obtuse way to reference a string. This is not a realistic use. On the other hand, if there are global tokens that should always reference the same thing: | def planetaryWelcome(planet)
if [:mercury, :venus, :earth, :mars, :jupiter, :saturn, :uranus, :neptune].include? planet
puts "Welcome to planet #{planet}!"
else
puts "#{planet} is not a planet!"
if [:moon].include? planet
puts "Come to the dark side, we have cake."
elsif [:pluto].include? planet
puts "Sorry dude."
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def objects_and_symbols; end",
"def symbols; end",
"def symbol\n @symbol\n end",
"def symbols() @symbols end",
"def symbol\n :R\n end",
"def symbolidentifier\n\n \t\n\t... | [
"0.69113374",
"0.69113374",
"0.69113374",
"0.69113374",
"0.69113374",
"0.69113374",
"0.68875116",
"0.67763805",
"0.67164433",
"0.6650552",
"0.63615495",
"0.63352233",
"0.6324929",
"0.62851375",
"0.62288034",
"0.618387",
"0.6167982",
"0.61440414",
"0.6103599",
"0.6050412",
"0.... | 0.0 | -1 |
Calculate and set the corrective_change parameter, based on the old_system_value of the property. | def calculate_corrective_change(old_system_value)
# Only idempotent properties, and cases where we have an old system_value
# are corrective_changes.
if @property_instance.idempotent? &&
!@property_instance.sensitive &&
!old_system_value.nil?
# If the values aren't insync, we have confirmed a corrective_change
insync = @property_instance.insync_values?(old_system_value, previous_value)
# Preserve the nil state, but flip true/false
@corrective_change = insync.nil? ? nil : !insync
else
@corrective_change = false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changed_value(property)\n new_value = new_resource.send(property)\n return new_value if current_resource.nil?\n\n current_value = current_resource.send(property)\n\n return current_value if required_properties.include? property\n\n new_value == current_value ? nil : new_value\n end",
"def cha... | [
"0.6497386",
"0.60641843",
"0.6031669",
"0.5838843",
"0.5789279",
"0.5634075",
"0.55774206",
"0.5522548",
"0.55003774",
"0.54552",
"0.54224056",
"0.54061586",
"0.53566515",
"0.53543466",
"0.534424",
"0.53415537",
"0.5340293",
"0.53168666",
"0.5264588",
"0.52580327",
"0.524801... | 0.81333745 | 0 |
If it's a failure, use 'err', else use either the resource's log level (if available) or 'notice'. | def log_level
status == "failure" ? :err : (@default_log_level || :notice)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollbar_level(severity)\n [:debug, :info, :warning, :error, :critical, :error][severity] || :error\n end",
"def level\n Logger::Severity.constants.each do |name|\n return name.downcase.to_sym if @logger.level.eql?(Logger::Severity.const_get(name))\n end\n raise \"error\"\n en... | [
"0.6471586",
"0.64533466",
"0.6344949",
"0.6226175",
"0.61946154",
"0.6092242",
"0.60480857",
"0.60421276",
"0.60421276",
"0.602095",
"0.60084015",
"0.60084015",
"0.59934914",
"0.59897155",
"0.5955885",
"0.5925081",
"0.5910066",
"0.58708024",
"0.5869981",
"0.5863575",
"0.5828... | 0.7750526 | 0 |
Used by the Logging module | def log_source
source_description || property || resource
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logger_output; end",
"def log_writer; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; e... | [
"0.77528805",
"0.7639025",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
... | 0.0 | -1 |
Print a short summary of the list. | def to_s
sprintf("#<%s:0x%x size=%d>", self.class.name, object_id, @size)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summary\n @items.map { |i| \"* #{i.title}\" }.join(\"\\n\")\n end",
"def print_summary\r\n traverse do |node|\r\n print node.effectively_skipped? ? '-' : '+'\r\n case\r\n when node.test? then print 'T'\r\n when node.suite? then print 'S'\r\n when node.static? the... | [
"0.7308192",
"0.7046981",
"0.6886973",
"0.67912745",
"0.6763501",
"0.6756746",
"0.67528033",
"0.67180103",
"0.6704319",
"0.6692735",
"0.66745",
"0.6666163",
"0.6642983",
"0.6642983",
"0.6640412",
"0.6629535",
"0.6619164",
"0.6619164",
"0.6619164",
"0.6619164",
"0.6610866",
... | 0.0 | -1 |
Fast, safe, unbounded accumulation of children. | def to_a
items = []
current = self
while current.tail != self
unless current.tail.is_a?(Iterator)
items << current.tail
end
current = current.tail
end
return items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_child_elements(memo = [])\n memo\n end",
"def collect_child_elements(memo = [])\n memo\n end",
"def collect_child_elements(memo = [])\n memo\n end",
"def all_children(accummulator=[])\n return accummulator if children.size == 0\n children.each do |child_i... | [
"0.6623573",
"0.6623573",
"0.6623573",
"0.65060663",
"0.64659846",
"0.64284015",
"0.63667667",
"0.6209316",
"0.6194813",
"0.61451435",
"0.6137409",
"0.61086774",
"0.60678965",
"0.6017126",
"0.600901",
"0.59775513",
"0.5952149",
"0.58408004",
"0.57900107",
"0.5771094",
"0.5728... | 0.0 | -1 |
A callback that is invoked when an item is added to the list. | def added(node)
@size += 1
return node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(item)\n\t\t#takes in item and adds to list\n\t\t@list << item\n\tend",
"def add_item(item)\r\n @list << item \r\n end",
"def on_add(&block)\n @add_proc = block\n end",
"def add_item(item)\n @get_items << item\n end",
"def addItem(item)\n @items << item\n end",
"def add_... | [
"0.7172329",
"0.7149613",
"0.6701956",
"0.64949346",
"0.64820355",
"0.645346",
"0.63813996",
"0.63811094",
"0.6361909",
"0.6355626",
"0.63524795",
"0.6342609",
"0.62787616",
"0.6270286",
"0.62450546",
"0.62250394",
"0.6201345",
"0.6183714",
"0.6131977",
"0.6060969",
"0.603182... | 0.0 | -1 |
Append a node to the end of the list. | def append(node)
if node.head
raise ArgumentError, "Node is already in a list!"
end
node.tail = self
@head.tail = node
node.head = @head
@head = node
return added(node)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(node)\n if next_node\n next_node.append(node)\n else\n next_node = node\n end\n end",
"def append(node)\n if @head.next.nil?\n @head.next = node\n else\n tail\n @current_node.next = node\n end\n end",
"def append(node)\n ... | [
"0.8177517",
"0.7799696",
"0.7706505",
"0.7628306",
"0.7623762",
"0.76045775",
"0.7581344",
"0.7519248",
"0.75068057",
"0.74191725",
"0.7396706",
"0.73656386",
"0.73631907",
"0.734137",
"0.7337335",
"0.7333959",
"0.7277202",
"0.7270262",
"0.72676307",
"0.72648823",
"0.7257583... | 0.75659466 | 7 |
A callback that is invoked when an item is removed from the list. | def removed(node)
@size -= 1
return node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_item(list, item_removed)\n list.delete(item_removed)\nend",
"def remove_item(list, item_remove)\n list.delete(item_remove)\nend",
"def remove_an_item(list, item)\n #method to remove item\n list.delete(item)\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_item (lis... | [
"0.76671064",
"0.7247406",
"0.7173165",
"0.7161813",
"0.7143181",
"0.71277976",
"0.71241826",
"0.7123011",
"0.7123011",
"0.7080409",
"0.7015575",
"0.7014446",
"0.7004985",
"0.7004259",
"0.6973761",
"0.6966492",
"0.6960967",
"0.6939578",
"0.6937549",
"0.693241",
"0.6917282",
... | 0.0 | -1 |
Remove the node if it is in a list. You should be careful to only remove nodes that are part of this list. | def remove?(node)
if node.head
return remove!(node)
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end",
"def remove_from_list(list)\n li = Fl::Framework::List::ListItem.query_for_listable_in_list(self, list).first\n if li.nil?\n false\n... | [
"0.6642302",
"0.6596331",
"0.64553654",
"0.6414349",
"0.63419306",
"0.63090044",
"0.62986803",
"0.62652946",
"0.62407154",
"0.617381",
"0.61465704",
"0.60795605",
"0.6079463",
"0.6073038",
"0.60277075",
"0.60013115",
"0.594602",
"0.59304744",
"0.5924987",
"0.5914537",
"0.5893... | 0.689051 | 0 |
Determine whether the given node is included in the list. | def include?(needle)
self.each do |item|
return true if needle.equal?(item)
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include?(el)\n list.include?(el)\n end",
"def include?(node)\n @pathway.graph[node] ? true : false\n end",
"def include?(element)\n @element_list.include? element\n end",
"def includes?(data)\n node = @head\n include_array = []\n until node.nil?\n include_array << node.d... | [
"0.7507986",
"0.7331201",
"0.72192067",
"0.7134357",
"0.703894",
"0.70134133",
"0.68320674",
"0.6818113",
"0.6760324",
"0.6692242",
"0.65774333",
"0.6517273",
"0.64987206",
"0.6481585",
"0.64811957",
"0.646513",
"0.64596057",
"0.6453263",
"0.6388799",
"0.63333875",
"0.6331430... | 0.0 | -1 |
def num_requests Request.where("receiver_id = ? AND accepted IS NULL", self.id).size end | def recommendations
User.where.not(id: self.friends).or(User.where.not(id: self.inverse_friends)).limit(5)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_requests\r\n return @requests.length\r\n end",
"def number_requests\r\n\t\treturn @requests.length\r\n \tend",
"def count_of_associated_requests\n self.requests.functional.count\n end",
"def size()\n @requests.length\n end",
"def count_of_existing_requests_through_step\n req... | [
"0.7588314",
"0.7424019",
"0.72864515",
"0.71836996",
"0.6893205",
"0.6787635",
"0.67735523",
"0.6525386",
"0.651995",
"0.65078735",
"0.64590865",
"0.6434623",
"0.6417707",
"0.63869584",
"0.6384158",
"0.63833857",
"0.6363117",
"0.6363117",
"0.6354333",
"0.63421285",
"0.630569... | 0.0 | -1 |
should answered survey (merged with answers), which can be saved (send button) | def show # BROKEN layout
cookies.delete :journal_entry
@options = {:answers => true, :disabled => false, :action => "show"}
@journal_entry = JournalEntry.and_survey_answer.find(params[:id])
cookies[:journal_entry] = @journal_entry.id
@survey_answer = SurveyAnswer.and_answer_cells.find(@journal_entry.survey_answer_id)
@@surveys[@journal_entry.survey_id] ||= Survey.and_questions.find(@survey_answer.survey_id)
@survey = @@surveys[@journal_entry.survey_id]
@survey.merge_survey_answer(@survey_answer)
@page_title = "CBCL - Vis Svar: " << @survey.get_title
render :layout => 'survey' # :template => 'surveys/show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answer\n params[:answers].each do |question_id, value|\n answer = Answer.find_or_initialize_by_question_id_and_user_id(question_id, current_user.id)\n answer.content = value[:content]\n answer.save\n end if params[:answers]\n\n survey = Survey.find(params[:id])\n redirect_to survey.n... | [
"0.7025898",
"0.695287",
"0.68001616",
"0.6730016",
"0.6730016",
"0.65000147",
"0.6445978",
"0.6407693",
"0.64025706",
"0.6397086",
"0.6353377",
"0.63512486",
"0.6346199",
"0.6339251",
"0.63265485",
"0.6316836",
"0.6296336",
"0.62623453",
"0.6258481",
"0.62574756",
"0.6251837... | 0.0 | -1 |
updates survey page with dynamic data. Consider moving to separate JavascriptsController | def dynamic_data
@journal_entry = JournalEntry.find(params[:id], :include => :journal)
save_interval = current_user && current_user.login_user && 30 || 20 # change to 900, 60
save_draft_url = "/survey_answers/save_draft/#{@journal_entry.id}"
logger.info "dynamic_data: current_user: #{current_user.inspect} entry: #{@journal_entry.inspect}"
# sleep(3000)
respond_to do |format|
if current_user.nil?
format.js {
render :update do |page|
page.replace_html 'centertitle', "Du er ikke logget ind"
page.visual_effect :pulsate, 'centertitle'
page.visual_effect :blind_up, 'content_survey', :duration => 6
page.visual_effect :fade, 'surveyform', :duration => 6
page.alert "Du bliver sendt til login-siden."
page.redirect_to login_path
end
}
elsif current_user && !current_user.login_user
format.js {
render :update do |page|
page.replace_html 'centertitle', @journal_entry.journal.center.get_title
page.insert_html :bottom, 'survey_journal_info', :partial => 'surveys/survey_header_info'
page.insert_html :bottom, 'survey_fast_input', :partial => 'surveys/fast_input_button'
page.insert_html :bottom, 'back_button', :partial => 'surveys/back_button'
page.show 'save_draft'
page.show 'submit_button'
end
}
else # login users
format.js {
render :update do |page|
page.replace_html 'centertitle', @journal_entry.journal.center.get_title
page.insert_html :bottom, 'survey_journal_info', :partial => 'surveys/survey_header_info_login_user'
page.show 'save_draft'
page.show 'submit_button'
end
}
end
end
rescue RecordNotFound
render :update do |page|
logger.info "dynamic_data: fejl! #{@journal_entry.id} journal id/kode: #{@journal_entry.journal.id}/#{@journal_entry.journal.code}"
page.alert "Der er sket en fejl, du skal logge ud og ind igen", @journal_entry.journal.center.get_title
page.redirect_to logout_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @survey = Survey.find(params[:id])\n success = @survey.update_attributes(params[:survey])\n \n puts \"UPDATE: Survey:#{@survey.id} - #{@survey.name}\"\n # Load the JSON Survey form data.\n survey_questions = ActiveSupport::JSON.decode(@survey.survey_data)\n #y survey_questions\n ... | [
"0.7150275",
"0.6779533",
"0.66367364",
"0.66367364",
"0.64643216",
"0.64399797",
"0.64377576",
"0.64189136",
"0.6370882",
"0.63076866",
"0.6300279",
"0.6299061",
"0.62817234",
"0.6221292",
"0.6205046",
"0.62032825",
"0.62008965",
"0.6194174",
"0.6185349",
"0.6176729",
"0.616... | 0.6160734 | 21 |
update survey_answer, journal_entry.answered_at, csv_survey_answers.age, csv_score_rapports.age | created_at, csv_answers.age | def update_date
entry = JournalEntry.find(params[:journal_entry][:id])
entry.follow_up = params[:journal_entry][:follow_up]
date_param = params[:journal_entry][:created]
if date_param.blank?
entry.save
flash[:notice] = "Opfølgning er rettet"
redirect_to journaL_path(entry.journal)
end
sep = date_param.include?("/") && "/" || date_param.include?("-") && "-"
d = date_param.split(sep).map {|p| p.to_i }
date = [d[2],d[1],d[0]]
created = Date.new(*date)
entry.update_date(created)
# age = ((created - entry.journal.birthdate).to_i / 365.25).floor
# entry.survey_answer.age = age
# entry.answered_at = created
# entry.save
# entry.survey_answer.created_at = created
# entry.survey_answer.save
# csv_score_rapport = CsvScoreRapport.find_by_survey_answer_id(entry.survey_answer_id)
# if csv_score_rapport
# csv_score_rapport.age = age if csv_score_rapport
# csv_score_rapport.created_at = created
# csv_score_rapport.save
# end
# csv_survey_answer = CsvSurveyAnswer.find_by_journal_entry_id(entry.id)
# if csv_survey_answer
# csv_survey_answer.created_at = created
# csv_survey_answer.age = age if csv_survey_answer
# csv_survey_answer.save
# end
# score_rapport = ScoreRapport.find_by_survey_answer_id(entry.survey_answer_id)
# if score_rapport
# score_rapport.age = age
# score_rapport.created_at = created
# score_rapport.save
# end
flash[:notice] = "Besvarelsesdato og opfølgning er rettet"
redirect_to journal_path(entry.journal)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateAnswer(ls,time)\n # ls is a list of list of answerd_factor_id, statistic_id pairs\n # t contains date information\n puts ls.inspect\n ls.each do |e|\n sid = e[0][1].to_i\n stat = Statistic.where(id: sid)\n\n amount = stat[0].EvalEquation(current_user.id, e)\n #if exists\n ... | [
"0.6230133",
"0.58326024",
"0.5832444",
"0.58173835",
"0.5680395",
"0.56374854",
"0.56374854",
"0.5615608",
"0.56051624",
"0.5558463",
"0.5546829",
"0.5539872",
"0.5533647",
"0.55181533",
"0.55128765",
"0.55125326",
"0.5503305",
"0.5495543",
"0.5476523",
"0.54755694",
"0.5475... | 0.6391308 | 0 |
GET /post302s/1 GET /post302s/1.xml | def show
@post302 = Post302.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @post302 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @post302 = Post302.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post302 }\n end\n end",
"def get_response_with_redirect(uri)\n r = Net::HTTP.get_response(uri)\n if r.code == \"301\"\n r = Net::HTTP.get_response(URI.parse(r.heade... | [
"0.6549692",
"0.64149165",
"0.62923175",
"0.62308323",
"0.60587853",
"0.5903428",
"0.58748364",
"0.58030635",
"0.5652155",
"0.5641995",
"0.5627749",
"0.5627476",
"0.5604831",
"0.56004226",
"0.5590861",
"0.5518629",
"0.5481308",
"0.5477773",
"0.5472376",
"0.54668015",
"0.54580... | 0.6360954 | 2 |
GET /post302s/new GET /post302s/new.xml | def new
@post302 = Post302.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @post302 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @post302 = Post302.new(params[:post302])\n\n respond_to do |format|\n if @post302.save\n format.html { redirect_to(@post302, :notice => 'Post302 was successfully created.') }\n format.xml { render :xml => @post302, :status => :created, :location => @post302 }\n else\n ... | [
"0.72212535",
"0.65230787",
"0.6439",
"0.6321765",
"0.6261677",
"0.62541753",
"0.62162423",
"0.6197615",
"0.61881196",
"0.6173761",
"0.61640406",
"0.6133067",
"0.6119894",
"0.6119476",
"0.6112073",
"0.61101675",
"0.61096144",
"0.60991657",
"0.6096511",
"0.6085207",
"0.6083968... | 0.7872124 | 0 |
POST /post302s POST /post302s.xml | def create
@post302 = Post302.new(params[:post302])
respond_to do |format|
if @post302.save
format.html { redirect_to(@post302, :notice => 'Post302 was successfully created.') }
format.xml { render :xml => @post302, :status => :created, :location => @post302 }
else
format.html { render :action => "new" }
format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @post302 = Post302.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post302 }\n end\n end",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def handle_302_found(respons... | [
"0.6120217",
"0.5955325",
"0.5949562",
"0.59292334",
"0.5918934",
"0.5697211",
"0.56586057",
"0.55532104",
"0.5456347",
"0.54507",
"0.54414684",
"0.542774",
"0.5393097",
"0.53402615",
"0.53277475",
"0.5300678",
"0.5291032",
"0.5270065",
"0.52504176",
"0.51715666",
"0.5163437"... | 0.67140645 | 0 |
PUT /post302s/1 PUT /post302s/1.xml | def update
@post302 = Post302.find(params[:id])
respond_to do |format|
if @post302.update_attributes(params[:post302])
format.html { redirect_to(@post302, :notice => 'Post302 was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n... | [
"0.6011841",
"0.59300005",
"0.591647",
"0.57253903",
"0.5571001",
"0.5543961",
"0.5415907",
"0.5407396",
"0.5377314",
"0.53258103",
"0.5306364",
"0.530303",
"0.5289401",
"0.5247236",
"0.5246094",
"0.5211587",
"0.52012855",
"0.5182247",
"0.5178692",
"0.5175493",
"0.51650393",
... | 0.65349734 | 0 |
DELETE /post302s/1 DELETE /post302s/1.xml | def destroy
@post302 = Post302.find(params[:id])
@post302.destroy
respond_to do |format|
format.html { redirect_to(post302s_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @post306 = Post306.find(params[:id])\n @post306.destroy\n\n respond_to do |format|\n format.html { redirect_to(post306s_ur... | [
"0.68401355",
"0.67884856",
"0.67702645",
"0.6734704",
"0.67324454",
"0.6721978",
"0.66853327",
"0.666699",
"0.66553324",
"0.6646322",
"0.66428",
"0.6632472",
"0.6623396",
"0.66042864",
"0.65998757",
"0.6596214",
"0.65933204",
"0.6580198",
"0.6576345",
"0.6572139",
"0.6567020... | 0.73653924 | 0 |
Sets the number of columns defined in TotalSpaces2 for the main display. This does not change the actual number of desktops present, you should call add_desktops or remove_desktops as appropriate after changing the number of columns. TotalSpaces2.set_grid_columns(3) | def set_grid_columns(columns)
TSApi.tsapi_setDefinedColumnsOnDisplay(columns, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_grid_dimensions(row_count, col_count)\n \n # Forbid resetting grid dimensions\n if @grid_dimensions_set\n Vizkit.warn(\"Error: You may set grid dimensions before configuration only.\")\n return\n else\n @grid_dimensions_set = true\n end\n ... | [
"0.57499975",
"0.57351977",
"0.5553342",
"0.54429096",
"0.53897727",
"0.5343184",
"0.5292715",
"0.52680224",
"0.5255623",
"0.52552164",
"0.52504885",
"0.52255446",
"0.52213967",
"0.5198733",
"0.51953804",
"0.5178039",
"0.51529235",
"0.5151116",
"0.5140587",
"0.5122981",
"0.50... | 0.5647578 | 2 |
Sets the number of columns defined in TotalSpaces2. This does not change the actual number of desktops present, you should call add_desktops_on_display or remove_desktops_on_display as appropriate after changing the number of columns. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.set_grid_columns_on_display(3, display_id) | def set_grid_columns_on_display(columns, display_id)
TSApi.tsapi_setDefinedColumnsOnDisplay(columns, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_grid_columns(columns)\n TSApi.tsapi_setDefinedColumnsOnDisplay(columns, 0)\n end",
"def columns=(n)\n @columns = n\n end",
"def columns=(integer); end",
"def set_cols(visible, list)\n @rows = 1 if visible\n @cols = (depends_on & list).find_all { |u| u.visible }.inject(0) { |s, v... | [
"0.6480799",
"0.6065957",
"0.57874715",
"0.5679564",
"0.56277114",
"0.55837053",
"0.5569885",
"0.55534035",
"0.55436236",
"0.5448767",
"0.5390982",
"0.53886837",
"0.5314076",
"0.5309804",
"0.5278624",
"0.5226935",
"0.52188313",
"0.520026",
"0.519874",
"0.51839453",
"0.5180914... | 0.64236224 | 1 |
Command TotalSpaces2 to switch to the given space number on the main display. Returns false if the space number was invalid. The on_space_change notification will be sent. TotalSpaces2.move_to_space(1) | def move_to_space(space_number)
TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end",
"def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_numbe... | [
"0.67794645",
"0.6774059",
"0.65374786",
"0.63984084",
"0.63631827",
"0.60728097",
"0.54985917",
"0.541382",
"0.5356555",
"0.53110063",
"0.52830863",
"0.52224225",
"0.5218815",
"0.52141035",
"0.52128756",
"0.51518625",
"0.5148263",
"0.5148263",
"0.5148263",
"0.5148263",
"0.51... | 0.7209901 | 0 |
Command TotalSpaces2 to switch to the given space number. Returns false if the space number was invalid. The on_space_change notification will be sent. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.move_to_space_on_Display(1, display_id) | def move_to_space_on_display(space_number, display_id)
TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_num... | [
"0.7483297",
"0.7446562",
"0.7297412",
"0.70637596",
"0.68068033",
"0.65397274",
"0.5806738",
"0.56229657",
"0.55475396",
"0.55475396",
"0.55475396",
"0.55475396",
"0.55475396",
"0.5546392",
"0.5512218",
"0.55027515",
"0.5498527",
"0.5412345",
"0.53761727",
"0.5375988",
"0.53... | 0.78626525 | 0 |
Set the name for a space on the main display. Note that using this command will cause a layout change notification to be sent if the new name was different from that previously set. The maximum length for a name is 255 bytes. TotalSpaces2.set_name_for_space(1, "Home") | def set_name_for_space(space_number, name)
TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home_name=(n)\n @home_name = n\n end",
"def set_name_for_space_on_display(space_number, name, display_id)\n TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, display_id)\n end",
"def changeName\r\n\t\tcheckSpace\r\n\tend",
"def change_space(namespace)\n update!(name: namespace)\n e... | [
"0.66215265",
"0.6485476",
"0.6408985",
"0.6023407",
"0.5976263",
"0.59232134",
"0.58171034",
"0.5785348",
"0.5760498",
"0.57510954",
"0.57435024",
"0.5672328",
"0.5667304",
"0.56596595",
"0.56539947",
"0.5625127",
"0.5606262",
"0.55691904",
"0.55521786",
"0.55503356",
"0.555... | 0.7430568 | 0 |
Set the name for a space. Note that using this command will cause a layout change notification to be sent if the new name was different from that previously set. The maximum length for a name is 255 bytes. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.set_name_for_space_on_display(1, "Home", display_id) | def set_name_for_space_on_display(space_number, name, display_id)
TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name_for_space(space_number, name)\n TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, 0)\n end",
"def home_name=(n)\n @home_name = n\n end",
"def changeName\r\n\t\tcheckSpace\r\n\tend",
"def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path un... | [
"0.7669021",
"0.6507637",
"0.6115902",
"0.6037224",
"0.6016562",
"0.60126317",
"0.5878414",
"0.5840199",
"0.58168834",
"0.57529753",
"0.57074565",
"0.5701779",
"0.5652545",
"0.5632509",
"0.5632509",
"0.5632509",
"0.5632509",
"0.5632509",
"0.5631495",
"0.5623806",
"0.5623806",... | 0.7571915 | 1 |
Cancel the on_space_change notification. | def cancel_on_space_change
$tsapi_on_space_change_block = nil
TSApi.tsapi_unsetSpaceWillChangeCallback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def destroy\n raise User::NotAuthorized, '삭제할 권한이 없습니다.' unless @space.updatable_by?(current_user)\n @space.destroy\n\n broadcast_delete_space(@space)\n end",
"def on_cancel\n\n doc = fetch(... | [
"0.5200666",
"0.5200666",
"0.5200666",
"0.51932776",
"0.51841074",
"0.5148234",
"0.5112529",
"0.5112529",
"0.510946",
"0.50615185",
"0.5046747",
"0.5046747",
"0.5046178",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
... | 0.845955 | 0 |
Cancel the layout change notification | def cancel_on_layout_change
$tsapi_on_layout_change_block = nil
TSApi.tsapi_unsetLayoutChangedCallback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onCancel(flag, view)\n self.reset(view)\n end",
"def onCancel(flag, view)\n self.reset(view)\n \tSketchup.undo\n end",
"def onCancel(flag, view)\n self.reset(view)\nend",
"def onCancel flag, view\n ## puts \"onCancel called\"\n\t\tself.reset(view)\n\tend",
"def uninstall\n ... | [
"0.6553298",
"0.6476466",
"0.6429745",
"0.61539626",
"0.57015985",
"0.5637399",
"0.5637399",
"0.5637399",
"0.56311345",
"0.56242657",
"0.5615695",
"0.5611285",
"0.5603243",
"0.559045",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.5585... | 0.800208 | 0 |
Move a window to a given space The window_id parameter must be fetched using window_list. Returns false if the space_number or window_id is invalid. | def move_window_to_space(window_id, space_number)
TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_window_to_space_on_display(window_id, space_number, display_id)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)\n end",
"def move(new_session, new_number)\n return if @session == new_session && @number == new_number\n target = \"%s:%s\" % [new_session.iden... | [
"0.71380687",
"0.65211385",
"0.5892226",
"0.5865455",
"0.58550644",
"0.57853323",
"0.56763864",
"0.56398386",
"0.5562855",
"0.5517389",
"0.55158377",
"0.53663987",
"0.5365342",
"0.5238219",
"0.521678",
"0.5127838",
"0.50720066",
"0.50328624",
"0.50002134",
"0.49600253",
"0.49... | 0.77395153 | 0 |
Move a window to a given space on the main display The window_id parameter must be fetched using window_list. Returns false if the space_number or window_id is invalid. | def move_window_to_space_on_display(window_id, space_number, display_id)
TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)\n end",
"def move(new_session, new_number)\n return if @session == new_session && @number == new_number\n target = \"%s:%s\" % [new_session.identifier, new_number]\n\n res... | [
"0.80645144",
"0.6797437",
"0.6611871",
"0.64104223",
"0.62135607",
"0.61805105",
"0.61400187",
"0.61280125",
"0.59365577",
"0.5893151",
"0.5538876",
"0.54859734",
"0.54701316",
"0.5466194",
"0.5423151",
"0.53313196",
"0.5321003",
"0.52708215",
"0.5143366",
"0.5132162",
"0.51... | 0.7871263 | 1 |
Move space to a new position in the grid on the main display. Returns false if the space_number or position_number is not valid. TotalSpaces2.move_space_to_position(4, 2) | def move_space_to_position(space_number, position_number)
TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n end",
"def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsap... | [
"0.7345556",
"0.70695674",
"0.6993478",
"0.6809427",
"0.6794172",
"0.6789958",
"0.67232746",
"0.67206734",
"0.6659641",
"0.6518978",
"0.6413597",
"0.6403341",
"0.6389916",
"0.6382818",
"0.6381655",
"0.6354069",
"0.6308633",
"0.6292757",
"0.6283047",
"0.62776273",
"0.62717736"... | 0.7570759 | 0 |
Move space to a new position in the grid. Spaces can only be moved within their own display. Returns false if the space_number or position_number is not valid. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.move_space_to_position_on_display(4, 2, display_id) | def move_space_to_position_on_display(space_number, position_number, display_id)
TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id)\n end",
"def move_space_to_position(space_number, position_number)\n TSAp... | [
"0.7740621",
"0.73314995",
"0.7271876",
"0.67355883",
"0.6600612",
"0.65086293",
"0.64791816",
"0.6478934",
"0.64209586",
"0.63598627",
"0.6342338",
"0.63348615",
"0.62164384",
"0.6209217",
"0.61665946",
"0.6141446",
"0.6128524",
"0.60923576",
"0.60510427",
"0.60484475",
"0.5... | 0.7992506 | 0 |
Move space to a new position on another screen. This won't work if you do not have displays have separate spaces enabled. Returns false if any parameters are not valid. display_id = TotalSpaces2.main_display[:display_id] display2_id = TotalSpaces2.display_list[1][:display_id] TotalSpaces2.move_space_on_display_to_position_on_display(2, display_id, 1, display2_id) | def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)
TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n end",
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end... | [
"0.79717374",
"0.77973783",
"0.73388463",
"0.6965127",
"0.69021106",
"0.6571451",
"0.6274849",
"0.6184589",
"0.61284095",
"0.61111426",
"0.6009155",
"0.5993963",
"0.5879582",
"0.58258116",
"0.5806621",
"0.57327735",
"0.572874",
"0.5727635",
"0.5725887",
"0.5724171",
"0.570859... | 0.8166593 | 0 |
Add desktops There can be at most 16 desktops unless the display has collected some when a secondary display has been unplugged. Returns true on success, false if number_to_add was zero, or would result in more than 16 desktops. The on_layout_change notification will be sent if a changed was made. TotalSpaces2.add_desktops(1) | def add_desktops(number_to_add)
TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_desktops_on_display(number_to_add, display_id)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id)\n end",
"def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)\n end",
"def desktops\n @desktops ||= if available?\n Libats... | [
"0.7062807",
"0.54731876",
"0.53513676",
"0.5337657",
"0.525137",
"0.51632684",
"0.49705702",
"0.48633435",
"0.48525223",
"0.48099914",
"0.47970316",
"0.4655567",
"0.46508253",
"0.45151818",
"0.44761214",
"0.4452858",
"0.44372815",
"0.44363898",
"0.44302163",
"0.4296588",
"0.... | 0.74095416 | 0 |
Add desktops There can be at most 16 desktops unless the display has collected some when a secondary display has been unplugged. Returns true on success, false if number_to_add was zero, or would result in more than 16 desktops. The on_layout_change notification will be sent if a changed was made. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.add_desktops_on_display(1, display_id) | def add_desktops_on_display(number_to_add, display_id)
TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)\n end",
"def remove_desktops_on_display(number_to_remove, display_id)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)\n end",
"def remove_desktops(number_to_remove)\n TSApi.tsapi_remove... | [
"0.7482838",
"0.61482394",
"0.569244",
"0.5281861",
"0.51685375",
"0.5076606",
"0.4891148",
"0.48880905",
"0.48796102",
"0.47549608",
"0.47183523",
"0.46594033",
"0.4594886",
"0.45712245",
"0.45316643",
"0.45222574",
"0.4403283",
"0.43503955",
"0.42971486",
"0.4292949",
"0.42... | 0.77525324 | 0 |
Remove desktops The highest numbered desktops are removed. Removing a desktop you are currently on will result in TotalSpaces2 switching to another dektop. Any windows present on a desktop being removed will be moved to one of the remaining desktops. Returns true on success, false if number_to_remove was zero or would result in less than 1 desktop remaining. The on_layout_change notification will be sent if a change was made. TotalSpaces2.remove_desktops(1) | def remove_desktops(number_to_remove)
TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_desktops_on_display(number_to_remove, display_id)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)\n end",
"def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)\n end",
"def desktops\n @desktops ||= if available?\n Libats... | [
"0.71847725",
"0.55630857",
"0.51586",
"0.48049235",
"0.46907488",
"0.46150577",
"0.4537496",
"0.4483417",
"0.4475176",
"0.4461352",
"0.44572833",
"0.4424133",
"0.43214753",
"0.42999113",
"0.42979833",
"0.42798176",
"0.42550057",
"0.42425928",
"0.42243078",
"0.4211777",
"0.42... | 0.784 | 0 |
Remove desktops The highest numbered desktops are removed. Removing a desktop you are currently on will result in TotalSpaces2 switching to another dektop. Any windows present on a desktop being removed will be moved to one of the remaining desktops. Returns true on success, false if number_to_remove was zero or would result in less than 1 desktop remaining. The on_layout_change notification will be sent if a change was made. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.remove_desktops_on_display(1, display_id) | def remove_desktops_on_display(number_to_remove, display_id)
TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)\n end",
"def add_desktops_on_display(number_to_add, display_id)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id)\n end",
"def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsO... | [
"0.7939232",
"0.58576113",
"0.583454",
"0.51110566",
"0.46880496",
"0.46064773",
"0.4504501",
"0.44935206",
"0.44927365",
"0.4477538",
"0.44751856",
"0.44677877",
"0.44565356",
"0.4432883",
"0.44187096",
"0.44145742",
"0.43738288",
"0.43343857",
"0.43275428",
"0.43227485",
"0... | 0.81090945 | 0 |
Move a particular window to the front and activate it. This might be usful after moving windows to other desktops. | def set_front_window(window_id)
TSApi.tsapi_setFrontWindow(window_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bring_current_window_to_front\n @fox_driver.switch_to.window(@fox_driver.window_handles.first)\n end",
"def show_window\r\n if visible?\r\n bring_to_front()\r\n else\r\n show_modal()\r\n end\r\n end",
"def activate_process_window( pid )\n pid , hwnd = find_parent_pr... | [
"0.8180855",
"0.71666",
"0.68272626",
"0.672905",
"0.66991854",
"0.6625408",
"0.6625408",
"0.65658736",
"0.6436523",
"0.6216314",
"0.62056345",
"0.61770236",
"0.6118638",
"0.59979236",
"0.5974988",
"0.5963231",
"0.5954785",
"0.59114265",
"0.58638746",
"0.5833954",
"0.5806035"... | 0.71877915 | 1 |
Bind an app to a space. The bundle_id is normally in the format "com.apple.mail" Setting the space_uuid to AllSpaces will result in an app appearing on every desktop. Setting the space_uuid to nil will delete the setting for the given bundle_id. TotalSpaces2.bind_app_to_space("com.apple.mail", "AllSpaces") | def bind_app_to_space(bundle_id, space_uuid)
TSApi.tsapi_bindAppToSpace(bundle_id, space_uuid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_app\n @app = App.find(params[:uid])\n end",
"def fill_app\n if @param_storage.app_id == nil\n apps = @app_service.all\n @param_storage.store_app_id(apps[0].id) if apps.count == 1\n end\n end",
"def modify_application(app_name, namespace, public_hostname)\n end",
... | [
"0.5276577",
"0.51932913",
"0.50844276",
"0.5054723",
"0.5017959",
"0.50005805",
"0.49933314",
"0.49660257",
"0.4934812",
"0.48842895",
"0.48402733",
"0.48287034",
"0.48214543",
"0.48156542",
"0.47961557",
"0.47172606",
"0.47152334",
"0.47052324",
"0.4700782",
"0.4697362",
"0... | 0.84763855 | 0 |
GET /api/admin/user_evaluations.json def index | def create
@user_evaluation = ::UserEvaluation.new(user_evaluation_params)
@user_evaluation.evaluation = @evaluation
@user_evaluation.account = current_user.account
if @user_evaluation.save
render json: @user_evaluation, status: :created,
serializer: ::Admin::Evaluation::UserEvaluationSerializer
else
render json: @user_evaluation.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if current_user\n @evaluations = current_user.readable_evaluations\n else\n @circle = Circle.where(name: 'Public').try(:first)\n @evaluations = @circle.present? ? @circle.evaluations : []\n end\n user_ids = @evaluations.map(&:created_by_id)\n @users = User.in(id: user_ids)... | [
"0.743854",
"0.7192998",
"0.7192998",
"0.7192998",
"0.7192998",
"0.7192998",
"0.71910703",
"0.71319187",
"0.70560473",
"0.7042955",
"0.7021815",
"0.6948761",
"0.69125646",
"0.69022363",
"0.6862299",
"0.6847277",
"0.6837487",
"0.67434317",
"0.67207795",
"0.6589854",
"0.6552325... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_evaluation
@evaluation = ::Evaluation.in_account(current_user.account.id).find(params[:evaluation_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 |
Never trust parameters from the scary internet, only allow the white list through. | def user_evaluation_params
params.require(:user_evaluation).permit(:evaluator_id)
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 |
returns the current loggedin user | def current_user
@current_user ||= User.find_by_auth_token(cookies[:auth_token]) if cookies[:auth_token]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end",
"def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n\t\t\tUser.find(session[:user_id])\n... | [
"0.8645991",
"0.86158556",
"0.8546729",
"0.8546729",
"0.85380167",
"0.8533476",
"0.8530044",
"0.8518198",
"0.8508356",
"0.85019004",
"0.84983087",
"0.8490113",
"0.8445486",
"0.8427902",
"0.8425241",
"0.84174234",
"0.84174234",
"0.8409872",
"0.8409872",
"0.8382717",
"0.8375381... | 0.0 | -1 |
returns the current week of all weeks for the given year | def current_week
return get_current_week_from_weeks(Week.where(year: Date.today.year)
.order(:number))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weeks_in_year(year)\n date_calc.weeks_in_year(year)\n end",
"def year_week\n @year_week ||= (((date-start_of_year)+1)/7.0).ceil\n end",
"def week_of_year date\n \tdate.strftime('%U').to_i\n end",
"def week_of_year(*weeks)\n merge(week: weeks)\n end",
"def weeks_in_year\n ... | [
"0.82422113",
"0.77540714",
"0.7370541",
"0.7282985",
"0.6990319",
"0.6966094",
"0.69470173",
"0.68604624",
"0.68520635",
"0.67422485",
"0.6714107",
"0.67027825",
"0.6701111",
"0.6673112",
"0.6673095",
"0.6642223",
"0.6633163",
"0.66074234",
"0.6505728",
"0.6494404",
"0.64889... | 0.7085923 | 4 |
returns the current week, from the specified array of weeks, based on the weeks' start times | def get_current_week_from_weeks(weeks)
now = DateTime.now
weeks.each { |week|
if now < week.start_time
return (week.number - 1)
end
}
return weeks.last.number
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_week\n week_split.select { |c| c.include?(day) }.flatten\n end",
"def weeks\n\t\tk = offset( first_day.cwday )\n\n [ first_week( k ) ] + middle_weeks( DPW - k )\n end",
"def setup_weeks(week_start)\n a_date = self.first\n the_last = self.last\n @weeks = []\n\n while (a_date ... | [
"0.7211833",
"0.71016705",
"0.7082129",
"0.68672514",
"0.6796819",
"0.67799085",
"0.6770836",
"0.6714053",
"0.67011446",
"0.66379714",
"0.6625588",
"0.66176665",
"0.6592336",
"0.6592336",
"0.6567472",
"0.6564778",
"0.6496082",
"0.6460043",
"0.64545846",
"0.6451746",
"0.644248... | 0.71990055 | 1 |
returns the week number based on whether any games in that particular week have already started | def game_week
now = DateTime.now
all_games = NflSchedule.where(year: Date.today.year)
.order(:start_time)
week_started = 0
all_games.each { |game|
if (week_started < game.week) && (now > game.start_time)
week_started = game.week
end
}
return week_started
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def week( date = Date.today )\n (0...weeks.size).find { |i| weeks[i].include? date } + 1\n end",
"def week\n working_date = DateTime.new(self.year, 1, 1)\n working_date.week_day_start = self.week_day_start\n working_date = (working_date-working_date.send(\"wday_offset\"))\n week_num = 0\n work... | [
"0.7157287",
"0.7049902",
"0.6924994",
"0.6918694",
"0.6899286",
"0.6851943",
"0.6797575",
"0.6718376",
"0.6714368",
"0.6697344",
"0.6673988",
"0.66644907",
"0.6648989",
"0.6647416",
"0.6618264",
"0.6610505",
"0.6610505",
"0.6570503",
"0.6503514",
"0.6502665",
"0.64974725",
... | 0.8510001 | 0 |
GET /university_profiles/1 GET /university_profiles/1.json | def show
@university_profile = UniversityProfile.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @university_profile }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end",
"def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.69243425",
"0.69243425",
"0.6900653",
"0.68601173",
"0.67913383",
"0.66611785",
"0.66429806",
"0.6641157",
"0.6624576",
"0.655977",
"0.6556821",
"0.65536",
"0.65536",
"0.6533507",
"0.6520157",
"0.65135384",
"0.650938",
"0.6475463",
"0.6452095",
"0.64447385",
"0.64406747",
... | 0.79866904 | 0 |
GET /university_profiles/new GET /university_profiles/new.json | def new
@university_profile = UniversityProfile.new
@university_profile.university_courses || @user.build_university_courses
respond_to do |format|
format.html # new.html.erb
format.json { render json: @university_profile }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @university_profile = UniversityProfile.new(params[:university_profile])\n \n respond_to do |format|\n if @university_profile.save\n format.html { redirect_to @university_profile, notice: 'University profile was successfully created.' }\n format.json { render json: ... | [
"0.7789181",
"0.75316393",
"0.75316393",
"0.7491082",
"0.7491082",
"0.7491082",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7407796",
"0.7406522",
"0.7333984",
"0.73157513",
"0.72933996",
"0.7232191",... | 0.76105875 | 1 |
POST /university_profiles POST /university_profiles.json | def create
@university_profile = UniversityProfile.new(params[:university_profile])
respond_to do |format|
if @university_profile.save
format.html { redirect_to @university_profile, notice: 'University profile was successfully created.' }
format.json { render json: @university_profile, status: :created, location: @university_profile }
else
format.html { render action: "new" }
format.json { render json: @university_profile.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end",
"def new\n @university_... | [
"0.6690696",
"0.64980185",
"0.6478158",
"0.6445904",
"0.6445904",
"0.6445125",
"0.64365804",
"0.6431544",
"0.63678014",
"0.63593143",
"0.6352346",
"0.6352069",
"0.6275461",
"0.6266235",
"0.62626374",
"0.6231612",
"0.6195032",
"0.6195032",
"0.6173253",
"0.61378783",
"0.6126015... | 0.75853705 | 0 |
PUT /university_profiles/1 PUT /university_profiles/1.json | def update
@university_profile = UniversityProfile.find(params[:id])
respond_to do |format|
if @university_profile.update_attributes(params[:university_profile])
format.html { redirect_to @university_profile, notice: 'University profile was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @university_profile.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n ... | [
"0.66502464",
"0.66496396",
"0.6640017",
"0.6640017",
"0.66112286",
"0.65614825",
"0.64841443",
"0.64750904",
"0.6467817",
"0.6464113",
"0.64370036",
"0.64363295",
"0.6420192",
"0.6406723",
"0.6373182",
"0.6362654",
"0.6348551",
"0.63437223",
"0.63220936",
"0.6296308",
"0.629... | 0.74559146 | 0 |
DELETE /university_profiles/1 DELETE /university_profiles/1.json | def destroy
@university_profile = UniversityProfile.find(params[:id])
@university_profile.destroy
respond_to do |format|
format.html { redirect_to university_profiles_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile... | [
"0.73018855",
"0.73018855",
"0.72988856",
"0.7292494",
"0.72700727",
"0.7269712",
"0.7269712",
"0.72634286",
"0.72577834",
"0.7250551",
"0.72116023",
"0.72109306",
"0.72109306",
"0.72109306",
"0.7207924",
"0.7207924",
"0.7207924",
"0.7207924",
"0.7207924",
"0.7207924",
"0.720... | 0.7634479 | 0 |
Build takes the array of instructions and adds them to the graph. | def build(insns, profile=nil)
# Find the basic blocks in the instructions.
blocks = basic_blocks(insns)
# Build each basic block into a graph fragment first.
fragments = {}
blocks.each do |ip, block|
fragments[block.start] = basic_block_to_fragment(block.insns, ip, profile)
end
# Create more detailed, transitive, input and output names and stacks for each fragment.
trans_names_in = {}
trans_stack_in = {}
trans_names_out = {}
trans_stack_out = {}
blocks.each_value do |block|
fragment = fragments[block.start]
block_trans_names_in = {}
block_trans_stack_in = []
# Combine the names and stack values that come in from previous blocks.
if block.prev.size == 1
# If the block has a single previous block, simply use all the names
# and stack values out from that block.
prev = block.prev.first
block_trans_names_in.merge! trans_names_out[prev]
block_trans_stack_in.push *trans_stack_out[prev]
elsif block.prev.size > 1
# If the block has multiple previous blocks then we could have
# arrived at this basic block from either of them. That means that
# values coming in for names or the stack. For each value that
# comes in we join all the possible values in a phi node. The phi
# node works as a switch to choose the correct value. It takes
# input from the merge which starts this block, to tell it
# which way to switch.
# Find all the names out from all the previous blocks.
all_names_out = block.prev.map { |p| trans_names_out[p].keys }.flatten.uniq.sort
# See the number of stack values out from all the previous blocks.
max_stack_out = block.prev.map { |p| trans_stack_out[p].size }.max
# If all blocks don't have the same names and number of stack values we don't know what to do.
block.prev.each do |prev|
raise 'unsupported' unless trans_names_out[prev].keys.sort == all_names_out
raise 'unsupported' unless trans_stack_out[prev].size == max_stack_out
end
# Create phis for each value
all_names_out.each do |name|
phi = Node.new(:phi)
fragment.merge.output_to :switch, phi
block.prev.each do |prev|
trans_names_out[prev][name].output_to :value, phi, :"value(#{prev})"
end
block_trans_names_in[name] = phi
end
max_stack_out.times do |index|
phi = Node.new(:phi)
fragment.merge.output_to :switch, phi
block.prev.each do |prev|
trans_stack_out[prev][index].output_to :value, phi, :"value(#{prev})"
end
block_trans_stack_in.push phi
end
end
# The output set is the same as the input set...
block_trans_names_out = block_trans_names_in.dup
block_trans_stack_out = block_trans_stack_in.dup
# ...then add the new names and stack values from this fragment.
fragment.names_out.each do |name, value|
block_trans_names_out[name] = value
end
fragment.stack_out.each do |value|
block_trans_stack_out.push value
end
# Remember this transitive set for this block.
trans_names_in[block.start] = block_trans_names_in
trans_stack_in[block.start] = block_trans_stack_in
trans_names_out[block.start] = block_trans_names_out
trans_stack_out[block.start] = block_trans_stack_out
end
# Connect the data flow between fragments, using the transitive sets.
blocks.each_value do |block|
fragment = fragments[block.start]
fragment.names_in.each do |name, input|
trans_names_in[block.start][name].output_to :value, input
end
fragment.stack_in.each_with_index do |input, index|
trans_stack_in[block.start][index].output_to :value, input
end
end
# Connect the control flow between fragments.
blocks.each_value do |block|
fragment = fragments[block.start]
if block.prev.empty?
# If the block has no previous blocks, connect the start of the
# graph to it.
@graph.start.output_to :control, fragment.merge
end
if block.next.empty?
# If the block has no next blocks, connect it to the finish of
# the graph.
fragment.last_control.output_to :control, @graph.finish
fragment.last_node.output_to :value, @graph.finish
elsif block.next.size == 1
# If the block has a single next block, connect the last control
# node of this block to the merge node of the next block.
next_i = block.next.first
next_fragment = fragments[next_i]
fragment.last_control.output_to :control, next_fragment.merge, :"control(#{block.start})"
elsif fragment.last_control.op == :branch
# If the block ends with a branch then it goes to two possible next
# blocks. The branch node outputs two control edges, one labelled
# true and one labelled false. This is the only place where control
# forks like this.
raise unless block.next.size == 2
branch = fragment.last_control
branch.output_to :true, fragments[block.next[0]].merge, :control
branch.output_to :false, fragments[block.next[1]].merge, :control
else
raise 'unsupported'
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push\n @instructions << Instruction.new(:push)\n self\n end",
"def add_instruction(*parts)\n @program.add Verneuil::Instruction.new(*parts)\n end",
"def build_graph\n @matrix.each_with_index do |row, x|\n row.each_with_index do |move, y|\n move = Coordinate.new(x,y)\n @matr... | [
"0.5794964",
"0.5662501",
"0.5583097",
"0.55065143",
"0.53973097",
"0.5381506",
"0.5353424",
"0.5277581",
"0.5220385",
"0.5220011",
"0.5203354",
"0.5143381",
"0.5134549",
"0.51275074",
"0.5122272",
"0.51101774",
"0.5091723",
"0.5082538",
"0.50754756",
"0.5039806",
"0.503321",... | 0.5247935 | 8 |
Finds the instructions that are the targets of jumping or branching, or fallthrough from not branching. | def targets(insns)
targets = Set.new
# The first instruction is implicitly jumped to when the function
# starts.
targets.add 0 unless insns.empty?
# Look at each instruction. If it's a jump add its target to the list of
# targets. If it's a branch then the branch may not be taken and so the
# next instruction is also a target as well as the actual target.
insns.each_with_index do |insn, index|
if [:jump, :branch].include?(insn.first)
targets.add insn[1]
targets.add index + 1 if insn.first == :branch
end
end
# Sort the targets so the output so we get the targets in the order
# they appear.
targets.to_a.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_correct_jump_offsets\n assert_instructions \"(true or true or true) or true\", [\n [\"lit\", true], [\"jtrue\", 4], [\"lit\", true], [\"jtrue\", 2], [\"lit\", true],\n [\"jtrue\", 2], [\"lit\", true],\n ]\n end",
"def valid_jump_destination?(from, to, pieces)\n ... | [
"0.60971874",
"0.57072026",
"0.54731196",
"0.5463928",
"0.542189",
"0.54170716",
"0.5333465",
"0.5186872",
"0.5158692",
"0.51487714",
"0.51413506",
"0.5115128",
"0.5099682",
"0.50930494",
"0.50517195",
"0.50358087",
"0.50358087",
"0.5018309",
"0.50063866",
"0.49908605",
"0.49... | 0.5698439 | 2 |
Find the basic blocks in an array of instructions. | def basic_blocks(insns)
# Jump and branch targets give us the start of each basic block.
targets = targets(insns)
# Create a basic block for each jump or branch target.
blocks = {}
targets.each_with_index do |start, index|
# Slice the instructions that form this block by looking for where
# the next block starts.
if index == targets.size - 1
last = insns.size
else
last = targets[index + 1]
end
block_insns = insns.slice(start, last - start)
last_insn = block_insns.last
# Create an array for the previous basic blocks, but we'll fill it
# in later.
prev_blocks = []
# Look at the last instruction and its targets to see what the next
# possible basic blocks are.
next_blocks = []
next_blocks.push last_insn[1] if [:jump, :branch].include?(last_insn.first)
next_blocks.push targets[index + 1] unless [:jump, :return].include?(last_insn.first)
blocks[start] = BasicBlock.new(start, block_insns, prev_blocks, next_blocks)
end
# No go back and use the information about the basic blocks following
# each block to store the reverse - the basic blocks previous to each
# block.
blocks.values.each do |block|
block.next.each do |n|
blocks[n].prev.push block.start
end
end
blocks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blocks\n @block_stacks.map { |candidates| candidates&.first }\n end",
"def basic_blocks\n @basic_block_collection ||= BasicBlockCollection.new(self)\n end",
"def get_blocks\n if (branches = @cur_state.branches[@tape.val])\n branches.map { |branch| branch.block } \n else\n ... | [
"0.62876546",
"0.599573",
"0.5870855",
"0.5801424",
"0.5785719",
"0.57395476",
"0.54923743",
"0.53547287",
"0.5333158",
"0.5319296",
"0.52905166",
"0.52682805",
"0.52349675",
"0.5191449",
"0.5181",
"0.51454115",
"0.5140853",
"0.51077753",
"0.5099594",
"0.50637573",
"0.5048022... | 0.6558905 | 0 |
Convert one basic block to a fragment of graph. | def basic_block_to_fragment(insns, ip=0, profile=nil)
# Basic blocks start with a merge node.
merge = Node.new(:merge)
# We're going to build up a list of names and stack values coming into
# this basic block that we're going to need to connect up later when
# we form a complete graph.
names_in = {}
stack_in = []
# Create an initial deoptimisation map.
deopt_map = FrameStateBuilder.new(insns, ip, names_in.dup, stack_in.dup)
last_node = nil
last_control = merge
# We're also going to build up a list of names and stack values that
# are available when this basic block is finished.
names = {}
stack = []
# When we pop a value off the stack, we may be using a value that
# wasn't created within this basic block - the value could have been
# expected to be on the stack already. This proc tries to pop a value
# off the basic block's stack, but if there isn't one, it then
# records that the basic block will need another stack value coming in
# and creates an unconnected value to represent that, called an input
# node.
pop = proc {
if stack.empty?
input = Node.new(:connector)
stack_in.unshift input
input
else
stack.pop
end
}
# Go through each instruction in the basic block, and perform a kind
# of abstract interpretation on it. This loop looks a lot like the one
# in the interpreter. The difference here is that we don't deal with
# real values, instead we deal with an abstraction of the values that
# will be there in the future. It's somewhat like computing with
# promises that are never fulfilled. It's simpler than it sounds
# because as this is a basic block the control flow is simple - it's a
# linear sequence of instructions with no branches. For each
# instruction we create a graph node that represents the computation
# on the abstract values. We build a backbone of linear control flow
# through the instructions by linking each instruction that has some
# kind of side effect to the previous instruction with a side effect.
insns.each_with_index do |insn, n|
case insn.first
when :trace
last_node = Node.new(:trace, line: insn[1])
when :self
last_node = Node.new(:self)
stack.push last_node
when :arg
last_node = Node.new(:arg, n: insn[1])
stack.push last_node
when :load
name = insn[1]
value = names[name]
unless value
# Like the pop proc, if we don't find that a name has been set
# in this basic block, we remember that we need it as an input
# and create an input node to represent its future value.
input = Node.new(:connector)
names_in[name] = input
names[name] = input
value = input
end
stack.push value
when :store
names[insn[1]] = pop.call
when :push
last_node = Node.new(:constant, value: insn[1])
stack.push last_node
when :send
name = insn[1]
argc = insn[2]
send_node = Node.new(:send, name: name, argc: argc)
argc.times do |n|
arg_node = pop.call
arg_node.output_to :value, send_node, :"arg(#{argc-n-1})"
end
receiver_node = pop.call
receiver_node.output_to :value, send_node, :receiver
if profile
send_node.props[:profile] = profile.sends[ip + n]
end
stack.push send_node
last_node = send_node
when :not
value_node = pop.call
not_node = Node.new(:not)
value_node.output_to :value, not_node
stack.push not_node
last_node = not_node
when :jump
jump_node = Node.new(:jump)
last_node = jump_node
when :branch
value_node = pop.call
branch_node = Node.new(:branch)
value_node.output_to :value, branch_node, :condition
last_node = branch_node
when :return
last_node = pop.call
stack.push last_node
else
raise 'unknown instruction'
end
# Does this instruction need a deoptimisation map becuase it could deoptimise?
if @build_deopt_maps && [:send].include?(insn.first)
# Create a deoptimisation map node?
deopt_map_node = Node.new(:deopt_map, insns: deopt_map.insns, ip: deopt_map.ip)
# Send the value of the receiver to it.
Node.new(:self).output_to :value, deopt_map_node, :receiver
# Send the value of all arguments to it.
args = insns.select { |i| i.first == :arg }.map { |i| i[1] }
if args.empty?
args_count = 0
else
args_count = args.max + 1
end
args_count.times do |n|
Node.new(:arg, n: n).output_to :value, deopt_map_node, :"arg(#{n})"
end
# Send the value of all names to it.
deopt_map.names.each_pair do |name, value|
value.output_to :value, deopt_map_node, name
end
# Send all values on the stack to it.
deopt_map.stack.each_with_index do |value, index|
value.output_to :value, deopt_map_node, :"stack(#{index})"
end
# Add the deoptimisation map to the instruction by adding a special edge.
deopt_map_node.output_to :deopt_map, last_node
end
# The trace and send instructions have side effects - link them into
# the backbone of control flow so that we know one instruction with
# side effects needs to happen before any other after it. The jump and
# branch instructions could or could not be seen as side effects. We
# treat them so because it seems to make this easier.
if [:trace, :send, :jump, :branch].include?(insn.first)
last_control.output_to :control, last_node
last_control = last_node
end
# If this instruction potentially has side-effects, create a new
# deoptimisation map for the state after the instruction.
if [:send].include?(insn.first)
deopt_map = FrameStateBuilder.new(insns, ip + n + 1, names.dup, stack.dup)
end
end
GraphFragment.new(names_in, stack_in, merge, last_node, last_control, names, stack)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_local_graph(block)\n block_flow = dfg.block_flows.fetch(block.id)\n\n # A map of instructions to nodes.\n insn_nodes = {}\n\n # Create a node for each instruction in the block.\n block.each_with_length do |insn, offset|\n node = InsnNode.new(insn, ... | [
"0.6396569",
"0.60814226",
"0.5910024",
"0.5480614",
"0.542897",
"0.5424043",
"0.53848016",
"0.5323638",
"0.5311645",
"0.5270826",
"0.52481115",
"0.52298474",
"0.52169645",
"0.52151054",
"0.5191754",
"0.5168946",
"0.51431596",
"0.5138544",
"0.5137062",
"0.5137062",
"0.5035485... | 0.6367712 | 1 |
before_action will run first and only render things inside find_book private method with find, edit and destroy action; this help to code dry by not repeting code over and over again by simply pointing the actions | def index
@books = Book.all.order("created_at DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t#show now run by find_book and before_action\n\t\t#keeps code dry\n\tend",
"def prepare_for_action\n # #don't save stuff between requests\n NotRelational::RepositoryFactory.instance.clear_session_cache\n @@page_blurbs =Set.new\n @renderer_params={}\n $current_weblab=nil\n ... | [
"0.6944654",
"0.5908161",
"0.58470625",
"0.5723019",
"0.56198925",
"0.55033916",
"0.5447014",
"0.54032576",
"0.53145635",
"0.5301747",
"0.5281134",
"0.5278196",
"0.52770156",
"0.5257393",
"0.5252478",
"0.5223222",
"0.52130383",
"0.51970327",
"0.5195389",
"0.51916593",
"0.5188... | 0.0 | -1 |
Handle emails to notify_to users | def normal_email(user, status)
@user = user
@status = status
mail to: @user.email, subject: 'CastleBridge Normal Email'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def... | [
"0.77243286",
"0.7352931",
"0.7266025",
"0.7259276",
"0.72396094",
"0.7233714",
"0.71800554",
"0.70704025",
"0.7054894",
"0.7049822",
"0.7042328",
"0.703432",
"0.6976092",
"0.69731915",
"0.6955278",
"0.69551337",
"0.6930769",
"0.69280404",
"0.6921682",
"0.6907902",
"0.6907713... | 0.0 | -1 |
Handle emails to morning_notify users | def morning_email(user, status)
@user = user
@status = status
mail to: @user.email, subject: 'CastleBridge Morning Email'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def... | [
"0.75621027",
"0.7097204",
"0.7080787",
"0.6987877",
"0.69147533",
"0.69126105",
"0.68146706",
"0.6773544",
"0.6773258",
"0.6760959",
"0.67299366",
"0.6715238",
"0.66894674",
"0.66833526",
"0.6680886",
"0.6656738",
"0.6644087",
"0.6637007",
"0.66369754",
"0.6621577",
"0.66206... | 0.6657463 | 15 |
Handle warning emails to all users | def warning_email(user, warning)
@user = user
@warning = warning
mail to: @user.email, subject: 'CastleBridge Warning Email'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def low_credit_warning_to_admin(user)\n @user = user\n @advertiser = user.advertiser\n\n set_attachments\n\n case APP_CONFIG['app_country']\n when 'AR'\n mail(to: 'sebastian@socialtarget.net', subject: \"Anunciante con crédito debajo de $1000 - Its time to go social\")\n when 'CO'\n ... | [
"0.70432657",
"0.6561599",
"0.65585905",
"0.6485254",
"0.64650327",
"0.63884485",
"0.63472915",
"0.6287187",
"0.61808294",
"0.61514384",
"0.6129055",
"0.608857",
"0.6080138",
"0.6079046",
"0.60732603",
"0.6066005",
"0.60626",
"0.6043357",
"0.6039502",
"0.6032962",
"0.60136604... | 0.73420143 | 0 |
Handle sending resolved emails to all users | def resolved_email(user, warning)
@user = user
@warning = warning
mail to: @user.email, subject: 'CastleBridge Resolved Email'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_self_eval_reminders\n users = User.all.select{|u| u.has_current_registration && u.current_registration.participant && !u.current_registration.has_complete_eval}\n @sent = []\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self e... | [
"0.7321592",
"0.72371495",
"0.71266496",
"0.7114521",
"0.7021203",
"0.6935726",
"0.6906808",
"0.6786121",
"0.6769543",
"0.67490363",
"0.6730936",
"0.668969",
"0.6686271",
"0.6572765",
"0.6544299",
"0.64343405",
"0.641731",
"0.64171994",
"0.63979447",
"0.63844293",
"0.6359168"... | 0.0 | -1 |
we have to do this since remote_file expects a checksum as a string | def fetch_checksum
uri = URI(new_resource.checksum_uri)
request = Net::HTTP.new(uri.host, uri.port)
request.use_ssl = true if uri.to_s.start_with?('https')
response = request.get(uri)
if response.code != '200'
Chef::Log.fatal("Fetching the Logstash tarball checksum at #{uri} resulted in an error #{response.code}")
raise
end
response.body.split(' ')[0]
rescue => e
Chef::Log.fatal("Could not fetch the checksum due to an error: #{e}")
raise
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_remote_digestsha2(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA256.hexdigest(data)\n end\n return chksum\n end",
"def file_remote_digestsha1(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::... | [
"0.7390663",
"0.71819943",
"0.71662086",
"0.7003425",
"0.6743358",
"0.66393846",
"0.65767634",
"0.65725833",
"0.64794296",
"0.6461368",
"0.6458413",
"0.63545007",
"0.6349538",
"0.6300919",
"0.6276329",
"0.62643063",
"0.624396",
"0.6219757",
"0.6206501",
"0.6196784",
"0.619303... | 0.6587466 | 6 |
this should be returning an array = ["",""] | def initialize(stops:)
@stops = stops.scan(/\b[\w\s\/]+/im)
convert_to_proper
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_a; []; end",
"def to_ary; []; end",
"def to_ary\n\t []\n\tend",
"def another; return []; end",
"def to_a; Array(force) end",
"def values\n []\n end",
"def to_a; [Array]; end",
"def to_ary\n nil\n end",
"def to_ary; nil; end",
"def to_ary\n nil\n end",... | [
"0.7512543",
"0.72874576",
"0.7178788",
"0.7026042",
"0.69259036",
"0.68895745",
"0.67083216",
"0.6645794",
"0.66211385",
"0.6596319",
"0.6596319",
"0.6596319",
"0.6596319",
"0.65525794",
"0.65525794",
"0.65525794",
"0.65525794",
"0.64691675",
"0.6448536",
"0.64323765",
"0.64... | 0.0 | -1 |
Find The Duplicated Number in a Consecutive Unsorted List Level: 7kyu You are given an array of n+1 integers 1 through n. In addition there is a single duplicate integer. The array is unsorted. An example valid array would be [3, 2, 5, 1, 3, 4]. It has the integers 1 through 5 and 3 is duplicated. [1, 2, 4, 5, 5] would not be valid as it is missing 3. You should return the duplicate value as a single integer. | def find_dup(cadena)
cadena.detect{ |e| cadena.count(e) > 1 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_duplicate(array)\n numberCount = {}\n array.each do |element|\n if !numberCount[element]\n numberCount[element] = 1\n else \n return element\n end \n end \n -1\nend",
"def find_dup(array)\n # 17 - (1 + 2 + 3 + 4 + 5) = 2 --- total in this array minus total if there were no dupes\... | [
"0.8070596",
"0.78280866",
"0.7688708",
"0.7678541",
"0.7650415",
"0.7647557",
"0.75819117",
"0.75796926",
"0.751927",
"0.7453325",
"0.74399203",
"0.7439353",
"0.73611224",
"0.73603886",
"0.7339873",
"0.73398083",
"0.7294938",
"0.72672004",
"0.7266288",
"0.724468",
"0.7236456... | 0.0 | -1 |
TODO : We can calculcate lat , long at the time of registration so we will not need a saprate zipcoe model and an "additional query". | def profile_photo_url(version)
if self.photos.profile_photo.blank?
"#{version.to_s}_avtar.jpg"
else
self.photos.profile_photo.first.name_url(version)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geo; end",
"def get_by_lat_lng\n\tend",
"def meshcode2_coordinate(gps_info)\n grid_square_code = gps_info.to_s\n \n # calc from 1st grid square code\n lat = grid_square_code[0..1].to_f / 1.5; lon = grid_square_code[2..3].to_f + 100\n\n # calc from 2nd grid square code\n latcode = grid_square_code[4].... | [
"0.6779189",
"0.6270964",
"0.6185727",
"0.61477476",
"0.61281157",
"0.61205757",
"0.6119252",
"0.6099083",
"0.6075505",
"0.60378706",
"0.60136986",
"0.5996927",
"0.5971844",
"0.5930033",
"0.5886866",
"0.5885558",
"0.5872504",
"0.5840385",
"0.58331954",
"0.58315635",
"0.582720... | 0.0 | -1 |
Reindex specific user only , instead of whole class. | def reindex_user!
Sunspot.index! self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_index\n \t\t@users = User.all\n \tend",
"def reindex!\n find(:all).each { |r| r.update_index(true) }\n end",
"def reindex!\n indexed if generate_solr_index\n end",
"def index_user\n @user = User.find(params[:id])\n @projects = @user.projects\n @user_index = true\... | [
"0.6265393",
"0.6084645",
"0.5906952",
"0.58696413",
"0.5845604",
"0.58391255",
"0.57809186",
"0.57809186",
"0.57558084",
"0.57063913",
"0.569151",
"0.56685054",
"0.56460935",
"0.5637015",
"0.56242466",
"0.56186455",
"0.5601047",
"0.55523485",
"0.55472046",
"0.55432546",
"0.5... | 0.8281975 | 0 |
def validate_card_for_payment_detail payment_detail.validate_card if payment_detail end Rating TODO Remove this manual code from here , It is only for testing purpose. | def find_or_create_business_with_current_user(user)
business = Business.find_or_create_by_employee_id_and_employer_id(self.id,user.id)
#business.blank? ? Business.create(:employee_id => self.id, :employer_id =>user.id , :title => 'Test Business') : business
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_card\n\t\tif paypal_express_token.blank? && !credit_card.valid?\n\t\t\tcredit_card.errors.full_messages.each do |message|\n\t\t\t\terrors.add_to_base message\n\t\t\tend\n\t\tend\n\tend",
"def validate_for_card\n tt = self.transaction_type.to_i\n \n # mandatory: transaction_type ... | [
"0.7149934",
"0.6929394",
"0.6873045",
"0.6784411",
"0.6652981",
"0.6627597",
"0.6616447",
"0.64701706",
"0.641898",
"0.6377554",
"0.6342429",
"0.63400567",
"0.6309344",
"0.62120503",
"0.62084115",
"0.6180396",
"0.6153603",
"0.61481327",
"0.6145207",
"0.61269045",
"0.61143637... | 0.0 | -1 |
has_many :reagents, :through => :game_base_skill_reagents, :class_name => :game_base_items | def skill_schools
[
'Tailoring',
'Jewelcrafting',
'Enchanting',
'Blacksmithing',
'Summoning',
'Shadow',
'Fire',
'Holy',
'Frost',
'Melee',
'Ranged'
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_target_actors\n [$game_party.members[0]]\n end",
"def a_tag_has_many_of_these_through_taggings\n ::Tag.class_exec(name, name.demodulize.underscore.pluralize.to_sym) do |class_name, association_name|\n has_many association_name, through: :taggings,\n ... | [
"0.5654088",
"0.55920863",
"0.52702314",
"0.5167521",
"0.51471233",
"0.51303613",
"0.5043285",
"0.5022889",
"0.5021468",
"0.5020541",
"0.5016457",
"0.49985677",
"0.49956834",
"0.49532527",
"0.4929928",
"0.49274936",
"0.49182433",
"0.49164566",
"0.4896456",
"0.48810714",
"0.48... | 0.0 | -1 |
Serialize all settings into a hash | def settings
# TODO
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash()\n Hash[\n self.class.settings.map do |key|\n begin\n [key, self[key]]\n rescue ArgumentError\n nil\n end\n end.compact()\n ]\n end",
"def to_hash\n self.config.to_hash\n end",
"def as_hash\n @settings.each_with... | [
"0.7642021",
"0.71637344",
"0.71404344",
"0.684871",
"0.6842132",
"0.6771699",
"0.6648124",
"0.6648124",
"0.6432106",
"0.6432106",
"0.6421479",
"0.63957775",
"0.63922936",
"0.637958",
"0.63619924",
"0.63312167",
"0.6321939",
"0.6321891",
"0.62680143",
"0.6250577",
"0.6198039"... | 0.61594564 | 25 |
Instantiates a new securityContainerRegistryEvidence and sets the default values. | def initialize()
super
@odata_type = "#microsoft.graph.security.containerRegistryEvidence"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.registryKeyEvidence\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.googleCloudResourceEvidence\"\n end",
"def initialize()\n ... | [
"0.641984",
"0.57567924",
"0.56801087",
"0.5619467",
"0.5546558",
"0.5406718",
"0.53548807",
"0.5220076",
"0.5012527",
"0.4963109",
"0.49273753",
"0.4919461",
"0.48658895",
"0.48651102",
"0.48417595",
"0.48417595",
"0.47785822",
"0.4772516",
"0.47507504",
"0.47369826",
"0.473... | 0.6913321 | 0 |
The deserialization information for the current model | def get_field_deserializers()
return super.merge({
"registry" => lambda {|n| @registry = n.get_string_value() },
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end",
"def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },... | [
"0.6510734",
"0.63224316",
"0.6322254",
"0.63094735",
"0.62954384",
"0.6238735",
"0.6232461",
"0.62155676",
"0.6200175",
"0.6199403",
"0.6173917",
"0.61733985",
"0.61705345",
"0.61631054",
"0.61620396",
"0.6158031",
"0.6156071",
"0.6142402",
"0.613998",
"0.6138061",
"0.612005... | 0.0 | -1 |
Gets the registry property value. The registry URI. | def registry
return @registry
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registry_key\n return @registry_key\n end",
"def [](registry_id)\n @registry[registry_id]\n end",
"def registry=(value)\n @registry = value\n end",
"def registry_key=(value)\n @registry_key = value\n end",
"def uri\n ... | [
"0.692245",
"0.60514754",
"0.6013806",
"0.5990011",
"0.59313554",
"0.58115417",
"0.58115417",
"0.58101183",
"0.57087725",
"0.57087725",
"0.5632581",
"0.5632581",
"0.5632581",
"0.5632519",
"0.5632519",
"0.56293017",
"0.56107503",
"0.5609899",
"0.5609899",
"0.554849",
"0.554469... | 0.5885671 | 5 |
Sets the registry property value. The registry URI. | def registry=(value)
@registry = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registry_key=(value)\n @registry_key = value\n end",
"def registry_path=(path=nil)\n if(path)\n custom_paths[:registry_directory] = path\n end\n custom_paths[:registry_directory]\n end",
"def registry_path=(path=nil)\n if(path)\n custom_paths[:... | [
"0.65558785",
"0.64465743",
"0.64465743",
"0.6398272",
"0.6398272",
"0.62428886",
"0.62428886",
"0.61232847",
"0.6087306",
"0.59248924",
"0.58984023",
"0.56568646",
"0.5648688",
"0.56280875",
"0.56248456",
"0.56008685",
"0.5574204",
"0.556259",
"0.55327195",
"0.55165225",
"0.... | 0.7437524 | 0 |
Serializes information the current object | def serialize(writer)
raise StandardError, 'writer cannot be null' if writer.nil?
super
writer.write_string_value("registry", @registry)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n end",
"def serialize(object) end",
"def serialize; end",
"def serialize; end",
"def serialize\n \n end",
"def serialize\n raise NotImplementedError\n end",
"def serialize\n raise NotImplementedError\n end",
"def dump\r\n super + to_s\r\n end",
... | [
"0.7951372",
"0.7645999",
"0.7579812",
"0.7579812",
"0.7440032",
"0.720861",
"0.720861",
"0.7207583",
"0.7016516",
"0.70007193",
"0.6992252",
"0.69838214",
"0.69723576",
"0.69666415",
"0.69666415",
"0.6942002",
"0.69417155",
"0.6933786",
"0.6913977",
"0.6891677",
"0.68810964"... | 0.0 | -1 |
You can add fixtures and/or initialization code here to make experimenting with your gem easier. You can also use a different console, if you like. (If you use this, don't forget to add pry to your Gemfile!) require "pry" Pry.start | def in_ms(seconds)
"#{'%.2f' % (seconds * 1000).round(2)}ms"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test\n # require \"pry\"; binding.pry\n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def main\n\n # test\n\n # Console.new\n console_start... | [
"0.6681039",
"0.6503785",
"0.6503785",
"0.6503785",
"0.6503785",
"0.6503785",
"0.6503785",
"0.6503785",
"0.6435417",
"0.6408537",
"0.6408537",
"0.6408537",
"0.6408537",
"0.6408537",
"0.6408537",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144... | 0.0 | -1 |
GET /qs GET /qs.json | def index
@qs = Q.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end",
"def getQuery\n\t\tquery = params[:query]\n\t\tresults = GetQueryFromSpotify.build.call(query)\n\t\trender json: results\n\tend",
"def http_query(verb, uri, opts)\n JSON.parse RestClient.send(verb, uri.to_s, opts)\n end",
"def q\n ... | [
"0.6967111",
"0.6878766",
"0.6575237",
"0.6530729",
"0.642635",
"0.6421816",
"0.6390276",
"0.63742244",
"0.6240254",
"0.62381876",
"0.6227804",
"0.6227804",
"0.61734974",
"0.6128986",
"0.6127512",
"0.6126428",
"0.6124328",
"0.6086575",
"0.60730296",
"0.6060777",
"0.60582715",... | 0.6500322 | 4 |
GET /qs/1 GET /qs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end",
"def q\n @q ||= HTTP.parseQs qs[1..-1]\n end",
"def getQuery\n\t\tquery = params[:query]\n\t\tresults = GetQueryFromSpotify.build.call(query)\n\t\trender json: results\n\tend",
"def http_query(verb, uri, opts)\n JSON.parse Res... | [
"0.67230064",
"0.64006436",
"0.63310105",
"0.62810373",
"0.6196126",
"0.61491925",
"0.6140475",
"0.6122536",
"0.6067986",
"0.60374254",
"0.6034821",
"0.60152197",
"0.6011379",
"0.59772384",
"0.5967782",
"0.59344023",
"0.591815",
"0.5912542",
"0.58863527",
"0.5850398",
"0.5843... | 0.0 | -1 |
POST /qs POST /qs.json | def create
@q = Q.new(q_params)
respond_to do |format|
if @q.save
format.html { redirect_to @q, notice: 'Q was successfully created.' }
format.json { render action: 'show', status: :created, location: @q }
else
format.html { render action: 'new' }
format.json { render json: @q.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\n request_object.post_query\n end",
"def post(endpoint, url, args, version = 'v1')\n qs = build_qs(args)\n req_url = \"#{url}/api/#{version}/#{endpoint}?#{qs}\"\n\n request(req_url, :POST)\n end",
"def post\n Typhoeus.post(@url,\n body: @result... | [
"0.6056008",
"0.58549833",
"0.58291733",
"0.575022",
"0.572263",
"0.5680553",
"0.56774926",
"0.5655744",
"0.56217605",
"0.5583506",
"0.5570381",
"0.55238485",
"0.55040896",
"0.54919994",
"0.54797703",
"0.54631466",
"0.5397797",
"0.539553",
"0.53905976",
"0.53873146",
"0.53773... | 0.5579825 | 10 |
PATCH/PUT /qs/1 PATCH/PUT /qs/1.json | def update
respond_to do |format|
if @q.update(q_params)
format.html { redirect_to @q, notice: 'Q was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @q.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @q = Q.find_by_unique_id(params[:id])\n\n respond_to do |format|\n if @q.update_attributes(params[:q])\n format.html { redirect_to @q, notice: 'Q was successfully updated.' }\n format.json { head :no_content }\n... | [
"0.6570083",
"0.65507406",
"0.64701235",
"0.64398533",
"0.64398533",
"0.64269096",
"0.642601",
"0.62791115",
"0.6208684",
"0.620093",
"0.614093",
"0.61223507",
"0.6107214",
"0.61007965",
"0.6096938",
"0.60758585",
"0.60758585",
"0.60758585",
"0.60758585",
"0.6055955",
"0.6043... | 0.639844 | 7 |
DELETE /qs/1 DELETE /qs/1.json | def destroy
@q.destroy
respond_to do |format|
format.html { redirect_to qs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @q = Q.find_by_unique_id(params[:id])\n @q.destroy\n\n respond_to do |format|\n format.html { redirect_to qs_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def delete!\n request! :delete\n end",
"def delete\n if body.empty? && ... | [
"0.72193485",
"0.7048139",
"0.69685876",
"0.6932484",
"0.6922741",
"0.68599194",
"0.68480086",
"0.6827804",
"0.68137574",
"0.681348",
"0.6812168",
"0.6812168",
"0.67819947",
"0.6755975",
"0.6731847",
"0.67178446",
"0.6711751",
"0.66873634",
"0.66723126",
"0.6664109",
"0.66443... | 0.71344167 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_q
@q = Q.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 |
Never trust parameters from the scary internet, only allow the white list through. | def q_params
params.require(:q).permit(:order, :quiz_id, :title)
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 |
even if list order is incorrect, parser shouldn't failed and it is recognized as toplevel. | def test_nested_ordered_list_incorrect
assert_nothing_raised do
parser = Juli::Parser.new
parser.parse(data_path('t005.txt'), Juli::Visitor::Tree.new)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_first_list_line(indentation, content); end",
"def parse_list; end",
"def parse_list; end",
"def parse_in_order(*files)\n global_state = OpenStruct.new\n\n return if before_parse_list_callbacks.any? do |cb|\n cb.call(files, global_state) == false\n end\n\n ... | [
"0.6116236",
"0.57363546",
"0.57363546",
"0.57267565",
"0.5679573",
"0.55632204",
"0.55284613",
"0.5456274",
"0.53122115",
"0.5292543",
"0.5285692",
"0.5249667",
"0.5249475",
"0.5222049",
"0.5221276",
"0.5219012",
"0.52121663",
"0.51987255",
"0.5186715",
"0.5168006",
"0.51656... | 0.71884537 | 0 |
t0122.txt resulted in 'syntax error' at the git version 0bc176893f57a6fdbecd0340101bd84a5eb724e0 (In other words, t0122.txt was the minimum input text to detect the parser bug of the version). | def test_list_n_verbatim2
t = build_tree_on('t012-2.txt')
assert_equal 3, t.array.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_format_rules(line_number, line)\n errors = []\n unless line_number > 0\n conventions = ['feat', 'fix', 'build', 'chore', 'ci', 'docs', 'style', 'refactor', 'perf', 'test']\n conventional_commit_conventions = conventions.map{|x| Regexp.new '(^' + x + ')' + '(\\(.*\\))?!?: [\\w+\\D\\-\\d+]'}\n ... | [
"0.6261784",
"0.61953443",
"0.6070767",
"0.60429984",
"0.5958418",
"0.5937136",
"0.5892407",
"0.57586676",
"0.57569396",
"0.5690387",
"0.5682005",
"0.5630323",
"0.5627618",
"0.5614959",
"0.5548733",
"0.55433947",
"0.5523248",
"0.54854363",
"0.5475023",
"0.546576",
"0.5428245"... | 0.0 | -1 |
This is a kind of irregular case, but Juli must parse as much as possible. So far, it should be 2 verbatims and one list. | def test_nested_quote3
t = build_tree_on('t022-3.txt')
assert_equal 3, t.array.size
assert_equal 1, t.array[2].array.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_list; end",
"def parse_list; end",
"def test_parsing_with_string\n value_ = ::Versionomy.parse('1.9.2pre2', :semver)\n assert_equal([1, 9, 2, 'pre2'], value_.values_array)\n assert_equal('1.9.2pre2', value_.unparse)\n end",
"def parse_definition_list; end",
"def test_met... | [
"0.6353886",
"0.6353886",
"0.57955426",
"0.573632",
"0.5625695",
"0.557097",
"0.5523348",
"0.55168813",
"0.5499414",
"0.54836035",
"0.5454044",
"0.542114",
"0.53804547",
"0.5344722",
"0.53440255",
"0.5335734",
"0.53059345",
"0.5287439",
"0.5257027",
"0.5247941",
"0.52394265",... | 0.0 | -1 |
return full path of test data file. | def data_path(filename)
File.join(File.dirname(__FILE__), 'repo', filename)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_path\n File.join(root_path, \"test\")\n end",
"def get_test_data_path_for(test_data_sub_path)\n File.expand_path(File.dirname(__FILE__) + \"/../test_data/#{ test_data_sub_path }\")\nend",
"def get_data_file_path(file_name)\n base = File.dirname __FILE__\n File.join(base, \"data\", file_name... | [
"0.77206683",
"0.7702129",
"0.7649831",
"0.761749",
"0.7542942",
"0.74282926",
"0.7408876",
"0.7305462",
"0.7297348",
"0.7297348",
"0.7297348",
"0.7230224",
"0.7226076",
"0.7226076",
"0.7205902",
"0.7181113",
"0.704472",
"0.6867056",
"0.68566096",
"0.6840618",
"0.6826795",
... | 0.71165705 | 16 |
redirect STDOUT in this block | def stdout_to_dev_null
$stdout = File.open('/dev/null', 'w')
yield
$stdout = STDOUT
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect\n orig_defout = $defout\n $stdout = StringIO.new\n yield\n $stdout.string\n ensure\n $stdout = orig_defout\n end",
"def redirect_stdout\n if Capybara::Chromefoil.mri?\n yield\n else\n begin\n prev = STDOUT.dup\n $stdout = @write_io\n ... | [
"0.79063493",
"0.76731133",
"0.7332611",
"0.72548985",
"0.7159202",
"0.71449137",
"0.6980251",
"0.6970769",
"0.6970769",
"0.6970769",
"0.6964693",
"0.6954705",
"0.69212884",
"0.68780655",
"0.68737674",
"0.68737674",
"0.6872757",
"0.686467",
"0.68562454",
"0.68499285",
"0.6847... | 0.6290815 | 70 |
TODO: Reuse the helper version | def sanitize_email(email)
email.gsub(/@/, "_at_").gsub(/\./, "_dot_")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def wrapper; end",
"def schubert; end",
"def probers; end",
"def formation; end",
"def common\n \n end",
"def custom; end",
"de... | [
"0.69135237",
"0.6127033",
"0.6127033",
"0.6127033",
"0.60047126",
"0.60047126",
"0.60047126",
"0.60047126",
"0.5912897",
"0.5795617",
"0.5703639",
"0.56548977",
"0.5626937",
"0.5591493",
"0.5591493",
"0.55655",
"0.5556643",
"0.54763675",
"0.5450508",
"0.5450508",
"0.54270107... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.notice_mailer.sendmail_confirm.subject | def subscription(letter)
@greeting = "ご担当者様"
@name = letter.name
@company = letter.company
@email = letter.email
mail to: "office.comforthousing@gmail.com",subject: "[コンフォート]ニュースレター購読申し込み"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def message_subject=(value)\n ... | [
"0.6912236",
"0.6822053",
"0.67955226",
"0.6685173",
"0.6684034",
"0.6679745",
"0.6677418",
"0.6580407",
"0.65657467",
"0.65475017",
"0.64384675",
"0.6430921",
"0.64237833",
"0.6360387",
"0.6348668",
"0.6336274",
"0.633325",
"0.6320941",
"0.6286503",
"0.62223476",
"0.61912227... | 0.0 | -1 |
Allows builder's DSL methods to be called from a class scope | def method_missing(name, *args, &block)
super unless respond_to? name
@builder = Builder.new(builder.tree) do
__send__(name, *args, &block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &block)\n return super unless builder\n\n builder.send(method, *args, &block)\n end",
"def method_missing(method, *args, &block)\n return super unless builder\n\n builder.send(method, *args, &block)\n end",
"def bui... | [
"0.6604525",
"0.6604525",
"0.65737504",
"0.65737504",
"0.65737504",
"0.6501042",
"0.63955414",
"0.63955414",
"0.631219",
"0.6185696",
"0.6185696",
"0.6111498",
"0.60460174",
"0.5918728",
"0.58979577",
"0.5866636",
"0.58654225",
"0.58420295",
"0.5817687",
"0.5813736",
"0.57421... | 0.599699 | 13 |
ajax answer the next page for paginated Prescriber search | def nextPrescribers
@searchPrescribers = Prescriber.nextPrescribers params[:start], params[:page], 9
render template: 'common/search/js/nextSearchPrescribers.js'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_next_page\n @browser.pluggable_parser.html = SearchPaginationParser\n\n @pagination.next\n previous_length = @results.size\n\n page = @browser.get(ajax_url)\n\n @results += page.search('.match_row').collect do |node|\n OKCupid::Profile.from_search_result(node)\n end\n\... | [
"0.7283596",
"0.719351",
"0.712438",
"0.70285916",
"0.6978852",
"0.6977104",
"0.6951121",
"0.69150895",
"0.6810806",
"0.6777248",
"0.6773149",
"0.6772437",
"0.6758603",
"0.67236286",
"0.67172444",
"0.6712684",
"0.66220665",
"0.66186017",
"0.6617014",
"0.6600223",
"0.6563989",... | 0.79200375 | 0 |
DELETE /prescribers/1 DELETE /prescribers/1.json | def destroy
@prescriber.destroy
respond_to do |format|
format.html { redirect_to prescribers_url, notice: 'Prescriber was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n re... | [
"0.75229764",
"0.74989325",
"0.7479443",
"0.7448541",
"0.7271936",
"0.7231357",
"0.71948296",
"0.7047412",
"0.7020993",
"0.6973432",
"0.6947614",
"0.6896681",
"0.6887121",
"0.6860743",
"0.68337417",
"0.67372745",
"0.67372745",
"0.67372745",
"0.67214495",
"0.66357785",
"0.6631... | 0.7593302 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_prescriber
@prescriber = Prescriber.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 |
Never trust parameters from the scary internet, only allow the white list through. | def prescriber_params
params.require(:prescriber).permit(:dept_number, :rna_prescriber_id_number, :last_name, :first_name, :middle_name, :dea_number, :npi_number, :surescripts_erx_id, :emdeon_erx_id, :active_flag, :participates_in_340b, :location_code, :requires_supervisor, :address1, :address2, :city, :state, :zip_code, :specialty, :memo, :group_code, :sig_default, :erx_eligibility, :remote_access, :facility_number, :allowed_to_prescribe_narcotics, :allowed_to_prescribe_controlled, :alternate_id1_qualifier, :alternate_id1, :alternate_id1_source, :alternate_id2_qualifier, :alternate_id2, :alternate_id2_source, :alternate_id3_qualifier, :alternate_id3, :alternate_id3_source, :alternate_id4_qualifier, :alternate_id4, :alternate_id4_source)
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 |
Make sure the interactive shell is working. | def test_interactive_rucas
cmd = "#{RUBY} -w -Ilib:ext:bin:test -rubygems bin/rucas"
output = IO.popen(cmd, 'r+') {|p|
p.puts "rucas_help"
p.close_write
p.read
}
expected = <<EXPECTED
-- interactive rucas --
To exit, type exit or quit.
For help, type rucas_help.
rucas:001:0> rucas_help
Interactive rucas is based on the standard Interactive Ruby (irb).
Declare symbolic variables using var.
Then you can manipulate them using standard Ruby code.
Examples:
> var :x
#=> #<struct Rucas::VarExpr name=:x>
> var :y
#=> #<struct Rucas::VarExpr name=:y>
> var :z
#=> #<struct Rucas::VarExpr name=:z>
> (x + 1 - x).simplify.to_s
#=> "1"
> [x, y, z].sum.to_s
#=> "x + y + z"
You can use underscore (_) to get the result of the last command.
nil
rucas:002:0>
EXPECTED
assert_equal expected.strip, output.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interactive_shell\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n loop do\n cmd = readline(prompt)\n\n case cmd\n when \"\", \"\\\\\"\n next\n when \"exit\", nil\n finish\n break\n when /.?\\\\$/\n final_cmd += cmd.sub(/\\\\$/... | [
"0.7322981",
"0.7044156",
"0.7044156",
"0.7044156",
"0.6518027",
"0.644695",
"0.62469447",
"0.61749923",
"0.614066",
"0.61399055",
"0.6101295",
"0.6072213",
"0.60472035",
"0.60273397",
"0.60273397",
"0.59777236",
"0.5953233",
"0.5913956",
"0.5849408",
"0.58268297",
"0.5774756... | 0.0 | -1 |
Return true if one of the sample attachments is audio | def contains_audio?
result = false
sample_attachments.map{|sa| result = true if sa.is_audio?}
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def audio?\n not audio_formats.empty?\n end",
"def audio?\n !!( content_type =~ Transit.config.audio_regexp )\n end",
"def is_audio_type?\n file_content_type =~ /\\Aaudio\\/.*\\Z/\n end",
"def audio?\n has_stream_of :audio\n end",
"def audio?\n if mime_type == 'application/mx... | [
"0.8035807",
"0.80038804",
"0.7881955",
"0.7846738",
"0.7820245",
"0.77520734",
"0.773891",
"0.77171326",
"0.7713901",
"0.76059484",
"0.7589621",
"0.7556706",
"0.7498337",
"0.7420775",
"0.7122937",
"0.7079695",
"0.7054178",
"0.6868039",
"0.686134",
"0.6780883",
"0.67526555",
... | 0.87240237 | 0 |
Return true if one of the sample attachments is video | def contains_video?
result = false
sample_attachments.map{|sa| result = true if sa.is_video?}
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video?\n attributes['_type'].split('::').last == 'Video'\n end",
"def is_video_type?\n file_content_type =~ %r(video)\n end",
"def video?\n !!( content_type =~ Transit.config.video_regexp )\n end",
"def is_video_type?\n photo_content_type =~ %r(video)\n end",
"def video?\n self.t... | [
"0.79525316",
"0.78907645",
"0.78466475",
"0.77067894",
"0.76821923",
"0.7587372",
"0.75550485",
"0.7538511",
"0.74831045",
"0.74105394",
"0.7335338",
"0.7266732",
"0.7214892",
"0.7164728",
"0.713228",
"0.7058546",
"0.693672",
"0.69328326",
"0.66700315",
"0.66283065",
"0.6609... | 0.86776674 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.