query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
DELETE /user_accounts_groups/1 DELETE /user_accounts_groups/1.json | def destroy
@user_accounts_group.destroy
respond_to do |format|
format.html { redirect_to user_accounts_groups_url, notice: 'User accounts group was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end",
"def destroy\n @groups = Group.find(params[:id])\n @groups.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n f... | [
"0.77438855",
"0.77144307",
"0.7708459",
"0.76923585",
"0.7511899",
"0.74640507",
"0.7452043",
"0.7434376",
"0.7433611",
"0.7415008",
"0.74116623",
"0.7407413",
"0.7373673",
"0.73659796",
"0.736591",
"0.734441",
"0.7338477",
"0.7337965",
"0.7326458",
"0.73036504",
"0.73036504... | 0.757578 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_user_accounts_group
@user_accounts_group = UserAccountsGroup.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_accounts_group_params
params.require(:user_accounts_group).permit(:account_id, :group_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_marketplace_bid_no_bid_question
@marketplace_bid_no_bid_question = ::Marketplace::BidNoBidQuestion.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def marketplace_bid_no_bid_question_params
params.permit(:question_text, :position, :tender_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7120904",
"0.70538116",
"0.69469863",
"0.6901261",
"0.67348766",
"0.6717708",
"0.66874576",
"0.6676195",
"0.66601187",
"0.65563625",
"0.6525127",
"0.64565873",
"0.64494514",
"0.644928",
"0.64452374",
"0.6433947",
"0.6412815",
"0.6412815",
"0.6391939",
"0.63792473",
"0.6379... | 0.0 | -1 |
give the links for the semi_index partial | def edit_link(obj)
case obj.class.to_s
when "Tenant"
edit_tenant_path(obj)
when "Semester"
edit_semester_path(obj)
when "Department"
edit_department_path(obj)
when "Subject"
edit_subject_path(obj)
when "Faculty"
edit_faculty_path(obj)
when "Exam"
edit_exam_path(obj)
when "Batch"
edit_batch_path(obj)
when "SchoolType"
edit_school_type_path(obj)
when "Student"
edit_student_path(obj)
when "Section"
edit_section_path(obj)
when "BloodGroup"
edit_blood_group_path(obj)
when "Resource"
edit_resource_path(obj)
when "Role"
edit_role_path(obj)
when "UserProfile"
edit_user_profile_path(obj)
when "Grade"
edit_grade_path(obj)
when nil
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_for_index; end",
"def url_for_index; end",
"def define_index_links(query)\n @links ||= []\n\n # Add some extra links to the index user is sent to if they click on an\n # undefined location.\n if query.flavor == :at_where\n @links << [:list_observations_location_define.l,\n ... | [
"0.67462087",
"0.67462087",
"0.6709865",
"0.6501287",
"0.6362406",
"0.63517994",
"0.62613326",
"0.62010217",
"0.61797297",
"0.6147147",
"0.61405456",
"0.6132732",
"0.6124785",
"0.6122753",
"0.612188",
"0.612188",
"0.612188",
"0.612188",
"0.612188",
"0.612188",
"0.612188",
"... | 0.0 | -1 |
If extra local variables have to passed to the partial, they will passed in to params If no extra variables are required, a blank hash will be used as a default value. | def link_to_add_fields(name, f, association, params={})
new_object = f.object.class.reflect_on_association(association).klass.new
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
#merge the params hash with the form builder being sent as a local variable to the partial
render(association.to_s.singularize + "_fields", {:f => builder}.merge(params))
end
link_to_function(name, "add_fields(this, '#{association}', '#{escape_javascript(fields)}')")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_params defaults = {}\n defaults.merge layout: layout\n end",
"def params\n @params.blank? ? default_hash : @params\n end",
"def params\n {}\n .merge!(base_params)\n .merge!(tracker_default_params)\n .merge!(global_options_params)\n .merge!(hit_params)\n ... | [
"0.6370954",
"0.6258175",
"0.6215388",
"0.6100431",
"0.60393727",
"0.5934502",
"0.58746696",
"0.58297503",
"0.5802294",
"0.5799748",
"0.5788642",
"0.57760745",
"0.57755774",
"0.5772103",
"0.57194006",
"0.57156736",
"0.57156736",
"0.57156736",
"0.57156736",
"0.5683473",
"0.566... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def todo_params
params.require(:todo).permit(:description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
simple calculation for promotions | def calculate_dicsount(index)
((index + 1) * 9) / 100.0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pmt(pv, n, r)\n (pv*r)/(1.0 - 1/(1.0+r)**n)\nend",
"def promedios\n promedio = (@nota1.to_f + @nota2.to_f + @nota3.to_f) / 3\n promedio\n end",
"def pmt(i, n, pv)\n return pv / ((1 - (1 / (1 + i) ** n )) / i)\n end",
"def percentage_of_promoters\n calculator.percentage_of_promoters\n ... | [
"0.66387093",
"0.64373314",
"0.6347403",
"0.6314204",
"0.6223738",
"0.6124138",
"0.6120193",
"0.6104821",
"0.6081337",
"0.60716367",
"0.60439485",
"0.60142493",
"0.59794176",
"0.59785956",
"0.5960817",
"0.59428555",
"0.5922606",
"0.5921299",
"0.5875557",
"0.5871444",
"0.58664... | 0.0 | -1 |
Takes a name and returns the string "Howdy Howdy, NAME!" Additionally must remove white spaces around the name and use standard english capitalization for example " bOB " => "Bob" | def greetings_interpolation(name)
# code goes here
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_name(name)\n properly_formatted_name = name.split(\" \").map { |n| n.capitalize }\n properly_formatted_name.join(' ')\n end",
"def format_name(name)\n name.split.map(&:capitalize)\n .join(' ')\nend",
"def format_name(name)\n names = name.split(\" \")\n formatted_names = []\n names.each d... | [
"0.80306464",
"0.8022016",
"0.7878082",
"0.78776765",
"0.75745225",
"0.75745225",
"0.75538975",
"0.7522513",
"0.74876785",
"0.7463529",
"0.7458455",
"0.7448558",
"0.74368626",
"0.740528",
"0.74034667",
"0.7399498",
"0.7397133",
"0.7343997",
"0.73284775",
"0.7326327",
"0.73174... | 0.0 | -1 |
Takes a string sentence of 0 or more words and reverses them and changes capitalization to fit standard English "This is AN example" => "Example an is this" No punctuation will be included in examples | def a_turn_of_phrase(sentence)
# code goes here
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capitalized string\n little_words = [\"a\", \"an\", \"the\", \"and\", \"in\", \"of\"]\n string = string.downcase\n string = string.split(\" \")\n if string.length > 1\n string.each_index do |i|\n if i == 0 || !little_words.include?(string[i])\n ... | [
"0.774764",
"0.7665982",
"0.76456",
"0.76456",
"0.76456",
"0.76456",
"0.763883",
"0.7622648",
"0.76161605",
"0.76161605",
"0.7593086",
"0.7580194",
"0.7555982",
"0.7552808",
"0.75448716",
"0.75360644",
"0.75198585",
"0.75164944",
"0.7498448",
"0.7487729",
"0.7481702",
"0.74... | 0.0 | -1 |
Takes a single positive integer and returns that integer reversed 24521 => 12542 | def dyslexic_accounting(number)
# code goes here
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reversed_number(int)\n int.to_s.reverse.to_i\nend",
"def reversed_number(int)\n int.to_s.reverse.to_i\nend",
"def reversed_number(int)\n int.to_s.reverse.to_i\nend",
"def reversed_number(integer)\n integer.to_s.reverse.to_i\nend",
"def reversed_number(integer)\n integer.to_s.reverse.to_i\nend",
... | [
"0.84845674",
"0.84845674",
"0.84845674",
"0.84505075",
"0.84505075",
"0.84505075",
"0.8344419",
"0.8334538",
"0.833096",
"0.833096",
"0.833096",
"0.83074206",
"0.830725",
"0.830725",
"0.82453936",
"0.82453936",
"0.82453936",
"0.82453936",
"0.82453936",
"0.82453936",
"0.82360... | 0.0 | -1 |
helper to export the complete nested attributes. | def export_attributes
attributes.to_nested_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_attrs\n self.class.export_attrs || []\n end",
"def exportable_attributes\n attributes.clone\n end",
"def dump_data\n create_attr_hash\n end",
"def nested_attributes\n []\n end",
"def dump\n\t\t\t\tflatten!\n\t\t\t\t\n\t\t\t\tMessagePack.dump(@attributes)\n\t\t\ten... | [
"0.7145824",
"0.71221995",
"0.68197215",
"0.6781049",
"0.65717417",
"0.64945203",
"0.6494318",
"0.64807415",
"0.6474723",
"0.64334774",
"0.64063007",
"0.63334435",
"0.6228887",
"0.61896086",
"0.6130107",
"0.60799575",
"0.6058245",
"0.59941417",
"0.5993633",
"0.59816456",
"0.5... | 0.81389475 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_app_record
@app_record = AppRecord.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def app_record_params
params.fetch(:app_record, {}).permit(
:company_name,
:position,
:description,
:salary,
:city,
:interest_level,
:app_link,
:notes,
:user_id
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Create a way for the username to become encrypted | def encrypt(val)
#Usage self.encrypt(val)
return Digest::SHA1.hexdigest(val.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_credentials(username, password)\n \"\\0#{username}\\0#{password}\"\n end",
"def username_format\n return if self.username.nil?\n self.username.gsub!(/[^0-9a-z\\- ]/i, '_')\n self.username.gsub!(/\\s+/, '-')\n self.username = self.username.downcase\n self.username = self.username... | [
"0.71242034",
"0.68715996",
"0.6871418",
"0.6718811",
"0.6634123",
"0.66153085",
"0.65640754",
"0.64792585",
"0.64270586",
"0.64196855",
"0.64130986",
"0.63812107",
"0.6350863",
"0.6347924",
"0.63435805",
"0.63087523",
"0.6295951",
"0.629466",
"0.62798417",
"0.62551326",
"0.6... | 0.0 | -1 |
NOTE: there are also `copy_to` and `copy_from` methods, but that would have exceeded my timebox | def download(path, &block)
resource = Aws::S3::Resource.new(client: @client).bucket(@bucket).object(path)
local = Tempfile.new
resource.download_file local.path
local.rewind
block.call local
ensure
local&.close
local&.unlink # deletes the temp file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(from, to)\n \n end",
"def copy_to(other); end",
"def copy\n \n end",
"def copy\n move(:copy)\n end",
"def copy\n dup\n end",
"def copy(from, to)\n @ctx.cp(@path + from, @path + to)\n end",
"def copy(dest)\n raise NotImplementedError\n end",
"def cache_... | [
"0.8461407",
"0.8036196",
"0.79643023",
"0.7836522",
"0.6963185",
"0.6870223",
"0.6805511",
"0.6796913",
"0.679664",
"0.67235106",
"0.6699976",
"0.6656682",
"0.6642306",
"0.6636167",
"0.6632536",
"0.6631695",
"0.6631695",
"0.6631695",
"0.6627004",
"0.65221107",
"0.6518402",
... | 0.0 | -1 |
set up access control | def pr_user
return nil unless current_user
@pr_user ||= PrUser.find_by_ssm_id(current_user.id)
unless @pr_user
@pr_user = PrUser.create! :ssm_id => current_user.id
end
unless session[:login_stamped] || @pr_user.nil?
@pr_user.update_attribute(:last_login, Time.now)
session[:login_stamped] = true
end
@pr_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_control\n \n end",
"def authorization; end",
"def create_access_control\n nil\n end",
"def set_access_control\n @access_control = AccessControl.find(params[:id])\n end",
"def set_access\n @access = @current_event.accesses.find(params[:id])\n authorize @access\n ... | [
"0.79815865",
"0.7099419",
"0.7001992",
"0.6866247",
"0.6696136",
"0.66671526",
"0.66639626",
"0.6636336",
"0.6605793",
"0.6553478",
"0.65270615",
"0.651345",
"0.65106803",
"0.64920694",
"0.64304835",
"0.6428622",
"0.6428622",
"0.6417419",
"0.63737434",
"0.6372735",
"0.636174... | 0.0 | -1 |
Main method for changing the value of the env var | def prepend(layer_env = {})
all_values = []
layer_env.each do |layer_name, value|
EnvProxy.validate_layer!(layer_name)
value = Array(value).map(&:to_s)
all_values << value
@layer_env_hash[layer_name] ||= []
@layer_env_hash[layer_name].prepend(value)
end
ENV[@key] = [all_values, ENV[key]].compact.join(":")
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_Enviroment_007_SetEnv\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_007_SetEnv\")\r\n puts2(\"#######################\")\r\n\r\n sEnvVarName = \"COMPUTERNAME\" # Is this one platform independent?\r\n sNewValue = \"MyNewName\"\r\n\r\n ... | [
"0.7532019",
"0.7051032",
"0.7051032",
"0.68079",
"0.67280114",
"0.66835606",
"0.6663836",
"0.66494614",
"0.6626137",
"0.66074795",
"0.6587406",
"0.658582",
"0.65290487",
"0.6515455",
"0.65063053",
"0.6407259",
"0.64021623",
"0.6400869",
"0.63857925",
"0.63857925",
"0.6385792... | 0.0 | -1 |
must yield a valid route as defined below == SCOPES returns the ActionDispatch::Routing::Route for this role_route | def route
@route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route\n @route\n end",
"def timeline_route\n @timeline_route ||= begin\n result = @timeline.route_for_kind(Activr::Timeline::Route.kind_for_routing_and_activity(@routing_kind, @activity.kind))\n raise \"Failed to find a route for #{@routing_kind} / #{@activity.kind}: #{self.inspect}\... | [
"0.60644776",
"0.5965119",
"0.5847937",
"0.5583974",
"0.5568266",
"0.55642855",
"0.55642855",
"0.55587715",
"0.55432475",
"0.55398685",
"0.55173427",
"0.55137485",
"0.5513365",
"0.5495576",
"0.5467603",
"0.5449172",
"0.5441111",
"0.54266876",
"0.54241014",
"0.54211766",
"0.54... | 0.7114458 | 0 |
rubocop:enable Metrics/AbcSize rubocop:disable Metrics/AbcSize | def layout_order_report_status order_status
if order_status.eql? Settings.order.desc
order_type = Settings.order.asc
icon = Settings.icon.sort_up
else
order_type = Settings.order.desc
icon = Settings.icon.sort_down
end
tags = html_escape("")
link_to manager_reports_path(page: params[:page],
date: params[:date],
name: params[:name],
email: params[:email],
status: params[:status],
order_status: order_type,
order_created: params[:order_created]),
class: "sort-report-link" do
tags << content_tag(:span, t(".status"))
tags << content_tag(:i, "", class: "fas fa-sort-#{icon}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def refutal()\n end",
"def implementation; end",
"def implementation; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def used?; end",
"def strategy; end",
"def offences_by; end",
"def isola... | [
"0.7638504",
"0.6362991",
"0.6227548",
"0.61983085",
"0.61983085",
"0.61882156",
"0.61882156",
"0.61882156",
"0.61882156",
"0.6161596",
"0.5997375",
"0.596157",
"0.5928905",
"0.5858953",
"0.5858953",
"0.58353126",
"0.58192396",
"0.58192396",
"0.5805077",
"0.5805077",
"0.57918... | 0.0 | -1 |
Overrides the Rake `task` method to make sure every defined task depends on `environment`. | def task(*arguments)
if arguments.first.kind_of?(Hash)
super(*arguments)
else
super(arguments.first => :environment)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_environment(tasks)\n environment = tasks[:environment]\n if environment.nil?\n Kernel.abort(\"Unable to load details of environment '#{tasks[:environment_name]}'\")\n end\n environment\nend",
"def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end",
"def remote_rake... | [
"0.67495036",
"0.6550757",
"0.638364",
"0.63696617",
"0.63375133",
"0.63368475",
"0.630216",
"0.62644553",
"0.62090397",
"0.6207525",
"0.613545",
"0.60839725",
"0.60793036",
"0.6071417",
"0.6071416",
"0.6071416",
"0.6071416",
"0.60583013",
"0.6013783",
"0.6011177",
"0.5935552... | 0.63365537 | 6 |
=> Validations => Becuse this is a subclass of Claim, we need to skip validations | def skip_validations
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required_claims; end",
"def required_claims; end",
"def validated; end",
"def validated?; end",
"def subclass_validations ; true ; end",
"def required_claims=(_arg0); end",
"def required_claims=(_arg0); end",
"def validator; end",
"def validation; end",
"def validation; end",
"def validate\... | [
"0.71906656",
"0.71906656",
"0.67872167",
"0.678302",
"0.6727849",
"0.66497064",
"0.66497064",
"0.6582732",
"0.64907634",
"0.64907634",
"0.6486719",
"0.6414438",
"0.6414438",
"0.6414438",
"0.6414438",
"0.6383493",
"0.6361794",
"0.6361794",
"0.6361794",
"0.63228613",
"0.630647... | 0.6020186 | 44 |
=> Email => Sends email to app/site owner | def send_email
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def funded_email_to_creator\n Pony.mail(:to => self.email, :from => 'admin@kittypool.com', :subject => 'the gift you created is now funded!', :body => 'yay! some people owe you money.')\n end",
"def send_mail\n User.send_welcome_email(self.id)\n end",
"def welcome_email(user)\n @user=user\n @url ... | [
"0.7429076",
"0.7288798",
"0.72651213",
"0.72341835",
"0.72322494",
"0.7224285",
"0.7212948",
"0.72100276",
"0.720717",
"0.71550566",
"0.7152755",
"0.7149911",
"0.7149911",
"0.7149911",
"0.7149911",
"0.71330243",
"0.71141946",
"0.710926",
"0.71062505",
"0.7102102",
"0.7095501... | 0.71954095 | 9 |
=> Hubspot destroy => This needs to be implemented into admin area => Destroys hubspot listings from hubspot_id | def hubspot_destroy
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @listing.destroy\n end",
"def destroy\n @spot = Spot.find(params[:id])\n @spot.mark_destroyed(current_admin)\n\n respond_to do |format|\n format.html { redirect_to spots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @connector = Connector.find... | [
"0.6813851",
"0.68113875",
"0.67996943",
"0.679222",
"0.667996",
"0.66640145",
"0.66510624",
"0.66404974",
"0.6636274",
"0.6620512",
"0.6615548",
"0.6593372",
"0.65720886",
"0.65698195",
"0.6564775",
"0.65605927",
"0.6536889",
"0.652333",
"0.65203154",
"0.6495557",
"0.6495557... | 0.75243163 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_socioeduk_alojamento_jovem
@socioeduk_alojamento_jovem = Socioeduk::AlojamentoJovem.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def socioeduk_alojamento_jovem_params
params.require(:socioeduk_alojamento_jovem).permit(:socioeduk_jovem_id, :unidade_socioeducativa_id, :socioeduk_bloco_id, :socioeduk_quarto_id,
:tamanho_roupa, :tamanho_cacaldo, :numero_kit, :justifica, :utilizar_exedente_vaga)
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 |
PASSES (was checking number_to_currency type function) | def teardown
@course = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_number_to_currency\n\t\tassert ActionView::Helpers::NumberHelper\n\t\tobj = ActionView::Base.new\n\t\tassert_respond_to obj, 'number_to_currency'\n\t\tassert_respond_to obj, 'orig_number_to_currency'\n\t\t\n\t\tassert_equal \"$1,234,567,890.51\", obj.number_to_currency(1234567890.506), \"NOTE: This ... | [
"0.7419621",
"0.7294744",
"0.71460253",
"0.70033616",
"0.6935506",
"0.6910056",
"0.68724126",
"0.68145037",
"0.68145037",
"0.68145037",
"0.6671685",
"0.6621612",
"0.65696114",
"0.65693504",
"0.6568192",
"0.65624815",
"0.65414447",
"0.65048486",
"0.6500113",
"0.6476299",
"0.64... | 0.0 | -1 |
call migrates features key from the old fashioned to the new format. It must replicate feature keys with changes: from "avenue:traffic_lights" => 42 to "avenue:42" => traffic_lights | def call
@from_redis.scan_each(match: "*", count: FeatureFlagger::Storage::Redis::SCAN_EACH_BATCH_SIZE) do |redis_key|
# filter out resource_keys
next if redis_key.start_with?("#{FeatureFlagger::Storage::Redis::RESOURCE_PREFIX}:")
migrate_key(redis_key)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migrate(_key, _options); end",
"def migrate(key, options); end",
"def convert_key(key); end",
"def convert_key(key); end",
"def convert_key(key); end",
"def migrate_update_keys update_keys\n path = '/activities'\n get(path, ids: update_keys)\n end",
"def migrate(data)\n keys = I... | [
"0.6301366",
"0.62295955",
"0.5466629",
"0.5466629",
"0.5466629",
"0.5434035",
"0.53715736",
"0.5360552",
"0.5155004",
"0.5136298",
"0.5098188",
"0.50201136",
"0.49748418",
"0.49628422",
"0.49136692",
"0.48518652",
"0.4793298",
"0.479193",
"0.47818497",
"0.47798422",
"0.47682... | 0.4464286 | 62 |
Return a new generateduid | def new_generateduid
CFUUIDCreateString(nil, CFUUIDCreate(nil))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_uid\n \"#{rand(100000)}-#{Time.now.to_i}-#{rand(100000)}\"\n end",
"def generate_uid\n begin\n # .uuid or .hex? both seem to do the same job\n self.uid = SecureRandom.uuid.gsub(/[-]/, '')\n end while self.class.exists?(uid: self.uid)\n end",
"def generate_uid\n [Time.now.s... | [
"0.850823",
"0.8205398",
"0.82017654",
"0.80643654",
"0.79963976",
"0.7799288",
"0.7789262",
"0.7745595",
"0.7724384",
"0.7689694",
"0.7663927",
"0.76461434",
"0.76276183",
"0.76168764",
"0.75199246",
"0.7472211",
"0.7452438",
"0.74369764",
"0.7379788",
"0.735951",
"0.7320901... | 0.8759782 | 1 |
Load the computer object Returns an NSDictionary representation of the the user.plist if it exists If it doesn't, it will return nil | def get_computer(name)
@file = "/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/computers/#{name}.plist"
NSMutableDictionary.dictionaryWithContentsOfFile(@file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(name)\n file = \"#{@@path_to_user_plists}/#{name}.plist\"\n user = NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end",
"def get_user(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/users/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsO... | [
"0.65846336",
"0.632198",
"0.61031497",
"0.5831744",
"0.56013286",
"0.55993444",
"0.5589866",
"0.5400026",
"0.5380556",
"0.53011453",
"0.5253398",
"0.52241194",
"0.519757",
"0.5196514",
"0.5191172",
"0.5180691",
"0.51286244",
"0.5122096",
"0.5077601",
"0.5044679",
"0.50346035... | 0.6734758 | 0 |
Delete the user and applicable shadow hash file | def delete_computer
begin
FileUtils.rm_rf(@file)
rescue Puppet::ExecutionFailure => detail
fail("Could not destroy the computer record, #{resource[:name]}: #{detail}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_shadowhash_file(sender)\n raise ShadowHashError.new(ShadowHashError::UNSUPPORTED_OBJECT_ERR) unless sender.is_a? MacAdmin::User\n path = \"#{SHADOWHASH_STORE}/#{sender[:generateduid].first}\"\n FileUtils.rm path if File.exists? path\n !File.exists? path\n end",
"def delete_user\... | [
"0.80404484",
"0.7054366",
"0.67936337",
"0.65763867",
"0.6552159",
"0.65131104",
"0.64888465",
"0.6463422",
"0.6455796",
"0.64265484",
"0.6367067",
"0.6345024",
"0.6333642",
"0.6321597",
"0.62839127",
"0.6239665",
"0.6200543",
"0.61945057",
"0.6165592",
"0.61498505",
"0.6103... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_order_status
@order_status = OrderStatus.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.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def order_status_params
params.require(:order_status).permit(:status, :order_id, :detail)
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 |
I worked on this challenge [ with: Angela Kosek]. 2. Pseudocode Input: method takes an arary of names Output: will return number of arrays with names in it for different groups Steps: DEF method create_group which takes an array as an argument Shuffle the array and assign it to variable shuffled_array SET variable new_groups to an empty array LOOP through shuffled_array ADD Every four elements as an array to new_groups END LOOP RETURN new_groups 3. Initial Solution | def new_groups(array)
new_group = []
array.shuffle.each_slice(4){|acc| new_group << acc}
if new_group.length > 1 && new_group.last.length <= 2
(new_group.last.length).times do |i|
new_group[i].push(new_group.last.pop)
new_group.pop
end
end
new_group
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_groups(names)\n groups = []\n names.shuffle.each_slice(4) do |group|\n if group.count == 4\n groups << group\n else\n i = 0\n group.each do |name|\n groups[i] << name\n i += 1\n end\n end\n end\n p groups\nend",
"def grouper(array)\n array = array.shuffl... | [
"0.8218012",
"0.78980106",
"0.78374815",
"0.78374815",
"0.7735198",
"0.7643933",
"0.7635971",
"0.7543966",
"0.7509818",
"0.7454669",
"0.7410339",
"0.7408823",
"0.74038017",
"0.7399894",
"0.7376428",
"0.72676086",
"0.7234703",
"0.72297436",
"0.72282547",
"0.72173566",
"0.71590... | 0.7817571 | 4 |
In our views, we use jquery.get with the _url option. When running with passenger, it always makes the URL http even if https is used. We use the _url because of Sub URI installs To resolve the missing https, we've added a config option to config/application.rb When the environment is a production env and https is true we manual set urls to https. We only do for production, so devs do not need to worry about this. | def default_url_options(options ={})
if Rails.env.production?
if TestDB::Application.config.ssl_enabled == true
options.merge({ :only_path => false, :protocol => 'https' })
else
options.merge({})
end
else
options.merge({})
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_https\n if Rails.env.production?\n if get_protocol != 'https://'\n return redirect_to \"https://#{request.url[(get_protocol.size)..(-1)]}\"\n end\n end\n end",
"def url\n 'https://' + request.host\n end",
"def try_https\n # Makes modifications to URL behavior\n begin\n... | [
"0.7244246",
"0.70158035",
"0.6680517",
"0.6158217",
"0.61501104",
"0.6103289",
"0.60588825",
"0.6057326",
"0.6041692",
"0.59898025",
"0.5955842",
"0.5935436",
"0.5932267",
"0.5920195",
"0.5920195",
"0.5919465",
"0.5914554",
"0.5900213",
"0.58826375",
"0.5866544",
"0.5858194"... | 0.6578501 | 3 |
/update_version_select/1 Get the versions for the current product Then render the small versions drop down partial for index search This is used for searches on index pages with a product. Ex. see assignments and and results (execute) index page | def update_version_select
versions = Version.where(:product_id => params[:id]).order(:version) unless params[:id].blank?
render :partial => "versions", :locals => { :versions => versions }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_from_combobox\n @versions = Project.find(params[:project_id]).shared_versions\n @sorted_versions = []\n @versions.each do |version|\n @sorted_versions.push(version.name.to_s)\n end\n @natural_sorted_versions = \\\n Naturalsorter::Sorter.sort_version(@sorted_versions, false)\n ... | [
"0.6672751",
"0.6340233",
"0.6335548",
"0.6306724",
"0.622417",
"0.6133397",
"0.6099903",
"0.60944396",
"0.6087498",
"0.6010113",
"0.59525603",
"0.5943714",
"0.59316754",
"0.5914761",
"0.58474874",
"0.5846949",
"0.5791928",
"0.5751249",
"0.5698358",
"0.56675607",
"0.5591197",... | 0.8145799 | 0 |
Verify user is logged in If not refer to login page | def require_login
unless current_user
redirect_to login_path(:referer => request.fullpath)
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_logged_in\n unless current_user\n redirect_to '/login'\n end\n end",
"def check_login!\n u = check_and_get_user\n redirect to('/signin.html') unless u\n u\n end",
"def verify_logged_in\n redirect_to root_path unless logged_in?\n end",
"def check_if_lo... | [
"0.83395827",
"0.8292265",
"0.82782316",
"0.81271154",
"0.81271154",
"0.8060002",
"0.8051386",
"0.8023653",
"0.7991681",
"0.7910934",
"0.78918064",
"0.7880072",
"0.78715014",
"0.7852641",
"0.7848119",
"0.78474313",
"0.78348446",
"0.7830171",
"0.7824766",
"0.78112847",
"0.7785... | 0.0 | -1 |
Authorize product raises an exception if user tries to a access a product that they do not have access to This is used in controller. The check for views is in the application helper | def authorize_product!(product)
unless product.nil?
unless current_user.products.include?(product)
raise Exceptions::ProductAccessDenied
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize\n if session[:user_id] != 3\n raise AccessDenied\n #render \"public/404\", status: :not_found, layout: false\n end\n end",
"def show\n # Prevents unauthorized access by other users\n # if !current_user.purchases.where(:id => @purchase.id).any?\n # flash[:notice... | [
"0.6654826",
"0.6486122",
"0.6402508",
"0.6393314",
"0.6371291",
"0.63313234",
"0.63107234",
"0.63074964",
"0.6305529",
"0.6282004",
"0.6245829",
"0.62382656",
"0.62273705",
"0.62078995",
"0.6201282",
"0.6196096",
"0.61855185",
"0.617958",
"0.61782175",
"0.6176873",
"0.614276... | 0.6899302 | 0 |
Call to set timezone for user | def set_user_time_zone
Time.zone = current_user.time_zone if current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_timezone\n u = User.find_by_id(current_user.id)\n u.timezone = params[:timezone]\n u.save\n render :layout => false\n end",
"def set_timezone\n Time.zone = @user.time_zone if has_session?\n end",
"def set_user_time_zone\n Time.zone = current_user.time_zone if current_user.try(:time_... | [
"0.8412679",
"0.8209255",
"0.81636345",
"0.81419426",
"0.813415",
"0.8126488",
"0.80992466",
"0.80992466",
"0.80992466",
"0.80992466",
"0.80992466",
"0.80600506",
"0.80131316",
"0.79884493",
"0.7979498",
"0.7974073",
"0.7963608",
"0.7935895",
"0.7837778",
"0.78250784",
"0.773... | 0.8202663 | 2 |
Traverses the category tree to find the parent category Finds the product_id set for the parent category Returns the product_id | def get_product_id_from_category_id(category_id)
authorize! :read, TestCase
category = Category.find(category_id)
if category.product_id
return category.product_id
else
return get_product_id_from_category_id(category.category_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_category_id\n parent.id if parent\n end",
"def parent\n \tif self.parent_id == -1\n \t\treturn nil\n \telse\n \t\treturn Category.find(self.parent_id)\n \tend\n end",
"def product_category_id=(id)\n self.parent = if id.blank?\n nil\n else\n ProductCategory.find(id)\n en... | [
"0.78865933",
"0.7274526",
"0.7004113",
"0.6916846",
"0.66909015",
"0.6671625",
"0.64338595",
"0.64231527",
"0.63682073",
"0.6352396",
"0.6283373",
"0.61828023",
"0.61278033",
"0.6122003",
"0.61192626",
"0.6084206",
"0.6060345",
"0.6054688",
"0.6032154",
"0.60180104",
"0.5959... | 0.0 | -1 |
Build a VirtualContext from applying the rule to the input. | def parse(path)
elems = path.split('/')
i = 0
vc = VirtualContext.new(@defs)
@defs.zip(elems).map do |d, e|
# register field order
vc.append_allfields(d.vars)
# not enough elems, incomplete path
break if e.nil?
# extract values
vc.append_values(d.parse_values(e)) unless e.empty?
i += 1
# last token is multimatch, stop to complete it
break if (i == elems.size and is_multimatch(e))
end
# puts (i - 1)
vc.set_current_index(i - 1)
return vc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_context\n Context.new(@req[:context])\n end",
"def context\n @_context ||= {\n :argv => START_CTX[:argv].map { |arg| arg.dup },\n :cwd => START_CTX[:cwd].dup,\n 0 => START_CTX[0].dup,\n }.tap do |ctx|\n rewrite_context(ctx)\n end\n end",
"def crea... | [
"0.53235525",
"0.49982622",
"0.4997215",
"0.49315456",
"0.4844116",
"0.47769764",
"0.4776448",
"0.47400293",
"0.47253358",
"0.47084287",
"0.4697357",
"0.46773002",
"0.4675468",
"0.4636125",
"0.46015665",
"0.45941997",
"0.4583196",
"0.454651",
"0.454651",
"0.45278874",
"0.4486... | 0.0 | -1 |
token considered a multimatch if contains wildcard | def is_multimatch(s)
return s.match(/[*?]/)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_token(token)\n return true\n end",
"def scan_for_and(token); end",
"def complex_token_matches?(token) # :nodoc:\n Matchers.matchers.any? {|matcher| matcher.matches?(token) }\n end",
"def match(keyword); end",
"def scan_for_in(token); end",
"def scan strOrRegexp\n @in.scan /\\s*/ # ... | [
"0.68923086",
"0.64468676",
"0.64329445",
"0.63277537",
"0.6297915",
"0.6271185",
"0.6249036",
"0.61375755",
"0.6063721",
"0.6050664",
"0.6050664",
"0.6050664",
"0.6042717",
"0.6012632",
"0.5965908",
"0.59550667",
"0.5942342",
"0.59106565",
"0.5900349",
"0.58793414",
"0.58793... | 0.65559316 | 1 |
return next def to complete (don't go further than last) | def next()
idx = @curridx
idx += 1 unless full?
return @defs[idx]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next() end",
"def next() end",
"def next!() end",
"def has_next?; end",
"def next()\n \n end",
"def next()\n \n end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def get_next\n\t\t\n\tend",
"def get_next_entry; end",
"def next_f\n ... | [
"0.74768484",
"0.74768484",
"0.7379265",
"0.70723504",
"0.68927306",
"0.68927306",
"0.67546225",
"0.66774076",
"0.66750246",
"0.66490746",
"0.65657824",
"0.65657824",
"0.6539902",
"0.6539902",
"0.6524198",
"0.6524198",
"0.6492237",
"0.6468065",
"0.6451682",
"0.64160174",
"0.6... | 0.6022716 | 39 |
Build a coll structure that matches conditions in a Hash | def make_coll_filters(values)
coll = Xmms::Collection.universe
unless values.empty?
values.each do |field, val|
matchop = make_coll_operator(field, val)
matchop.operands << coll
coll = matchop
end
end
return coll
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def criteria_from_hash(condition) # :nodoc:\n h = {}\n condition.each { |k,v|\n h[k] = case v\n when Array\n {:$in => k == 'id' || k == '_id' ? v.collect{ |val| val.to_oid} : v} # if id, can't pass in string; must be ObjectId\n when Range\n ... | [
"0.65586853",
"0.5975154",
"0.5974988",
"0.5974988",
"0.59626555",
"0.5905237",
"0.5857997",
"0.5810057",
"0.579916",
"0.5777743",
"0.5742093",
"0.5718929",
"0.5718929",
"0.5700071",
"0.5673351",
"0.5665763",
"0.5665763",
"0.562318",
"0.55832344",
"0.55558103",
"0.5538823",
... | 0.62219423 | 1 |
Autoguess whether it should be an exact or partial match | def make_coll_operator(field, value)
if value.match(/[*?]/)
type = Xmms::Collection::TYPE_MATCH
else
type = Xmms::Collection::TYPE_EQUALS
end
op = Xmms::Collection.new(type)
op.attributes["field"] = field
op.attributes["value"] = value.gsub(/\*/, '%').gsub(/\?/, '_')
return op
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exact_match?\n !partial_match?\n end",
"def exact_match?\n search_settings = @settings['search']\n matching = search_settings.fetch('matching', 'pattern').normalize_matching\n matching == :exact\n end",
"def found_exact?\n @found_exact\n end",
"def case_insensitive_match... | [
"0.7785559",
"0.7454499",
"0.6808945",
"0.67950094",
"0.6765556",
"0.66734785",
"0.66085404",
"0.6597184",
"0.659228",
"0.6591718",
"0.65492135",
"0.64697164",
"0.6404342",
"0.63704276",
"0.63704276",
"0.6336196",
"0.6333557",
"0.6329857",
"0.62806696",
"0.6248664",
"0.623966... | 0.0 | -1 |
PUT /comments/1.xml PUT /comments/1.json | def update
@comment = Comment.find(params[:id])
respond_to do |format|
if @comment.update_attributes(params[:comment])
format.xml { head :ok }
format.json { head :ok }
else
format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }
format.json { render :json => @comment.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end",
"def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end",
"def comments_put(resource, comment)\n merged_options = options.merge({ resource: resou... | [
"0.6638866",
"0.65790904",
"0.64167476",
"0.64138556",
"0.6344143",
"0.63400936",
"0.6307433",
"0.6296865",
"0.6282935",
"0.6265966",
"0.6259213",
"0.6230647",
"0.6226569",
"0.6203838",
"0.6201508",
"0.6183913",
"0.6177102",
"0.6169761",
"0.6163214",
"0.6159252",
"0.61578304"... | 0.70375973 | 0 |
DELETE /comments/1.xml DELETE /comments/1.json | def destroy
@comment = Comment.find(params[:id])
@comment.destroy
respond_to do |format|
format.xml { head :ok }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { head :ok }\n form... | [
"0.7157358",
"0.7105928",
"0.70865405",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7073765",
"0.7057617",
"0.70268226",
"0.70266134",
"0.70258164",
"0.6991692",... | 0.7394572 | 0 |
POST /comments/exists.xml POST /comments/exists.json | def exists
@record = Record.new
comment = Comment.find_by_app_id_and_authorId(params[:app_id], params[:authorId], :select => :id)
if comment.nil?
@record.exists = false
else
@record.id = comment.id
@record.exists = true
end
respond_to do |format|
format.xml {render :xml => @record}
format.json {render :json => @record}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_comment_creation?\n request.post? && request.request_parameters['comment'].present?\n end",
"def exists?\n json['exists']\n end",
"def has_comments?\n comments.size > 0\n end",
"def has_comments?\n @comments_count > 0\n end",
"def are_there_comments?\n @comments.size > 0\n end",
... | [
"0.5792246",
"0.57162917",
"0.55497015",
"0.5435844",
"0.5434988",
"0.5340666",
"0.5332262",
"0.524309",
"0.52049863",
"0.51598275",
"0.51364136",
"0.5106553",
"0.5103431",
"0.5102602",
"0.5095069",
"0.50949126",
"0.5088419",
"0.5084685",
"0.50700164",
"0.50699264",
"0.505986... | 0.66348433 | 0 |
just output some text without a log level | def text(msg="", nested=false)
@last_msg = ""
@last_lvl = nil
msg = "\n#{msg}\n \n" unless nested
if msg.include?("\n")
msg.split("\n").each do |line|
text(line, true)
end
return
end
message = colorize(msg, :white, :black, true)
blocks = colorize(" ", :black, :white)
puts "#{blocks} #{message}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def msg(text)\n print text if VERBOSE\n STDOUT.flush\nend",
"def msg(text, level = :info)\n case level\n when :warn\n puts \"\\e[31m#{text}\\e[0m\"\n else\n puts \"\\e[33m#{text}\\e[0m\"\n end\nend",
"def msg(text, level = :info)\n case level\n when :warn\n puts \"\\e[31m#{text}\\e[0m\"\n els... | [
"0.6813319",
"0.6683644",
"0.6683644",
"0.66649836",
"0.66440284",
"0.644009",
"0.6405595",
"0.6405077",
"0.6398349",
"0.63620424",
"0.63620424",
"0.6341639",
"0.62857836",
"0.6270678",
"0.6256809",
"0.6243691",
"0.6238183",
"0.62277544",
"0.62089753",
"0.6197892",
"0.6197892... | 0.0 | -1 |
append to a prevous message | def append(msg="")
print "\r#{ONE_UP}#{ERASE}"
fmt_msg("#{@last_msg} #{msg.to_s.strip}", @last_lvl)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(message)\n @messages.unshift(message)\n end",
"def msg_add(c)\n\t@msg_buf << c\n end",
"def add_message(text,name=nil)\n debug \"add message\"\n puts \"WWWTHUNHEOUTSN\"\n puts @glade['scrolledwindow1'].hadjustment.value\n puts @glade['scrolledwindow1'].had... | [
"0.63109297",
"0.6144306",
"0.60070115",
"0.5981558",
"0.58327645",
"0.5831893",
"0.58218914",
"0.57724637",
"0.5697555",
"0.56834626",
"0.5627022",
"0.562596",
"0.56242305",
"0.5615866",
"0.5614353",
"0.56110567",
"0.5573142",
"0.55587715",
"0.55578226",
"0.55426",
"0.553836... | 0.6338534 | 0 |
PUBLIC METHODS RecipHeading gives the heading for the recipient | def recip_heading
identity.name.titleize.pluralize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heading\n self.class.heading\n end",
"def heading\n render_citation(@document)\n end",
"def heading(title = @title, opts={})\n \n heading = @renderer.heading(title, opts)\n \n puts \"[Cutlist.heading]: #{heading}\" if $cutlister_debug\n \n heading\n \n end",
"def header\... | [
"0.59952956",
"0.5858531",
"0.5827221",
"0.57942903",
"0.5787826",
"0.57449955",
"0.57362586",
"0.57341605",
"0.57302696",
"0.56413484",
"0.56353164",
"0.56332666",
"0.56163836",
"0.5610164",
"0.56017655",
"0.559958",
"0.5560259",
"0.553343",
"0.553179",
"0.5518195",
"0.55096... | 0.6249098 | 0 |
Recip identity that is being judged | def recip
self.identity
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_name\n return @identity_name\n end",
"def resident_key; end",
"def name\n \"identity\"\n end",
"def add_identity_to_log\n RequestLocals.store[:identity] = { candidate_id: current_candidate&.id }\n end",
"def name\n \"identity\"\n ... | [
"0.6275323",
"0.61383766",
"0.6095459",
"0.6064983",
"0.6063799",
"0.6013645",
"0.59582806",
"0.5957705",
"0.5936399",
"0.5892609",
"0.5882722",
"0.5880226",
"0.5835588",
"0.58191067",
"0.57909125",
"0.57909125",
"0.57909125",
"0.5785599",
"0.5779712",
"0.57378936",
"0.573461... | 0.75434965 | 0 |
Create a new VerifyKey object from a serialized public key. The key can be decoded from any serialization format supported by the Crypto::Encoding system. | def initialize(key, encoding = :raw)
key = Encoder[encoding].decode(key)
Util.check_length(key, NaCl::ED25519_VERIFYKEY_BYTES, "key")
@key = key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_string_public_key(raw, offset=0, algo=nil)\n key_raw, str_read = decode_string(raw, offset)\n key, cert_read = decode_public_key(key_raw, 0, algo)\n\n if cert_read != key_raw.bytesize\n raise DecodeError, \"unexpected trailing data\"\n end\n\n [key, str_read]\n end",
... | [
"0.6504492",
"0.62602264",
"0.624494",
"0.61753273",
"0.61753273",
"0.60851914",
"0.59883815",
"0.5981428",
"0.59378034",
"0.5935695",
"0.5795585",
"0.57435924",
"0.5743569",
"0.5738093",
"0.5731519",
"0.561222",
"0.55782306",
"0.5526932",
"0.5524965",
"0.5497712",
"0.5456731... | 0.5490012 | 20 |
Create a new VerifyKey object from a serialized public key. The key can be decoded from any serialization format supported by the Crypto::Encoding system. You can remember the argument ordering by "verify message with signature" It's like a legal document, with the signature at the end. | def verify(message, signature, signature_encoding = :raw)
signature = Encoder[signature_encoding].decode(signature)
Util.check_length(signature, signature_bytes, "signature")
sig_and_msg = signature + message
buffer = Util.zeros(sig_and_msg.bytesize)
buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)
NaCl.crypto_sign_ed25519_open(buffer, buffer_len, sig_and_msg, sig_and_msg.bytesize, @key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_string_public_key(raw, offset=0, algo=nil)\n key_raw, str_read = decode_string(raw, offset)\n key, cert_read = decode_public_key(key_raw, 0, algo)\n\n if cert_read != key_raw.bytesize\n raise DecodeError, \"unexpected trailing data\"\n end\n\n [key, str_read]\n end",
... | [
"0.6289133",
"0.62160313",
"0.60343796",
"0.60343796",
"0.59135723",
"0.5823101",
"0.57859",
"0.57788414",
"0.5714868",
"0.5700977",
"0.56821954",
"0.5657602",
"0.5643604",
"0.56318235",
"0.5536536",
"0.55265546",
"0.54239494",
"0.540689",
"0.53886396",
"0.53656816",
"0.53411... | 0.46878222 | 83 |
Return the raw key in byte format | def to_bytes; @key; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end",
"def to_bytes\n @public_key\n end",
"def public_key_string\n [@public_key.to_s].pack(\"m*\").gsub(\"\\n\", \"\")\n end",
"de... | [
"0.7833033",
"0.7480416",
"0.72746444",
"0.7259334",
"0.7242505",
"0.7066993",
"0.70399505",
"0.70025724",
"0.69956917",
"0.6946423",
"0.6918244",
"0.6883743",
"0.68622625",
"0.6799893",
"0.6768893",
"0.6750338",
"0.67335355",
"0.6729559",
"0.6729559",
"0.6728644",
"0.6717093... | 0.86449236 | 1 |
The crypto primitive this VerifyKey class uses for signatures | def primitive; self.class.primitive; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crypto_key\n # Returns singleton object\n EmailEncryptionKey.instance.key\n end",
"def get_crypto_key_hex\n return @crypto_key if ! @crypto_key\n @crypto_key.unpack(\"H*\")\n end",
"def sign_key; end",
"def verify_key; end",
"def verify_key; end",
"def key_iv\r\n @key_iv\r\n end... | [
"0.7052465",
"0.6918751",
"0.6862655",
"0.65664876",
"0.65664876",
"0.65055305",
"0.6505158",
"0.6456855",
"0.6428397",
"0.6428397",
"0.64085764",
"0.63983417",
"0.63579935",
"0.63304615",
"0.6308838",
"0.63013685",
"0.6213742",
"0.621198",
"0.6207232",
"0.6174447",
"0.617390... | 0.0 | -1 |
The size of signatures verified by the VerifyKey instance | def signature_bytes; NaCl::ED25519_SIGNATUREBYTES; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n destination.size + private_key.size + signing_key.size\n end",
"def size\n keys.size\n end",
"def size\n @keys.size\n end",
"def size\n self.data.keys.size\n end",
"def key_size\n compute_minimal_keys if not @key_length\n @key_length \n end",
"def s... | [
"0.727958",
"0.6891047",
"0.6830876",
"0.6752672",
"0.6689702",
"0.6654646",
"0.6632074",
"0.6628402",
"0.662772",
"0.6619703",
"0.6619703",
"0.6619703",
"0.6606119",
"0.660124",
"0.65387046",
"0.6531528",
"0.6500893",
"0.6500893",
"0.64819986",
"0.642317",
"0.63922256",
"0... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_channel
@channel = Channel.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def channel_params
params.require(:channel).permit(:channel_id, :channel_description, :channel_status)
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 |
render html sourcecode with images | def render(content = 'No template provided')
# get Nokogiri object with html source
html = Nokogiri::HTML(htmlbody)
# pick image tags from source and inject the right images
mailskinassets.each do |mailskinasset|
html.css('img').each do |image|
# do we have the filename of our mailskinasset in the source attribute?
if image.attributes['src'].value.to_s.include? mailskinasset.mailskinasset_file_name
# replace he whole source with correct url
image.attributes['src'].value = mailskinasset.absolute_asset_url.to_s
end
end
end
html.to_s.gsub('{yield}', content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_html\r\n return '' unless image?\r\n %(<div>\r\n <a href=\"#{@url}\" target=\"_blank\">\r\n <img src=\"#{@image_url}\">\r\n </a>\r\n </div>)\r\n end",
"def render_image\n render_image_iterm2\n end",
"def to_erb\n url = @img['src']\n url.sub!(\"/images/\",... | [
"0.66957337",
"0.6651247",
"0.657971",
"0.65756196",
"0.65285087",
"0.64639246",
"0.6457889",
"0.6348121",
"0.63435423",
"0.62210304",
"0.62159544",
"0.61641395",
"0.61073923",
"0.6093117",
"0.60884786",
"0.6087466",
"0.60777676",
"0.6064418",
"0.6046976",
"0.6038442",
"0.603... | 0.68433565 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_country_shop
@country_shop = CountryShop.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def country_shop_params
params.require(:country_shop).permit(:shop_id, :country_id, :mode)
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 |
=> 18 m (5,3) = 5 + m (5,2) ... m (5, 3) = m ( 3, 5) m (5, 3) = m (5,3) | def lucas_sequence(num)
return [] if num==0
return [2] if num==1
return [2,1] if num == 2
lucas_sequence(num-1)+ [lucas_sequence(num-1)[-1]+lucas_sequence(num-1)[-2]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recessive k, m, n\n all = k + m + n\n mix = m + n\n total = 4.0 * triangle(all) # 2 * squareish all = 2 * 2 * triangle all\n\n lhs = triangle n\n mid = n * mix - n\n rhs = triangle mix\n\n 1 - (lhs+mid+rhs) / total\n end",
"def m3; 3 end",
"def matrix_region_sum(matrix, top_left_coord... | [
"0.6510017",
"0.6298643",
"0.62676316",
"0.62552345",
"0.6077046",
"0.6006124",
"0.599249",
"0.5850871",
"0.5847466",
"0.58259296",
"0.5821434",
"0.58129174",
"0.58105344",
"0.57874334",
"0.5766924",
"0.5757796",
"0.57575923",
"0.5744369",
"0.5739602",
"0.5729575",
"0.5714591... | 0.0 | -1 |
=> [2, 1, 3, 4, 7, 11, 18, 29] | def isprime?(num)
return false if num<2
(2...num).each do |factor|
return false if num % factor == 0
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def given\n [6,5,3,1,8,7,2,3]\nend",
"def series_up(n) # given n, return a list that goes [1,1,2,1,2,3... n]\n n_list = []\n (n+1).times do |m|\n m.times do |val|\n n_list.push(val+1)\n end\n end\n return n_list\nend",
"def series_up(nums) \r\n series = 0 # start the li... | [
"0.7610117",
"0.6555771",
"0.6534972",
"0.6340324",
"0.62796617",
"0.6234124",
"0.62291795",
"0.620265",
"0.61924005",
"0.6176269",
"0.6168404",
"0.6165806",
"0.61275774",
"0.61271924",
"0.6105388",
"0.60709107",
"0.606117",
"0.60477865",
"0.6046792",
"0.6046085",
"0.6036601"... | 0.0 | -1 |
GET /people GET /branches/1/people GET /businesses/1/people | def index
render :index if @people
render :index_for_patrons if @patrons
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def index\n case\n when params.has_key?(:company_id) then\n @parent = Company.find(params[:company_id])\n @people = @parent.people\n when params.has_key?(:person_id) then\n @parent = Person.find(params[:pe... | [
"0.62222105",
"0.59114003",
"0.58923566",
"0.5868764",
"0.5868764",
"0.58610666",
"0.5840585",
"0.5797233",
"0.5790994",
"0.5766361",
"0.5759379",
"0.57427806",
"0.5725173",
"0.5719261",
"0.56513345",
"0.5619096",
"0.5614046",
"0.5614046",
"0.5607476",
"0.5590379",
"0.5589269... | 0.0 | -1 |
GET /family_histories GET /family_histories.json | def index
@family_histories = FamilyHistory.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end",
"def index\n @fundamentals_histories = @company.fundamentals_histories.all\n\n respond_to do |format|\n ... | [
"0.71313196",
"0.66687083",
"0.65626675",
"0.6493162",
"0.6366066",
"0.6365955",
"0.6337237",
"0.6239882",
"0.6203846",
"0.62029326",
"0.6159766",
"0.6154554",
"0.6091634",
"0.6067703",
"0.6065467",
"0.60643333",
"0.60643333",
"0.6047217",
"0.60415894",
"0.6040515",
"0.603498... | 0.76875293 | 0 |
GET /family_histories/1 GET /family_histories/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @family_histories = FamilyHistory.all\n end",
"def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end",
"def new\n @family_history = FamilyHistory.new... | [
"0.7502044",
"0.74096537",
"0.6789069",
"0.67738414",
"0.65864724",
"0.6479679",
"0.6472558",
"0.6462367",
"0.63592696",
"0.6343431",
"0.63351244",
"0.6300005",
"0.62610215",
"0.6254033",
"0.62124187",
"0.61935014",
"0.61935014",
"0.6092397",
"0.6086366",
"0.60638154",
"0.606... | 0.0 | -1 |
POST /family_histories POST /family_histories.json | def create
@family_history = FamilyHistory.new(family_history_params)
respond_to do |format|
if @family_history.save
format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully created.' }
format.json { render :show, status: :created, location: @family_history }
else
format.html { render :new }
format.json { render json: @family_history.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @family_history = FamilyHistory.new(params[:family_history])\n\n respond_to do |format|\n if @family_history.save\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully created.' }\n format.json { render js... | [
"0.66057336",
"0.6605026",
"0.6574083",
"0.64806885",
"0.6414705",
"0.6218579",
"0.6141314",
"0.59926724",
"0.59926724",
"0.5957328",
"0.5945642",
"0.5911225",
"0.5866166",
"0.57638484",
"0.5754734",
"0.57402015",
"0.5734575",
"0.5723629",
"0.57108974",
"0.57061374",
"0.56613... | 0.6653563 | 0 |
PATCH/PUT /family_histories/1 PATCH/PUT /family_histories/1.json | def update
respond_to do |format|
if @family_history.update(family_history_params)
format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully updated.' }
format.json { render :show, status: :ok, location: @family_history }
else
format.html { render :edit }
format.json { render json: @family_history.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n if @family_history.update_attributes(params[:family_history])\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully updated.' }\n ... | [
"0.6985075",
"0.6592985",
"0.65639323",
"0.65639323",
"0.65053546",
"0.64841425",
"0.64764565",
"0.64654005",
"0.6414846",
"0.6368925",
"0.6331091",
"0.62963295",
"0.6273065",
"0.6264191",
"0.6253739",
"0.6142333",
"0.6139469",
"0.61380905",
"0.6137319",
"0.6135581",
"0.61091... | 0.7013667 | 0 |
DELETE /family_histories/1 DELETE /family_histories/1.json | def destroy
@family_history.destroy
respond_to do |format|
format.html { redirect_to family_histories_url, notice: 'Family history was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @family_history = FamilyHistory.find(params[:id])\n @family_history.destroy\n\n respond_to do |format|\n format.html { redirect_to family_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historial = Historial.find(params[:id])\n @historia... | [
"0.77003956",
"0.7304784",
"0.7102137",
"0.70926046",
"0.7087947",
"0.7070217",
"0.70327663",
"0.69991046",
"0.6875669",
"0.6871906",
"0.68471956",
"0.6830725",
"0.6784044",
"0.67737746",
"0.6766836",
"0.6754331",
"0.67354196",
"0.67286074",
"0.6727467",
"0.67243314",
"0.6723... | 0.7507815 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_family_history
@family_history = FamilyHistory.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def family_history_params
params.require(:family_history).permit(:first_name, :last_name, :relationship, :dob, :dod, :medical_history, :patient_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.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
Returns an array of routes, ignoring exceptions | def my_routes
my_routes = []
exceptions = %w(Login Signin)
self.class.routes['GET'].each do |r|
route = r.first.to_s.gsub(/\W+|mix/,'').capitalize
my_routes << route unless exceptions.include?(route)
end
return my_routes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def routes_normal\n return Array.new\n end",
"def get_routes\n raise \"Method not implemented\"\n end",
"def routes\n @routes ||= []\n end",
"def routes\n @routes ||= []\n end",
"def routes\n @routes ||= []\n end",
"def routes_unhighlighted\n return Array.ne... | [
"0.7562973",
"0.7328139",
"0.73165554",
"0.73165554",
"0.7283972",
"0.718276",
"0.7081735",
"0.70598453",
"0.6834728",
"0.6817335",
"0.6817335",
"0.6816099",
"0.67349327",
"0.66528654",
"0.6646333",
"0.6638214",
"0.6599385",
"0.6574866",
"0.6520511",
"0.6517264",
"0.650079",
... | 0.7773459 | 0 |
Sanitize text input before evaluating | def sanitize( str )
return str.scan(/\d|\(|\)|\*|\+|\-|\/|\.|\%/).to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize(context,input)\n safe = ''\n begin\n safe = antisamy(context,input)\n rescue Exception => e\n end\n safe\n end",
"def sanitize!; end",
"def sanitize(text)\n sanitized_text = text.dup\n\n # Strip URLs\n sanitized_text.gsub!(URL... | [
"0.7259956",
"0.7239552",
"0.7047935",
"0.6918973",
"0.6913846",
"0.6901053",
"0.685648",
"0.6817125",
"0.68129134",
"0.6762043",
"0.6730322",
"0.6708264",
"0.6682563",
"0.6679509",
"0.66620135",
"0.66361964",
"0.6616259",
"0.6613669",
"0.6605613",
"0.6556117",
"0.6501612",
... | 0.6239531 | 41 |
we can welcome new and known users, need a helper | def welcome( user )
session[:user] = user
session[:last_login] = Time.now.strftime("%m-%d-%Y %H:%M:%S")
redirect "/"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def welcome\n @current_user = current_user\n end",
"def welcome(user)\n @the_new_user_who_signed_up = user\n\n mail to: user.email, from: \"jeff@startergrill.com\"\n end",
"def verify_welcome_message\n if is_newbie_changed? && is_newbie == false\n generate_welcome_message\n DefaultFollo... | [
"0.7073493",
"0.68903244",
"0.6831217",
"0.6808093",
"0.6763209",
"0.676031",
"0.6738259",
"0.67248815",
"0.66971934",
"0.6687613",
"0.6685772",
"0.6672079",
"0.666584",
"0.664756",
"0.6617702",
"0.65855557",
"0.6584371",
"0.65809256",
"0.65606236",
"0.65596086",
"0.65409327"... | 0.6305389 | 48 |
Returns users and their attributes Optional: filter, fields | def index
users = get_collection(visible_users) || return
respond_to do |format|
format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: :users, skip_types: true) }
format.json { render json: users.to_json(only: DEFAULT_FIELDS) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fields\n Iterable.request(conf, '/users/getFields').get\n end",
"def get_users(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"users\", params)\n... | [
"0.7016345",
"0.68872595",
"0.68271273",
"0.6814705",
"0.67519397",
"0.6750368",
"0.6740111",
"0.67067736",
"0.67007023",
"0.6672344",
"0.6665858",
"0.66351116",
"0.65872335",
"0.65813106",
"0.6567486",
"0.6565599",
"0.65570134",
"0.64925903",
"0.64878386",
"0.64814043",
"0.6... | 0.0 | -1 |
Creates a new user Requires: user_name, type, first_name, last_name Optional: section_name, grace_credits | def create
if has_missing_params?([:user_name, :type, :first_name, :last_name])
# incomplete/invalid HTTP params
render 'shared/http_status', locals: { code: '422', message:
HttpStatusHelper::ERROR_CODE['message']['422'] }, status: :unprocessable_entity
return
end
# Check if that user_name is taken
user = User.find_by(user_name: params[:user_name])
unless user.nil?
render 'shared/http_status', locals: { code: '409', message:
'User already exists' }, status: :conflict
return
end
# No conflict found, so create new user
param_user_type = params[:type].camelize.downcase
params.delete(:type)
begin
case param_user_type
when 'enduser'
EndUser.create!(params.permit(*DEFAULT_FIELDS))
when 'adminuser'
AdminUser.create!(params.permit(*DEFAULT_FIELDS))
else
render 'shared/http_status', locals: { code: '422', message: 'Unknown user type' },
status: :unprocessable_entity
return
end
rescue ActiveRecord::SubclassNotFound, ActiveRecord::RecordInvalid => e
render 'shared/http_status', locals: { code: '422', message: e.to_s }, status: :unprocessable_entity
else
render 'shared/http_status',
locals: { code: '201', message: HttpStatusHelper::ERROR_CODE['message']['201'] }, status: :created
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n if has_missing_params?([:user_name, :type, :first_name, :last_name])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: {code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422']}, status: 422\n return\n end\n\n # Check i... | [
"0.742768",
"0.73657745",
"0.73572886",
"0.73361236",
"0.7325564",
"0.7279954",
"0.7276551",
"0.7272052",
"0.72412324",
"0.723935",
"0.7228596",
"0.7221998",
"0.7205386",
"0.7201958",
"0.7193282",
"0.7187215",
"0.7177707",
"0.71776205",
"0.71757144",
"0.7173474",
"0.71734244"... | 0.73636085 | 2 |
Returns a user and its attributes Requires: id Optional: filter, fields | def show
user = visible_users.find_by(id: params[:id])
if user.nil?
# No user with that id
render 'shared/http_status', locals: { code: '404', message:
'No user exists with that id' }, status: :not_found
else
respond_to do |format|
format.xml { render xml: user.to_xml(only: DEFAULT_FIELDS, root: :user, skip_types: true) }
format.json { render json: user.to_json(only: DEFAULT_FIELDS) }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}\", params)\n end",
"def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",... | [
"0.6934946",
"0.68955755",
"0.67761314",
"0.67599165",
"0.67517364",
"0.66539705",
"0.6638836",
"0.65345836",
"0.6522974",
"0.64992446",
"0.64217705",
"0.6408829",
"0.64018524",
"0.639262",
"0.63476866",
"0.63447464",
"0.6324918",
"0.6309589",
"0.6297333",
"0.6277602",
"0.627... | 0.0 | -1 |
Requires: id Optional: first_name, last_name, user_name | def update
user = visible_users.find_by(id: params[:id])
if user.nil?
render 'shared/http_status', locals: { code: '404', message: 'User was not found' }, status: :not_found
return
end
user.update!(user_params)
rescue ActiveRecord::SubclassNotFound, ActiveRecord::RecordInvalid => e
render 'shared/http_status', locals: { code: '422', message: e.to_s }, status: :unprocessable_entity
rescue StandardError
render 'shared/http_status', locals: { code: '500', message:
HttpStatusHelper::ERROR_CODE['message']['500'] }, status: :internal_server_error
else
render 'shared/http_status', locals: { code: '200', message:
HttpStatusHelper::ERROR_CODE['message']['200'] }, status: :ok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name_with_id\n id.to_s + \": \" + user.first_name + \" \" + user.last_name\n end",
"def get_name(id)\n return \"\" if !id\n user = User.find(id)\n user.first_name + ' ' + user.last_name\n end",
"def full_name_with_id\n id.to_s + \": \" + first_name + \" \" + last_name\n end",
... | [
"0.722545",
"0.7037313",
"0.6978342",
"0.65697396",
"0.6357903",
"0.63168395",
"0.63143796",
"0.63092244",
"0.62979305",
"0.62963176",
"0.62564266",
"0.61787206",
"0.61498547",
"0.6109742",
"0.6078087",
"0.6045767",
"0.6044269",
"0.6029161",
"0.6023883",
"0.5987191",
"0.59870... | 0.0 | -1 |
Update a user's attributes based on their user_name as opposed to their id (use the regular update method instead) Requires: user_name | def update_by_username
if has_missing_params?([:user_name])
# incomplete/invalid HTTP params
render 'shared/http_status',
locals: { code: '422', message: HttpStatusHelper::ERROR_CODE['message']['422'] },
status: :unprocessable_entity
return
end
user = User.find_by(user_name: params[:user_name])
if user.nil?
render 'shared/http_status', locals: { code: '404', message: 'User was not found' }, status: :not_found
return
end
user.update!(user_params)
rescue ActiveRecord::SubclassNotFound, ActiveRecord::RecordInvalid => e
render 'shared/http_status', locals: { code: '422', message: e.to_s }, status: :unprocessable_entity
rescue StandardError
render 'shared/http_status', locals: { code: '500', message:
HttpStatusHelper::ERROR_CODE['message']['500'] }, status: :internal_server_error
else
render 'shared/http_status', locals: { code: '200', message:
HttpStatusHelper::ERROR_CODE['message']['200'] }, status: :ok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end",
"def update\n # If no user is found, render an error.\n user = User.find_by_id(params[:id])\n if user.nil?\n render 'shared/http_status', locals: {code: ... | [
"0.84820056",
"0.8066077",
"0.77982724",
"0.77982724",
"0.7791103",
"0.77834505",
"0.7758361",
"0.7603567",
"0.7551911",
"0.7431223",
"0.7361754",
"0.7343018",
"0.7340448",
"0.7332482",
"0.7327722",
"0.73186034",
"0.73155755",
"0.72816426",
"0.72469085",
"0.72282124",
"0.7209... | 0.73235136 | 15 |
Do not make AutotestUser users visible | def visible_users
User.where.not(type: :AutotestUser)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def off_org_users\n \n end",
"def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end",
"def testNoAction\n executeTest('DummyUser', {})\n end",
"def include_public_users?\n true\n end",
"def show_users\n @user... | [
"0.67973125",
"0.64449453",
"0.63261586",
"0.632516",
"0.6189137",
"0.6185949",
"0.61498743",
"0.61498743",
"0.6094246",
"0.60853875",
"0.6016768",
"0.60043406",
"0.6004092",
"0.5987089",
"0.5983152",
"0.59766114",
"0.59692746",
"0.596323",
"0.5935923",
"0.5933732",
"0.592536... | 0.75043565 | 0 |
Average Revenue Per Order | def get_average_revenue_per_order(order_type=nil, start_date=nil, end_date=nil)
orders_count = get_orders_count(order_type, start_date, end_date)
return (get_revenue(order_type, start_date, end_date)/orders_count).round(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_average_revenue_per_order_item(order_type=nil, start_date=nil, end_date=nil)\n (get_revenue(order_type, start_date, end_date)/get_items_sold_count(order_type, start_date, end_date)).round(2)\n end",
"def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end... | [
"0.7875154",
"0.7629451",
"0.7084407",
"0.6970247",
"0.69223315",
"0.67495847",
"0.67010206",
"0.6605434",
"0.6582496",
"0.65723115",
"0.655904",
"0.6548161",
"0.64764345",
"0.64655304",
"0.64185876",
"0.6418556",
"0.6379762",
"0.63695186",
"0.6352476",
"0.6352476",
"0.632150... | 0.78708464 | 1 |
Average Revenue Per Order Item | def get_average_revenue_per_order_item(order_type=nil, start_date=nil, end_date=nil)
(get_revenue(order_type, start_date, end_date)/get_items_sold_count(order_type, start_date, end_date)).round(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end",
"def get_average_revenue_per_order(order_type=nil, start_date=nil, end_date=nil)\n orders_count = get_orders_count(order_type, start_date, end_date)\n return (get_revenue(order_type, start_date, end_date... | [
"0.73492616",
"0.7346743",
"0.7330883",
"0.7138519",
"0.70750594",
"0.702968",
"0.69464535",
"0.6928561",
"0.68511236",
"0.681629",
"0.6796739",
"0.6688929",
"0.6666513",
"0.6660459",
"0.66324747",
"0.6626453",
"0.66040957",
"0.65604335",
"0.64406735",
"0.6434388",
"0.6410795... | 0.8286279 | 0 |
Average Orders Per Customer | def get_average_orders_per_customer(customer_type=nil)
(get_orders_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_average_order_items_per_customer(customer_type=nil)\n (get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end",
"def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end",
"def index\n # uses the cus... | [
"0.7714796",
"0.6421369",
"0.6334133",
"0.62264735",
"0.5987185",
"0.5926142",
"0.5879872",
"0.58662117",
"0.58555657",
"0.58237153",
"0.5821276",
"0.5821276",
"0.5821276",
"0.5821276",
"0.58069533",
"0.58027786",
"0.5755036",
"0.5729838",
"0.57120043",
"0.5711469",
"0.570505... | 0.8391852 | 0 |
Average Order Items Per Customer | def get_average_order_items_per_customer(customer_type=nil)
(get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_average_orders_per_customer(customer_type=nil)\n (get_orders_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end",
"def get_average_items_per_order(order_type=nil, start_date=nil, end_date=nil)\n if get_orders_count(order_type, start_date, end_date) > 0\n ... | [
"0.7987969",
"0.7031677",
"0.69518197",
"0.69072133",
"0.64569676",
"0.6449781",
"0.6093867",
"0.60916364",
"0.60746455",
"0.60615057",
"0.60306484",
"0.6023318",
"0.60215765",
"0.6014028",
"0.6007907",
"0.5994727",
"0.59940296",
"0.597378",
"0.59695953",
"0.5968002",
"0.5966... | 0.8338892 | 0 |
Average Items Per Order | def get_average_items_per_order(order_type=nil, start_date=nil, end_date=nil)
if get_orders_count(order_type, start_date, end_date) > 0
(get_items_sold_count(order_type, start_date, end_date)/get_orders_count(order_type, start_date, end_date)).round(0)
else
0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end",
"def get_average_order_items_per_customer(customer_type=nil)\n (get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end",
"def average_price\n su... | [
"0.74473006",
"0.71956444",
"0.70686513",
"0.691084",
"0.6897596",
"0.6855064",
"0.6811624",
"0.6795871",
"0.6785261",
"0.6724578",
"0.65883505",
"0.6569625",
"0.64554936",
"0.6412604",
"0.6408691",
"0.63903147",
"0.6371128",
"0.63479805",
"0.63293904",
"0.6308164",
"0.630050... | 0.7611944 | 0 |
return true if tracks have only one value for 'parameter_name' | def unique?( tracks, parameter_name )
values = []
tracks.each do |track|
values << track.send( parameter_name )
end
return values.uniq.length == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uses_par?(parameter); @params.values.include?(parameter); end",
"def param_exists?(param_name)\n params[param_name] and not params[param_name].empty? ? true : false\n end",
"def has_param(name) \n return (@params.has_key? name)\n end",
"def has_param?(name)\n\n end",
"def ... | [
"0.6470434",
"0.62602895",
"0.62574023",
"0.62445563",
"0.61386085",
"0.6073199",
"0.60357475",
"0.60012776",
"0.5968408",
"0.5965425",
"0.59523284",
"0.5917802",
"0.5906149",
"0.5894024",
"0.58608276",
"0.5858045",
"0.5830624",
"0.5816976",
"0.5757066",
"0.5751734",
"0.57352... | 0.8034076 | 0 |
other things we could test write support. duplicate key handling | def test_pseudo_properties
# load some compressed rtf data
data = File.read File.dirname(__FILE__) + '/test_rtf.data'
props = PropertySet.new PropertySet::Key.new(0x1009) => StringIO.new(data)
# all these get generated from the rtf. still need tests for the way the priorities work
# here, and also the html embedded in rtf stuff....
assert_equal((<<-'end').chomp.gsub(/\n/, "\n\r"), props.body_rtf)
{\rtf1\ansi\ansicpg1252\fromtext \deff0{\fonttbl
{\f0\fswiss Arial;}
{\f1\fmodern Courier New;}
{\f2\fnil\fcharset2 Symbol;}
{\f3\fmodern\fcharset0 Courier New;}}
{\colortbl\red0\green0\blue0;\red0\green0\blue255;}
\uc1\pard\plain\deftab360 \f0\fs20 \par
I will be out of the office starting 15.02.2007 and will not return until\par
27.02.2007.\par
\par
I will respond to your message when I return. For urgent enquiries please\par
contact Motherine Jacson.\par
\par
}
end
assert_equal <<-'end', props.body_html
<html>
<body>
<br>I will be out of the office starting 15.02.2007 and will not return until
<br>27.02.2007.
<br>
<br>I will respond to your message when I return. For urgent enquiries please
<br>contact Motherine Jacson.
<br>
<br></body>
</html>
end
assert_equal <<-'end', props.body
I will be out of the office starting 15.02.2007 and will not return until
27.02.2007.
I will respond to your message when I return. For urgent enquiries please
contact Motherine Jacson.
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_modifyingfile\n keys = []\n names = []\n 3.times {\n k = mkkey\n #h[:ensure] = :present\n #h.retrieve\n keys << k\n names << k.name\n }\n assert_apply(*keys)\n keys.clear\n\n @catalog.clear(true)\n @catalog = nil\n\n newkey = mkkey\n #newkey[:ensure] ... | [
"0.6342405",
"0.6278296",
"0.62424046",
"0.61876214",
"0.61232096",
"0.6108877",
"0.6082207",
"0.6052111",
"0.6037649",
"0.60310304",
"0.60310304",
"0.6023723",
"0.6023371",
"0.6023234",
"0.5981422",
"0.5955789",
"0.59496254",
"0.5945464",
"0.5943789",
"0.58714414",
"0.586664... | 0.0 | -1 |
Creates and initializes a new instance of the IntegrationRuntimeNodes class. | def initialize(client)
@client = client
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @nodes = []\n end",
"def initialize\n @nodes = []\n end",
"def initialize\n @j_del = org.vertx.java.platform.impl.JRubyVerticleFactory.vertx.createNetServer\n end",
"def init\n @calls = []\n @accept_nodes = []\n @connected_nodes = nil\n @re... | [
"0.58970994",
"0.58326286",
"0.5754967",
"0.5741659",
"0.56740236",
"0.56740236",
"0.5673526",
"0.56384444",
"0.55885",
"0.5552643",
"0.55380803",
"0.5520146",
"0.55010283",
"0.5471777",
"0.54543453",
"0.5453141",
"0.54517883",
"0.5444576",
"0.5435255",
"0.5383976",
"0.535271... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_section
@section = Section.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def section_params
params.require(:section).permit(:name, :semester, :schedule, :teacher_id, :subject_id, teaching_loads_attributes: [:teacher_id, :subject_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_debt_management3
@debt_management3 = DebtManagement3.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.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def debt_management3_params
params.require(:debt_management3).permit(:Public_Debt_Repayment_Liabilities, :Amounts, :Year)
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 |
GET /categories GET /categories.xml | def index
if params[:category]
@search = Category.search :name_like => params[:category][:name]
params.clear
else
@search = Category.search(params[:search])
end
@categories = @search.paginate(:per_page => "20", :page => params[:page])
redirect_to admin_category_path(@categories.first, params) and return if (@categories.size.eql?(1))
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @categories }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end",
"def index\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n... | [
"0.7949818",
"0.73486304",
"0.73486304",
"0.73188496",
"0.7292199",
"0.7285156",
"0.7230788",
"0.71587074",
"0.7076353",
"0.7019252",
"0.70091593",
"0.69999546",
"0.697133",
"0.68882805",
"0.6817585",
"0.6806651",
"0.6784837",
"0.6759062",
"0.675618",
"0.66560626",
"0.6647625... | 0.0 | -1 |
GET /categories/1 GET /categories/1.xml | def show
@category = Category.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @category }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end",
"def index\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n... | [
"0.75137776",
"0.73183477",
"0.73183477",
"0.7282174",
"0.7237171",
"0.6928893",
"0.6908232",
"0.6871056",
"0.6851294",
"0.68342465",
"0.6810015",
"0.6787032",
"0.6780212",
"0.66883856",
"0.66748106",
"0.66291744",
"0.66271156",
"0.66271156",
"0.662619",
"0.6606129",
"0.65962... | 0.6690318 | 13 |
GET /categories/new GET /categories/new.xml | def new
@category = Category.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @category }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end",
"def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categ... | [
"0.760369",
"0.760369",
"0.760369",
"0.760369",
"0.7591787",
"0.74941653",
"0.7377025",
"0.73087305",
"0.7287367",
"0.72565544",
"0.7239733",
"0.72310567",
"0.7174033",
"0.7167501",
"0.7121368",
"0.711047",
"0.71100324",
"0.7090954",
"0.70723087",
"0.70644605",
"0.7063358",
... | 0.76277685 | 0 |
POST /categories POST /categories.xml | def create
@category = Category.new(params[:category])
respond_to do |format|
if @category.save
flash[:notice] = 'Kategoria została stworzona poprawnie.'
format.html { redirect_to([:admin, @category]) }
format.xml { render :xml => @category, :status => :created, :location => @category }
else
format.html { render :action => "new" }
format.xml { render :xml => @category.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end",
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend",
"def get_categories\n body = ... | [
"0.6691622",
"0.6525031",
"0.6454988",
"0.6193545",
"0.6099787",
"0.6094962",
"0.60859716",
"0.6065166",
"0.6060535",
"0.6051126",
"0.604862",
"0.6043285",
"0.60214573",
"0.6020132",
"0.6020132",
"0.60124165",
"0.5995836",
"0.5967278",
"0.59510535",
"0.5931672",
"0.591819",
... | 0.6010239 | 16 |
PUT /categories/1 PUT /categories/1.xml | def update
@category = Category.find(params[:id])
respond_to do |format|
if @category.update_attributes(params[:category])
flash[:notice] = 'Kategoria została zapisana poprawnie.'
format.html { redirect_to([:admin, @category]) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @category.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end",
"def UpdateCategory params = {}\n ... | [
"0.70238113",
"0.68414366",
"0.6461406",
"0.6284337",
"0.62295425",
"0.62170756",
"0.61702573",
"0.61506844",
"0.61276215",
"0.6036525",
"0.6021104",
"0.6012928",
"0.6012055",
"0.599599",
"0.59765",
"0.59765",
"0.59625256",
"0.5953942",
"0.59451157",
"0.5928523",
"0.590998",
... | 0.5902622 | 23 |
DELETE /categories/1 DELETE /categories/1.xml | def destroy
@category = Category.find(params[:id])
@category.destroy
if @category.destroyed?
flash[:notice] = 'Kategoria została usunięta poprawnie.'
else
flash[:notice] = 'Wystąpił błąd podczas usuwania kategorii.'
end
respond_to do |format|
format.html { redirect_to(admin_categories_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\r\n @ccategory = Ccategory.find(params[:id])\r\n @ccategory.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(ccategories_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n... | [
"0.7066325",
"0.7036115",
"0.69916683",
"0.69916683",
"0.69916683",
"0.6986449",
"0.69760543",
"0.6969206",
"0.69483775",
"0.69109625",
"0.6908067",
"0.6906969",
"0.6884139",
"0.6871092",
"0.68673575",
"0.68592954",
"0.6852229",
"0.6787517",
"0.6735929",
"0.67167944",
"0.6711... | 0.6434453 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.