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 |
|---|---|---|---|---|---|---|
Returns if the participant have trashed the Notification | def is_trashed?
trashed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_trashed?(participant)\n return false if participant.nil?\n return self.receipts_for(participant).trash.count!=0\n end",
"def is_trashed?(participant)\n return false unless participant\n receipts_for(participant).trash.count != 0\n end",
"def trashed?(user)\n case user\n when sender\n... | [
"0.76055527",
"0.75707865",
"0.7054356",
"0.6988385",
"0.6920738",
"0.6849828",
"0.68401915",
"0.68401915",
"0.6530766",
"0.62726885",
"0.60252964",
"0.6015025",
"0.6015025",
"0.60047054",
"0.5898026",
"0.5855564",
"0.58520824",
"0.585204",
"0.58286136",
"0.5816493",
"0.57786... | 0.72693264 | 3 |
Removes the duplicate error about not present subject from Conversation if it has been already raised by Message | def remove_duplicate_errors
if errors["mailboxer_notification.conversation.subject"].present? and errors["mailboxer_notification.subject"].present?
errors["mailboxer_notification.conversation.subject"].each do |msg|
errors["mailboxer_notification.conversation.subject"].delete(msg)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def questionnaire_duplication_failed(user, questionnaire, error_message)\n I18n.locale = user.language\n @questionnaire = questionnaire\n @user = user\n @error_message = error_message\n @subject = (questionnaire.email_subject(user.language) ? questionnaire.email_subject(user.language) : \"\") + I18n... | [
"0.64190036",
"0.5963016",
"0.5953426",
"0.5728807",
"0.5635917",
"0.5624468",
"0.5602356",
"0.5449",
"0.54165626",
"0.5365867",
"0.5353443",
"0.53362876",
"0.5333402",
"0.5319669",
"0.5286173",
"0.5270402",
"0.52457094",
"0.5237825",
"0.52321404",
"0.52259946",
"0.52169865",... | 0.8101815 | 0 |
GET /tgl_rows/1 GET /tgl_rows/1.json | def show
@tgl_row = TglRow.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tgl_row }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tgl_row = TglRow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tgl_row }\n end\n end",
"def index\n @rowempls = Rowempl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rowempls }... | [
"0.6421892",
"0.62933755",
"0.6136797",
"0.60735625",
"0.6038587",
"0.6029383",
"0.59193695",
"0.59126294",
"0.59040064",
"0.58713007",
"0.5860978",
"0.5852289",
"0.5849023",
"0.58387774",
"0.5830664",
"0.58262146",
"0.5822181",
"0.5799376",
"0.57950467",
"0.5786947",
"0.5772... | 0.7080595 | 0 |
GET /tgl_rows/new GET /tgl_rows/new.json | def new
@tgl_row = TglRow.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @tgl_row }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @rowempl = Rowempl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rowempl }\n end\n end",
"def create\n @tgl_row = TglRow.new(params[:tgl_row])\n\n respond_to do |format|\n if @tgl_row.save\n format.html { redirect_to @tgl... | [
"0.7062049",
"0.6880784",
"0.6873265",
"0.6873265",
"0.673189",
"0.6717289",
"0.6690249",
"0.6682668",
"0.6681636",
"0.6596807",
"0.65540546",
"0.6499683",
"0.6492694",
"0.64643866",
"0.64512277",
"0.64437884",
"0.64342594",
"0.63816893",
"0.63709104",
"0.6350379",
"0.6315059... | 0.8003283 | 0 |
POST /tgl_rows POST /tgl_rows.json | def create
@tgl_row = TglRow.new(params[:tgl_row])
respond_to do |format|
if @tgl_row.save
format.html { redirect_to @tgl_row, notice: 'Tgl row was successfully created.' }
format.json { render json: @tgl_row, status: :created, location: @tgl_row }
else
format.html { render action: "new" }
format.json { render json: @tgl_row.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tgl_row = TglRow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tgl_row }\n end\n end",
"def tbody_params\n params.require(:tbody).permit(:main, :name)\n end",
"def save\n if row_data[:id] == 0\n row = Vh.new\n else\n ... | [
"0.610786",
"0.5483471",
"0.5396389",
"0.53333175",
"0.53084666",
"0.5276221",
"0.5231554",
"0.5106497",
"0.5102345",
"0.5092518",
"0.50703025",
"0.5065076",
"0.50585705",
"0.50575113",
"0.50559485",
"0.5030619",
"0.50262445",
"0.50189507",
"0.50165755",
"0.5014832",
"0.50077... | 0.6460435 | 0 |
PUT /tgl_rows/1 PUT /tgl_rows/1.json | def update
@tgl_row = TglRow.find(params[:id])
respond_to do |format|
if @tgl_row.update_attributes(params[:tgl_row])
format.html { redirect_to @tgl_row, notice: 'Tgl row was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @tgl_row.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @tgl_row = TglRow.new(params[:tgl_row])\n\n respond_to do |format|\n if @tgl_row.save\n format.html { redirect_to @tgl_row, notice: 'Tgl row was successfully created.' }\n format.json { render json: @tgl_row, status: :created, location: @tgl_row }\n else\n format.h... | [
"0.5888445",
"0.58310467",
"0.5798096",
"0.57535917",
"0.572255",
"0.5711425",
"0.56626844",
"0.5649413",
"0.5555183",
"0.55511326",
"0.5545294",
"0.55097663",
"0.5488048",
"0.54512006",
"0.54295886",
"0.54125977",
"0.5398745",
"0.5397817",
"0.5390087",
"0.5385882",
"0.537652... | 0.70282817 | 0 |
DELETE /tgl_rows/1 DELETE /tgl_rows/1.json | def destroy
@tgl_row = TglRow.find(params[:id])
@tgl_row.destroy
respond_to do |format|
format.html { redirect_to tgl_rows_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end",
"def delete_row lb # {{{\n index = lb.current_index\n id = lb.list[lb.current_index].first\n lb.list().delete_at(index)\n lb.touch\n ret = @db.execute(\"UPDATE #{@tablename} SET status = ? WHERE rowid = ?\", [ \"x\", id ])\nend",... | [
"0.7290274",
"0.6632057",
"0.6575827",
"0.6575142",
"0.6560537",
"0.6490953",
"0.64103085",
"0.6287505",
"0.6278501",
"0.62599385",
"0.6257325",
"0.6236148",
"0.6234698",
"0.62288254",
"0.62115437",
"0.61711544",
"0.60896665",
"0.6068019",
"0.60643554",
"0.6045184",
"0.603229... | 0.7582664 | 0 |
TODO object number range (for 'any' rather than 'all') ALTERNATE NUMBER | def alt_num_input(index)
input_locator [fieldset(PAHMAObjectData::ALT_NUM.name, index)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_numerals\n [ range(:numerals) ]\n end",
"def on_numeric(n)\n n\n end",
"def on_numeric(n)\n n\n end",
"def of_number(val)\n val > 0\n end",
"def featured(n)\n (n..9_999_999_999).each {|number| return number if number_valid?(n, number)}\n return \"There is no possible... | [
"0.63280237",
"0.63139033",
"0.63139033",
"0.6245072",
"0.61969846",
"0.6106307",
"0.60947466",
"0.6033823",
"0.5993865",
"0.5993865",
"0.5967705",
"0.59623003",
"0.593409",
"0.5913058",
"0.59010327",
"0.5832201",
"0.5832201",
"0.5827219",
"0.5827049",
"0.58038074",
"0.578989... | 0.0 | -1 |
Using a single set of test data, enters search parameters in the advanced search form | def enter_object_id_search_data(data_set)
search_input_errors = []
hide_notifications_bar
# The first input on the form occasionally vanishes when leaving the field, so click through several fields before entering
# any values.
wait_for_element_and_click(object_num_input 0)
wait_for_element_and_click(alt_num_input 0)
wait_for_element_and_click(is_component_input 0)
object_nums = data_set[PAHMAObjectData::OBJECT_NUM.name]
if object_nums
when_exists(object_num_input(0), Config.short_wait)
# Some search test data sets could have an array of object numbers or an individual one.
if object_nums.instance_of? Array
object_nums.each do |num|
index = object_nums.index num
logger.debug "Entering #{num} at index #{index}"
wait_for_element_and_click object_num_add_btn unless index.zero?
attempt_action(search_input_errors, num) { element(object_num_input(index)).send_keys num[PAHMAObjectData::OBJECT_NUM.name] }
end
else
logger.debug "Entering #{object_nums}"
attempt_action(search_input_errors, object_nums) { element(object_num_input(0)).send_keys object_nums }
end
sleep 2
end
alt_nums = data_set[PAHMAObjectData::ALT_NUM_GRP.name]
alt_nums && alt_nums.each do |num|
index = alt_nums.index num
logger.debug "Entering #{num} at index #{index}"
wait_for_element_and_click alt_num_add_btn unless index.zero?
attempt_action(search_input_errors, num) { wait_for_element_and_type(alt_num_input(index), num[PAHMAObjectData::ALT_NUM.name]) }
end
components = data_set[PAHMAObjectData::IS_COMPONENT.name]
if components
# Some search test data sets could have an array of is-components or an individual one.
if components.instance_of? Array
components.each do |comp|
index = components.index comp
logger.debug "Entering #{comp} at index #{index}"
wait_for_element_and_click is_component_add_btn unless index.zero?
attempt_action(search_input_errors, comp) { wait_for_options_and_select(is_component_input(index), is_component_options(index), comp) }
end
else
attempt_action(search_input_errors, components) { wait_for_options_and_select(is_component_input(0), is_component_options(0), components) }
end
end
obj_statuses = data_set[PAHMAObjectData::OBJ_STATUS_LIST.name]
obj_statuses && obj_statuses.each do |status|
index = obj_statuses.index status
logger.debug "Entering #{status} at index #{index}"
wait_for_element_and_click obj_status_add_btn unless index.zero?
attempt_action(search_input_errors, status) { wait_for_options_and_select(obj_status_input(index), obj_status_options(index), status[PAHMAObjectData::OBJ_STATUS.name]) }
end
obj_names = data_set[PAHMAObjectData::OBJ_NAME_GRP.name]
obj_names && obj_names.each do |name|
index = obj_names.index name
logger.debug "Entering #{name} at index #{index}"
wait_for_element_and_click obj_name_add_btn unless index.zero?
attempt_action(search_input_errors, name) { wait_for_element_and_type(obj_name_input(index), name[PAHMAObjectData::OBJ_NAME_NAME.name]) }
end
resp_colls = data_set[PAHMAObjectData::RESPONSIBLE_DEPTS.name]
resp_colls && resp_colls.each do |coll|
index = resp_colls.index coll
logger.debug "Entering #{coll} at index #{index}"
wait_for_element_and_click resp_coll_add_btn unless index.zero?
attempt_action(search_input_errors, coll) { wait_for_options_and_select(resp_coll_input(index), resp_coll_options(index), coll[PAHMAObjectData::RESPONSIBLE_DEPT.name]) }
end
obj_types = data_set[PAHMAObjectData::COLLECTION.name]
if obj_types
# Some search test data sets could have an array of object types or an individual one.
if obj_types.instance_of? Array
obj_types.each do |type|
index = obj_types.index type
logger.debug "Entering #{type} at index #{index}"
wait_for_element_and_click obj_type_add_btn unless index.zero?
attempt_action(search_input_errors, type) { wait_for_options_and_select(obj_type_input(index), obj_type_options(index), type[PAHMAObjectData::COLLECTION.name]) }
end
else
attempt_action(search_input_errors, obj_types) { wait_for_options_and_select(obj_type_input(0), obj_type_options(0), obj_types) }
end
end
ethno_file_codes = data_set[PAHMAObjectData::ETHNO_FILE_CODE_LIST.name]
ethno_file_codes && ethno_file_codes.each do |code|
index = ethno_file_codes.index code
logger.debug "Entering #{code} at index #{index}"
wait_for_element_and_click ethno_file_code_add_btn unless index.zero?
# TODO - handle option creation
attempt_action(search_input_errors, code) { wait_for_element_and_type(ethno_file_code_input(index), code[PAHMAObjectData::ETHNO_FILE_CODE.name]) }
end
assoc_cult_grps = data_set[PAHMAObjectData::ASSOC_PPL_GRP.name]
assoc_cult_grps && assoc_cult_grps.each do |grp|
index = assoc_cult_grps.index grp
logger.debug "Entering #{grp} at index #{index}"
wait_for_element_and_click assoc_cult_grp_add_btn unless index.zero?
# TODO - handle option creation
attempt_action(search_input_errors, grp) { wait_for_element_and_type(assoc_cult_grp_input(index), grp[PAHMAObjectData::ASSOC_PPL.name]) }
end
materials = data_set[PAHMAObjectData::MATERIAL_GRP.name]
materials && materials.each do |mat|
index = materials.index mat
logger.debug "Entering #{mat} at index #{index}"
wait_for_element_and_click material_add_btn unless index.zero?
# TODO - handle option creation
attempt_action(search_input_errors, mat) { wait_for_element_and_type(material_input(index), mat[PAHMAObjectData::MATERIAL.name]) }
end
titles = data_set[PAHMAObjectData::TITLE_GRP.name]
titles && titles.each do |title|
index = titles.index title
logger.debug "Entering #{title} at index #{index}"
wait_for_element_and_click title_add_btn unless index.zero?
attempt_action(search_input_errors, title) { wait_for_element_and_type(title_input(index), title[PAHMAObjectData::TITLE.name]) }
end
series_grp = data_set[PAHMAObjectData::AUDIO_SERIES_GRP.name]
if series_grp
# Some search test data sets could have an array of audio series or an individual one.
if series_grp.instance_of? Array
series_grp.each do |series|
index = series_grp.index series
logger.debug "Entering #{series} at index #{index}"
wait_for_element_and_click audio_series_add_btn unless index.zero?
attempt_action(search_input_errors, series) { wait_for_options_and_select(audio_series_input(index), audio_series_options(index), series[PAHMAObjectData::AUDIO_SERIES.name]) }
end
else
attempt_action(search_input_errors, obj_types) { wait_for_options_and_select(audio_series_input(index), audio_series_options(index), series_grp) }
end
end
pahma_collections = data_set[PAHMAObjectData::PAHMA_COLLECTION_LIST.name]
pahma_collections && pahma_collections.each do |coll|
index = pahma_collections.index coll
logger.debug "Entering #{coll} at index #{index}"
wait_for_element_and_click pahma_collection_add_btn unless index.zero?
attempt_action(search_input_errors, coll) { wait_for_options_and_select(pahma_collection_input(index), pahma_collection_options(index), coll[PAHMAObjectData::PAHMA_COLLECTION.name]) }
end
legacy_depts = data_set[PAHMAObjectData::LEGACY_DEPT_GRP.name]
legacy_depts && legacy_depts.each do |dept|
index = legacy_depts.index dept
logger.debug "Entering #{dept} at index #{index}"
wait_for_element_and_click legacy_dept_add_btn unless index.zero?
attempt_action(search_input_errors, dept) { wait_for_options_and_select(legacy_dept_input(index), legacy_dept_options(index), dept[PAHMAObjectData::LEGACY_DEPT.name]) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advanced_search\n if params[:name] || params[:location] || params[:user] || params[:content]\n query = create_advanced_search_query(params)\n else\n return if handle_advanced_search_invalid_q_param?\n\n query = find_query(:Observation)\n end\n show_selected_observations(query)\n res... | [
"0.6920259",
"0.683952",
"0.66746026",
"0.65071493",
"0.6481944",
"0.64704895",
"0.64703286",
"0.6460861",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.64119405",
"0.639806",
"0.63910437",
"0.... | 0.0 | -1 |
Enters object search criteria and hits search. Returns an array of any errors caused by form fields. | def perform_adv_search_for_all(data_set)
click_clear_button
select_adv_search_all_option
search_input_errors = enter_object_id_search_data data_set
click_search_button
search_input_errors
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n @error = params[:error]\n end",
"def search_results(form_values)\n results = form_values.submit\n results.search('p.row')\nend",
"def advanced_search_form # :nologin: :norobots:\n return unless request.method == \"POST\"\n\n model = params[:search][:type].to_s.camelize.constantize\n\n ... | [
"0.6062435",
"0.59568185",
"0.57472074",
"0.5741631",
"0.56180084",
"0.56169474",
"0.55568385",
"0.5518164",
"0.55136853",
"0.5434876",
"0.5422406",
"0.5392098",
"0.5390834",
"0.5383996",
"0.53801084",
"0.53655",
"0.53638184",
"0.53624785",
"0.53475225",
"0.5347306",
"0.53010... | 0.5794185 | 2 |
Moved to V2 def monthly_stats_email | def get_year_month_list()
arr=[]
start="2008_01"
str=""
var_date = Time.now
while( start != str)
str = var_date.year.to_s + "_" + "%02d" % var_date.month.to_s
arr << str
var_date = var_date - 1.month
end
return arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monthly\n NewsletterMailer.monthly\n end",
"def monthly\n @greeting = \"Hello\"\n mail subject: args[:subject], to: args[:emails]\n mail to: \"to@example.org\"\n end",
"def monthly\n @greeting = \"Here are your monthly deals!\"\n\n mail to: \"to@example.org\"\n end",
"def monthly_mas... | [
"0.7563788",
"0.7117313",
"0.69681185",
"0.6837152",
"0.6722104",
"0.64059275",
"0.6386095",
"0.62125605",
"0.60587484",
"0.6047232",
"0.6043479",
"0.60201156",
"0.600276",
"0.5972852",
"0.5899075",
"0.5895034",
"0.5883525",
"0.58556557",
"0.5818334",
"0.58167744",
"0.5783987... | 0.0 | -1 |
Moved to V2 def report_monthly_published_partners | def report_partner_curated_data
@page_header = 'Content Partner Curated Data'
@year_month_list = get_year_month_list()
if(params[:year_month]) then
@year_month = params[:year_month]
session[:form_year_month] = params[:year_month]
elsif(session[:form_year_month]) then
@year_month = session[:form_year_month]
end
if(@year_month) then
params[:year], params[:month] = @year_month.split("_")
@report_year = params[:year].to_i
@report_month = params[:month].to_i
@year_month = params[:year] + "_" + "%02d" % params[:month].to_i
else
last_month = Time.now
@report_year = last_month.year.to_s
@report_month = last_month.month.to_s
@year_month = @report_year + "_" + "%02d" % @report_month.to_i
end
if(params[:content_partner_id]) then
@content_partner_id = params[:content_partner_id]
session[:form_content_partner_id] = params[:content_partner_id]
elsif(session[:form_content_partner_id]) then
@content_partner_id = session[:form_content_partner_id]
else
@content_partner_id = "All"
end
@content_partners_with_published_data = ContentPartner.with_published_data
if @content_partner_id == "All"
@partner_fullname = "All Curation"
arr_dataobject_ids = []
else
content_partner = ContentPartner.find(@content_partner_id)
@partner_fullname = content_partner.user.full_name
unless content_partner.resources.blank?
latest_harvest_event = content_partner.resources.first.latest_harvest_event
arr_dataobject_ids = HarvestEvent.data_object_ids_from_harvest(latest_harvest_event.id)
else
arr_dataobject_ids = []
end
end
arr = User.curated_data_object_ids(arr_dataobject_ids, @report_year, @report_month, @content_partner_id)
@arr_dataobject_ids = arr[0]
@arr_user_ids = arr[1]
if @arr_dataobject_ids.length == 0
@arr_dataobject_ids = [1] #no data objects
end
@arr_obj_tc_id = DataObject.tc_ids_from_do_ids(@arr_dataobject_ids);
page = params[:page] || 1
@partner_curated_objects = User.curated_data_objects(@arr_dataobject_ids, @report_year, @report_month, page, "report")
@cur_page = (page.to_i - 1) * 30
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monthly\n NewsletterMailer.monthly\n end",
"def show\n @report_lines = @monthly_report.report_lines\n end",
"def create_amount_to_bill_report\n\t\t\n\t\treport = {}\n\n\t\t@partners.each do |partner|\n\t\t\tnext if(partner.program_type == :direct) \n\t\t\treport[partner.partner_name] = {}\n\n\t\t\t... | [
"0.59098244",
"0.5806255",
"0.57888097",
"0.57718533",
"0.57009953",
"0.5642474",
"0.56330186",
"0.5545805",
"0.54784995",
"0.53778154",
"0.5361463",
"0.5361123",
"0.53587276",
"0.5355911",
"0.5348653",
"0.5339071",
"0.53045774",
"0.5301062",
"0.5295558",
"0.528265",
"0.52716... | 0.56769264 | 5 |
Returns a cached reference to a variable or searches all surrounding scopes for a variable. If no variable is found, it returns nil and a nested scope will create the variable in itself. | def search_local(name)
if variable = variables[name]
return variable.nested_reference
end
if variable = search_scopes(name)
variables[name] = variable
return variable.nested_reference
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_local(name)\n if variable = variables[name]\n return variable.nested_reference\n end\n\n if variable = search_scopes(name)\n variables[name] = variable\n return variable.nested_reference\n end\n end",
"def find_var(name, depth = 0)\n if ... | [
"0.7248237",
"0.70980495",
"0.70196867",
"0.70033914",
"0.65072125",
"0.647825",
"0.6248843",
"0.58265495",
"0.57409626",
"0.57121044",
"0.5703032",
"0.560316",
"0.55382013",
"0.5525908",
"0.5493311",
"0.54556334",
"0.5452632",
"0.54101306",
"0.5356901",
"0.534407",
"0.534407... | 0.7325744 | 0 |
TODO: Complete edit_profile method > DONE! This will be invoked when user choose Edit Profile menu in view_profile screen | def edit_profile(opts = {})
clear_screen(opts)
form = View.edit_profile(opts)
case form[:steps].last[:option].to_i
when 1
user = User.load
user = User.new(
name: form[:name],
email: form[:email],
phone: form[:phone],
password: form[:password],
gopay: user.gopay
)
user.save!
form[:user] = user
view_profile(form)
when 2
view_profile(form)
else
form[:flash_msg] = 'Wrong option entered, please retry'
edit_profile(form)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_profile\n end",
"def user_profile_edit\n\n\n end",
"def edit\n @user.profile ||= Profile.new\n @profile = @user.profile\n end",
"def edit\n @profile = Profile.find(current_user.id)\n end",
"def edit\n @title = \"Edit Profile\"\n @user = current_user\n @user.profile ||= Profil... | [
"0.871915",
"0.8371808",
"0.8129878",
"0.80859864",
"0.8050004",
"0.7980133",
"0.79284",
"0.79140955",
"0.78950614",
"0.78934264",
"0.788585",
"0.78768647",
"0.78488934",
"0.7814353",
"0.7787972",
"0.77224064",
"0.769219",
"0.76763463",
"0.7675589",
"0.7590062",
"0.75825316",... | 0.7370829 | 28 |
TODO: Complete order_goride method > DONE! | def order_goride(opts = {})
clear_screen(opts)
form = View.order_goride(opts)
type = ''
price = 0
case form[:steps].last[:option].to_i
when 1
type = 'GoJek'
price = 1500
when 2
type = 'GoCar'
price = 2500
when 3
main_menu(form)
else
form[:flash_msg] = 'Wrong option entered, please retry'
order_goride(form)
end
start = Location.find(form[:origin])
finish = Location.find(form[:destination])
if !start.empty? && !finish.empty?
est_price = Order.calc_price(start, finish, price)
order = Order.new(
origin: form[:origin],
destination: form[:destination],
est_price: est_price.round,
type: type
)
form[:order] = order
order_goride_confirm(form)
else
form[:flash_msg] = "We're not serving that route yet"
order_goride(form)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order; end",
"def order; end",
"def order\n end",
"def processOrder\n \n end",
"def original_order\n end",
"def order\n @order || \"99_99\"\n end",
"def ordering_query; end",
"def orders\n \"assetcode ASC\"# \"staffgrade_id ASC\"\n end",
"def ordered_list; end",
"def norma... | [
"0.7348676",
"0.7348676",
"0.7251446",
"0.7027641",
"0.66918886",
"0.64856666",
"0.64557093",
"0.6445148",
"0.6411671",
"0.63459516",
"0.6324545",
"0.620364",
"0.6198377",
"0.61779696",
"0.61422163",
"0.61422163",
"0.61230785",
"0.61209434",
"0.60716015",
"0.6038625",
"0.6032... | 0.53925145 | 83 |
TODO: Complete order_goride_confirm method > DONE! This will be invoked after user finishes inputting data in order_goride method | def order_goride_confirm(opts = {})
clear_screen(opts)
form = View.order_goride_confirm(opts)
case form[:steps].last[:option].to_i
when 1
form = opts
cust = Location.find(form[:origin])
driver = Fleet.find_driver(cust)
dest = Location.find(form[:destination])
if !driver.empty?
order = Order.new(
timestamp: '',
origin: form[:order].origin,
destination: form[:order].destination,
est_price: form[:order].est_price,
type: form[:order].type,
driver: driver
)
order.save!
fleet = Fleet.new(
type: form[:order].type,
driver: driver,
location: dest
)
fleet.move_driver!
form[:order] = order
payment(form)
else
order_goride_nodriver(form)
end
when 2
order_goride(form)
when 3
main_menu(form)
else
form[:flash_msg] = 'Wrong option entered, please retry'
order_goride_confirm(form)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_goride_confirm(opts = {})\n clear_screen(opts)\n form = View.order_goride_confirm(opts)\n \n\n case form[:steps].last[:option].to_i\n when 1\n order = Order.new(\n des_user: form[:des_user],\n place_user: form[:place_user],\n timestamp: form[... | [
"0.7579547",
"0.7544213",
"0.7285453",
"0.7094821",
"0.7063053",
"0.69199115",
"0.6902711",
"0.68243897",
"0.6719009",
"0.6648325",
"0.6586236",
"0.641145",
"0.64111114",
"0.6400687",
"0.63769376",
"0.6375418",
"0.6360107",
"0.6320035",
"0.6311155",
"0.6301283",
"0.6288717",
... | 0.7085986 | 4 |
You don't need to modify this | def clear_screen(opts = {})
Gem.win_platform? ? (system 'cls') : (system 'clear')
if opts[:flash_msg]
puts opts[:flash_msg]
puts ''
opts[:flash_msg] = nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def custom; end",
"def custom; end",
"def suivre; end",
"def refutal()\n end",
"def implementation; end",
"def implementation; end",
"def extra; end"... | [
"0.79867435",
"0.7010627",
"0.6832665",
"0.6704998",
"0.6704998",
"0.6704998",
"0.6704998",
"0.6551047",
"0.6551047",
"0.6533062",
"0.63608676",
"0.6340469",
"0.6340469",
"0.6270394",
"0.62596196",
"0.6185688",
"0.61676437",
"0.61612535",
"0.61612535",
"0.615146",
"0.615146",... | 0.0 | -1 |
TODO: credential matching with email or phone > DONE! | def credential_match?(user, login, password)
false unless user.email == login || user.phone == login
false unless user.password == password
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_credential\n user.credentials.where(name: email).first\n end",
"def match_by_email\n true\n end",
"def confirm_credentials(email, pwd, users)\r\n return users.all.find {|user| user.email == email && user.pwd == pwd}\r\nend",
"def credential; end",
"def credential; end",
"def credential... | [
"0.6651484",
"0.64671516",
"0.640089",
"0.6177011",
"0.6177011",
"0.6174372",
"0.61591226",
"0.6150764",
"0.6150764",
"0.6150764",
"0.6126867",
"0.59741193",
"0.5878189",
"0.58549047",
"0.5846915",
"0.5823747",
"0.58220094",
"0.5815389",
"0.57901007",
"0.57901007",
"0.5790100... | 0.6306925 | 3 |
in case if used with Mandatory module included | def on_return(&block); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required; end",
"def required; end",
"def required; end",
"def has_required?; end",
"def module?\n false\n end",
"def module?\n true\n end",
"def module?\n true\n end",
"def required_by_default?; end",
"def needed_if_relevant?\n false\n end",
"def needed_if_relevant?\n ... | [
"0.6748222",
"0.6748222",
"0.6748222",
"0.66302407",
"0.65643483",
"0.64872044",
"0.64872044",
"0.6456916",
"0.6452824",
"0.6434492",
"0.6412122",
"0.639663",
"0.6393035",
"0.63905853",
"0.6323779",
"0.62967026",
"0.62967026",
"0.62832767",
"0.62762487",
"0.6254672",
"0.62514... | 0.0 | -1 |
Update this voice state with new data from Discord | def update(channel, mute, deaf, self_mute, self_deaf)
@voice_channel = channel
@mute = mute
@deaf = deaf
@self_mute = self_mute
@self_deaf = self_deaf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_voice_state(data)\n server_id = data['guild_id'].to_i\n server = server(server_id)\n return unless server\n\n server.update_voice_state(data)\n\n @session_id = data['session_id']\n end",
"def update_voice_state(data)\n @session_id = data['session_id']\n\n server_i... | [
"0.71155506",
"0.69177645",
"0.66454345",
"0.62569076",
"0.6248525",
"0.6209032",
"0.61352295",
"0.6033683",
"0.6033683",
"0.59426254",
"0.58076084",
"0.5793596",
"0.57831675",
"0.5730117",
"0.5716558",
"0.5715743",
"0.5645713",
"0.5619755",
"0.5571066",
"0.5560423",
"0.55536... | 0.5930709 | 10 |
Use callbacks to share common setup or constraints between actions. | def set_order
@order = Order.find(session[:order_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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def order_params
params.require(:order).permit(:tax, :subtotal, :total, :first_name, :last_name, :address, :email)
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 |
Use callbacks to share common setup or constraints between actions. | def set_todo_item
@todo_item = TodoItem.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.6163927",
"0.6046165",
"0.59465253",
"0.59167755",
"0.58904207",
"0.58346355",
"0.577713",
"0.5703502",
"0.5703502",
"0.56531286",
"0.56215113",
"0.54224145",
"0.5410795",
"0.5410795",
"0.5410795",
"0.53924775",
"0.5379919",
"0.53580743",
"0.53401667",
"0.53397506",
"0.533... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def todo_item_params
params.require(:todo_item).permit(:body, :course_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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
validates :first_open_time, :presence => true validates :last_close_time, :presence => true validates :multiplier, :presence => true validates :pnl_points, :presence => true validates :symbol, :presence => true validates :underlying_symbol, :presence => true | def trades_count
trades.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n validate_amount\n validate_game\n validate_period\n end",
"def validate\n\n # no need to validate if disabled\n return if disabled?\n\n # validate that we've filled in all the days\n if rateType == 'Day'\n\n if dayValue == 0\n\n if requireFullWeek == true\n\n ... | [
"0.6691749",
"0.6548165",
"0.6469752",
"0.6453105",
"0.6453105",
"0.6313767",
"0.6209758",
"0.6172496",
"0.6124501",
"0.6093472",
"0.6079533",
"0.606909",
"0.6029088",
"0.5959297",
"0.5954966",
"0.59283054",
"0.5883928",
"0.5878715",
"0.58594936",
"0.5844052",
"0.5842968",
... | 0.0 | -1 |
returns a money object including the price. returns nil if there is no price | def price
if raw_data[:PackagePrice] && raw_data[:PackagePrice][:TotalPrice]
Money.new(raw_data[:PackagePrice][:TotalPrice][:Value].to_f * 100, raw_data[:PackagePrice][:TotalPrice][:Currency])
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price\n BigDecimal('3.0')\n end",
"def price\n basic = Spree::Currency.basic.char_code\n price = prices.where(currency: basic).limit(1)[0]\n if price\n amount = price.amount\n else\n amount = read_attribute(:price) || 0\n end\n Spree::Currency.conversion_to_current(amount)\n ... | [
"0.74261016",
"0.7422434",
"0.7309016",
"0.72947115",
"0.71948856",
"0.7084984",
"0.7011691",
"0.6981616",
"0.69227946",
"0.6910348",
"0.6892846",
"0.68924665",
"0.6875597",
"0.68594456",
"0.68477577",
"0.6828686",
"0.68056357",
"0.6751279",
"0.67476285",
"0.6741042",
"0.6722... | 0.73448795 | 2 |
returns a money object with the savings, nil if there are no savings. | def savings
if raw_data[:PackagePrice] && raw_data[:PackagePrice][:TotalSavings]
Money.new(raw_data[:PackagePrice][:TotalSavings][:Value].to_f * 100, raw_data[:PackagePrice][:TotalSavings][:Currency])
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def savings(inc_vat:)\n price_calculator.savings(inc_vat: inc_vat)\n end",
"def savings\n read_attribute(:price) - read_attribute(:sale_price)\n end",
"def transfer_to_savings funds\n withdraw_checking(funds).deposit_savings(funds)\n return nil #No chaining after this method --subject to ... | [
"0.6717704",
"0.66537136",
"0.64774925",
"0.58968985",
"0.582354",
"0.5763708",
"0.5676276",
"0.56338483",
"0.5616922",
"0.5582131",
"0.5569414",
"0.5560913",
"0.55563176",
"0.55102175",
"0.5507922",
"0.5498068",
"0.54721624",
"0.5430384",
"0.542171",
"0.54045224",
"0.5388683... | 0.82167625 | 0 |
returns the details url for the package | def details_url
raw_data[:DetailsUrl]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def information_url\n return @information_url\n end",
"def information_url\n return @information_url\n end",
"def main_info_url\n url(:main_info)\n end",
"def get_package_link(params, mode=:edit)\n hardcoded_string = \"#{APP_CONFIG['site_prefix']}tas... | [
"0.6852104",
"0.6852104",
"0.67377347",
"0.6481997",
"0.64560705",
"0.6321474",
"0.6274852",
"0.6166235",
"0.6150974",
"0.614621",
"0.614621",
"0.6132263",
"0.61139464",
"0.6101128",
"0.60989255",
"0.6096473",
"0.6093876",
"0.60863096",
"0.60863096",
"0.60798234",
"0.6078297"... | 0.71487635 | 0 |
validates :firstname, presence: true validates :lastname, presence: true validates :phone, presence: true validates :email, presence: true TODO view 217 Multistep Forms Rails cast on validation settings | def current_step
@current_step || steps.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n errors.add(:post_office, \"- must be filled for postalcode #{self.postal_code}\") if self.post_office.blank? && !self.postal_code.blank?\n errors.add(:postal_code, \"- must be filled for #{self.post_office}\") if self.postal_code.blank? && !self.post_office.blank? \n errors.add_to_base(\... | [
"0.7603901",
"0.7561472",
"0.74582887",
"0.73637515",
"0.70181084",
"0.69801503",
"0.6949601",
"0.6948057",
"0.6903075",
"0.67901456",
"0.67866653",
"0.6685473",
"0.66772914",
"0.66772914",
"0.6671843",
"0.66709733",
"0.66253453",
"0.6613118",
"0.66012204",
"0.6601066",
"0.66... | 0.0 | -1 |
return the name of this resolver. | def name
"Berkshelf"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n @name ||= self.class.non_namespaced_name\n end",
"def name\n @name ||= (@config[:name] || self.class.name.split(/::/).last.titleize)\n end",
"def name\n (@name ||= namespace).to_s.underscore.symbolize\n end",
"def name\n @name ||= self.class.name\n end",
"def ... | [
"0.7425276",
"0.7189856",
"0.7058759",
"0.69603926",
"0.69338465",
"0.69099057",
"0.6854727",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
"0.6845097",
... | 0.0 | -1 |
is this dependency resolver present? should we use it? | def present?
File.exist?("Berksfile") and `berks`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dependencies_resolved?\n !@resolved_dependencies.nil?\n end",
"def dependency_met?\n true\n end",
"def has_dependency?\n return true unless @dependency.nil?\n end",
"def resolve_dependency(_completed_operation)\n true\n end",
"def resolver_exists?\n !options['re... | [
"0.721286",
"0.7012898",
"0.6771031",
"0.6595234",
"0.65855306",
"0.6481002",
"0.6466242",
"0.64547276",
"0.64228225",
"0.64214593",
"0.6402382",
"0.62922746",
"0.6258543",
"0.6221005",
"0.6221005",
"0.6221005",
"0.61901754",
"0.6186988",
"0.61594486",
"0.6152254",
"0.6144165... | 0.0 | -1 |
set debug to a true/false value. | def debug=(truthy=false)
@debug=truthy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_debug\n @debug = @debug == false ? true : false\n end",
"def debugging(bool)\n @@debug = bool\n end",
"def debug_on(debug=true)\n ap \"Debugging is ON\"\n @debug = debug\n end",
"def debug=(new_debug)\n LOGGER.debug = new_debug\n end",
"def debug=(new_debug)\n ... | [
"0.8641214",
"0.83211315",
"0.818305",
"0.81604695",
"0.81604695",
"0.80980253",
"0.80651575",
"0.805388",
"0.8041617",
"0.79906607",
"0.79681236",
"0.7959952",
"0.7907675",
"0.7904095",
"0.7843668",
"0.7827919",
"0.7774746",
"0.7616354",
"0.75630164",
"0.75448763",
"0.754487... | 0.8862187 | 0 |
actually run the resolver and download the cookbooks we need. | def fetch_dependencies()
"berks vendor cookbooks #{(@debug ? '-v' : '-q')}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_cookbooks()\n self.resolver.config_dir = self.options[:config_dir] ? self.options[:config_dir] : Dir.pwd\n unless File.exists?(\"cookbooks\")\n\tKitchenplan::Log.info \"No cookbooks directory found. Running #{self.resolver.name} to download necessary cookbooks.\"\n\tself.platform.normaldo sel... | [
"0.7085345",
"0.7006339",
"0.66510576",
"0.6576299",
"0.6460053",
"0.61276025",
"0.59983706",
"0.5912426",
"0.58804685",
"0.58371013",
"0.5811126",
"0.5796932",
"0.5769586",
"0.57380503",
"0.5716763",
"0.57009536",
"0.5692863",
"0.5649184",
"0.56398034",
"0.5619137",
"0.55484... | 0.61176884 | 6 |
update dependencies after the initial install | def update_dependencies()
"berks vendor cookbooks #{(@debug ? '-d' : '-q')}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n install\n end",
"def update\n self.install\n end",
"def update\n self.install\n end",
"def update\n self.install\n end",
"def update\n # Install in pacman can be used for update, too\n self.install\n end",
"def update\n # Install in pacman can be used for update, to... | [
"0.74728054",
"0.7316624",
"0.7316624",
"0.7316459",
"0.7180781",
"0.7180781",
"0.7019425",
"0.6962521",
"0.6919496",
"0.684923",
"0.67364204",
"0.6691599",
"0.6688372",
"0.6679979",
"0.6591633",
"0.6510189",
"0.6465014",
"0.6438761",
"0.6419165",
"0.6385712",
"0.63765913",
... | 0.7271403 | 4 |
test adding of edges is correct for a directed graph | def test_graph_edges
test_g = Graph.new
test_g.add_edge("a", "b")
puts "assert adding edge to a graph adds its nodes too"
assert (test_g.contains("a"))
puts "assert that edges are directed, ie not symmetric relation"
assert test_g.has_edge("a","b")
assert !(test_g.has_edge("b","a"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_edge\n @dgraph.add_edge('a', 'b');\n\n # 0 and 1 are indexes of vertex a and vertex b respectively\n assert(@dgraph.vertices[0].neighbours[1] == true && @dgraph.vertices[1].neighbours[0] == nil)\n end",
"def test_add_edge_with_cycles\n @graph.add_edge('a', 'b');\n @graph.add_edge('b'... | [
"0.8008137",
"0.7954649",
"0.7855991",
"0.77391255",
"0.75373083",
"0.7212642",
"0.7198212",
"0.70395106",
"0.7018865",
"0.69343555",
"0.68906814",
"0.6884725",
"0.6762464",
"0.67338514",
"0.6699675",
"0.6680906",
"0.6670496",
"0.66545045",
"0.6627958",
"0.6613807",
"0.660987... | 0.81295925 | 0 |
============================================================================== bin_tree tests Ensure that object attributes are correct | def test_attrs
#test BinTree attr
tree = BinTree.new
test_val = tree.root
assert test_val == nil
#test TreeNode value
test_node = TreeNode.new(18)
test_val = test_node.value
assert_equal(test_val, 18)
#test TreeNode left set value and read value
test_left = TreeNode.new(1)
test_node.left = test_left
assert_equal(test_left, test_node.left)
#test TreeNode right set value and read value
test_right = TreeNode.new(23)
test_node.right = test_right
assert_equal(test_right, test_node.right)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_marshal_dump\n # Setup Test Data\n test_root = Tree::TreeNode.new(\"ROOT\", \"Root Node\")\n test_content = {\"KEY1\" => \"Value1\", \"KEY2\" => \"Value2\" }\n test_child = Tree::TreeNode.new(\"Child\", test_content)\n test_content2 = [\"AValue1\", \"AValue2\", \"AValue3\"]\n... | [
"0.6464614",
"0.61485386",
"0.60261214",
"0.5970094",
"0.59686035",
"0.58553326",
"0.5848028",
"0.5808604",
"0.579826",
"0.57389843",
"0.57236403",
"0.57231414",
"0.57006663",
"0.56927466",
"0.56455517",
"0.56105936",
"0.56098187",
"0.55849123",
"0.55758697",
"0.554297",
"0.5... | 0.7500128 | 0 |
Ensure that the add method works correctly | def test_add
tree = BinTree.new
#test empty
assert tree.root == nil
test_node = TreeNode.new(6)
tree.add(test_node)
#test one node added
assert_equal(tree.root, test_node)
test_node = TreeNode.new(4)
tree.add(test_node)
#test 2 nodes added
assert_equal(test_node, tree.root.left)
test_node = TreeNode.new(9)
tree.add(test_node)
#test 3 nodes added
assert_equal(test_node, tree.root.right)
test_node = TreeNode.new(-1)
tree.add(test_node)
#test 4 nodes added
assert_equal(test_node, tree.root.left.left)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add\n end",
"def add\n end",
"def add \n end",
"def add\n\tend",
"def add\n\nend",
"def add(o); addObject o end",
"def add(*args); end",
"def add(value)\n\tend",
"def add(value)\n end",
"def add(el)\n raise NotImplementedError\n end",
"def add(*); end",
"def item_add item\n... | [
"0.78738415",
"0.78738415",
"0.78423274",
"0.7667501",
"0.73588717",
"0.69303507",
"0.68536747",
"0.6778859",
"0.67612255",
"0.6679204",
"0.66733474",
"0.6648867",
"0.6624448",
"0.6565375",
"0.65571845",
"0.6555641",
"0.65163016",
"0.6488471",
"0.64860874",
"0.6469314",
"0.64... | 0.0 | -1 |
test finding the lowest common ancestor | def test_lca
#build the following tree
tree = BinTree.new
tree.add(TreeNode.new(8)) # => 8
tree.add(TreeNode.new(1)) # => / \
tree.add(TreeNode.new(4)) # => 1 17
tree.add(TreeNode.new(17)) # => / \
tree.add(TreeNode.new(-3)) # =>-3 4
#test lca for two child nodes of root is root
x = tree.lowest_com_ancestor(TreeNode.new(17), TreeNode.new(1))
assert_equal(8, x.value)
#test one node being the parent of the other returns the parent
x = tree.lowest_com_ancestor(TreeNode.new(4), TreeNode.new(1))
assert_equal(1, x.value)
#test far sides of tree return root
x = tree.lowest_com_ancestor(TreeNode.new(-3), TreeNode.new(17))
assert_equal(8, x.value)
#test negative value works normally
x = tree.lowest_com_ancestor(TreeNode.new(4), TreeNode.new(-3))
assert_equal(1, x.value)
#test that if both nodes are the same, returns that node
x = tree.lowest_com_ancestor(TreeNode.new(17), TreeNode.new(17))
assert_equal(17, x.value)
#test negative with root itself returns root
x = tree.lowest_com_ancestor(TreeNode.new(-3), TreeNode.new(8))
assert_equal(8, x.value)
#test node not in tree
x = tree.lowest_com_ancestor(TreeNode.new(-7), TreeNode.new(8))
assert x == nil
#test nil node
x = tree.lowest_com_ancestor(nil, TreeNode.new(-3))
assert x == nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_lowest_common_ancestor(n1, n2)\n return n1 if n1 == n2\n p1, p2 = n1, n2\n\n while p1 != p2\n break if p1.parent.nil? or p2.parent.nil?\n p1 = p1.parent\n p2 = p2.parent\n end\n\n should_up_p1 = p1.parent.nil? ? false : true\n\n count = 0\n while not (p1.parent.nil? and p2.parent.nil?) and... | [
"0.8163853",
"0.7979345",
"0.7853625",
"0.781323",
"0.7773671",
"0.7704766",
"0.76484406",
"0.76323676",
"0.7606259",
"0.75817263",
"0.75780267",
"0.75615823",
"0.74731123",
"0.74505144",
"0.7372311",
"0.733935",
"0.72931695",
"0.7267512",
"0.72347605",
"0.7185128",
"0.716718... | 0.6997406 | 22 |
GET /products/index/approved/:true or :false | def index_approved
if params[:approved] == 'true'
@products = Product.where(approved: true)
elsif params[:approved] == 'false'
@products = Product.where(approved: false)
end
json_response(@products, :ok)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @products = current_user.products.all\n @products_approved_false = current_user.products.where(approve: false)\n @products_approved = current_user.products.where(approve: true)\n @cancelled = current_user.products.where(cancelled: true)\n end",
"def index\n @resources = Resource.w... | [
"0.7129244",
"0.69515175",
"0.64759815",
"0.62792677",
"0.6170571",
"0.61642414",
"0.61296266",
"0.61262137",
"0.6108014",
"0.6098953",
"0.6042611",
"0.6033854",
"0.6030735",
"0.59486157",
"0.5915583",
"0.59123015",
"0.5890736",
"0.58778423",
"0.5877674",
"0.5875525",
"0.5873... | 0.8733555 | 0 |
check the archive, whether it's the old format. If so, it needs to be converted to the BinaryHistoryStore | def is_oldformat?
db.keys[0..5].each {|key|
begin
YAML.load(db[key])
rescue Psych::SyntaxError => ex
return false
rescue => ex
return false
end
}
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def archive_ok?\n #todo, we lack any real heuristic for this.\n true\n end",
"def verify_archive\n if Dir[BuildCommandGenerator.archive_path + \"/*\"].count == 0\n ErrorHandler.handle_empty_archive\n end\n end",
"def correct_binary?\n latest == current && File.exists?(binary)\... | [
"0.60121584",
"0.58801323",
"0.58639944",
"0.5837816",
"0.57611305",
"0.57299125",
"0.5711788",
"0.5658666",
"0.5506663",
"0.5492257",
"0.5448354",
"0.5442112",
"0.53654236",
"0.5331887",
"0.53225785",
"0.53225785",
"0.5293096",
"0.5293096",
"0.5292507",
"0.52766234",
"0.5265... | 0.51464736 | 29 |
display a formatted time commend | def fmt(cmd); " %s %s" % [cmd[:time].strftime(@options[:time_format]), cmd[:cmd]]; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_datetime(time)\n time.strftime('%e %B, %l:%M%p')\n end",
"def display_time(time_type, time)\n message = Time.new.strftime('%H:%M:%S') + \" #{time_type} \"\n message += time.days.positive? ? \"#{time.days} day, \" : ''\n message.insert(message.length - 2, 's') if time.days > 1\n message += tim... | [
"0.830683",
"0.79754347",
"0.7972657",
"0.7927756",
"0.7871475",
"0.7868427",
"0.78516716",
"0.78516716",
"0.78516716",
"0.7802181",
"0.77714527",
"0.77034014",
"0.76577",
"0.7632772",
"0.75945884",
"0.7527785",
"0.75007856",
"0.7496111",
"0.74595875",
"0.74212646",
"0.738641... | 0.0 | -1 |
returns a Persistent::Shell::History object from the current GDBM database. intended for marshalling to other historystores | def to_history
history = History.new
values.each do |value|
value[:time].each do |t|
history << Command.new(value[:cmd], t.to_i)
end
end
return history
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history\n History\n end",
"def history\n return @history\n end",
"def history\n return @history\n end",
"def history\n self.class.history.of(self)\n end",
"def history\n self.class.history.of(self)\n end",
"def history\n @... | [
"0.6847499",
"0.6444105",
"0.6444105",
"0.6332776",
"0.6332776",
"0.6296006",
"0.62952554",
"0.62923783",
"0.6222881",
"0.61895645",
"0.61895645",
"0.61895645",
"0.61779994",
"0.61699426",
"0.6130368",
"0.6090438",
"0.60748416",
"0.60442275",
"0.5994576",
"0.5990386",
"0.5890... | 0.61626834 | 14 |
create an output that looks like a regular ~/.bash_history file | def render(file)
File.open(file,'w+') do |f|
values.each do |v|
f.write("#" + v[:time].to_i.to_s + "\n") if v[:time] and not (v[:time].to_i == 0)
f.write(v[:cmd] + "\n")
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_to_bash_history(cmd)\n File.open(ENV['HOME'] + '/.bash_history', 'a') {|f| f << cmd + \"\\n\"}\n end",
"def store_history\n if ENV['HOME']\n File.open(history_file, \"w\") do |f|\n Readline::HISTORY.to_a.reverse[0..49].each do |item|\n f.puts(item)\n end\n ... | [
"0.74984866",
"0.7191757",
"0.7092735",
"0.66778815",
"0.66778815",
"0.6568939",
"0.6432023",
"0.6381958",
"0.62916017",
"0.61979836",
"0.61918104",
"0.61469847",
"0.61469847",
"0.6101667",
"0.598613",
"0.598613",
"0.598613",
"0.59681857",
"0.5939682",
"0.5931472",
"0.5917882... | 0.0 | -1 |
Return a DateAdd expression, adding the negative of the interval to the date/timestamp expr. | def date_sub(expr, interval)
interval = if interval.is_a?(Hash)
h = {}
interval.each{|k,v| h[k] = -v unless v.nil?}
h
else
-interval
end
DateAdd.new(expr, interval)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_add_sql_append(sql, da)\n if defined?(super)\n return super\n end\n h = da.interval\n expr = da.expr\n cast = case db_type = db.database_type\n when :postgres\n interval = String.new\n each_valid_interval_unit(h, DEF_DU... | [
"0.6357422",
"0.59396976",
"0.55863225",
"0.55789715",
"0.542364",
"0.52859277",
"0.523227",
"0.513146",
"0.50472826",
"0.50185096",
"0.49602696",
"0.48728767",
"0.48661682",
"0.48310596",
"0.48268497",
"0.4809107",
"0.47927412",
"0.4752302",
"0.47509757",
"0.4737229",
"0.471... | 0.73925555 | 0 |
Append the SQL fragment for the DateAdd expression to the SQL query. | def date_add_sql_append(sql, da)
if defined?(super)
return super
end
h = da.interval
expr = da.expr
cast = case db_type = db.database_type
when :postgres
interval = String.new
each_valid_interval_unit(h, DEF_DURATION_UNITS) do |value, sql_unit|
interval << "#{value} #{sql_unit} "
end
if interval.empty?
return literal_append(sql, Sequel.cast(expr, Time))
else
return complex_expression_sql_append(sql, :+, [Sequel.cast(expr, Time), Sequel.cast(interval, :interval)])
end
when :sqlite
args = [expr]
each_valid_interval_unit(h, DEF_DURATION_UNITS) do |value, sql_unit|
args << "#{value} #{sql_unit}"
end
return function_sql_append(sql, Sequel.function(:datetime, *args))
# SEQUEL5: Remove cubrid
when :mysql, :hsqldb, :cubrid
if db_type == :hsqldb
# HSQLDB requires 2.2.9+ for the DATE_ADD function
expr = Sequel.cast(expr, Time)
end
each_valid_interval_unit(h, MYSQL_DURATION_UNITS) do |value, sql_unit|
expr = Sequel.function(:DATE_ADD, expr, Sequel.lit(["INTERVAL ", " "], value, sql_unit))
end
when :mssql, :h2, :access, :sqlanywhere
units = case db_type
when :mssql, :sqlanywhere
MSSQL_DURATION_UNITS
when :h2
H2_DURATION_UNITS
when :access
ACCESS_DURATION_UNITS
end
each_valid_interval_unit(h, units) do |value, sql_unit|
expr = Sequel.function(:DATEADD, sql_unit, value, expr)
end
when :derby
if expr.is_a?(Date) && !expr.is_a?(DateTime)
# Work around for https://issues.apache.org/jira/browse/DERBY-896
expr = Sequel.cast_string(expr) + ' 00:00:00'
end
each_valid_interval_unit(h, DERBY_DURATION_UNITS) do |value, sql_unit|
expr = Sequel.lit(["{fn timestampadd(#{sql_unit}, ", ", timestamp(", "))}"], value, expr)
end
when :oracle
each_valid_interval_unit(h, MYSQL_DURATION_UNITS) do |value, sql_unit|
expr = Sequel.+(expr, Sequel.lit(["INTERVAL ", " "], value.to_s, sql_unit))
end
when :db2
expr = Sequel.cast(expr, Time)
each_valid_interval_unit(h, DB2_DURATION_UNITS) do |value, sql_unit|
expr = Sequel.+(expr, Sequel.lit(["", " "], value, sql_unit))
end
false
else
raise Error, "date arithmetic is not implemented on #{db.database_type}"
end
if cast
expr = Sequel.cast(expr, Time)
end
literal_append(sql, expr)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compound_dataset_sql_append(sql, ds)\n sql << '('\n super\n sql << ')'\n end",
"def rewrite_query # :nodoc:\n if timestamp = compute_mtime\n append_query(timestamp.to_i.to_s)\n end\n end",
"def date_clause_with_date_column(table, field, from, to, is_cus... | [
"0.5646627",
"0.5449804",
"0.53820056",
"0.5333359",
"0.5328638",
"0.5261835",
"0.5257323",
"0.5200408",
"0.51954913",
"0.51645124",
"0.51645124",
"0.5155713",
"0.51553404",
"0.5141315",
"0.51233363",
"0.5123218",
"0.5113815",
"0.503925",
"0.50349295",
"0.5013774",
"0.5011607... | 0.6531445 | 0 |
Yield the value in the interval for each of the units present in the interval, along with the SQL fragment representing the unit name. Returns false if any values were yielded, true otherwise | def each_valid_interval_unit(interval, units)
cast = true
units.each do |unit, sql_unit|
if (value = interval[unit]) && value != 0
cast = false
yield value, sql_unit
end
end
cast
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constructs_units?\n each_constructable_item do |item, base, name|\n return true if base == \"unit\"\n end\n\n false\n end",
"def unit?(unit)\n @units.include?(unit)\n end",
"def next_unit?\n !@unit.nil?\n end",
"def units?\n return units.any?\n end",
"def query_... | [
"0.53521425",
"0.5329273",
"0.5197609",
"0.51406574",
"0.5109503",
"0.503717",
"0.50092965",
"0.499831",
"0.48882118",
"0.48691365",
"0.48029557",
"0.47562626",
"0.47495046",
"0.47491267",
"0.47438613",
"0.47155",
"0.4692493",
"0.4681107",
"0.46667248",
"0.4630132",
"0.459929... | 0.74927366 | 0 |
Supports two types of intervals: Hash :: Used directly, but values cannot be plain strings. ActiveSupport::Duration :: Converted to a hash using the interval's parts. | def initialize(expr, interval)
@expr = expr
@interval = if interval.is_a?(Hash)
interval.each_value do |v|
# Attempt to prevent SQL injection by users who pass untrusted strings
# as interval values.
if v.is_a?(String) && !v.is_a?(LiteralString)
raise Sequel::InvalidValue, "cannot provide String value as interval part: #{v.inspect}"
end
end
interval
else
h = Hash.new(0)
interval.parts.each{|unit, value| h[unit] += value}
Hash[h]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_duration_to_nums(duration)\n duration_values = duration.scan(/\\d+/)\n duration_hash = { hour: 0, minutes: 0 }\n if duration.include?(\"&\")\n duration_hash[:hour] = duration_values[0].to_i\n duration_hash[:minutes] = duration_values[1].to_i\n elsif duration.include?(\... | [
"0.66338944",
"0.62342924",
"0.62206775",
"0.6107853",
"0.60202026",
"0.60111356",
"0.59967166",
"0.57921416",
"0.5780017",
"0.57496685",
"0.57396007",
"0.5724603",
"0.57141143",
"0.57141143",
"0.569804",
"0.5687719",
"0.564125",
"0.56381845",
"0.56349576",
"0.56339544",
"0.5... | 0.5330988 | 46 |
We can perform initialization here | def nuixWorkerItemCallbackInit
if $superutilities_jar_path.nil? == false
require $superutilities_jar_path
end
java_import com.nuix.superutilities.annotations.AnnotationRepository
$repo = AnnotationRepository.new($annotations_db_file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize() end",
"def pre_initialize; end",
"def init\n end",
"def init\n end",
"def init\n end",
"def init\n\n end",
"def at_init\n\n\t\tend",
"def initialize\n \n end",
"def pre_initialize\n ... | [
"0.8198824",
"0.8198824",
"0.8198824",
"0.8198824",
"0.7997858",
"0.79298073",
"0.7873127",
"0.7873127",
"0.7873127",
"0.78262174",
"0.77498573",
"0.7735865",
"0.7666409",
"0.76476926",
"0.75515586",
"0.75515586",
"0.75515586",
"0.75515586",
"0.75515586",
"0.75515586",
"0.755... | 0.0 | -1 |
Define our worker item callback | def nuixWorkerItemCallback(worker_item)
# Get this item's MD5
md5 = worker_item.getDigests.getMd5
# Does this item actually have an MD5 value?
if md5.nil? == false
tags = $repo.getTagsForMd5(md5)
if $verbose
puts "Found #{tags.size} tags for item with MD5 #{md5}: #{tags.join("; ")}"
end
tags.each do |tag|
worker_item.addTag(tag)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nuixWorkerItemCallbackInit\nend",
"def _on_workitem(wi)\n Ruote.participant_send(\n self, [ :on_workitem, :consume ], 'workitem' => wi)\n end",
"def callback\n\n end",
"def nuixWorkerItemCallbackClose\nend",
"def nuixWorkerItemCallback(worker_item)\n\tputs \"#{worker_item.getItemGuid}... | [
"0.7725557",
"0.67665476",
"0.674771",
"0.6739621",
"0.67348266",
"0.6731313",
"0.6694368",
"0.65169626",
"0.6387062",
"0.61729395",
"0.6071625",
"0.6071625",
"0.59787613",
"0.5967691",
"0.596661",
"0.5948231",
"0.5948231",
"0.59355885",
"0.59273523",
"0.58979225",
"0.5886858... | 0.65066314 | 8 |
We can perform cleanup here if we need to | def nuixWorkerItemCallbackClose
# We need to close connections to the SQLite DB file by
# calling the AnnotationRepository.close method when we are done.
if $repo.nil? == false
$repo.close
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup!; end",
"def cleanup!; end",
"def cleanup\r\n end",
"def cleanup!\n # This method may be left unimplemented if that is applicable\n end",
"def cleanup\n end",
"def cleanup\n end",
"def... | [
"0.8462016",
"0.8462016",
"0.8462016",
"0.8462016",
"0.81421787",
"0.81421787",
"0.79880303",
"0.79616654",
"0.79184663",
"0.79184663",
"0.79184663",
"0.7851859",
"0.7851859",
"0.7851859",
"0.7851859",
"0.7829275",
"0.7829275",
"0.7644681",
"0.75630736",
"0.754775",
"0.754775... | 0.0 | -1 |
rubocop:disable PredicateName Yggdrasil method | def has_joined
@username = params[:username]
server = params[:serverId]
sessions = Session.joins(:user).where(
serverid: server,
users: { username: @username }
)
if sessions.empty?
render json: { error: 'Bad login', errorMessage: 'Bad login' }
return
else
user = sessions.first.user
@uuid = sessions.first.uuid
@textures = gen_texdata(@uuid, user.username, user, request.host)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_predicate; end",
"def predicate\n operand.predicate.and(super).optimize\n end",
"def predicate(true_class, name=nil)\n name = name ? name.to_s : true_class.name.split('::')[-1]\n label = Purugin::StringUtils.camelcase_to(name, ' ')\n name = Purugin::StringUtils.camelc... | [
"0.7212691",
"0.63558346",
"0.60614395",
"0.6001184",
"0.59406406",
"0.5815592",
"0.5753319",
"0.57457036",
"0.57324475",
"0.56995124",
"0.56874806",
"0.5674958",
"0.5663993",
"0.56298494",
"0.56298494",
"0.5586269",
"0.5584648",
"0.5570222",
"0.5569414",
"0.5558776",
"0.5515... | 0.0 | -1 |
rubocop:enable CyclomaticComplexity rubocop:disable AccessorMethodName | def get_session
session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)
render json: { id: session.id, key: session.key }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def getters; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attr_reader(*)\n end",
"def get()\n \n end",
"def accessor\n @@accessor... | [
"0.72380847",
"0.6966831",
"0.670647",
"0.670647",
"0.670647",
"0.670647",
"0.670647",
"0.670647",
"0.670647",
"0.6686958",
"0.6487247",
"0.6467898",
"0.6361384",
"0.6319362",
"0.62232745",
"0.6213911",
"0.61892986",
"0.606746",
"0.60497403",
"0.60497403",
"0.60497403",
"0.... | 0.0 | -1 |
Define a column id to use to find data when passing a Hash to row. [options] Can contain a :style Hash added to all cells of this column | def column id = nil, options = {}
unless id
id = options[:id]
raise "Need a column ID" if id.nil?
end
if options.empty?
@cols << {}
else
@cols << options
end
@col_count = @cols.size
@col_ids << id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell_with_id(cell_id, options = {})\r\n if options && options[:index] then\r\n cell(:id => cell_id.to_s, :index => options[:index]).text\r\n else\r\n cell(:id, cell_id).text\r\n end\r\n end",
"def format(id, value, options = {})\n id.split(/,\\s/).each do |i|\n col... | [
"0.6899355",
"0.5908009",
"0.59006256",
"0.55459285",
"0.55123866",
"0.5473975",
"0.5446284",
"0.5434728",
"0.5429419",
"0.54117227",
"0.5333681",
"0.5299843",
"0.5278883",
"0.5278883",
"0.5257669",
"0.52230656",
"0.52157736",
"0.5206626",
"0.520067",
"0.51948977",
"0.5181582... | 0.6162005 | 1 |
Same as row but with header cells | def header_row data
data = get_cells data unless data.is_a?(Array)
add_row data, "!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_header_row\n generate_row(@header)\n end",
"def generate_header_row\n generate_row(@header)\n end",
"def generate_header_row\n (@header.map {|x| generate_header_item(x)}).join\n end",
"def header_rows\n []\n end",
"def headings_with_rows\n @headings + rows\n end",
"de... | [
"0.74537283",
"0.74537283",
"0.7341629",
"0.7176975",
"0.7121954",
"0.7080688",
"0.7059644",
"0.70224905",
"0.6946751",
"0.69380707",
"0.6912427",
"0.68574095",
"0.6807153",
"0.6741288",
"0.6720003",
"0.6625717",
"0.6612329",
"0.657679",
"0.6559838",
"0.655554",
"0.6514044",
... | 0.7211527 | 3 |
Present enum in col_count columns | def columnify col_count, enum
@cols = [{}] * col_count
@col_count = col_count
@col_ids = Array(col_count.times)
enum = Array(enum)
item_count = enum.count
row_count = item_count / col_count
rest = item_count % col_count
row_count += 1 if rest > 0
row_count.times do |r|
row Array(col_count.times.map { |i| enum[r * col_count + i] || "" })
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_count\n visible_column_names().count\n end",
"def count_columns\n fields.size\n end",
"def columns_count\n @values.empty? ? 0 : @values.first.count\n end",
"def columns\n @columns.to_enum\n end",
"def cols_enum\n data_maker.questions.\n map{|q|q.attribute_... | [
"0.66615254",
"0.65724576",
"0.65376896",
"0.6459814",
"0.63540864",
"0.62770116",
"0.6259188",
"0.6246139",
"0.62123704",
"0.6197505",
"0.6131208",
"0.6123966",
"0.6113576",
"0.6075179",
"0.6049646",
"0.60150504",
"0.59601754",
"0.5954163",
"0.5943491",
"0.5912409",
"0.58931... | 0.7220586 | 0 |
Doublequotes are replaced with single ones so this list can be included in a data block. Ex: embedded link" rel="popover">Click me | def file_list files
files.map { |gf| link_to_file(gf) }.join(', ').gsub(/"/, "'")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _(data=\"\"); self.__ self.escape_html(data.to_s); end",
"def tags_with_html_content\n [:details, :description, :detailed_information, :impact]\n end",
"def tags_with_html_content\n [:details, :description, :detailed_information, :impact]\n end",
"def enrich_data(a)\n b = a.scan(/<p>(.... | [
"0.6169588",
"0.572713",
"0.572713",
"0.5602483",
"0.55744374",
"0.55647403",
"0.55598986",
"0.5555763",
"0.5463636",
"0.5463589",
"0.54360527",
"0.54359627",
"0.539605",
"0.5367847",
"0.5362989",
"0.53056395",
"0.5266889",
"0.52501583",
"0.5226724",
"0.5217762",
"0.5213102",... | 0.0 | -1 |
configure with some basic params | def configure
reconfigure_notifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_with(params)\r\n\r\n\t\tend",
"def configure; end",
"def initialize(...)\n super()\n configure(...)\n end",
"def configure\n end",
"def configure(opts)\n #This is a stub, used for indexing\n end",
"def set_config(*args); end",
"def set... | [
"0.83021986",
"0.75733775",
"0.75511616",
"0.7382509",
"0.73732054",
"0.73419976",
"0.73419976",
"0.73419976",
"0.73419976",
"0.73419976",
"0.73124737",
"0.73124737",
"0.73124737",
"0.73124737",
"0.73124737",
"0.7235885",
"0.7226747",
"0.7226747",
"0.7013885",
"0.7013885",
"0... | 0.0 | -1 |
Start the IdlePokemonAnimation (bouncing) | def spc_start_bouncing_animation(pokemon_index)
sprite = @actor_sprites[pokemon_index]
bar = @actor_bars[pokemon_index]
@parallel_animations[Battle::Visual::IdlePokemonAnimation] = Battle::Visual::IdlePokemonAnimation.new(self, sprite, bar)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spc_stop_bouncing_animation\n @parallel_animations[Battle::Visual::IdlePokemonAnimation]&.remove\n end",
"def pbHiddenMoveAnimation(pokemon)\n return false if !pokemon\n viewport=Viewport.new(0,0,0,0)\n viewport.z=99999\n bg=Sprite.new(viewport)\n bg.bitmap=BitmapCache.load_bitmap(\"Graphics/Picture... | [
"0.7183097",
"0.644477",
"0.6352397",
"0.6326087",
"0.61595273",
"0.6100417",
"0.60436493",
"0.5982728",
"0.5917454",
"0.5913578",
"0.59120363",
"0.5894039",
"0.5827469",
"0.58035576",
"0.57907677",
"0.5776521",
"0.57747793",
"0.5732264",
"0.5682239",
"0.56808364",
"0.5666925... | 0.81629765 | 0 |
Stop the IdlePokemonAnimation (bouncing) | def spc_stop_bouncing_animation
@parallel_animations[Battle::Visual::IdlePokemonAnimation]&.remove
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_loop_animation\n loop_animation(nil)\n end",
"def spc_start_bouncing_animation(pokemon_index)\n sprite = @actor_sprites[pokemon_index]\n bar = @actor_bars[pokemon_index]\n @parallel_animations[Battle::Visual::IdlePokemonAnimation] = Battle::Visual::IdlePokemonAnimation.new(self, sprite, bar... | [
"0.6662719",
"0.6497737",
"0.62365925",
"0.6128075",
"0.6128075",
"0.6086266",
"0.60828304",
"0.6051637",
"0.59845257",
"0.5938941",
"0.58962846",
"0.58607775",
"0.58309966",
"0.581628",
"0.58046466",
"0.5798677",
"0.5756839",
"0.57333356",
"0.5718039",
"0.5708614",
"0.568926... | 0.87796974 | 0 |
GET /unit_categories GET /unit_categories.json | def index
@unit_categories = UnitCategory.where('is_active = 1').order('name')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def index\n @unit_categories = UnitCategory.all\n end",
"def index\n @unit_categories = UnitCategory.all\n end",
"def get_subcategories\r\n sub... | [
"0.7569464",
"0.74808353",
"0.74808353",
"0.70622605",
"0.7039107",
"0.6970642",
"0.69146466",
"0.68720865",
"0.68274856",
"0.6728517",
"0.6725317",
"0.6616604",
"0.66113824",
"0.6592868",
"0.6576883",
"0.6562787",
"0.6556106",
"0.65437084",
"0.6543511",
"0.65164137",
"0.6502... | 0.62234944 | 52 |
GET /unit_categories/1 GET /unit_categories/1.json | def show
@action = "show"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @unit_categories = UnitCategory.all\n end",
"def index\n @unit_categories = UnitCategory.all\n end",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def GetCategory id\n\n AP... | [
"0.736093",
"0.736093",
"0.73512477",
"0.7020004",
"0.69138116",
"0.6812813",
"0.6788402",
"0.67208725",
"0.67047364",
"0.66939855",
"0.6685475",
"0.66724855",
"0.66333663",
"0.66333663",
"0.66333663",
"0.66272616",
"0.6550223",
"0.6532574",
"0.65243614",
"0.65011203",
"0.648... | 0.0 | -1 |
POST /unit_categories POST /unit_categories.json | def create
@unit_category = UnitCategory.new(unit_category_params)
respond_to do |format|
if @unit_category.save
format.html { redirect_to unit_categories_url, flash: { notice: 'Категория "' + @unit_category.name + '" была добавлена', type: 'created', state: 'ok' } }
format.json { render :show, status: :created, location: @unit_category }
else
format.html { render :new }
format.json { render json: @unit_category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @unit_category = UnitCategory.new(unit_category_params)\n\n respond_to do |format|\n if @unit_category.save\n format.html { redirect_to @unit_category, notice: 'Unit category was successfully created.' }\n format.json { render :show, status: :created, location: @unit_category ... | [
"0.722625",
"0.6941883",
"0.6830106",
"0.6585179",
"0.65530074",
"0.65530074",
"0.6466136",
"0.64526534",
"0.6390055",
"0.6313909",
"0.6299974",
"0.6299974",
"0.6265169",
"0.6265169",
"0.6265169",
"0.62615967",
"0.6230877",
"0.62076795",
"0.6180988",
"0.6174109",
"0.6173785",... | 0.6957893 | 1 |
PATCH/PUT /unit_categories/1 PATCH/PUT /unit_categories/1.json | def update
respond_to do |format|
if @unit_category.update(unit_category_params)
format.html { redirect_to unit_categories_url, flash: { notice: 'Категория "' + @unit_category.name + '" была изменена', type: 'updated', state: 'ok' } }
format.json { render :show, status: :ok, location: @unit_category }
else
format.html { render :edit }
format.json { render json: @unit_category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n json_update(category,category_params, Category)\n end",
"def update\n respond_to do |format|\n if @unit_category.update(unit_category_params)... | [
"0.72194076",
"0.716857",
"0.70658654",
"0.66114306",
"0.6569412",
"0.6516207",
"0.6396051",
"0.6386344",
"0.63649607",
"0.63631517",
"0.63631517",
"0.63631517",
"0.63481754",
"0.63161755",
"0.6304836",
"0.6299006",
"0.6288882",
"0.6284072",
"0.6235324",
"0.6218809",
"0.62117... | 0.69835454 | 3 |
DELETE /unit_categories/1 DELETE /unit_categories/1.json | def destroy
@unit_category.is_active = 0
@unit_category.save
respond_to do |format|
format.html { redirect_to unit_categories_url, flash: { notice: 'Категория была удалена', type: 'deleted', state: 'ok', rollback_url: "/unit_categories/#{params[:id]}/recover" } }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @unit_category.destroy\n respond_to do |format|\n format.html { redirect_to unit_categories_url, notice: 'Unit category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n render json: @category, status: :ok\n ... | [
"0.75712407",
"0.7272593",
"0.72592604",
"0.7250426",
"0.7099837",
"0.7052529",
"0.70480305",
"0.70287704",
"0.7014199",
"0.6980039",
"0.6973692",
"0.6970293",
"0.6948369",
"0.6947145",
"0.6933966",
"0.69292074",
"0.69292074",
"0.69292074",
"0.69292074",
"0.69281596",
"0.6886... | 0.72411996 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_unit_category
@unit_category = UnitCategory.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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def unit_category_params
params.require(:unit_category).permit(:name, :counterparty_id, :tax_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.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
before_filter :myauth GET /users GET /users.json | def index
# if ( !current_user || !current_user.isAdmin )
# render :text => "You are not authorized to see this page", :layout => true
#
# return
# end
@users = User.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @users = User.all\n authorize @users\n\n render json: @users\n end",
"def auth\n\n @user = current_user\n render json: @user\n \n end",
"def get_current_logged_in_user \n get(\"/users.json/current\")\nend",
"def get_current_logged_in_user \n get(\"/user... | [
"0.7023454",
"0.6824138",
"0.67483807",
"0.67483807",
"0.6738118",
"0.66136295",
"0.6569709",
"0.65589",
"0.6534117",
"0.6529377",
"0.6526238",
"0.6483128",
"0.64830524",
"0.6457429",
"0.6407728",
"0.6405412",
"0.63862187",
"0.63768846",
"0.6375225",
"0.63703114",
"0.63601565... | 0.0 | -1 |
GET /users/1 GET /users/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.81049806",
"0.77023244",
"0.77010894",
"0.7625595",
"0.75821865",
"0.74811673",
"0.74603444",
"0.7446582",
"0.7305236",
"0.72992796",
"0.72888285",
"0.72772574",
"0.72345036",
"0.72321355",
"0.72321355",
"0.72321355",
"0.72321355",
"0.72321355",
"0.72321355",
"0.72321355",
... | 0.0 | -1 |
POST /users POST /users.json | def create
@user = User.new(user_params)
respond_to do |format|
if @user.save
#if a normal user is signing up, send a confirmation email
if (!current_user || !@user.isConf)
UserNotifier.send_signup_email(@user).deliver!
if (!current_user)
format.html { render :confirmation_process }
end
end
format.html { redirect_to @user, notice: 'User was successfully created.' }
format.json { render :show, status: :created, location: @user }
else
format.html { render :new }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post b... | [
"0.7717216",
"0.75203925",
"0.73826534",
"0.72408456",
"0.7198273",
"0.71413374",
"0.7104663",
"0.70592535",
"0.7041866",
"0.70243144",
"0.70035493",
"0.7002658",
"0.7002658",
"0.7002658",
"0.6993813",
"0.6990762",
"0.69811314",
"0.697928",
"0.697928",
"0.6979072",
"0.6976808... | 0.0 | -1 |
PATCH/PUT /users/1 PATCH/PUT /users/1.json | def update
respond_to do |format|
if @user.update(user_params)
session[:user_username] = user_params[:username]
session[:user_isAdmin] = user_params[:isAdmin]
format.html { redirect_to @user, notice: 'User was successfully updated.' }
format.json { render :show, status: :ok, location: @user }
else
format.html { render :edit }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"de... | [
"0.7225487",
"0.71291554",
"0.7003983",
"0.6903858",
"0.682214",
"0.6816166",
"0.6708457",
"0.66937435",
"0.6680848",
"0.6674177",
"0.6672642",
"0.66645867",
"0.66645867",
"0.6660262",
"0.6660262",
"0.6654932",
"0.66482556",
"0.66436964",
"0.6642245",
"0.6635296",
"0.6618284"... | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.json | def destroy
@user.destroy
respond_to do |format|
format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\... | [
"0.7875345",
"0.77512276",
"0.7713299",
"0.76091963",
"0.7471578",
"0.74069583",
"0.74069583",
"0.73691666",
"0.7345325",
"0.7339192",
"0.73272485",
"0.7309725",
"0.73092926",
"0.73057216",
"0.7296841",
"0.72904414",
"0.7290419",
"0.72891515",
"0.72831494",
"0.7249661",
"0.72... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_params
params.require(:user).permit(:username, :email, :password, :age, :gender, :isAdmin, :isConf , :avatar)
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.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915... | 0.0 | -1 |
def current_user current_authenticated_entity end | def render_json(json, status = :ok, serializer = nil)
if serializer.blank?
render json: json, status: status
else
render json: json, status: status,
each_serializer: serializer
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n @authenticated_user\n end",
"def current_user\n @authenticated_user\n end",
"def current_user\n\t\tauthenticated(User)\n\tend",
"def current_user\n @current_user\n end",
"def current_user\n @current_user\n end",
"def current_user\n @current_user\n end",
"def curre... | [
"0.85721564",
"0.85721564",
"0.8538636",
"0.8223576",
"0.8223576",
"0.8223576",
"0.8223576",
"0.8211444",
"0.8145624",
"0.8136558",
"0.8120268",
"0.80839896",
"0.8068184",
"0.8021469",
"0.8021469",
"0.8012698",
"0.8007911",
"0.8007911",
"0.79785615",
"0.79785615",
"0.7963861"... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.forgot_password_mailer.reset_email.subject | def reset_email(user, temp_pass)
@user = user
@temp_pass = temp_pass
mail to: @user.email, subject: 'Password Reset'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject\n @mail.subject\n end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n ... | [
"0.6894103",
"0.68207717",
"0.6757991",
"0.6756988",
"0.67245287",
"0.67230165",
"0.66643727",
"0.66352254",
"0.66043466",
"0.657627",
"0.6544595",
"0.6448782",
"0.63866967",
"0.6375513",
"0.63753915",
"0.63712037",
"0.63448715",
"0.6344036",
"0.62951446",
"0.6262042",
"0.623... | 0.0 | -1 |
TODO: Alias for GithubFlow::Client.new | def new(options = {}, &block)
#@api_client = Github::Client.new(options, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client\n @client ||= Github::ApiProxy.new(@options[:access_token])\n end",
"def github_client\n p = Project.find(params[:id])\n if p.github_token\n github = Github.new :oauth_token => p.github_token\n else\n github = Github.new :client_id => GITHUB_CLIENT_ID , :client_secret => GIT... | [
"0.74669635",
"0.7309308",
"0.7228384",
"0.7116429",
"0.7044576",
"0.69485533",
"0.694098",
"0.6695676",
"0.6685681",
"0.66110694",
"0.65560645",
"0.65120316",
"0.6502237",
"0.6502237",
"0.6502237",
"0.64763695",
"0.64742005",
"0.6459747",
"0.6406574",
"0.63197535",
"0.631975... | 0.80067015 | 0 |
Prints the output from tree to the given `io` | def print(io)
tree.each_with_index do |(command, event_called_handlerss), index|
io.puts '+++++++++++++++++++++++++++++++++++' if index == 0
io.puts "Command: #{command.class} resulted in #{event_called_handlerss.length} events"
event_called_handlerss.each_with_index do |event_called_handlers, i|
io.puts '' if i > 0
io.puts "-- Event #{event_called_handlers.event.class} was handled by:"
io.puts "-- Projectors: [#{event_called_handlers.projectors.join(', ')}]"
io.puts "-- Workflows: [#{event_called_handlers.workflows.join(', ')}]"
end
io.puts '+++++++++++++++++++++++++++++++++++'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output=(io); end",
"def write(io = $stdout)\n #Require and spawn StringIO in the subprocess.\n @subproc.static(:Object, :require, \"stringio\")\n string_io = @subproc.new(\"StringIO\")\n \n #We want a human-readable print.\n writer = @subproc.new(\"REXML::Formatters::Pretty\", 5)\n write... | [
"0.6924902",
"0.6864691",
"0.67517805",
"0.67372644",
"0.64550287",
"0.64550287",
"0.63620716",
"0.63132894",
"0.6307973",
"0.6249703",
"0.6237144",
"0.6195077",
"0.6193486",
"0.6183914",
"0.610427",
"0.61039484",
"0.60677177",
"0.6064089",
"0.6032556",
"0.5998436",
"0.598851... | 0.75345963 | 0 |
following methods are internal hungry? | def hungry?
@stuff_in_belly <= 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def internal; end",
"def big_bad; end",
"def probers; end",
"def pausable; end",
"def anchored; end",
"def used?; end",
"def silly_adjective; end",
"def sharp; accidental; end",
"def internship_passed; end",
"def leeway; end",
"def leeway; end",
"def weber; end",
"def ... | [
"0.7105167",
"0.68517447",
"0.6848119",
"0.68354523",
"0.6739607",
"0.67146367",
"0.6560033",
"0.6532106",
"0.6448684",
"0.6440127",
"0.63797927",
"0.63797927",
"0.63740295",
"0.63738364",
"0.633191",
"0.6310889",
"0.63092035",
"0.62469697",
"0.6226221",
"0.62168515",
"0.6213... | 0.0 | -1 |
passage of time, this is when things happen | def passage_of_time
if @stuff_in_belly > 0
# move food from belly to intestine
@stuff_in_belly = @stuff_in_belly - 1
@stuff_in_intestine = @stuff_in_intestine + 1
else
if @asleep
@asleep = false
puts 'He wakes up suddenly!'
end
puts @name + ' is starving! In desperation, he ate YOU!'
exit
end
if @stuff_in_intestine >= 10
@stuff_in_intestine = 0
puts 'Whoops! ' + @name + ' had an accident...'
end
if hungry?
if @asleep
@asleep = false
puts 'He wakes up suddenly!'
end
puts @name + '\'s stomach grumbles...'
end
if poopy?
if @asleep
@asleep = false
puts 'He wakes up suddenly!'
end
puts @name + ' does the potty dance...'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def build_timing; end",
"def cstime=(*) end",
"def story_time\n touch(@@detailsheader)\n sleeper(30)\n end",
"def start_t... | [
"0.74320763",
"0.74320763",
"0.74320763",
"0.74320763",
"0.74320763",
"0.74320763",
"0.74320763",
"0.74320763",
"0.74320763",
"0.7046818",
"0.6961891",
"0.6955159",
"0.6945547",
"0.6893453",
"0.6856729",
"0.6842125",
"0.6842125",
"0.6842125",
"0.6842125",
"0.6837949",
"0.6800... | 0.0 | -1 |
Returns true if something was changed | def set_their_public_key(their_public_key_x, their_public_key_y)
# Check if we're actually changing anything
if(@keys[:their_public_key_x] == their_public_key_x && @keys[:their_public_key_y] == their_public_key_y)
@@window.puts("Attempted to set the same public key!")
return false
end
@old_keys = @keys
@keys = {
:my_nonce => -1,
:their_nonce => -1,
}
if(ready?())
@@window.puts("Wow, this session is old (or the client is needy)! Key re-negotiation requested!")
end
@keys[:my_private_key] = 1 + SecureRandom.random_number(ECDH_GROUP.order - 1)
@keys[:my_public_key] = ECDH_GROUP.generator.multiply_by_scalar(@keys[:my_private_key])
@keys[:their_public_key_x] = their_public_key_x
@keys[:their_public_key_y] = their_public_key_y
@keys[:their_public_key] = ECDSA::Point.new(ECDH_GROUP, their_public_key_x, their_public_key_y)
@keys[:shared_secret] = @keys[:their_public_key].multiply_by_scalar(@keys[:my_private_key]).x
@keys[:their_authenticator] = _create_authenticator("client", @preshared_secret)
@keys[:my_authenticator] = _create_authenticator("server", @preshared_secret)
@keys[:their_write_key] = _create_key("client_write_key")
@keys[:their_mac_key] = _create_key("client_mac_key")
@keys[:my_write_key] = _create_key("server_write_key")
@keys[:my_mac_key] = _create_key("server_mac_key")
@@window.puts("Setting their public key: #{CryptoHelper.bignum_to_text(@keys[:their_public_key_x])} #{CryptoHelper.bignum_to_text(@keys[:their_public_key_y])}")
@@window.puts("Setting my public key: #{CryptoHelper.bignum_to_text(@keys[:my_public_key].x)} #{CryptoHelper.bignum_to_text(@keys[:my_public_key].y)}")
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changed? \n @changed == true\n end",
"def changed?\r\n @changed\r\n end",
"def changed?\n true\n end",
"def changed?\n @changed\n end",
"def changed?\n @changed\n end",
"def changed?\n !!@changed\n end",
"def changed?\n\t\treturn self.chan... | [
"0.8880344",
"0.87220365",
"0.8710393",
"0.8627816",
"0.8624178",
"0.85757196",
"0.82971585",
"0.82915413",
"0.8176315",
"0.8054586",
"0.80370975",
"0.80114126",
"0.80084395",
"0.7999754",
"0.7983275",
"0.79365647",
"0.7904696",
"0.7904696",
"0.7837699",
"0.7814665",
"0.78094... | 0.0 | -1 |
We use this special internal function so we can try decrypting with different keys | def _decrypt_packet_internal(keys, data)
# Don't decrypt if we don't have a key set
if(!ready?(keys))
@@window.puts("Not decrypting data (incoming data seemed to be cleartext): #{data.unpack("H*")}")
return data
end
# Parse out the important fields
header, signature, nonce, encrypted_body = data.unpack("a5a6a2a*")
# Put together the data to sign
signed_data = header + nonce + encrypted_body
# Check the signature
correct_signature = SHA3::Digest::SHA256.digest(keys[:their_mac_key] + signed_data)
if(correct_signature[0,6] != signature)
@@window.puts("Couldn't verify packet signature!")
raise(Encryptor::Error, "Invalid signature!")
end
# Check the nonce *after* checking the signature (otherwise, we might update the nonce to a bad value and Bad Stuff happens)
nonce_int = nonce.unpack("n").pop()
if(nonce_int < keys[:their_nonce])
@@window.puts("Client tried to use an invalid nonce: #{nonce_int} < #{keys[:their_nonce]}")
raise(Encryptor::Error, "Invalid nonce!")
end
keys[:their_nonce] = nonce_int
# Decrypt the body
body = Salsa20.new(keys[:their_write_key], nonce.rjust(8, "\0")).decrypt(encrypted_body)
#@@window.puts("Decryption successful")
return header+body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt; end",
"def decrypt(alg, password, cipher)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256')\n ... | [
"0.7451354",
"0.71044576",
"0.70645094",
"0.6976337",
"0.6897504",
"0.68879205",
"0.6760972",
"0.67533726",
"0.6747938",
"0.66115147",
"0.6593636",
"0.6567799",
"0.65408",
"0.6534792",
"0.6533567",
"0.65168995",
"0.65168995",
"0.64845455",
"0.6446024",
"0.64396596",
"0.643274... | 0.64655715 | 18 |
By doing this as a single operation, we can always be sure that we're encrypting data with the same key the client use to encrypt data | def decrypt_and_encrypt(data)
## ** Decrypt
keys = @keys
begin
#@@window.puts("Attempting to decrypt with primary key")
data = _decrypt_packet_internal(keys, data)
#@@window.puts("Successfully decrypted with primary key")
# If it was successfully decrypted, make sure the @old_keys will no longer work
@old_keys = nil
rescue Encryptor::Error => e
# Attempt to fall back to old keys
if(@old_keys.nil?)
@@window.puts("No secondary key to fallback to")
raise(e)
end
@@window.puts("Attempting to decrypt with secondary key")
keys = @old_keys
data = _decrypt_packet_internal(@old_keys, data)
@@window.puts("Successfully decrypted with secondary key")
end
# Send the decrypted data up and get the encrypted data back
data = yield(data, ready?(keys))
# If there was an error of some sort, return nothing
if(data.nil? || data == '')
return ''
end
# If encryption is turned off, return unencrypted data
if(!ready?(keys))
@@window.puts("Returning an unencrypted response")
return data
end
## ** Encrypt
#@@window.puts("Encrypting the response")
# Split the packet into a header and a body
header, body = data.unpack("a5a*")
# Encode the nonce properly
nonce = [keys[:my_nonce]].pack("n")
# Encrypt the body
encrypted_body = Salsa20.new(keys[:my_write_key], nonce.rjust(8, "\0")).encrypt(body)
# Sign it
signature = SHA3::Digest::SHA256.digest(keys[:my_mac_key] + header + nonce + encrypted_body)
# Arrange things appropriately
return [header, signature[0,6], nonce, encrypted_body].pack("a5a6a2a*")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt; end",
"def encrypt_message plaintext\n key_pair.encrypt plaintext\n end",
"def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end",
"def encrypt\n self\n end",
"def encryption_key\n\tself.data_encrypting_key ||= DataEncryptin... | [
"0.71183944",
"0.70034456",
"0.69304144",
"0.6881148",
"0.684709",
"0.68094003",
"0.6753988",
"0.6724333",
"0.67170805",
"0.669178",
"0.66908157",
"0.6665775",
"0.6636512",
"0.6614415",
"0.6588695",
"0.6568611",
"0.6544962",
"0.6524082",
"0.65157986",
"0.65154546",
"0.6513627... | 0.6808384 | 6 |
Shows all the users | def index
@users = User.paginate(:page => params[:page], :per_page => 5)
authorize @users
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @users = User.all\n end",
"def show\n @users = User.all\n end",
"def show\n @users = User.all\n end",
"def show\n @users = User.all\n end",
"def show_users\n @users = User.all\n end",
"def index\n @users = User.all\n end",
"def index\n @users = User.all\n... | [
"0.8532425",
"0.8532425",
"0.8532425",
"0.8532425",
"0.8499493",
"0.82731193",
"0.8244182",
"0.8244182",
"0.8244182",
"0.817901",
"0.817901",
"0.817901",
"0.817901",
"0.817901",
"0.817901",
"0.8143561",
"0.8143561",
"0.8143561",
"0.8143561",
"0.8143561",
"0.8143561",
"0.814... | 0.0 | -1 |
Shows the user information | def show
@user = User.find(params[:id])
authorize @user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end",
"def show\n set_user\n end",
"def info\n\t@user = User.find(params[:id])\n end",
"def show\n @client = basic_c... | [
"0.7761885",
"0.7752329",
"0.76784825",
"0.7586752",
"0.7579039",
"0.7525511",
"0.7513288",
"0.75094837",
"0.7488238",
"0.744519",
"0.7442603",
"0.74094105",
"0.74083704",
"0.74015933",
"0.7392973",
"0.73552716",
"0.7352795",
"0.73504937",
"0.7347889",
"0.7346565",
"0.7337580... | 0.0 | -1 |
Prepares a new to will be created | def new
@user = User.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare; dup; end",
"def prepare\n model.tap do |p|\n p.name = name\n p.identifier = set_identifiers\n p.meta = set_meta\n end\n end",
"def prepare\n model.tap do |p|\n p.name = name\n p.identifier = set_identifiers\n ... | [
"0.6596825",
"0.6315048",
"0.6315048",
"0.6254608",
"0.622181",
"0.622181",
"0.61649555",
"0.6135921",
"0.6135921",
"0.6135921",
"0.6135921",
"0.6134004",
"0.6134004",
"0.6134004",
"0.6134004",
"0.6134004",
"0.6134004",
"0.6134004",
"0.6070803",
"0.6035397",
"0.60047984",
"... | 0.0 | -1 |
Saves a new user with the enabled status to false | def create
@user = User.new(user_params)
if @user.save
redirect_to :controller => 'welcome', :action => 'index'
flash[:info] = 'Wait until admin enables your account'
else
render 'new'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate_user(user)\n user.status_id=0\n user.save\n end",
"def create_user(**data)\n create_object(type: 'User', data: { enabled: true }.merge(data))\n end",
"def create\n authorize! :create, User\n @user = User.new(params[:user])\n @user.enabled = false\n respond_to do |format|... | [
"0.6967424",
"0.68988556",
"0.67252445",
"0.671051",
"0.6675519",
"0.66644394",
"0.6622831",
"0.65789455",
"0.6511236",
"0.6504372",
"0.6495421",
"0.648702",
"0.6441078",
"0.6430459",
"0.6396521",
"0.63905716",
"0.63895553",
"0.63647974",
"0.6364522",
"0.63588405",
"0.6354937... | 0.62642395 | 33 |
Shows the current user information | def profile
@user = current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t@user = current_user\n\tend",
"def user_information\n @current_user = current_user\n\n render :partial => 'home/user_info'\n end",
"def show\n @user = User.find(current_user.id)\n end",
"def show\n json_response(current_user.decorate, :ok)\n end",
"def show\n s... | [
"0.7952431",
"0.78764343",
"0.7846677",
"0.77020794",
"0.76976246",
"0.76343375",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7615272",
"0.7614944",... | 0.0 | -1 |
Changes the users enabled status to "False" | def destroy
@user = User.find(params[:id])
authorize @user
@user.destroy
redirect_to users_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable\n authorize! @user\n @user.enabled = false\n @user.save\n @user.owned_extensions.update_all(enabled: false)\n redirect_to root_path, notice: t(\"user.disabled\", name: @user.username)\n end",
"def user_onoff_flag\n @requested_user = User.find_by_account_number(params[:id])\n if ... | [
"0.7668573",
"0.71001303",
"0.7074982",
"0.70554787",
"0.69925565",
"0.6989057",
"0.6972989",
"0.6890364",
"0.6829925",
"0.68212074",
"0.6814587",
"0.6811642",
"0.68102634",
"0.6805149",
"0.68023497",
"0.67965615",
"0.67965615",
"0.67965615",
"0.67965615",
"0.67965615",
"0.67... | 0.0 | -1 |
Changes the users enabled status to "True" | def revive
@user = User.find(params[:user_id])
authorize @user
@user.revive
redirect_to users_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_is_enabled\n member = Member.find params[:id]\n user = User.find(member.user_id)\n Member.change_student_status(member)\n if member.is_enabled == true\n redirect_to users_url, :flash => { :success => \"#{user.first_name} #{user.last_name} has been enabled.\" }\n else\n redirect_... | [
"0.75687176",
"0.74803823",
"0.7228026",
"0.72169423",
"0.72169423",
"0.72169423",
"0.72169423",
"0.72169423",
"0.72169423",
"0.72169423",
"0.71693826",
"0.7130758",
"0.7118738",
"0.7118738",
"0.7118738",
"0.707006",
"0.707006",
"0.69884586",
"0.6980601",
"0.6930187",
"0.6922... | 0.0 | -1 |
Check if there is an user logged in | def anonymous_user?
unless logged_in?
redirect_to root_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n return false unless session[:user_id]\n\n User.find_by_id(session[:user_id]).present?\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end"... | [
"0.85078835",
"0.8274214",
"0.81482273",
"0.81233793",
"0.81233793",
"0.81233793",
"0.81233793",
"0.8119161",
"0.8106483",
"0.8101841",
"0.810168",
"0.8100639",
"0.8083034",
"0.8064542",
"0.8061766",
"0.80516267",
"0.80516267",
"0.8042069",
"0.80357623",
"0.80291057",
"0.8018... | 0.0 | -1 |
POST /tags POST /tags.xml | def create
@tag = Tag.new(params[:tag])
respond_to do |format|
if @tag.save
flash[:notice] = "#{@tag.name} Was Successfully Created"
format.html { redirect_to tag_path(@business, @tag) }
format.xml { head :created, :location => tag_url(@business, @tag) }
else
format.html { render :action => tag_path(@tag) }
format.xml { render :xml => @tag.errors.to_xml }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'... | [
"0.7495267",
"0.6577584",
"0.65153253",
"0.6300751",
"0.628571",
"0.6275362",
"0.622986",
"0.61921144",
"0.61804706",
"0.61754376",
"0.61754376",
"0.61753094",
"0.6145868",
"0.61345434",
"0.61340797",
"0.6134057",
"0.6102722",
"0.60921174",
"0.60711455",
"0.6070686",
"0.60484... | 0.614837 | 12 |
PUT /tags/1 PUT /tags/1.xml | def update
@tag = Tag.find(params[:id])
respond_to do |format|
if @tag.update_attributes(params[:business])
flash[:success] = "#{@business.name} Was Successfully Updated"
format.html { redirect_to business_path(@business) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @business.errors.to_xml }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n bod... | [
"0.6783059",
"0.65366703",
"0.6499224",
"0.6401138",
"0.6265914",
"0.6265914",
"0.6265914",
"0.62573963",
"0.6242138",
"0.6223239",
"0.62196237",
"0.62128425",
"0.62098515",
"0.61989594",
"0.6189008",
"0.6185726",
"0.61756414",
"0.61056256",
"0.60948724",
"0.60827786",
"0.607... | 0.0 | -1 |
Add an option to the option stack | def add_option(name, type, options_info, options_text, option_name, option_descr, attribute)
raise 'Invalid option type' unless VALID_OPTION_TYPE.include?(type)
options_info = parse_string(options_info) if options_info.is_a?(String)
options_text = parse_string(options_text) if options_text.is_a?(String)
options_text.map! { |option_text| get_text(option_text) } unless options_text.is_a?(String)
option_name = get_text(option_name)
option_descr = get_text(option_descr)
getter = attribute
setter = "#{getter}="
return if options_info.is_a?(Array) && options_info.size <= 1
@options[name] = Helper.new(type, options_info, options_text, option_name, option_descr, getter, setter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_option(option)\n @options += [option]\n end",
"def add_option(choice, *args, &block)\n self.options << choice\n self.builder.add_choice(choice, *args, &block)\n end",
"def add(option:)\n self\n .class\n .new(\n option: option,\n options: @options\n )\n ... | [
"0.79903847",
"0.7670999",
"0.72459614",
"0.71131897",
"0.7034031",
"0.70267797",
"0.6969407",
"0.690037",
"0.6813013",
"0.68107116",
"0.6623984",
"0.6608497",
"0.6587797",
"0.6573878",
"0.6489745",
"0.6446105",
"0.6425316",
"0.6422594",
"0.6337708",
"0.6316825",
"0.6287067",... | 0.6309315 | 20 |
Parser allowing to retrieve the right value | def parse_string(str)
return str if str.include?('%')
constants, *attributes = str.split('#')
value = Object.const_get(constants)
while (attribute = attributes.shift)
value = value.send(attribute) unless attribute.empty?
end
return value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_value; end",
"def parse_values; end",
"def parse_value(nodes); end",
"def parse; end",
"def parse; end",
"def parse; end",
"def get_parse(s);end",
"def parse()\n #This is a stub, used for indexing\n end",
"def parse\n end",
"def parse(str); end",
"def parse\... | [
"0.7863406",
"0.7094623",
"0.6813565",
"0.678812",
"0.678812",
"0.678812",
"0.67107546",
"0.6610517",
"0.6564835",
"0.6411029",
"0.6321529",
"0.6262748",
"0.62535584",
"0.624634",
"0.6245914",
"0.6227998",
"0.6227998",
"0.6153616",
"0.6153616",
"0.6153616",
"0.6153616",
"0.... | 0.0 | -1 |
Create a new option | def initialize(*args)
@type = args[0]
@values = args[1]
@values_text = args[2]
@name = args[3]
@description = args[4]
@getter = args[5]
@setter = args[6]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_option(value)\n payload = { value: value }\n client.post(\"/customFields/#{id}/options\", payload)\n end",
"def new_option(opts = {})\n Survey::Option.new(option_attributes.merge(opts))\nend",
"def add(option:)\n self\n .class\n .new(\n option: option,\n ... | [
"0.7543427",
"0.74349797",
"0.72148806",
"0.7037115",
"0.7002032",
"0.6830048",
"0.6819225",
"0.68168163",
"0.6802075",
"0.6786198",
"0.67694503",
"0.6767359",
"0.6716808",
"0.66580254",
"0.6646239",
"0.6646181",
"0.6621562",
"0.65949476",
"0.6553226",
"0.648198",
"0.6481791"... | 0.0 | -1 |
Retreive the current value | def current_value
value = $options.send(getter)
if @type == :slider
value = value.clamp(@values[:min], @values[:max])
return value - (value % @values[:increment])
end
value_index = @values.index(value)
return @values[value_index || 0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_value\n @value\n end",
"def current_value; end",
"def get_value\n @value\n end",
"def value\r\n @value\r\n end",
"def get_value\n @value \n end",
"def value\n return @value\n end",
"def value\n return @value\n end"... | [
"0.86289",
"0.8476445",
"0.79009837",
"0.7863719",
"0.7856688",
"0.78436106",
"0.78436106",
"0.78436106",
"0.78336203",
"0.78287584",
"0.7818483",
"0.77793556",
"0.7770747",
"0.7770747",
"0.77330226",
"0.77330226",
"0.7725783",
"0.7725783",
"0.7725783",
"0.7725783",
"0.772578... | 0.7302996 | 62 |
Retreive the next value | def next_value
value = $options.send(getter)
return (value + @values[:increment]).clamp(@values[:min], @values[:max]) if @type == :slider
value_index = @values.index(value)
new_value = @values[(value_index || 0) + 1]
new_value = @values.first if new_value.nil?
return new_value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next\r\n next_values[0]\r\n end",
"def next\n @next && @next.value\n end",
"def next\n if @elements and not @elements.empty?\n @index = (@index + 1) % @elements.length\n element = @elements[@index]\n value = value_of(element)\n @element... | [
"0.8699808",
"0.7908956",
"0.75673455",
"0.75594646",
"0.75304794",
"0.75304794",
"0.75304794",
"0.75304794",
"0.75304794",
"0.75304794",
"0.75279284",
"0.749041",
"0.7411051",
"0.7321877",
"0.7312212",
"0.7200593",
"0.72001475",
"0.7193838",
"0.7166429",
"0.71408474",
"0.703... | 0.7010543 | 22 |
Retreive the prev value | def prev_value
value = $options.send(getter)
return (value - @values[:increment]).clamp(@values[:min], @values[:max]) if @type == :slider
value_index = @values.index(value)
return @values.last if value_index == 0
new_value = @values[(value_index || 0) - 1]
new_value = @values.first if new_value.nil?
return new_value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_prev()\n\t\t\treturn @prev\n\t\tend",
"def prev\n\t\t@prev\n\tend",
"def prev\n prev? ? @current - 1 : nil\n end",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def get_Previous()\n \t return @outputs[\"Previous\"]\n \tend",
"def get_Previous()\n ... | [
"0.8414563",
"0.8034299",
"0.7874153",
"0.7797528",
"0.7797528",
"0.7797528",
"0.7797528",
"0.7797528",
"0.7763089",
"0.7728041",
"0.77039737",
"0.76866144",
"0.7583961",
"0.75735503",
"0.7572196",
"0.7542234",
"0.75355506",
"0.748798",
"0.73344016",
"0.73318934",
"0.73266494... | 0.75495064 | 15 |
Update the option value | def update_value(new_value)
if @type != :slider
value_index = @values.index(new_value)
new_value = @values[value_index || 0]
end
$options.send(setter, new_value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_option(opt, val)\n @options[opt] = val\n end",
"def set option_value\n self.select option_value\n end",
"def set_option_value\n @option_value = OptionValue.find(params[:id])\n end",
"def update\n @option_value = OptionValue.find(params[:id])\n\n respond_to do |format|... | [
"0.75294113",
"0.6979128",
"0.6951734",
"0.66961825",
"0.6526384",
"0.6279811",
"0.6232502",
"0.6193406",
"0.61433893",
"0.61157095",
"0.61157095",
"0.61157095",
"0.6091804",
"0.60682666",
"0.60531765",
"0.6018995",
"0.6018983",
"0.60040647",
"0.600179",
"0.59997106",
"0.5999... | 0.66382927 | 4 |
diff two hashes at a path and return the changed items | def hash_diff(old_hash, new_hash, path)
(new_hash.dig(*path).to_a - old_hash.dig(*path).to_a).to_h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_diff(a_hash, another_hash)\n\n relevant_diffs = a_hash.diff(another_hash)\n @ignored_files = [\"metadata.json\", \".gitignore\"]\n @ignored_files.each do |file|\n relevant_diffs.delete(file)\n end\n relevant_diffs\n\n end",
"def diff(from, to)\n @... | [
"0.6981276",
"0.6793034",
"0.6768421",
"0.66584224",
"0.6595907",
"0.65097517",
"0.6372387",
"0.63166374",
"0.6282958",
"0.62684643",
"0.61651105",
"0.61644894",
"0.6137688",
"0.61172396",
"0.610721",
"0.61046666",
"0.6083761",
"0.60646564",
"0.60366184",
"0.60366184",
"0.603... | 0.78342754 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.