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 |
|---|---|---|---|---|---|---|
redefines the constructor for StudentPerson to utilize three params | def initialize(name, gender, program_name)
@program_name = program_name
# calls the constructor of the Person class
super(name, gender)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(lastName, firstName, studentID)\n @lastName = lastName\n @firstName = firstName\n @studentID = studentID\n end",
"def initialize(person_id, name, last_name, title, salary)\n super(person_id, name, last_name)\n @title = title\n @salary = salary\n end",
"def initialize(person_i... | [
"0.74819213",
"0.7185471",
"0.70207286",
"0.70171386",
"0.6992464",
"0.6976348",
"0.69342417",
"0.6877494",
"0.6875248",
"0.68540645",
"0.6852564",
"0.6837207",
"0.683523",
"0.68276787",
"0.68155974",
"0.67976844",
"0.67903143",
"0.67873627",
"0.6778133",
"0.6767711",
"0.6763... | 0.6720244 | 25 |
get_instance_count get data inconsistency rate based on the instance count in Hash table | def get_IR_by_count(inst_cnt)
incon, sample_size = 0.0, 0.0
inst_cnt.values.each do |hcnt|
cnt = hcnt.values
incon += cnt.sum-cnt.max
sample_size += cnt.sum
end
# inconsistency rate
(sample_size.zero?) ? 0.0 : incon/sample_size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_instance_count\n data.db_instance_count\n end",
"def get_count\n capture(\"cf curl /v2/apps/#{$app_uuid} | jq .entity.instances\").to_i\nend",
"def count_used_instances\n count = 0\n return count\n end",
"def chi2_get_inconsistency_rate(inst_cnt, f2bs)\n # build a new instan... | [
"0.7020216",
"0.64799225",
"0.6375542",
"0.62193424",
"0.61297035",
"0.6014982",
"0.60098606",
"0.5995368",
"0.59916866",
"0.5942212",
"0.5940575",
"0.59170175",
"0.5857477",
"0.5850115",
"0.58455986",
"0.5829715",
"0.5828734",
"0.5805956",
"0.5804859",
"0.57989734",
"0.57963... | 0.60514283 | 5 |
get_IR_by_count get data inconsistency rate for given features | def get_IR_by_feature(inst_cnt, feats)
return 0.0 if feats.empty?
# build new inst_count for feats
inst_cnt_new = {}
inst_cnt.each do |key, hcnt|
key_new = feats.sort.collect { |f|
match_data = key.match(/#{f}:.*?\|/)
match_data[0] if match_data
}.compact.join # rem... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_IR_by_count(inst_cnt) \n incon, sample_size = 0.0, 0.0\n \n inst_cnt.values.each do |hcnt|\n cnt = hcnt.values\n incon += cnt.sum-cnt.max\n sample_size += cnt.sum\n end\n \n # inconsistency rate\n (sample_size.zero?) ? 0.0 : incon/sample_size\n end",
"def chi2_get_... | [
"0.71889544",
"0.60502756",
"0.60220766",
"0.51870245",
"0.48825082",
"0.48470926",
"0.4787254",
"0.47772256",
"0.4759624",
"0.47190768",
"0.47106472",
"0.46925238",
"0.4661079",
"0.4647908",
"0.4634355",
"0.46264553",
"0.46220815",
"0.46197286",
"0.46090388",
"0.46032047",
"... | 0.7662135 | 0 |
get_IR_by_feature get data inconsistency rate, suitable for singletime calculation | def get_IR(my_data=nil)
my_data ||= get_data # use internal data by default
inst_cnt = get_instance_count(my_data)
ir = get_IR_by_count(inst_cnt)
# inconsistency rate
ir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_IR_by_feature(inst_cnt, feats)\n return 0.0 if feats.empty?\n \n # build new inst_count for feats\n inst_cnt_new = {}\n \n inst_cnt.each do |key, hcnt|\n key_new = feats.sort.collect { |f|\n match_data = key.match(/#{f}:.*?\\|/)\n match_data[0] if match_data\n }.co... | [
"0.73559296",
"0.62670654",
"0.5520189",
"0.52100265",
"0.5104419",
"0.50785017",
"0.5056432",
"0.5035982",
"0.50288516",
"0.50062466",
"0.4990073",
"0.49866426",
"0.4964677",
"0.49541637",
"0.49402267",
"0.49398246",
"0.49240556",
"0.49130794",
"0.48848432",
"0.4878239",
"0.... | 0.6818577 | 1 |
101 add a new user | def test_add_user
user = User.new
user.name = "testStudent1"
user.fullname = "test_Student_1"
user.clear_password = "testStudent1"
user.clear_password_confirmation = "testStudent1"
user.email = "testStudent1@foo.edu"
user.role_id = "1"
user.save! # an exception is thrown if the u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end",
"def add_new_user()\n new_user_link.click\n end",
"def addUser(stat,typ,email,pwhash)\n @conn.exec_prepared(\"add_user\",[stat,typ,email,pwhash])\n end",
"def _user_add argv = {}\n\t\tf\t\t\t\t= {}\n\t\tf[:tag]\t\t\t= argv[:tag]... | [
"0.7755996",
"0.75178",
"0.75032717",
"0.7470731",
"0.7379892",
"0.73672885",
"0.7306198",
"0.72496116",
"0.7238248",
"0.72301406",
"0.7210192",
"0.7199878",
"0.7173042",
"0.7135687",
"0.71040875",
"0.7041445",
"0.6959711",
"0.69358534",
"0.6910528",
"0.6910185",
"0.6908795",... | 0.6772579 | 30 |
102 Add a user with existing name | def test_add_user_with_exist_name
user = User.new
user.name = 'student1'
user.clear_password = "testStudent1"
user.clear_password_confirmation = "testStudent1"
user.fullname = "student1_fullname",
user.role_id = "3"
assert !user.save
assert_equal I18n.translate('activerecord.erro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_user(name)\n\t@users << {:name => name}\n end",
"def _user_add argv = {}\n\t\tf\t\t\t\t= {}\n\t\tf[:tag]\t\t\t= argv[:tag] if argv.include?(:tag)\n\t\tf[:salt] \t\t= _random 5\n\n\t\t#username\n\t\t_throw Sl[:'the user is existing'] if _user? f[:name]\n\t\tf[:name] \t\t= argv[:name]\n\n\t\t#password\n... | [
"0.788529",
"0.75253373",
"0.7373468",
"0.7365512",
"0.7345954",
"0.7315605",
"0.7302522",
"0.72385234",
"0.7215159",
"0.71703964",
"0.7148325",
"0.70382726",
"0.70283395",
"0.7020525",
"0.70133454",
"0.69658834",
"0.690606",
"0.688447",
"0.68824166",
"0.6847229",
"0.6834672"... | 0.0 | -1 |
103 Check valid user name and password | def test_add_user_with_invalid_name
user = User.new
assert !user.valid?
assert user.errors.invalid?(:name)
#assert user.errors.invalid?(:password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username_and_password_check\n company = get_company\n if company == nil\n exit\n end\n if get_username_and_test_validity(company)\n if get_password_and_test_validity(company)\n else\n puts \"That is not the correct password, please try again.\"\n entry_menu\n end\n... | [
"0.7974775",
"0.76432866",
"0.7615238",
"0.74997777",
"0.7433137",
"0.73547786",
"0.7353492",
"0.7333441",
"0.72655016",
"0.723147",
"0.7184584",
"0.7182812",
"0.7153024",
"0.7150983",
"0.7135021",
"0.70946485",
"0.7078638",
"0.70781535",
"0.7025026",
"0.70020884",
"0.6991840... | 0.0 | -1 |
202 edit a user name to an invalid name (e.g. blank) | def test_update_user_with_invalid_name
user = User.find_by_login('student1')
user.name = "";
assert !user.valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_real_name(user, real_name)\n user.real_name = real_name\n user.save_data\n end",
"def new_username=(value)\n @new_username = (value.nil? ? value : value.upcase)\n end",
"def set_user_name_field(user_name)\n end",
"def user_name_set(name)\n self.username.set name if nil_o... | [
"0.684706",
"0.66648",
"0.66438574",
"0.6601671",
"0.6555587",
"0.6479743",
"0.64718056",
"0.64287895",
"0.64211935",
"0.641428",
"0.6346574",
"0.63400257",
"0.62909216",
"0.62884307",
"0.6272083",
"0.6251564",
"0.6221917",
"0.61800456",
"0.6169797",
"0.6155189",
"0.6155189",... | 0.67929846 | 1 |
203 Change a user name to an existing name. | def test_update_user_with_existing_name
user = User.find_by_login('student1')
user.name = "student2"
assert !user.valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_name(new_name)\n self.update(name: new_name)\n self\n puts \"Your username has been updated.\".colorize(:magenta)\n end",
"def username=(new_name)\n @username = new_name.upcase\n end",
"def set_user_name_field(user_name)\n end",
"def edit_real_name(user, real_name)\n u... | [
"0.7336371",
"0.7320119",
"0.7091228",
"0.70347303",
"0.7007563",
"0.700508",
"0.68952274",
"0.68641496",
"0.684512",
"0.68254995",
"0.68169713",
"0.6742066",
"0.66746795",
"0.66689324",
"0.66604316",
"0.6647963",
"0.6592216",
"0.6581637",
"0.6569032",
"0.6538102",
"0.6538102... | 0.59893584 | 68 |
TODO: using `permit` later | def account_params
@account_params ||= params.require(:account).except(:user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted?; end",
"def resource_params\n deserialized_params.permit!\n end",
"def share_params\n# params.fetch(:share, {})\n params.fetch(:share).permit(:email, :view_perm, :analyze_perm, :export_perm, :download_perm)\n end",
... | [
"0.6871635",
"0.66476035",
"0.6517377",
"0.64820194",
"0.6470737",
"0.6463305",
"0.6398253",
"0.6387796",
"0.6385445",
"0.6371868",
"0.6355452",
"0.6353101",
"0.6347623",
"0.6334647",
"0.6320074",
"0.63141996",
"0.6310634",
"0.63091725",
"0.6308163",
"0.6296717",
"0.6274876",... | 0.0 | -1 |
============================================ Instance methods ============================================ Return the full name of this dashboard Currently a simple accessor to the dashboard name (used to include the company name) | def full_name
self.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_name\n display_name = @current_profile.display_name\n end",
"def display_name\n name\n end",
"def name\n @name ||= config(\"name\", \"WorkshopDash\")\n end",
"def display_name\n name\n end",
"def display_name\n name\n end",
"def display_name\n @na... | [
"0.69448954",
"0.6909436",
"0.6897259",
"0.6893969",
"0.6893969",
"0.6860574",
"0.6851009",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
"0.682069",
... | 0.6689224 | 68 |
Return all the organizations linked to this dashboard and to which the user has access If the dashboard is a template, return all the current user's organizations | def organizations(org_list = nil)
if org_list
return org_list if dashboard_type == 'template'
org_list.to_a.select { |e| organization_ids.include?(e.uid) || organization_ids.include?(e.id) }
else
MnoEnterprise::Organization.where('uid.in' => organization_ids).to_a
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_organizations\r\n Organization.organizations_by_user(self)\r\n end",
"def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end",
"def current_user_oganizations\n endpoint = '/api/user/orgs'\n @logger.debug(\"Getting current user o... | [
"0.78917235",
"0.7495927",
"0.7485861",
"0.7314383",
"0.73028827",
"0.72751504",
"0.7161657",
"0.71470207",
"0.7104225",
"0.7100632",
"0.70648074",
"0.70196307",
"0.68574727",
"0.68293977",
"0.6791273",
"0.67275244",
"0.6725619",
"0.671156",
"0.6703879",
"0.66912544",
"0.6684... | 0.7482761 | 3 |
Filter widgets list based on config | def filtered_widgets_templates
if MnoEnterprise.widgets_templates_listing
return self.widgets_templates.select do |t|
MnoEnterprise.widgets_templates_listing.include?(t[:path])
end
else
return self.widgets_templates
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_widget_by\n []\n end",
"def find_widgets widgets_description\n @widgets.find_all widgets_description\n end",
"def config_filters\n []\n end",
"def index \n\n ...\r\n \r\n #add/remove any selected filters\n selected_filter_conditions(Widget)\n\n @widgets = Wid... | [
"0.6340933",
"0.6195873",
"0.6192605",
"0.6157035",
"0.6103034",
"0.609333",
"0.60533714",
"0.60169",
"0.5916796",
"0.58574235",
"0.5772871",
"0.57691157",
"0.5751812",
"0.5749401",
"0.5702557",
"0.56995857",
"0.56963825",
"0.56963825",
"0.5681106",
"0.5596345",
"0.5552714",
... | 0.66529316 | 1 |
Parameters: user category or parent message body flag (Fixnum) | def initialize(params)
raise 'No user' unless params[:user] or params[:userid]
unless ((params[:category] or params[:categoryid]) || (params[:parent] or params[:parentmessageid]))
raise 'No category or parentmessage'
end
raise 'No body' unless params[:body]
super(params)
# C... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_message\n end",
"def set_body from_user\n self.body = message_body from_user\n end",
"def personal_message(msg, cl, state)\n respond(msg, cl, \"Hi. Your message was: #{msg.inspect}\")\n respond(msg, cl, \"Body: #{msg.body.to_s}\")\nend",
"def message_body\n return message.spanish_body ... | [
"0.6136857",
"0.5346499",
"0.5278617",
"0.52411264",
"0.51941156",
"0.5176993",
"0.511881",
"0.5098874",
"0.5097494",
"0.50798136",
"0.50761074",
"0.5070643",
"0.50329006",
"0.5003065",
"0.49751312",
"0.4970536",
"0.49398074",
"0.49390113",
"0.4936332",
"0.4934873",
"0.493271... | 0.552584 | 1 |
Finds the first in the thread recursively. Since initialize() uses this method to find the root message before the thread is known, MB::Thread methods cannot be used. Otherwise, self.thread.rootmessage would be faster. Using while (or until) loops may lead to neverending loops if the database contains awkward data (act... | def find_thread_root
msg = self
until (msg.is_root?) do
msg = msg.parent
end
return msg
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thread_message! message\n startt = Time.now\n\n ## build the path of msgids from leaf to ancestor\n ids = [message.safe_msgid] + message.safe_refs.reverse\n seen = {}\n ids = ids.map { |x| seen[x] = true && x unless seen[x] }.compact\n\n ## write parent/child relationships\n if ids.size > ... | [
"0.60951144",
"0.55454403",
"0.5539695",
"0.550906",
"0.5194823",
"0.51868796",
"0.5144992",
"0.5100949",
"0.5041336",
"0.5040675",
"0.50257164",
"0.49790543",
"0.49556273",
"0.49367854",
"0.4933495",
"0.49186236",
"0.49003804",
"0.4870091",
"0.48393965",
"0.48376042",
"0.483... | 0.7571323 | 0 |
route request based on path and query from the window location (URL) | def route(path, query)
if path == 'search'
item = {view: Search, query: query}
elsif path == 'comments'
item = {view: Comments}
elsif path and path != '.'
item = Agenda.find(path)
else
item = Agenda
end
# provide defaults for required properties
item.color ||= 'blank... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route() request.route end",
"def navigated\n url = get_location\n @params = []\n\n idx = match(path_to_parts(decode(url.pathname)), decode(url.search))\n\n if idx\n @routes[idx][:callback].call(@params)\n else\n @page404.call(url.pathname)\n end\n end",
"d... | [
"0.67203146",
"0.6086693",
"0.60334957",
"0.6001978",
"0.59827167",
"0.59424055",
"0.5936021",
"0.588675",
"0.58416086",
"0.5828264",
"0.58279306",
"0.58259916",
"0.57989043",
"0.5749073",
"0.57270944",
"0.5716356",
"0.56951743",
"0.56919754",
"0.56765",
"0.56650597",
"0.5660... | 0.0 | -1 |
common layout for all pages: header, main, footer, and forms | def render
_Header item: @item
_main do
React.createElement(@item.view, item: @item)
end
_Footer item: @item, buttons: @buttons
if @item.buttons
@item.buttons.each do |button|
React.createElement(button.form, item: @item, server: @@server)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout; end",
"def layouts; end",
"def layouts; end",
"def page_layout\n @user = User.current\n @blocks = @user.pref.my_page_layout\n end",
"def layout\n @layout\n end",
"def default_layout\n site.config.page_layout\n end",
"def kopal_layout_after_page_header\n\n end",
"de... | [
"0.7106484",
"0.7084871",
"0.7084871",
"0.64781415",
"0.64627373",
"0.64015216",
"0.6394078",
"0.63576704",
"0.6250488",
"0.6228207",
"0.6227595",
"0.6224674",
"0.6150285",
"0.61324984",
"0.60446775",
"0.60074633",
"0.6002124",
"0.597773",
"0.5962019",
"0.5942571",
"0.5935691... | 0.0 | -1 |
initial load of the agenda, and route first request | def componentWillMount()
# copy server info for later use
for prop in @@server
Server[prop] = @@server[prop]
end
Agenda.load(@@page.parsed)
Agenda.date = @@page.date
self.route(@@page.path, @@page.query)
# free memory
@@page.parsed = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start!(roda_app)\n if Bridgetown::Current.preloaded_configuration.base_path == \"/\"\n load_all_routes roda_app\n return\n end\n\n # Support custom base_path configurations\n roda_app.request.on(\n Bridgetown::Current.preloaded_configuration.... | [
"0.6121635",
"0.6065378",
"0.5877749",
"0.5830962",
"0.57163507",
"0.568272",
"0.5675922",
"0.56260777",
"0.55954474",
"0.55954474",
"0.55954474",
"0.55954474",
"0.55954474",
"0.55767703",
"0.5569882",
"0.55623263",
"0.5562022",
"0.5562022",
"0.55573",
"0.55507684",
"0.553973... | 0.57337636 | 4 |
navigation method that updates history (back button) information | def navigate(path, query)
self.route(path, query)
history.pushState({path: path, query: query}, nil, path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def back\n navigate.back\n end",
"def back\n navigate.back\n end",
"def back\n navigate.back\n end",
"def update_steps_history # rubocop:disable Metrics/AbcSize\n if history.nil?\n log_action('Creating first step into the back link history')\n ... | [
"0.74514973",
"0.74514973",
"0.74514973",
"0.7284807",
"0.71872836",
"0.7058552",
"0.69886875",
"0.697808",
"0.69403505",
"0.68598163",
"0.6858495",
"0.6804416",
"0.6789752",
"0.67638856",
"0.6763668",
"0.6763668",
"0.6763668",
"0.6706002",
"0.668635",
"0.6654037",
"0.664002"... | 0.0 | -1 |
refresh the current page | def refresh()
self.route(history.state.path, history.state.query)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reloads\n load_page\n end",
"def reload\n Howitzer::Log.info \"Reload '#{current_url}'\"\n visit current_url\n end",
"def refresh\n end",
"def refresh\r\n end",
"def refresh\n end",
"def refresh\n end",
"def refresh\n render js: \"location.reload()\"\n end",
"... | [
"0.7860161",
"0.78093827",
"0.7580512",
"0.75685817",
"0.7508215",
"0.7508215",
"0.7421952",
"0.7396618",
"0.7396618",
"0.73338443",
"0.7312823",
"0.7312307",
"0.7311976",
"0.7311976",
"0.72599053",
"0.72262466",
"0.72017723",
"0.7175135",
"0.71436024",
"0.7136012",
"0.712434... | 0.6644676 | 30 |
additional client side initialization | def componentDidMount()
# export navigate and refresh methods
Main.navigate = self.navigate
Main.refresh = self.refresh
# store initial state in history, taking care not to overwrite
# history set by the Search component.
if not history.state or not history.state.query
history.replaceSta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_client; end",
"def post_init\n puts \"#{self.class}/#{self} client post_init runs\"\n end",
"def init\n\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def post_init\n end",
"def at_init\n\n\t\tend",
"def init; end",
"def init; end",
"def init; end",
... | [
"0.78847325",
"0.73474425",
"0.7312914",
"0.730315",
"0.730315",
"0.730315",
"0.7275111",
"0.72079355",
"0.71405405",
"0.71405405",
"0.71405405",
"0.71405405",
"0.7126021",
"0.7078955",
"0.70680946",
"0.70680946",
"0.7067408",
"0.70284605",
"0.7024919",
"0.6985289",
"0.694248... | 0.0 | -1 |
after each subsequent rerendering, resize main window | def componentDidUpdate()
window.onresize()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_local_window_size(size); end",
"def remake_window\n self.width = window_width\n self.height = window_height\n create_contents\n end",
"def before_show()\n $ENV = VR::load_yaml(SavableSettings, \"settings.yaml\")\n @builder[:window1].resize $ENV.width, $ENV.height\n refresh()\n en... | [
"0.7465931",
"0.7296629",
"0.6904565",
"0.6689023",
"0.6657805",
"0.66405326",
"0.66215533",
"0.6520747",
"0.65061295",
"0.6505767",
"0.64672726",
"0.6463764",
"0.6445372",
"0.6356932",
"0.63315415",
"0.63076544",
"0.62923086",
"0.62606955",
"0.61769545",
"0.61769545",
"0.612... | 0.72127926 | 2 |
GET /shop/platinum_offers GET /shop/platinum_offers.json | def index
@shop_platinum_offers = Shop::PlatinumOffer.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @shop_platinum_offers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end",
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def new\n @shop_pla... | [
"0.73110384",
"0.72144324",
"0.6990316",
"0.6984181",
"0.6920462",
"0.69086015",
"0.68031245",
"0.67641",
"0.67568433",
"0.67458665",
"0.6726152",
"0.6717726",
"0.6645077",
"0.6641578",
"0.66292536",
"0.66292536",
"0.6618811",
"0.66127086",
"0.66018534",
"0.65189666",
"0.6513... | 0.7916808 | 0 |
GET /shop/platinum_offers/1 GET /shop/platinum_offers/1.json | def show
@shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @shop_platinum_offer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end",
"def new\n @shop_platinum_offer = Shop::PlatinumOffer.new\n\n respond_to do |format|\n format.htm... | [
"0.7837212",
"0.7251988",
"0.7099386",
"0.68409514",
"0.6757134",
"0.66884965",
"0.66884965",
"0.667892",
"0.6657214",
"0.66472495",
"0.6643095",
"0.6637887",
"0.6633428",
"0.6598035",
"0.65695417",
"0.6561095",
"0.6525387",
"0.652302",
"0.6510229",
"0.65042406",
"0.6479908",... | 0.75583184 | 1 |
GET /shop/platinum_offers/new GET /shop/platinum_offers/new.json | def new
@shop_platinum_offer = Shop::PlatinumOffer.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @shop_platinum_offer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n ... | [
"0.76421005",
"0.759197",
"0.759197",
"0.759197",
"0.75303197",
"0.75135744",
"0.73032314",
"0.7297685",
"0.7265925",
"0.71909684",
"0.71802956",
"0.71693623",
"0.7091577",
"0.70513606",
"0.70513606",
"0.7018565",
"0.69402945",
"0.6922488",
"0.6919518",
"0.6902066",
"0.688865... | 0.7928996 | 0 |
POST /shop/platinum_offers POST /shop/platinum_offers.json | def create
@shop_platinum_offer = Shop::PlatinumOffer.new(params[:shop_platinum_offer])
respond_to do |format|
if @shop_platinum_offer.save
format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully created.' }
format.json { render json: @shop_platinum_offer,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @shop_platinum_offer = Shop::PlatinumOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end",
"def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end",
"de... | [
"0.6798831",
"0.67751306",
"0.67263204",
"0.66895103",
"0.6555843",
"0.65012175",
"0.64537793",
"0.64048576",
"0.6364331",
"0.6362568",
"0.6348361",
"0.62990266",
"0.62764525",
"0.62363803",
"0.61986583",
"0.6192489",
"0.6192489",
"0.61590135",
"0.61402476",
"0.6124745",
"0.6... | 0.70916224 | 0 |
PUT /shop/platinum_offers/1 PUT /shop/platinum_offers/1.json | def update
@shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])
respond_to do |format|
if @shop_platinum_offer.update_attributes(params[:shop_platinum_offer])
format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully updated.' }
format.json { head :o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateOffer()\n @offer_operation = :update\n end",
"def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n ... | [
"0.684222",
"0.6832055",
"0.6718058",
"0.6693253",
"0.6483262",
"0.64796",
"0.64436",
"0.639746",
"0.6366531",
"0.6343687",
"0.6343687",
"0.63395923",
"0.6336143",
"0.62674385",
"0.62674385",
"0.6260467",
"0.62132686",
"0.62108546",
"0.61963564",
"0.61955994",
"0.61944205",
... | 0.7247974 | 0 |
DELETE /shop/platinum_offers/1 DELETE /shop/platinum_offers/1.json | def destroy
@shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])
@shop_platinum_offer.destroy
respond_to do |format|
format.html { redirect_to shop_platinum_offers_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @shop_special_offer = Shop::SpecialOffer.find(params[:id])\n @shop_special_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_special_offers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n ... | [
"0.7446695",
"0.74227506",
"0.74227506",
"0.7341933",
"0.7331064",
"0.72472507",
"0.7192474",
"0.71747625",
"0.71608394",
"0.7127007",
"0.7127007",
"0.7111654",
"0.7111654",
"0.7090002",
"0.7087504",
"0.70684564",
"0.70550454",
"0.7032906",
"0.70102346",
"0.69821304",
"0.6971... | 0.7726243 | 0 |
Print the DCs based on DNS records before host selection | def initialize
pdc, dcs = get_dcs
if pdc and dcs
dc_list = ""
dc_list << "PDC: #{pdc}\n" unless pdc.empty?
dc_list << "DCs: #{dcs.join(' ')}" unless dcs.empty?
puts dc_list unless dc_list.empty?
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_known_hosts\n\t\tputs \"\\nSummary of local hosts Table:\"\n\t\tputs \"Total entries: #{@known_hosts.size}\"\n\t\t(@known_hosts.keys.sort-[\"\",nil]).each do |key|\n\t\t\tvalue=@known_hosts[key]\n\t\t\tputs \"#{key}\\t#{value}\" if is_fqdn?(key)\n\t\tend\n\t\tputs \"End of the summary\"\n\tend",
"def p... | [
"0.59976166",
"0.5989048",
"0.5979668",
"0.58977747",
"0.5892853",
"0.5890244",
"0.5858937",
"0.58491373",
"0.5819832",
"0.5712884",
"0.56561744",
"0.5652796",
"0.5642028",
"0.5640359",
"0.5639573",
"0.559482",
"0.559482",
"0.55796057",
"0.5541031",
"0.5481562",
"0.5472009",
... | 0.5954517 | 3 |
Print progress on download | def progress(size, file)
print '.'
sleep 1.5
print '.'
sleep 1.5
print '.'
sleep 1.5
percent = (File.size? file).to_f / size.to_f
percent = percent * 100
percent = ((percent*20).round / 20.0)
print "\e[1;37m#{percent}\e[0m%"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_progress\n @data[\"print_progress\"]\n end",
"def show\n puts \"Downloading %s\" % @@clonePW['url'].to_s\n @@thread = download(@@clonePW['url'].to_s)\n @progress_web=@@clonePW\n @@start = Time.now\n\n end",
"def progress; end",
"def progress; end",
"def progress; end",
"def... | [
"0.7580165",
"0.7153473",
"0.694257",
"0.694257",
"0.694257",
"0.694257",
"0.694257",
"0.69404536",
"0.6876141",
"0.6522011",
"0.6521914",
"0.6503979",
"0.64607036",
"0.64282113",
"0.63820374",
"0.63189095",
"0.6314882",
"0.62997055",
"0.62782466",
"0.62782365",
"0.62574345",... | 0.67745066 | 9 |
=== Return files where occurs: phrase_we_have_now | def search_in_project phrase_we_have_now
result_files_with_phrase = []
path_to_files = File.join(DIRECTORY_PATH, '**/*.rb')
files_to_check = []
Dir.glob(path_to_files) do |rb_file|
files_to_check << rb_file
end
raise "files_to_check is empty !" if files_to_check.length == 0
#Looking fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate_several_file file_path\n #Iterate file line by line\n result_lines_in_file = []\n reg = /.*#{@phrase_we_have_now}.*/\n file = File.open(file_path, \"r\") do |f|\n f.each_line do |line|\n if line.match?(reg)\n result_lines_in_file << line\n end\n end\n end... | [
"0.6455032",
"0.6131316",
"0.6072181",
"0.60100216",
"0.59508896",
"0.59123826",
"0.5905737",
"0.58907324",
"0.5845353",
"0.5825991",
"0.5788495",
"0.5785443",
"0.57852584",
"0.577604",
"0.5769491",
"0.5767229",
"0.57509285",
"0.5749213",
"0.5743935",
"0.5715855",
"0.57133067... | 0.81258565 | 0 |
=== Return array which contains lines with searched phrase for indicated file. | def iterate_several_file file_path
#Iterate file line by line
result_lines_in_file = []
reg = /.*#{@phrase_we_have_now}.*/
file = File.open(file_path, "r") do |f|
f.each_line do |line|
if line.match?(reg)
result_lines_in_file << line
end
end
end
result_lines... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grep(filename, phrase)\n File.open(filename) do |lines|\n lines.each do |line|\n puts \"#{lines.lineno}. #{line}\" if line =~ Regexp.new(phrase)\n end\n end\nend",
"def grep(filename, phrase)\n matches = []\n lines = IO.readlines filename\n (1..lines.length).each do |n... | [
"0.7128457",
"0.7125836",
"0.69238985",
"0.6905917",
"0.69048",
"0.6885366",
"0.6835945",
"0.6657407",
"0.6636865",
"0.66109884",
"0.65037006",
"0.64726603",
"0.64112854",
"0.63722193",
"0.63722193",
"0.63263345",
"0.62803096",
"0.62404174",
"0.6239854",
"0.6190422",
"0.61884... | 0.71408373 | 0 |
This method ask you for confirmation if you want to make indicated change. | def ask_for_several_change_in_file line_to_change, file_path
if @change_all
puts "\n\e[39m******************************************"
puts '* *'
puts '* Automatically changes has been started *'
puts '* *'
pu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm(question)\n CLI::UI.confirm(question)\n end",
"def confirm\n\n end",
"def confirm(question)\n formatted_question = \"\\n #{question} [Y/n]\"\n answer = ask(formatted_question).strip\n fail unless [\"Y\", \"y\", \"\"].include?(answer)\n end",
"def confirm\n p... | [
"0.74216497",
"0.7254088",
"0.7144451",
"0.7043146",
"0.6910561",
"0.6909471",
"0.68409014",
"0.6840304",
"0.6840304",
"0.6826939",
"0.67771095",
"0.6710017",
"0.6705021",
"0.6697442",
"0.66584504",
"0.66324043",
"0.6614772",
"0.6575333",
"0.6533774",
"0.65085596",
"0.6508088... | 0.6006368 | 52 |
Returns bool value for info if changes made correctly or rather problem occurs. | def make line_to_change, phrase_we_have_now, phrase_we_want_to_have, file_path
verbose = $conf[:verbose]
if verbose
puts "\e[39m-----------------------------"
puts "I'm changing:\n#{phrase_we_have_now}"
puts '-----------------------------'
puts "to:\n#{phrase_we_want_to_have}"
puts... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changed?\n\t\treturn self.changed_reason ? true : false\n\tend",
"def changed?\n !!@changed\n end",
"def changed?\r\n @changed\r\n end",
"def modified?\n\t\treturn @dirty ? true : false\n\tend",
"def modified?\r\n @modified\r\n end",
"def changed? \n @changed == true\n ... | [
"0.74104035",
"0.7173952",
"0.7164767",
"0.71090674",
"0.70800674",
"0.7068852",
"0.7040347",
"0.7005509",
"0.6994847",
"0.69840413",
"0.69694996",
"0.69585305",
"0.6942907",
"0.69428205",
"0.69324017",
"0.69266444",
"0.69266444",
"0.69144946",
"0.69054776",
"0.68297714",
"0.... | 0.0 | -1 |
What will it return? | def execute(&block)
block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def returns; end",
"def return_value; end",
"def return_type; end",
"def return_type; end",
"def return_type; end",
"def original_result;... | [
"0.73123395",
"0.73123395",
"0.73123395",
"0.73123395",
"0.73123395",
"0.73123395",
"0.73123395",
"0.73123395",
"0.7302111",
"0.7262517",
"0.7241289",
"0.7241289",
"0.7241289",
"0.70424354",
"0.67376614",
"0.668079",
"0.660926",
"0.65817434",
"0.6544071",
"0.6544071",
"0.6463... | 0.0 | -1 |
The program will print nothing to the screen because it miss the call method The program will return a Proc object Modify the code in exercise 2 to make the block execute properly. | def execute(&block)
block.call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test1\n p = Proc.new { return }\n p.call\n puts “This line can’t display”\nend",
"def proc_demo_method\n proc_demo = Proc.new { return \"Only I print!\" }\n proc_demo.call\n \"But what about me?\" # Never reached\nend",
"def test\r\n puts \"Enter in methods\"\r\n p = Proc.new {p \"Entering bloc... | [
"0.73825675",
"0.7218275",
"0.7154397",
"0.7005914",
"0.6976142",
"0.6963315",
"0.69449365",
"0.6862105",
"0.6861901",
"0.67856205",
"0.67787856",
"0.6759689",
"0.6700532",
"0.6697541",
"0.6685185",
"0.66722995",
"0.66722345",
"0.66715515",
"0.6641204",
"0.66341424",
"0.66182... | 0.0 | -1 |
attr_accessor :initial_size def initialize | def populate_deck
# self.initial_size.times do
# new_card_class = Card.library.values.sample
# new_card = new_card_class.new
# self.cards << new_card
# end
40.times do
new_card_type = Card.library.values.sample
new_card = new_card_type.create
self.cards << new_card
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize \n\t\tsuper(SIZE)\n\tend",
"def initialize(size)\n @size = size\n end",
"def initialize(args={})\n @size = args[:size] # <- promoted from RoadBike\n end",
"def initialize unit_size = 256 # defaults to 256\n\t\t\t@unit_size = unit_size\n\t\tend",
"def initialize(size)\n @... | [
"0.79574513",
"0.7934442",
"0.7854908",
"0.7796383",
"0.75807256",
"0.75145644",
"0.74375236",
"0.74341875",
"0.7317423",
"0.7309886",
"0.7293086",
"0.72110426",
"0.70901996",
"0.7067969",
"0.7026926",
"0.7003441",
"0.6984841",
"0.6978762",
"0.6978335",
"0.6978335",
"0.697720... | 0.0 | -1 |
GET /ads GET /ads.xml | def index
@ads = Ad.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @ads }
format.json { render :json => @ads }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n end\n end",
"def index\n @ads = Ad.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @ads.to_xml }\n en... | [
"0.7364696",
"0.72835666",
"0.7056196",
"0.69553655",
"0.6917627",
"0.6890893",
"0.6840493",
"0.6802959",
"0.6652822",
"0.6652822",
"0.6652822",
"0.6652822",
"0.6652822",
"0.6642466",
"0.66190606",
"0.657084",
"0.657084",
"0.6551971",
"0.65514565",
"0.6540528",
"0.64437926",
... | 0.70364416 | 3 |
GET /ads/1 GET /ads/1.xml | def show
@ad = Ad.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @ad }
format.json
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n end\n end",
"def index\n @ads = Ad.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @ads.to_xml }\n en... | [
"0.72110647",
"0.71499324",
"0.69318825",
"0.6909815",
"0.68556553",
"0.68513006",
"0.6689705",
"0.6588134",
"0.6588134",
"0.6530148",
"0.6521746",
"0.64924604",
"0.64236635",
"0.6412978",
"0.64126915",
"0.63063145",
"0.6294836",
"0.62866426",
"0.62866426",
"0.62866426",
"0.6... | 0.65510297 | 9 |
GET /ads/new GET /ads/new.xml | def new
@ad = Ad.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @ad }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert }\n end\n end",
"def new\n @advert = Advert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @advert }\n e... | [
"0.7246472",
"0.7246472",
"0.703648",
"0.6988676",
"0.69388354",
"0.6762822",
"0.67388356",
"0.67238015",
"0.6679309",
"0.66749793",
"0.667481",
"0.667481",
"0.6659455",
"0.6641959",
"0.66296804",
"0.66185975",
"0.65708196",
"0.65529805",
"0.6540494",
"0.65337914",
"0.6532016... | 0.7490911 | 1 |
POST /ads POST /ads.xml | def create
@ad = current_advertiser.ads.new(params[:ad])
respond_to do |format|
if @ad.save
format.html { redirect_to(@ad, :notice => 'Ad was successfully created.') }
format.xml { render :xml => @ad, :status => :created, :location => @ad }
else
format.html { render :action ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ad = Ad.new(params[:ad])\n\n respond_to do |format|\n if @ad.save\n flash[:notice] = 'Ad was successfully created.'.l\n format.html { redirect_to ad_url(@ad) }\n format.xml { head :created, :location => ad_url(@ad) }\n else\n format.html { render :action =... | [
"0.655109",
"0.6437091",
"0.6333174",
"0.6268408",
"0.62113065",
"0.61846685",
"0.61482894",
"0.613438",
"0.60580367",
"0.60243183",
"0.60080224",
"0.59799504",
"0.5971434",
"0.58916676",
"0.58676434",
"0.5862601",
"0.58564824",
"0.582978",
"0.57936877",
"0.57864076",
"0.5749... | 0.6978248 | 0 |
PUT /ads/1 PUT /ads/1.xml | def update
@ad = Ad.find(params[:id])
respond_to do |format|
if @ad.update_attributes(params[:ad])
format.html { redirect_to(@ad, :notice => 'Ad was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def upd... | [
"0.6861055",
"0.6582346",
"0.6339055",
"0.61574143",
"0.6061955",
"0.59721386",
"0.59676737",
"0.5953461",
"0.58593136",
"0.58588886",
"0.5840107",
"0.5836505",
"0.58318263",
"0.5789399",
"0.5782702",
"0.577271",
"0.577271",
"0.57463974",
"0.5713168",
"0.5707409",
"0.56424916... | 0.6127757 | 4 |
DELETE /ads/1 DELETE /ads/1.xml | def destroy
@ad = Ad.find(params[:id])
@ad.destroy
respond_to do |format|
format.html { redirect_to(ads_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to(ads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to ads_url }\n format.xml { head... | [
"0.72471845",
"0.7074387",
"0.7074387",
"0.7074387",
"0.69714904",
"0.68989664",
"0.6880963",
"0.6859546",
"0.6849848",
"0.68175167",
"0.67454636",
"0.66903937",
"0.6666782",
"0.66627675",
"0.6642551",
"0.66368985",
"0.66019744",
"0.65889335",
"0.6556639",
"0.65478224",
"0.65... | 0.7192666 | 1 |
TODO: Cyclomatic complexity for inverse is too high. [7/6] | def inverse(x, operator)
if x.num?
x = x.to_numeric
if operator == :+
_(- x)
else
_(Rational(1, x))
end
elsif x.is_a?(Inverse) && x.operator == operator
x.x
else
Inverse.new(x, operator)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse; end",
"def inverse; end",
"def inverse\n end",
"def inverse_of; end",
"def invert() end",
"def invert; end",
"def inverse!\n inverse self\n end",
"def invert\n end",
"def inversed; end",
"def inverse_of=(_arg0); end",
"def inverted; invert = true; self; end",
"def inverse... | [
"0.8477054",
"0.8477054",
"0.8274837",
"0.7928972",
"0.7923596",
"0.7874508",
"0.7718438",
"0.76626843",
"0.75551695",
"0.723393",
"0.7100114",
"0.7096614",
"0.70546114",
"0.7043647",
"0.7019748",
"0.68156505",
"0.6786926",
"0.6772676",
"0.6662975",
"0.66560996",
"0.66497993"... | 0.6151951 | 52 |
remove rails default log subscriptions [ActiveRecord::LogSubscriber, ActionController::LogSubscriber, ActionView::LogSubscriber, ActionMailer::LogSubscriber] | def remove_existing_log_subscriptions
ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|
case subscriber
when ActionView::LogSubscriber
unsubscribe(:action_view, subscriber)
when ActionController::LogSubscriber
unsubscribe(:action_controller, subscriber)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_logging\n @logger = nil\n end",
"def reset_logging\n\t\tMongrel2.reset_logger\n\tend",
"def disable_logging\n @communicator_logger = nil\n end",
"def disable_logging\n @communicator_logger = nil\n end",
"def clear_log\n @messages = []\n end",
"def clear_mes... | [
"0.6561888",
"0.6399561",
"0.63518065",
"0.63518065",
"0.6237149",
"0.61168534",
"0.6092307",
"0.60305023",
"0.6026589",
"0.6026589",
"0.5984686",
"0.5931459",
"0.59240454",
"0.59138364",
"0.5888427",
"0.5868434",
"0.5822584",
"0.58137894",
"0.57679045",
"0.5756762",
"0.57566... | 0.8608591 | 0 |
The path used after sending reset password instructions | def after_sending_reset_password_instructions_path_for(resource_name)
new_session_path(resource_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sending_reset_password_instructions_path_for(resource_name)\n receber_email_password_path\n end",
"def after_sending_reset_password_instructions_path_for(resource_name)\n root_path\n end",
"def after_sending_reset_password_instructions_path_for(resource_name)\n store_url\n end",
"... | [
"0.7399897",
"0.7388807",
"0.7221363",
"0.7169863",
"0.70551175",
"0.70126516",
"0.7008006",
"0.6926533",
"0.6911947",
"0.6905408",
"0.6905408",
"0.6900387",
"0.6900387",
"0.6900387",
"0.6884388",
"0.68729913",
"0.6870175",
"0.6807925",
"0.6807925",
"0.6781113",
"0.6687174",
... | 0.6858631 | 18 |
has_many :episodes, include_nested_associations: true | def episodes
object.episodes.collect do |episode|
{
:episode_code => episode.episode_code,
:episode_name => episode.episode_name
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @episodes = @season.episodes\n end",
"def episode_params\n params.require(:episode).permit(:user_id, :comment, :approved_by, :approved_time,:title,:total_time,:holiday_id, :start_date, :end_date,:_destroy,children_attributes: [:total_time,:holiday_id, :start_date, :end_date,:_destroy,:id])\... | [
"0.5931878",
"0.58995104",
"0.580515",
"0.57973546",
"0.5754207",
"0.5745016",
"0.5694779",
"0.5641791",
"0.5631923",
"0.5631378",
"0.556535",
"0.5542792",
"0.5542792",
"0.5542792",
"0.5542792",
"0.5542792",
"0.5542792",
"0.5541163",
"0.5515765",
"0.55095404",
"0.5490125",
... | 0.60838485 | 0 |
Write a method that takes an Array of numbers, and returns an Array with the same number of elements, and each element has the running total from the original Array. Examples: | def running_total(array)
result = []
array.each_index do |i|
result[i] = (0..i).to_a.map { |e| array[e] }.inject(:+)
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running_total(array)\n run_total = []\n \n index = 1\n while index <= array.length\n element = array.slice(0,index)\n run_total << element.inject(:+)\n index += 1\n end\n run_total\nend",
"def running_total(array)\r\n new_arr = []\r\n total = 0\r\n array.map do |x|\r\n total += x... | [
"0.8626914",
"0.85823333",
"0.85522926",
"0.8549791",
"0.8516487",
"0.847079",
"0.84627575",
"0.84522915",
"0.84447396",
"0.8441292",
"0.84375095",
"0.84351766",
"0.8414317",
"0.840104",
"0.83862555",
"0.8341666",
"0.8339806",
"0.8338676",
"0.8338676",
"0.8338676",
"0.8313545... | 0.8449086 | 8 |
Never trust parameters from the scary internet, only allow the white list through. | def master_reservation_params
params.require(:master_reservation).permit(:paid, :payment_method, :user_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 |
GET /fellowships GET /fellowships.json | def index
@fellowships = Fellowship.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friendships_show(options = {})\n @req.get(\"/1.1/friendships/show.json\", options)\n end",
"def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end",
"def all_followships\n... | [
"0.68399906",
"0.677079",
"0.66788733",
"0.6673716",
"0.6600876",
"0.6530814",
"0.64723",
"0.63641745",
"0.62883073",
"0.6271121",
"0.62546223",
"0.6192769",
"0.6192769",
"0.6094432",
"0.60479635",
"0.60295016",
"0.59806514",
"0.5938384",
"0.5932049",
"0.5920053",
"0.5914618"... | 0.75781894 | 0 |
GET /fellowships/1 GET /fellowships/1.json | def show
respond_to do |format|
if current_user
format.html
format.js
else
format.html {render :layout => 'join'}
format.js
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @fellowships = Fellowship.all\n end",
"def show\n @friendship = @user.friendships.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end",
"def index\n @friendships = @user.friendships\n\n respo... | [
"0.743488",
"0.6932207",
"0.6730921",
"0.6684906",
"0.65486324",
"0.65461636",
"0.63578725",
"0.6356778",
"0.63304085",
"0.63263345",
"0.63263345",
"0.6281293",
"0.62437433",
"0.62437433",
"0.62431085",
"0.61480373",
"0.6140587",
"0.61285144",
"0.6128125",
"0.6118599",
"0.609... | 0.0 | -1 |
POST /fellowships POST /fellowships.json | def create
@fellowship = Fellowship.new(fellowship_params)
@fellowship.users << current_user
# Capitalize fellowship name
@fellowship.fellowship_name = @fellowship.fellowship_name.titleize
respond_to do |format|
if @fellowship.save
format.html { redirect_to @fellowship, notice: 'Fell... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friendships_create(options = {})\n @req.post(\"/1.1/friendships/create.json\", options)\n end",
"def create\n @friendship = @user.friendships.new(params[:friendship])\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to [@game, @user, @friendship], notice... | [
"0.6730782",
"0.66602993",
"0.64368373",
"0.6300739",
"0.629646",
"0.62136364",
"0.61378735",
"0.61314875",
"0.6091154",
"0.6081026",
"0.6061243",
"0.60283875",
"0.6027313",
"0.6020404",
"0.5962556",
"0.5914881",
"0.58770686",
"0.5870517",
"0.5863505",
"0.5857794",
"0.5850313... | 0.7283734 | 0 |
PATCH/PUT /fellowships/1 PATCH/PUT /fellowships/1.json | def update
respond_to do |format|
if @fellowship.update(fellowship_params)
format.html { redirect_to @fellowship, notice: 'Fellowship was successfully updated.' }
format.json { render :show, status: :ok, location: @fellowship }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @friendship = @user.friendships.find(params[:id])\n\n respond_to do |format|\n if @friendship.update_attributes(params[:friendship])\n format.html { redirect_to [@game, @user, @friendship], notice: 'Friendship was successfully updated.' }\n format.json { head :no_content }\n ... | [
"0.6577438",
"0.6572786",
"0.63750905",
"0.63712245",
"0.6364273",
"0.6355806",
"0.6355806",
"0.6349399",
"0.63353676",
"0.6317811",
"0.6317811",
"0.62416816",
"0.6156808",
"0.612449",
"0.6119615",
"0.611216",
"0.61070263",
"0.61058515",
"0.6076143",
"0.605085",
"0.60452294",... | 0.7349757 | 0 |
DELETE /fellowships/1 DELETE /fellowships/1.json | def destroy
@fellowship.destroy
respond_to do |format|
format.html { redirect_to fellowships_url, notice: 'Fellowship was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @friendship = @user.friendships.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to game_user_friendships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientship = current_user.clientships.find(params[:id... | [
"0.73010033",
"0.72287136",
"0.7168933",
"0.7126834",
"0.7002743",
"0.6930039",
"0.69144964",
"0.68991405",
"0.68991405",
"0.68991405",
"0.6881094",
"0.68626404",
"0.68558574",
"0.6847012",
"0.68368685",
"0.6826178",
"0.680313",
"0.6783466",
"0.6758267",
"0.6748581",
"0.67429... | 0.76634187 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_fellowship
@fellowship = Fellowship.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def fellowship_params
params.require(:fellowship).permit(:fellowship_name, :user_id, :fellowship_description)
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 |
HERE IS WHERE MY PROBLEM IS search for track by name. Returns the index of the track or 1 if not found Put a while loop here that searches through the tracks Use the read_string() function from input_functions. NB: you might need to use .chomp to compare the strings correctly | def search_for_track_name(tracks, search_string)
# search_string = gets.chomp
index = 0
while (index < tracks.length)
if (tracks[index].name == search_string)
return index
end
index += 1
end
return -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_for_track_name(tracks, search_string)\nputs (\"Searching for track: \" + search_string)\nfound_index = -1\ni = 0\n\twhile (i < tracks.length)\n\t\t\t# track = tracks[i]\n\t\t\tif (tracks[i].name.chomp == search_string.chomp)\n\t\t\t\tfound_index = i\n\t\t\tend\n\t\t\ti += 1\n\t\tend\n\tfound_index\nend"... | [
"0.88278",
"0.8806834",
"0.84274423",
"0.779225",
"0.7767581",
"0.76326054",
"0.75226533",
"0.6730903",
"0.67054236",
"0.6592457",
"0.6546084",
"0.6351245",
"0.6264797",
"0.62097067",
"0.62037647",
"0.61787224",
"0.61520106",
"0.6137741",
"0.6129702",
"0.60880524",
"0.6030298... | 0.8906325 | 0 |
Reads in an Album from a file and then prints all the album to the terminal | def main
music_file = File.open("album.txt", 'r')
if music_file
album = read_album(music_file)
album.tracks = read_tracks(music_file)
music_file.close()
end
puts "Enter the track name you wish to find: "
search_string = gets.chomp
index = search_for_track_name(album.tracks, search_string)
if i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main\n music_file = File.new(\"album.txt\", \"r\")\n\talbum = read_album(music_file)\n music_file.close()\n\n\tprint_album(album)\nend",
"def main()\n\t music_file = File.new(\"album.txt\", \"r\")\n\t album = read_album(music_file)\n\t music_file.close()\n\t print_album(album)\n end",
"def read_albu... | [
"0.82238275",
"0.8168838",
"0.78670126",
"0.77832097",
"0.77832097",
"0.7739746",
"0.7618495",
"0.7602705",
"0.74717784",
"0.74259996",
"0.74094355",
"0.73925894",
"0.73923737",
"0.73200476",
"0.7229838",
"0.72257847",
"0.71979827",
"0.7192569",
"0.7174716",
"0.70636374",
"0.... | 0.62836623 | 29 |
get every test to pass before coding runner below | def runner
welcome
hand = initial_round
while hand < 21
updated_hand = hit?(hand)
display_card_total(updated_hand)
hand = updated_hand
end
end_game(updated_hand)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if no... | [
"0.72739923",
"0.7200749",
"0.7192741",
"0.7133238",
"0.71286565",
"0.703575",
"0.68629813",
"0.68229353",
"0.68083966",
"0.67929894",
"0.67929894",
"0.67667425",
"0.6571596",
"0.6554889",
"0.654819",
"0.6545211",
"0.65298504",
"0.6459734",
"0.6449296",
"0.6449296",
"0.644150... | 0.0 | -1 |
I worked on this challenge with: Dan. Take starting value and subtract one from that value all the way down to 1. Multiple all the numbers together. Set factorial 0 equal to one. Your Solution Below | def factorial(n)
# until ((n - 1) = 0)
# do n - 1
if n == 0
return 1
else
fact_array = Array.new(n) {|f| f = f + 1}
fact_array.inject(:*)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def factorial (number)\n if number == 0\n return 1\n else\n\n total = 1\n for i in 1..number\n total *= i\n i += 1\n end\n return total\n end\nend",
"def factorial(number)\r\ntotal = 1\t\r\n\twhile number != 0\r\n\t\ttotal *= number\r\n\t\tnumber = number -1\r\n\tend\r\n\ttotal\r\nend",
... | [
"0.8128986",
"0.8068104",
"0.8064745",
"0.800699",
"0.79941887",
"0.79804826",
"0.79357994",
"0.7930116",
"0.7928459",
"0.7914675",
"0.7914675",
"0.7907942",
"0.7906989",
"0.79042643",
"0.7899969",
"0.78985167",
"0.7887808",
"0.7883785",
"0.7876835",
"0.78754574",
"0.78652185... | 0.0 | -1 |
hack for the test to run | def initialize(name, artist, genre)
@name = name
@artist = artist
@genre = genre
@@all.push(self)
# @@count += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running_test_case; end",
"def spec; end",
"def spec; end",
"def testing\n # ...\n end",
"def self_test; end",
"def self_test; end",
"def __dummy_test__\n end",
"def tests; end",
"def tests; end",
"def test_case; end",
"def setup; end",
"def setup; end",
"def setup; end",
... | [
"0.6913379",
"0.69073737",
"0.69073737",
"0.68506426",
"0.6797596",
"0.6797596",
"0.6784355",
"0.67117506",
"0.67117506",
"0.65753305",
"0.6569023",
"0.6569023",
"0.6569023",
"0.6569023",
"0.6569023",
"0.6569023",
"0.6569023",
"0.6569023",
"0.6569023",
"0.6569023",
"0.6569023... | 0.0 | -1 |
OLD SECTION STUFF all this stuff will be replaced by the new teacher dashboard (the code for this happens to live in pegasus) and will be deleted once that ships | def new
@section = Section.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twiki_index\n @show_teams_for_many_courses = false\n @machine_name = \"http://rails.sv.cmu.edu\"\n\n url = get_twiki_http_referer()\n @course = Course.find(:first, :conditions => [\"twiki_url = ?\", url])\n\n @show_create_course = false\n if(@course.nil?)\n @show_create_course = true\n ... | [
"0.5859007",
"0.5813787",
"0.5813099",
"0.5725672",
"0.57104653",
"0.56650126",
"0.56344134",
"0.56092334",
"0.56020164",
"0.5597841",
"0.55816436",
"0.5536892",
"0.5518467",
"0.5498936",
"0.54964286",
"0.54804224",
"0.54634935",
"0.54622227",
"0.5458884",
"0.54402953",
"0.54... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def section_params
params.require(:section).permit(:name, students_attributes: [:name, :username, :password, :provider])
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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_contract
@contract = Contract.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def contract_params
params.require(:contract).permit(:status, :contractor_id, :user_profile_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
choose two random positions in the world | def moves(world_state)
[rand(world_state.size), rand(world_state.size)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_generator(pos1, pos2, length)\n # generate a position away from earth and moon\n position = rand(1..length - 1)\n if pos1.include? position or pos2.include? position\n position = position_generator(pos1, pos2, length)\n end\n return position\nend",
"def create_random_world\n randomize_ter... | [
"0.7658976",
"0.6903688",
"0.6858225",
"0.6796618",
"0.6647672",
"0.65743464",
"0.65726393",
"0.6545599",
"0.64779025",
"0.64369714",
"0.6359561",
"0.63200927",
"0.6306826",
"0.62765986",
"0.62659097",
"0.62457967",
"0.6192756",
"0.6167988",
"0.61634",
"0.61617005",
"0.615783... | 0.62635434 | 15 |
IDEA can not handle text content with indents so need to removing indenting Can not pass true as third argument as the ruby library seems broken | def write(f)
document.write(f, -1, false, true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indent; end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent; end",
"def change_indent plus\n # nothing here\n end",
"def indentation; end",
"def indentation; end",
"def indent=(_arg0); end",
"def indent()\n #This is a stub, used for indexing\n ... | [
"0.7163049",
"0.7163049",
"0.7163049",
"0.7163049",
"0.7163049",
"0.71525156",
"0.71307516",
"0.71307516",
"0.690279",
"0.68191886",
"0.6627504",
"0.66103095",
"0.6589161",
"0.65154094",
"0.6492186",
"0.6461226",
"0.64276856",
"0.6424821",
"0.63996434",
"0.63996434",
"0.63885... | 0.0 | -1 |
replace overridden component (if any) with specified component | def inject_component(doc, component)
doc.root.delete_element("//component[@name='#{component.attributes['name']}']")
doc.root.add_element component
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace!(oth)\n if self.class != oth.class\n raise ArgumentError, \"expected #{self.class} object\"\n end\n\n component.each do |c|\n self.__send__(\"#{c}=\", oth.__send__(c))\n end\n end",
"def replace(*)\n lazy_load # lazy load so that targets are always orpha... | [
"0.6217935",
"0.5851744",
"0.5851744",
"0.5740516",
"0.56353927",
"0.56353927",
"0.55662876",
"0.5557204",
"0.5469669",
"0.5343248",
"0.5308913",
"0.5260245",
"0.5260245",
"0.5237003",
"0.52104384",
"0.51787484",
"0.5177196",
"0.5165983",
"0.5153559",
"0.5137964",
"0.5131073"... | 0.5616872 | 6 |
Don't exclude things that are subdirectories of other excluded things | def net_excluded_directories
net = []
all = self.excluded_directories.map { |dir| buildr_project._(dir.to_s) }.sort_by { |d| d.size }
all.each_with_index do |dir, i|
unless all[0 ... i].find { |other| dir =~ /^#{other}/ }
net << dir
end
end
net
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclude_dir\n @exclude_dirs.map { |p| Pathname.new(path) + p }.select(&:exist?)\n end",
"def exclude\n @_exclude ||= Set.new %w(test spec tmp features config public db).map{ |path| Padrino.root(path) }\n end",
"def excluded_files() = []",
"def apply_exclusions paths\n paths.reject do... | [
"0.7640305",
"0.7480123",
"0.74511415",
"0.7405409",
"0.7363529",
"0.7317784",
"0.7256852",
"0.7212629",
"0.71903944",
"0.7178808",
"0.7165311",
"0.7072369",
"0.69164747",
"0.69031",
"0.67741275",
"0.67739356",
"0.6750786",
"0.6703186",
"0.66887844",
"0.6682781",
"0.6639183",... | 0.6936999 | 13 |
Handle missing methods so we can do fancy URL hooks. This is what gives us "edit_player_icon" and "new_game_icon" | def method_missing_with_icon_links(method_id, *args)
method = method_id.to_s
# special catch for "run_icon", where it really means "run_run_icon"
method = "#{$1}_#{$1}_icon" if method =~ /^([a-z]+)_icon$/
if method =~ /^([a-z]+)_(.+)_icon$/
options = args.last.is_a?(Hash) ? args.pop : {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon_no_link_processing(method, url=nil, alt=nil, label=method.humanize)\n\n if (label == 'Destroy')\n label = 'Delete';\n end\n\n return nil unless (filename = method_to_icon_filename(method.downcase))\n \n # if method.to_s == \"info\"\n # make into cool javascript div thing!\n \n i... | [
"0.6233598",
"0.615125",
"0.58730745",
"0.5807232",
"0.5805596",
"0.5798527",
"0.57427466",
"0.568982",
"0.568982",
"0.5633644",
"0.55670005",
"0.5490245",
"0.5486341",
"0.5410707",
"0.54066026",
"0.5405247",
"0.5339818",
"0.5324322",
"0.5310097",
"0.53070885",
"0.53068984",
... | 0.6956579 | 0 |
Public: Creates a new UnitOfWork instance. | def initialize
@identity_map = {}
@meta = {}
@pending_saves = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @unit = Unit.new(unit_params)\n authorize @unit\n begin\n ActiveRecord::Base.transaction do\n @unit.save!\n end\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @unit.errors.any? ? @unit : e },\n status: :bad_... | [
"0.58053595",
"0.5518828",
"0.5473824",
"0.53229034",
"0.5308944",
"0.52999717",
"0.50668705",
"0.50668705",
"0.5065667",
"0.50531423",
"0.50526154",
"0.5047939",
"0.49867436",
"0.49728087",
"0.49728087",
"0.49691248",
"0.49515408",
"0.49030033",
"0.4902051",
"0.48997742",
"0... | 0.0 | -1 |
Public: Add additional meta data to be sent along with any save reciepts on the message bus for the duration of the unit of work. | def add_meta_data(meta_hash)
meta.merge! meta_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n if (not @queued_for_delete.empty?) and @queued_for_write.empty?\n instance_write(:meta, ActiveSupport::Base64.encode64(Marshal.dump({}))) if instance.respond_to?(:\"#{name}_meta=\")\n end\n original_save\n end",
"def save_additional_data\n end",
"def merge_metadata_to_sen... | [
"0.6486739",
"0.6122423",
"0.6061689",
"0.5907443",
"0.58464247",
"0.5810245",
"0.57848537",
"0.578153",
"0.563734",
"0.5563939",
"0.5563521",
"0.5544783",
"0.5544783",
"0.553418",
"0.552932",
"0.55232614",
"0.55094343",
"0.5468377",
"0.5436757",
"0.54222745",
"0.5391912",
... | 0.5844981 | 5 |
Public: Executes all pending saves within a transaction, clears the pending saves, and publishes the reciepts via the message bus. Returns self. | def execute_work!
save_receipts = event_store.with_transaction do
pending_saves.map(&:call)
end
@pending_saves = []
save_receipts.each do |reciept|
message_bus.publish_events(reciept.id, reciept.klass, reciept.events,
reciept.meta.merge(meta))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save!\n no_recursion do\n _sq_around_original_save do\n super if defined?(super)\n end\n\n save_queue.save!\n end\n end",
"def transactions\n @connection.savepoint\n end",
"def save(*)\n super.tap { |result| send_pending_email if result }\... | [
"0.5911008",
"0.57054454",
"0.570071",
"0.56451714",
"0.554578",
"0.546174",
"0.540657",
"0.53439665",
"0.53351825",
"0.5309278",
"0.5305898",
"0.52807957",
"0.52781755",
"0.52768975",
"0.5273703",
"0.52465266",
"0.5238226",
"0.52192616",
"0.5216401",
"0.5204785",
"0.520458",... | 0.7648541 | 0 |
Public: Fetches an aggregate via it's ID from the identity map. type the type for the aggregate. id the ID for the aggregate. Returns nil if not found. Returns Aggregate if found. | def fetch_aggregate(type, id)
return unless identity_map[type]
identity_map[type][id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_aggregate(aggregate_id, clazz = nil)\n result = aggregates.fetch(aggregate_id) do |_|\n stream, events = @event_store.load_events(aggregate_id)\n raise AggregateNotFound.new(aggregate_id) unless stream\n aggregate_class = Class.const_get(stream.aggregate_type)\n ... | [
"0.67342156",
"0.6724899",
"0.5534811",
"0.54373527",
"0.5300605",
"0.5186826",
"0.5118275",
"0.5104394",
"0.506786",
"0.5057087",
"0.50392383",
"0.5026509",
"0.5016119",
"0.4986281",
"0.49750254",
"0.49571168",
"0.49536654",
"0.49529868",
"0.49429488",
"0.494267",
"0.4933193... | 0.8147694 | 0 |
Public: Stores an aggregate via it's ID into the identity map. aggregate the aggregate to store. Returns self. | def store_aggregate(aggregate)
type = aggregate.class.to_s
identity_map[type] ||= {}
identity_map[type][aggregate.id] = aggregate
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_aggregate(aggregate)\n existing = aggregates[aggregate.id]\n if existing && !existing.equal?(aggregate)\n raise NonUniqueAggregateId.new(aggregate, aggregates[aggregate.id])\n else\n aggregates[aggregate.id] = aggregate\n end\n end",
"def add_aggregate(a... | [
"0.6711002",
"0.6711002",
"0.6016628",
"0.5993684",
"0.5875134",
"0.5819763",
"0.5684788",
"0.5643692",
"0.545328",
"0.54153013",
"0.5414914",
"0.54032654",
"0.5391896",
"0.519619",
"0.5148701",
"0.5090018",
"0.50510126",
"0.49885383",
"0.4962707",
"0.49500427",
"0.4938215",
... | 0.85116476 | 0 |
GET /questionnaires GET /questionnaires.json | def index
@questionnaires = Questionnaire.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end",
"def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n ... | [
"0.75763637",
"0.6953089",
"0.692888",
"0.6895143",
"0.6792777",
"0.6698487",
"0.6696715",
"0.6696715",
"0.6687998",
"0.667861",
"0.6629849",
"0.6621805",
"0.6575555",
"0.63936925",
"0.6362681",
"0.6336179",
"0.632804",
"0.63277745",
"0.63257277",
"0.6320819",
"0.628833",
"... | 0.6794665 | 5 |
GET /questionnaires/1 GET /questionnaires/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n ... | [
"0.742471",
"0.7290521",
"0.7089278",
"0.7089278",
"0.6979919",
"0.68588394",
"0.68273973",
"0.670289",
"0.667116",
"0.6660555",
"0.6644325",
"0.662616",
"0.6584409",
"0.6584409",
"0.6584409",
"0.65730816",
"0.65534264",
"0.65438294",
"0.6525332",
"0.65009725",
"0.6489891",
... | 0.0 | -1 |
POST /questionnaires POST /questionnaires.json | def create
@questionnaire = Questionnaire.new(questionnaire_params)
@questionnaire.build_questionnaire_with_options(
questionnaire_params[:options][:question_count],
questionnaire_params[:options][:answer_count])
respond_to do |format|
if @questionnaire.save
format.html { redi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redire... | [
"0.6628127",
"0.6516484",
"0.6485117",
"0.6454647",
"0.6394063",
"0.6381477",
"0.63798666",
"0.63659567",
"0.63437366",
"0.6333206",
"0.63324606",
"0.62913746",
"0.6288558",
"0.6235486",
"0.6231012",
"0.6214164",
"0.6159615",
"0.614689",
"0.6143025",
"0.61364704",
"0.6117868"... | 0.6585721 | 1 |
PATCH/PUT /questionnaires/1 PATCH/PUT /questionnaires/1.json | def update
respond_to do |format|
if @questionnaire.update(questionnaire_params)
format.html { redirect_to @questionnaire, notice: 'Тест успешно обновлен.' }
format.json { render :show, status: :ok, location: @questionnaire }
else
format.html { render :edit }
format.json ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end",
"def update\n @question = Question.update(params[:id], { \n :b... | [
"0.70384896",
"0.69516647",
"0.6948583",
"0.6902964",
"0.68503",
"0.6789693",
"0.67585784",
"0.6736368",
"0.67278576",
"0.6726722",
"0.67096454",
"0.66641563",
"0.66607726",
"0.6659296",
"0.6650957",
"0.66421586",
"0.66157824",
"0.66145205",
"0.6610917",
"0.6610917",
"0.66109... | 0.65047455 | 36 |
DELETE /questionnaires/1 DELETE /questionnaires/1.json | def destroy
@questionnaire.destroy
respond_to do |format|
format.html { redirect_to questionnaires_url, notice: 'Тест успешно удален.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n f... | [
"0.78990173",
"0.7862867",
"0.7862867",
"0.75283194",
"0.7526599",
"0.749106",
"0.7443345",
"0.74232304",
"0.7396388",
"0.73805773",
"0.7351647",
"0.73419195",
"0.73237777",
"0.7314943",
"0.7314943",
"0.7314943",
"0.7314943",
"0.7314943",
"0.7314943",
"0.7313181",
"0.7301081"... | 0.7657406 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_questionnaire
@questionnaire = Questionnaire.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 questionnaire_params
params.require(:questionnaire).permit(
:title,
:description,
options: {},
questions_attributes:
[:id,
:question_text,
:correct_answer,
:_destroy,
question_answers_attributes:
... | {
"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 |
FIXME: implement line folding | def kv_pair(k, v)
v = normalize_encoding(v)
if token_safe?(v)
add_text k + '=' + v
elsif not CONTROL_CHAR =~ v
add_text k + '=' + quote_token(v)
else
# apply RFC2231 encoding
kv = k + '*=' + "iso-2022-jp'ja'" + encode_value(v)
add_text kv
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def folds\n\t\t@lines.map{|l| l.folded_lines}\n\tend",
"def dividing_line; end",
"def original_line; end",
"def line_to_wrap; end",
"def project_to_line\n end",
"def line_ranges=(_); end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line_for_position(posi... | [
"0.69714314",
"0.6694071",
"0.6678519",
"0.64364696",
"0.63826483",
"0.62295663",
"0.62194186",
"0.62194186",
"0.62194186",
"0.6218207",
"0.61070603",
"0.60982686",
"0.60982686",
"0.60982686",
"0.60982686",
"0.60982686",
"0.60982686",
"0.60982686",
"0.60982686",
"0.60982686",
... | 0.0 | -1 |
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity Bite me. If this app becomes wildy profitable, I'll fix it. | def delta_message
if this_weeks_errors > last_weeks_errors
if percentage_difference > 25
"a big increase of #{percentage_difference}% from"
elsif percentage_difference < 5
"a slight increase of #{percentage_difference}% from"
else
"up #{percentage_difference}% from"
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def appraisals; end",
"def appraisals; end",
"def implementation; end",
"def implementation; end",
"def strategy; end",
"def refutal()\n end",
"def private_method\n end",
"def intensifier; end",
"def probers; end",
"def schubert; end",
"def sitemaps; end",
"def i... | [
"0.6590742",
"0.5880974",
"0.5880974",
"0.56726605",
"0.56726605",
"0.55850405",
"0.55055743",
"0.5493033",
"0.545662",
"0.5348972",
"0.5331226",
"0.5307275",
"0.5283785",
"0.5283785",
"0.52585757",
"0.52475375",
"0.5226848",
"0.5216945",
"0.51839626",
"0.51791507",
"0.515444... | 0.0 | -1 |
Run the scaffolder It created the directories and the nescessary files | def run
super
create_easy_type_source
create_simple_provider_source
create_name_attribute_source
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup()\n create_directories\n end",
"def generate_files\n ip = local_ip\n version = Farmstead::VERSION\n scaffold_path = \"#{File.dirname __FILE__}/scaffold\"\n scaffold = Dir.glob(\"#{scaffold_path}/**/*.erb\", File::FNM_DOTMATCH)\n scaffold.each do |file|\n base... | [
"0.69156545",
"0.6820083",
"0.66743004",
"0.664513",
"0.664513",
"0.66366476",
"0.6553373",
"0.6437034",
"0.63251036",
"0.63179386",
"0.6314223",
"0.6293067",
"0.62845117",
"0.6277205",
"0.6274075",
"0.6273754",
"0.62473136",
"0.62418914",
"0.6197656",
"0.6192067",
"0.6184819... | 0.0 | -1 |
Create the easy type source file. ./lib/puppet/type/type_name.rb | def create_easy_type_source
create_source(TYPE_TEMPLATE, type_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_definition\n # return if not @type # ToDo: remove?\n @type.to_s + ' ' + code_name + \";\\n\"\n end",
"def type_path\n type_directory + \"#{@name}.rb\"\n end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; en... | [
"0.72343683",
"0.68850625",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.6716906",
"0.63614374",
"0.63518107",
"0.6350147",
"0.6344717",... | 0.7841972 | 0 |
Create the easy_type provider source file. ./lib/puppet/provider/type_name/provider_name.rb | def create_simple_provider_source
create_source(PROVIDER_TEMPLATE, provider_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_easy_type_source\n create_source(TYPE_TEMPLATE, type_path)\n end",
"def type\n :puppet_provider\n end",
"def initialize(type_name, name)\n @type_name = type_name\n super(PuppetStrings::Yard::CodeObjects::Providers.instance(type_name), name)\n end",
"def generate\n sen... | [
"0.6833228",
"0.67541355",
"0.6688306",
"0.66062933",
"0.6443001",
"0.62247926",
"0.618997",
"0.6091165",
"0.60012203",
"0.60008454",
"0.5864689",
"0.5862238",
"0.58397174",
"0.57940793",
"0.57409793",
"0.57376426",
"0.5678912",
"0.56600064",
"0.56107444",
"0.5599568",
"0.558... | 0.72801447 | 0 |
Create the easy type name attribute source file. ./lib/puppet/type/type_name/parameter_name.rb | def create_name_attribute_source
create_source(PARAMETER_TEMPLATE, name_attribute_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_attr(type) type_info(type, :name_attr) end",
"def name_attribute_path\n type_attribute_directory + \"#{@namevar}.rb\"\n end",
"def name_with_type\n\t\t\"#{type}: #{name}\"\n\tend",
"def generate_argument_code\n 'const ' + @type.to_s + '& ' + code_name\n end",
"def input_name_from... | [
"0.65414023",
"0.65000445",
"0.6343576",
"0.62327015",
"0.6221138",
"0.6218624",
"0.6169844",
"0.6169844",
"0.6169844",
"0.6100225",
"0.6074896",
"0.60598475",
"0.60193896",
"0.60117024",
"0.60047096",
"0.6003836",
"0.6000967",
"0.5998977",
"0.5967555",
"0.5960274",
"0.593905... | 0.72566235 | 0 |
include it Should pass | def test_tag_pass
assert_equal mail_to("bob@here.com"), "<a href='mailto:bob@here.com'>bob@here.com</a>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include; end",
"def include; end",
"def included; end",
"def includes\n end",
"def includes\n end",
"def include?(something); end",
"def included(mod); end",
"def include=(_arg0); end",
"def include?(arg0)\n end",
"def test_0210_includeq\n @@log.debug \"test_0210_includeq starts\" if @@... | [
"0.77090734",
"0.77090734",
"0.7500149",
"0.7107764",
"0.7107764",
"0.6937578",
"0.6843065",
"0.67782557",
"0.67194027",
"0.6691352",
"0.6665815",
"0.6663737",
"0.6663737",
"0.6663737",
"0.6643876",
"0.6639596",
"0.66301197",
"0.6595553",
"0.65950656",
"0.65950656",
"0.659506... | 0.0 | -1 |
The elements of the first array are all factors of the integer being considered The integer being considered is a factor of all elements of the second array These numbers are referred to as being between the two arrays. Determine how many such numbers exist. a = [2, 6] b = [24, 36] two numbers: 6 and 12. 6 % 2 = 0, 6 %... | def getTotalX(a, b)
(a[-1]..b[0]).to_a.reject do |cand|
first_issue = a.detect { |elem| !(cand % elem).zero? }
second_issue = first_issue ? false : b.detect { |elem| !(elem % cand).zero? }
second_issue.nil? ? false : true
end.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTotalX(a, b)\n factors_of_b = (a.min..b.min).select do |num|\n b.all? { |n| num.factor?(n) }\n end\n\n factors_of_b.select { |num| a.all? { |n| n.factor?(num) } }.length\nend",
"def solution(a, b)\n count = 0\n a.zip(b).each do |ai, bi|\n count += 1 if has_prime_divisors?(ai, bi)\n end\n coun... | [
"0.7340889",
"0.7262867",
"0.7030041",
"0.70171165",
"0.69350284",
"0.6846612",
"0.6671942",
"0.6607958",
"0.6491265",
"0.6367874",
"0.6366356",
"0.6362034",
"0.6346817",
"0.6330685",
"0.6285543",
"0.6258957",
"0.6219872",
"0.6205822",
"0.6197444",
"0.61777234",
"0.61541134",... | 0.72643805 | 1 |
Used AU TOWNS SAMPLE .csv to validate postcode addresss considering Residential Address to validate against postcode combination | def valid_postcode_location(data)
@csv ||= CSV.read(AU_DATA_FILE_PATH, headers: true)
if @csv.find do |row|
row['postcode'] == data['Residential Address Postcode'] && row['name'].downcase == data['Residential Address Locality'].downcase
end
true
else
false
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(address)\n if (address.country.present? && scotland_country_code_valid?(address.country) == false) ||\n (address.postcode.present? && scotland_postcode_format_valid?(address.postcode) == false)\n address.errors.add(:postcode, :postcode_format_invalid)\n end\n end",
"def aramex_addr... | [
"0.63251585",
"0.6213452",
"0.60437423",
"0.6039948",
"0.60354203",
"0.59121114",
"0.5907153",
"0.5863843",
"0.58017105",
"0.5789128",
"0.578361",
"0.57539845",
"0.57518685",
"0.5745018",
"0.57422173",
"0.57257366",
"0.5720446",
"0.5688598",
"0.5675911",
"0.5674622",
"0.56628... | 0.7333914 | 0 |
== Synopsis return the movie hash that contains the media meta data | def movie
@movie ||= Hash.new
@movie
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_object_hash\n fields_to_hash media_object_fields\n end",
"def meta\n @meta ||= decoded_body[:meta]\n end",
"def to_hash\n {\n 'meta' => {\n 'version' => version,\n 'title' => title,\n 'subtitle' => subtitle,\n 'artist' => artist,\n ... | [
"0.7199356",
"0.61213",
"0.6108689",
"0.60981435",
"0.60672426",
"0.60482126",
"0.604273",
"0.604273",
"0.6029909",
"0.6028467",
"0.6010052",
"0.5999915",
"0.5906388",
"0.5886376",
"0.588072",
"0.5871426",
"0.58498555",
"0.58486205",
"0.58436793",
"0.5842751",
"0.5842191",
... | 0.6220265 | 1 |
== Synopsis set the movie hash | def movie=(other)
@movie = other
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_start(_key)\n @current_movie = {\n title: nil,\n year: nil,\n image: nil,\n color: nil,\n score: nil,\n rating: nil,\n alternative_titles: [],\n genres: [],\n }\n @array_name = nil\n end",
"def movie\n @movie ||= Hash.new\n @movie\n end",
"def p... | [
"0.6109685",
"0.6015151",
"0.58779824",
"0.58779824",
"0.57439166",
"0.56133276",
"0.5597392",
"0.5577479",
"0.5563413",
"0.5544406",
"0.554157",
"0.5529768",
"0.5523362",
"0.5515457",
"0.5493141",
"0.54869795",
"0.54775244",
"0.5457052",
"0.54475915",
"0.54405916",
"0.543869... | 0.5142915 | 95 |
== Synopsis save the profile to the .nfo file, but only if it has changed | def save
begin
if dirty?
xml = self.to_xml
unless xml.blank?
AppConfig[:logger].info { "updated #{@nfo_filespec}"}
DvdProfiler2Xbmc.save_to_file(@nfo_filespec, xml)
end
end
rescue Exception => e
AppConfig[:logger].error "Unable to save xbmc info to #... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_profile( filename )\n if filename = @opts.save( filename )\n print_status \"Saved profile in '#{filename}'.\"\n print_line\n else\n banner\n print_error 'Could not save profile.'\n exit 0\n end\n end",
"def Write(outputFile)\... | [
"0.7312269",
"0.6186856",
"0.6153736",
"0.61041945",
"0.6049656",
"0.6037678",
"0.5966027",
"0.5943658",
"0.5921939",
"0.5921939",
"0.57977265",
"0.57977265",
"0.5783559",
"0.5742084",
"0.5723613",
"0.5705808",
"0.56592345",
"0.5643205",
"0.56192964",
"0.5609533",
"0.560909",... | 0.62137216 | 1 |
== Synopsis filter the given movie hash first collapsing (removing from Array) the plot, tagline, and overview values by removing, then removing any HTML tags such as , ,... | def filter(data)
data.delete_if { |key, value| value.nil? }
%w(plot tagline overview).each do |key|
if data[key].respond_to?('first')
data[key] = data[key].first
end
data[key] = data[key].gsub(FILTER_HTML, '') unless data[key].blank?
end
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_clean_filters( src_key, tree_key = nil )\n\n tree_key = \"#{src_key}_tree\".to_sym unless tree_key\n src_key, tree_key = src_key.to_k, tree_key.to_k\n\n filters = []\n filters << html_parse_filter( src_key, tree_key )\n\n #FIXME: PAGE: filters << TitleExtractor... | [
"0.56619436",
"0.5575148",
"0.5534568",
"0.5499996",
"0.539706",
"0.5387429",
"0.5348722",
"0.53459126",
"0.53459126",
"0.53459126",
"0.53392154",
"0.5309423",
"0.5300947",
"0.52809197",
"0.5226505",
"0.52171504",
"0.52057064",
"0.5198529",
"0.51962054",
"0.51801103",
"0.5176... | 0.6777434 | 0 |
== Synopsis has any of the data changed? | def dirty?
result = false
if @original_movie.nil?
result = true
else
@movie.each do |key, value|
if @original_movie[key].nil?
result = true
break
end
if @movie[key].to_s != @original_movie[key].to_s
result = true
break
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_changed?\n changes.include?(\"data\")\n end",
"def changed? \n @changed == true\n end",
"def changed?\n true\n end",
"def modified?; end",
"def changed?\r\n @changed\r\n end",
"def updated_data; end",
"def changed?\n @changed\n end",
"def changed?\n ... | [
"0.7312819",
"0.70367277",
"0.68903047",
"0.6858046",
"0.684812",
"0.67673755",
"0.67623836",
"0.67376137",
"0.67284167",
"0.6716941",
"0.6685793",
"0.6674665",
"0.66691136",
"0.66096383",
"0.6607686",
"0.6600845",
"0.6529627",
"0.6521062",
"0.6517808",
"0.64763397",
"0.64019... | 0.0 | -1 |
Compare up to three searches | def compare
#https://github.com/superjustin/zip-codes-for-rails
@compare = Search.limit(3).find(params[:compare])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiple_search?\n\t\t@attempts > 1\n\tend",
"def near_match\n (0..3).each do |guess_index|\n compare_for_near_match(guess_index)\n end\n end",
"def searching\n \t@temp = Account.all\n \t@own_temp = Account.find_by_aid(session[:id])\n \t@temp.delete(@own_temp)\n \t\n \t@after_lower... | [
"0.6199297",
"0.60784817",
"0.5992586",
"0.59708595",
"0.59315956",
"0.5929749",
"0.59238803",
"0.58923227",
"0.58793384",
"0.5871277",
"0.5860875",
"0.5860875",
"0.5792722",
"0.5761049",
"0.57132494",
"0.5651189",
"0.5629499",
"0.5616933",
"0.5614985",
"0.55947113",
"0.55885... | 0.59738886 | 3 |
destroys a heart with matching question_id and user_id | def unheart!(question)
heart = self.hearts.find_by(question_id: question.id)
heart.destroy!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unheart!(post)\n heart = self.hearts.find_by_post_id(post.id)\n heart.destroy!\n end",
"def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification... | [
"0.68115956",
"0.63073474",
"0.629593",
"0.62125033",
"0.6198942",
"0.61807936",
"0.6116383",
"0.61032695",
"0.60966",
"0.6080001",
"0.60681075",
"0.6066643",
"0.6058396",
"0.6052819",
"0.6052819",
"0.6044474",
"0.6042628",
"0.60363734",
"0.600123",
"0.5997775",
"0.5972447",
... | 0.7842063 | 0 |
returns true of false if a question is hearted by user | def heart?(question)
self.hearts.find_by(question_id: question.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def will_answer?\n return true\n end",
"def answered?\n !answered_at.nil?\n end",
"def answered?\n return @answered\n end",
"def pending_answer?\r\n\t\t\treturn (@type == 'answer' && @state == 're')\r\n\t\tend",
"def answered_questionnaire?(user)\n answered_users.include?(user)\n end",
"d... | [
"0.7389369",
"0.72982675",
"0.7278289",
"0.7177625",
"0.71670824",
"0.71299946",
"0.7026616",
"0.70253575",
"0.69203264",
"0.68335927",
"0.6819003",
"0.6810846",
"0.67823905",
"0.6777736",
"0.6777602",
"0.6777602",
"0.6767202",
"0.6729927",
"0.6611233",
"0.65895814",
"0.65794... | 0.72249275 | 3 |
If we have an explicit refspec, check it against incoming payloads Special case: if we do not pass in any payloads, return true | def needs_push(payloads=[])
return true if payloads.empty?
return true if push_mode==PUSHMODE_MIRROR
refspec_parse = explicit_refspec.match(/^\+?([^:]*)(:[^:]*)?$/)
payloads.each do |payload|
if splitpath = refcomp_parse(payload[:ref])
return true if payload[:ref] == refspec_parse[1] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_valid_payload?\n\t\treturn self.payload_hash == self.calculate_payload_hash\n\tend",
"def has_valid_issue_ref?(body, general_ref_spec, flake_config)\n body.scan(general_ref_spec) do |reference|\n $stderr.puts \" Determining if reference ##{reference[1]} meets criteria...\"\n issue... | [
"0.6654079",
"0.65390664",
"0.64424145",
"0.64066184",
"0.6260642",
"0.6093188",
"0.6075334",
"0.60673094",
"0.6000688",
"0.59866464",
"0.59861916",
"0.5859776",
"0.58464897",
"0.5844984",
"0.5824346",
"0.5808137",
"0.5780286",
"0.5764828",
"0.57563376",
"0.574387",
"0.572875... | 0.7472126 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.