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 |
|---|---|---|---|---|---|---|
PROGRAMMER INSTRUCTIONS: IF EVENT_TYPE = PREGNANCY VISIT 1, OR IF EVENT_TYPE = BIRTH, AND PREGNANCY VISIT 1 NOT SET TO COMPLETE, GO TO MAIDEN_NAME. OTHERWISE, GO PROGRAMMER INSTRUCTIONS FOLLOWING (NICKNAME_1)/ (NICKNAME_2). | def should_show_maiden_name_and_nicknames?(question)
ri = false
event_type_code = event.try(:event_type_code).to_i
case event_type_code
when 13
ri = true
when 18
pv1_events = person.contact_links.select do |cl|
cl.event.try(:event_type_code) == 13
end.map(&:event).uniq
ri = pv1_events.last && !pv1_events.last.try(:completed?)
end
answer_for(question, ri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_activity\n if self.accepted_or_rejected == \"1\"\n#-----------move this section to possiblity creation method under possiblity see note: 1 in todo\n if self.possibility.name == \"Create a New Possibility for the Future\"\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\... | [
"0.5636326",
"0.56328833",
"0.55185515",
"0.53914505",
"0.5252534",
"0.52275556",
"0.5210388",
"0.5147353",
"0.5145032",
"0.51397127",
"0.5126471",
"0.5126471",
"0.5126471",
"0.5100571",
"0.5084756",
"0.5071903",
"0.50678897",
"0.504433",
"0.50357085",
"0.50093746",
"0.499812... | 0.54705673 | 3 |
PROGRAMMER INSTRUCTIONS: IF PERSON_DOB COMPLETED DURING PREVIOUS INTERVIEW FOR CURRENT (R_FNAME)(R_MNAME)(R_LNAME) AND VALID RESPONSE PROVIDED, GO TO PROGRAMMER INSTRUCTIONS FOLLOWING PERSON_DOB. OTHERWISE, GO TO PERSON_DOB. | def has_dob_been_previously_collected?(question)
ri = false
if person.person_dob_date
ri = true
elsif most_recent_response = person.responses_for("PARTICIPANT_VERIF.PERSON_DOB").last
ri = true unless %w(neg_1 neg_2).include?(most_recent_response.try(:answer).try(:reference_identifier).to_s)
elsif person.person_dob_date.nil?
ri = false
end
answer_for(question, ri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oh_crap_i_forgot(title, person, location, date, thesis, major_accomplishment, pronoun)\n pronoun = 'male' ? p_use = 'he' : p_use = 'she'\n date < 1000 ? e_or_l = 'early era' : e_or_l = 'late era'\n\n puts \"#{title} : The Story of #{person}\"\n puts \" \"\n puts \"In #{e_or_l} #{location}, #{person} was a... | [
"0.531228",
"0.5168369",
"0.51607937",
"0.5146612",
"0.51409537",
"0.51202124",
"0.50245446",
"0.5010932",
"0.50049007",
"0.49616364",
"0.49525914",
"0.49246252",
"0.49127978",
"0.49013335",
"0.4877445",
"0.48718143",
"0.48504832",
"0.4847894",
"0.48357216",
"0.48315984",
"0.... | 0.45898592 | 56 |
PROGRAMMER INSTRUCTIONS: IF (C_FNAME)(C_LNAME) COLLECTED DURING PREVIOUS INTERVIEW AND VALID RESPONSE PROVIDED, PRELOAD C_FNAME FROM PREVIOUS INTERVIEW, AND GO TO PROGRAMMER INSTRUCTIONS FOLLOWING (C_FNAME)/(C_LNAME). | def should_show_child_name?(question)
ri = ((participant.person.try(:first_name) && participant.person.try(:last_name)) ||
(child_first_name_response_exists? && child_last_name_response_exists?)) ? false : true
answer_for(question, ri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name\n\t\tresponse = false\n\t\twhile not response\n\t\t\tputs \"What is your name?\"\n\t\t\tresponse = gets.chomp.downcase.capitalize!\n\t\t\t# entry_ok?(response) # Need to implement is_alpha check \n\t\tend\n\t\tresponse\n\tend",
"def match_to_preflabel(name)\n name = name.downcase\n case name\n... | [
"0.5473434",
"0.5467637",
"0.53780353",
"0.5293501",
"0.5286446",
"0.52740574",
"0.5245852",
"0.5223893",
"0.52149755",
"0.5202927",
"0.5124798",
"0.5101489",
"0.51010686",
"0.51010686",
"0.51010686",
"0.5080541",
"0.5062407",
"0.50555694",
"0.5023938",
"0.5020972",
"0.502042... | 0.0 | -1 |
PROGRAMMER INSTRUCTIONS: IF CHILD_DOB COLLECTED DURING PREVIOUS INTERVIEW AND VALID DATE OF BIRTH PROVIDED, GO TO PROGRAMMER INSTRUCTIONS FOLLOWING CHILD_DOB. OTHERWISE, GO TO CHILD_DOB. | def should_show_child_dob?(question)
ri = true
if participant.person.try(:person_dob_date)
ri = "false"
elsif valid_response_exists?("PARTICIPANT_VERIF_CHILD.CHILD_DOB")
ri = "false"
end
question.answers.select { |a| a.reference_identifier == ri }.first
ri = (participant.person.try(:person_dob_date) ||
valid_response_exists?("PARTICIPANT_VERIF_CHILD.CHILD_DOB")) ? false : true
answer_for(question, ri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def committee_date\n @problem.make(Timetable::CommitteeDate.asp(:weekday_id => \"WD\", :timeframe_id => \"TF\")) {\n conjunct{[\n Timeframe.asp(:global_id => \"TF\"),\n Weekday.asp(:global_id => \"WD\"),\n no {Timetable::Entry.asp( :timeframe_id => \"TF\", :weekday_id => \"WD\")},\n ... | [
"0.57067764",
"0.5593646",
"0.5410709",
"0.53033495",
"0.52983963",
"0.5245489",
"0.52408516",
"0.52179086",
"0.5204939",
"0.5204939",
"0.5187092",
"0.5187092",
"0.51851964",
"0.5183805",
"0.51730406",
"0.51681775",
"0.5164383",
"0.515676",
"0.51425797",
"0.5134736",
"0.51169... | 0.5282829 | 5 |
PROGRAMMER INSTRUCTIONS: IF CHILD_SEX COLLECTED PREVIOUSLY AND VALID RESPONSE PROVIDED, GO TO PROGRAMMER INSTRUCTIONS FOLLOWING CHILD_SEX. OTHERWISE, GO TO CHILD_SEX. | def should_show_child_sex?(question)
ri = (participant.person.try(:sex_code).to_i > 0 ||
valid_response_exists?("PARTICIPANT_VERIF_CHILD.CHILD_SEX")) ? false : true
answer_for(question, ri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seekHelp_case0(patient)\n physician = ''\n ci1 = ''\n generate(\n [\n [PATIENT, patient],\n [PHYSICIAN, physician],\n [COMMITMENT, C1, ci1, physician, patient]\n ],\n [], physician, ci1\n ) {\n yield [\n ['create', C1, ci1, physician, patient, list(patient)],\n ['reques... | [
"0.5859673",
"0.52493405",
"0.50518525",
"0.5033894",
"0.49932066",
"0.49893558",
"0.49834546",
"0.49606714",
"0.49580228",
"0.49578467",
"0.49350297",
"0.49146762",
"0.48801908",
"0.4878887",
"0.48654848",
"0.48550543",
"0.48451215",
"0.48420045",
"0.4838903",
"0.48238817",
... | 0.5482226 | 1 |
Is the participant assciated with response set the first child | def is_first_child?(question)
answer_for(question, participant.person.is_first_child?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_child?\n if mother = participant.try(:mother)\n if mother.participant?\n return mother.children.first == self\n end\n end\n false\n end",
"def ocare_child_previously_collected_and_equals_one?(question)\n answer_for(question, ocare_child_response_is_one?)\n end",
"de... | [
"0.7254193",
"0.6906695",
"0.6394839",
"0.6052264",
"0.600748",
"0.59983516",
"0.5939776",
"0.59382474",
"0.59217465",
"0.58822316",
"0.58406526",
"0.58379835",
"0.5819614",
"0.58171034",
"0.57043177",
"0.5672686",
"0.56695694",
"0.5666008",
"0.5663676",
"0.56511354",
"0.5637... | 0.7474111 | 0 |
PROGRAMMER INSTRUCTIONS: IF RESP_GUARD COLLECTED DURING PREVIOUS INTERVIEW WITH (R_FNAME)(R_MNAME)(R_LNAME) AND VALID RESPONSE PROVIDED, GO TO RESP_GUARD_CONF. OTHERWISE, IF RESP_GUARD NOT COLLECTED DURING PREVIOUS INTEVIEW WITH (R_FNAME)(R_MNAME)(R_LNAME) OR VALID RESPONSE NOT PROVIDED, GO RESP_GUARD. | def resp_guard_previously_collected?(question)
answer_for(question, valid_response_exists?("PARTICIPANT_VERIF.RESP_GUARD"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def are_you_or_is_guardian_name\n guard_name = response_for(\"#{OperationalDataExtractor::ParticipantVerification::INTERVIEW_CHILD_PREFIX}.G_FNAME\") + ' ' +\n response_for(\"#{OperationalDataExtractor::ParticipantVerification::INTERVIEW_CHILD_PREFIX}.G_MNAME\") + ' ' +\n r... | [
"0.5168951",
"0.5063489",
"0.49431574",
"0.4937101",
"0.49166176",
"0.4859782",
"0.48314872",
"0.48106477",
"0.4801363",
"0.47855267",
"0.4781755",
"0.47788966",
"0.47719583",
"0.47566074",
"0.47561467",
"0.4741275",
"0.47380343",
"0.4726046",
"0.47237238",
"0.47056115",
"0.4... | 0.618049 | 0 |
PROGRAMMER INSTRUCTIONS: IF RESP_PCARE COLLECTED DURING PREVIOUS INTERVIEW FOR CURRENT (R_FNAME)(R_MNAME)(R_LNAME) AND VALID RESPONSE PROVIDED, PRELOAD RESP_PCARE, AND GO TO PROGRAMMER INSTRUCTIONS FOLLOWING RESP_PCARE. OTHERWISE, GO TO RESP_PCARE. | def should_show_resp_pcare?(question)
answer_for(question, !valid_response_exists?("PARTICIPANT_VERIF.RESP_PCARE"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pcare_rel_previously_collected?(question)\n answer_for(question, valid_response_exists?(\"PARTICIPANT_VERIF.PCARE_REL\"))\n end",
"def precondition(_op)\n # gain access to operation instance methods \n op = Operation.find(_op.id)\n \n # get params\n response_request = op.input(\"Respon... | [
"0.539535",
"0.53850144",
"0.53088754",
"0.5256044",
"0.5231007",
"0.51895195",
"0.5184431",
"0.51647407",
"0.51008373",
"0.5034705",
"0.49466756",
"0.49466756",
"0.48863512",
"0.48716247",
"0.4857523",
"0.48332998",
"0.47808412",
"0.47788262",
"0.4770937",
"0.47593036",
"0.4... | 0.5571637 | 0 |
PROGRAMMER INSTRUCTIONS: IF RESP_PCARE = 1 FOR CURRENT OR PREVIOUS INTERVIEW, GO TO PROGRAMMER INSTRUCTIONS FOLLOWING (P_FNAME)(P_MNAME)(P_LNAME). OTHERWISE, GO TO (P_FNAME)(P_MNAME)(P_LNAME). | def resp_pcare_equals_one?(question)
previous_responses = person.responses_for("PARTICIPANT_VERIF.RESP_PCARE").all
ri = previous_responses.detect{ |r| r.answer.try(:reference_identifier).to_i == 1 } ? true : false
answer_for(question, ri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seekHelp_case0(patient)\n physician = ''\n ci1 = ''\n generate(\n [\n [PATIENT, patient],\n [PHYSICIAN, physician],\n [COMMITMENT, C1, ci1, physician, patient]\n ],\n [], physician, ci1\n ) {\n yield [\n ['create', C1, ci1, physician, patient, list(patient)],\n ['reques... | [
"0.5410424",
"0.51950026",
"0.5104487",
"0.5104487",
"0.5104487",
"0.5103855",
"0.5094914",
"0.5013295",
"0.49795055",
"0.4859706",
"0.48526764",
"0.4839491",
"0.47677076",
"0.47648484",
"0.47514978",
"0.47498405",
"0.472965",
"0.46976355",
"0.46895602",
"0.46849087",
"0.4682... | 0.44286174 | 68 |
PROGRAMMER INSTRUCTIONS: IF PCARE_REL COLLECTED DURING PREVIOUS INTERVIEW AND VALID RESPONSE PROVIDED, GO TO PROGRAMMER INSTRUCTIONS FOLLOWING OCARE_CHILD. OTHERWISE, GO TO PCARE_REL. | def pcare_rel_previously_collected?(question)
answer_for(question, valid_response_exists?("PARTICIPANT_VERIF.PCARE_REL"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ocare_rel_previously_collected?(question)\n answer_for(question, valid_response_exists?(\"PARTICIPANT_VERIF.OCARE_REL\"))\n end",
"def forkless(interspinous_interdevour, cladodontid_michel)\n end",
"def proceeding_or_congress\n if record.leader[12] == '1' || (record['008'] && record['008'... | [
"0.53689396",
"0.5345831",
"0.5157844",
"0.505478",
"0.50295734",
"0.50205165",
"0.4958586",
"0.4949664",
"0.49356058",
"0.4914997",
"0.4909147",
"0.4905557",
"0.48729688",
"0.48725143",
"0.48511437",
"0.4830683",
"0.48263198",
"0.481662",
"0.4807735",
"0.47804752",
"0.474707... | 0.5653842 | 0 |
PROGRAMMER INSTRUCTIONS: IF OCARE_CHILD COLLECTED DURING PREVIOUS INTERVIEW AND OCARE_CHILD = 1, GO TO PROGRAMMER INSTRUCTIONS FOLLOWING OCARE_CHILD. OTHERWISE, GO TO OCARE_CHILD. | def ocare_child_previously_collected_and_equals_one?(question)
answer_for(question, ocare_child_response_is_one?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tree_navigate_through_child\n @ontology_class = OntologyClass.find_by_id(params[:id])\n \n @object_relationship = ObjectRelationship.find(params[:parent_relationship]) if !params[:parent_relationship].blank?\n @object_relationship == 'root' if !@object_relationship \n \n # close 1 1; open 0 ... | [
"0.60609573",
"0.5813674",
"0.5480359",
"0.5386456",
"0.53698945",
"0.5275222",
"0.5234568",
"0.5223996",
"0.52227795",
"0.5206265",
"0.51910985",
"0.5189836",
"0.5143129",
"0.51179653",
"0.5094798",
"0.5083537",
"0.5081213",
"0.5080042",
"0.5067801",
"0.5065593",
"0.5041702"... | 0.5116421 | 14 |
PROGRAMMER INSTRUCTIONS: IF OCARE_REL COLLECTED DURING PREVIOUS INTERVIEW AND VALID RESPONSE PROVIDED, GO TO PV051. OTHERWISE, GO TO OCARE_REL. | def ocare_rel_previously_collected?(question)
answer_for(question, valid_response_exists?("PARTICIPANT_VERIF.OCARE_REL"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pcare_rel_previously_collected?(question)\n answer_for(question, valid_response_exists?(\"PARTICIPANT_VERIF.PCARE_REL\"))\n end",
"def rcpt\n @correspondence = Correspondence.find(:first, :conditions => { :receipt => params[:id]})\n\n respond_to do |format|\n if @correspondence\n # ... | [
"0.5588332",
"0.5238598",
"0.5233702",
"0.5152272",
"0.5069493",
"0.50218385",
"0.49914092",
"0.49830332",
"0.4975801",
"0.4958709",
"0.4936973",
"0.49247032",
"0.4915254",
"0.49030977",
"0.49030977",
"0.48755208",
"0.48453373",
"0.48167795",
"0.47843072",
"0.47779518",
"0.47... | 0.6430753 | 0 |
PROGRAMMER INSTRUCTIONS: IF CHILD_TIME COLLECTED DURING PREVIOUS INTERVIEW AND VALID RESPONSE PROVIDED, PRELOAD CHILD_TIME, AND GO TO PROGRAMMER INSTRUCTIONS FOLLOWING CHILD_TIME. OTHERWISE GO TO CHILD_TIME. | def child_time_previously_collected?(question)
answer_for(question, valid_response_exists?("PARTICIPANT_VERIF.CHILD_TIME"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def when_to_run\n time - @@REMINDER_TIME\n end",
"def story_time\n touch(@@detailsheader)\n sleeper(30)\n end",
"def build_timing; end",
"def updateTime\n #Increments invulnerable time if invulnerable. If greater than the invulnerability period, makes the enemy vulnerable.\n if @in... | [
"0.56138307",
"0.5609147",
"0.53550714",
"0.52485365",
"0.51767194",
"0.5150767",
"0.5109514",
"0.5096872",
"0.5090052",
"0.5082171",
"0.50649387",
"0.501823",
"0.50182265",
"0.5007197",
"0.50063604",
"0.49846223",
"0.49730182",
"0.4970122",
"0.4962494",
"0.4952974",
"0.49488... | 0.53384626 | 3 |
PROGRAMMER INSTRUCTIONS: IF PA_PHONE COLLECTED DURING PREVIOUS INTERVIEW AND VALID PHONE NUMBER PROVIDED, GO TO PROGRAMMER INSTRUCTIONS FOLLOWING PA_PHONE. OTHERWISE, GO PA_PHONE. | def pa_phone_previously_collected?(question)
answer_for(question, valid_response_exists?("PARTICIPANT_VERIF.PA_PHONE"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directorio(nombre, pais_c, numero)\n puts \" #{make_phone_call(numero,pais_c)}\n The phone number belongs to #{nombre}.\"\nend",
"def phone_for_display(phone)\n if phone.blank? then return \"N/A\" end\n md = PHONE_REGEX.match(phone)\n if md\n \"+1 (#{md[1]}) #{md[2]}-#{md[3]}\"\n else\n ... | [
"0.58524066",
"0.5811875",
"0.5809191",
"0.5790238",
"0.5769663",
"0.575674",
"0.57549524",
"0.5741227",
"0.57223046",
"0.57223046",
"0.56777656",
"0.5655436",
"0.5642442",
"0.56225455",
"0.56112003",
"0.56070167",
"0.56022465",
"0.55890584",
"0.5573763",
"0.5551037",
"0.5517... | 0.59620357 | 0 |
PROGRAMMER INSTRUCTIONS: PRELOAD SECONDARY PHONE NUMBER FROM MOST RECENT INTERVIEW. IF SA_PHONE_CONFIRM =1 AND IF CHILD_NUM = 1, GO TO TIME_STAMP_PV_ET. IF CHILD_QNUM > 1, GO TO PROGRAMMER INSTRUCTIONS FOLLOWING SA_PHONE. OTHERWISE, GO TO SA_PHONE. | def sa_phone_previously_collected?(question)
answer_for(question, valid_response_exists?("PARTICIPANT_VERIF.SA_PHONE"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primary_phone=(n)\n pull unless @details\n pn = Quickbooks::Model::TelephoneNumber.new\n pn.free_form_number = n\n @details.primary_phone = pn\n #update our locally stored number too\n update_phone_number\n end",
"def set_phone_number(phone, location, primary = false, extension = nil)\n ... | [
"0.5753873",
"0.5244129",
"0.52430445",
"0.51567566",
"0.5102404",
"0.51004636",
"0.5052983",
"0.50076777",
"0.500321",
"0.49537608",
"0.4940942",
"0.49280354",
"0.48819897",
"0.48782387",
"0.48616445",
"0.48570582",
"0.483279",
"0.48296994",
"0.48154676",
"0.48115996",
"0.48... | 0.47961295 | 21 |
Manually create a state param, with JWT. | def authorize_params
if !OmniAuth.config.test_mode
options.authorize_params[:state] = generate_jwt_state(request.params)
# Remove querystring params as only `state` is allowed.
request.params.clear
end
params = options.authorize_params.merge(options_for("authorize"))
if OmniAuth.config.test_mode
@env ||= {}
@env["rack.session"] ||= {}
end
session["omniauth.state"] = params[:state]
redirect_params.merge(params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_auth_state\n\t auth_state = {:pathway => params[:gift_template][:pathway], \n :gift_template_id => params[:gift_template][:gift_template_id]}\n\n if session[:page_tab_id] #[Page Tab] include the page tab id\n\t auth_state[:page_tab_id] = session[:page_tab_id]\n\t end\n\t return URI.encode(... | [
"0.645336",
"0.63714707",
"0.615297",
"0.61028314",
"0.6085235",
"0.6027521",
"0.6012819",
"0.5966917",
"0.5952664",
"0.5952664",
"0.59133416",
"0.5891518",
"0.58866304",
"0.58866304",
"0.5861761",
"0.58534384",
"0.5829471",
"0.58223987",
"0.5761527",
"0.5754962",
"0.5738599"... | 0.56040007 | 34 |
Do validation callbacks, then manually set 'omniauth.params' with decoded JWT. | def callback_phase # rubocop:disable AbcSize, CyclomaticComplexity, MethodLength, PerceivedComplexity
super
@env['omniauth.params'] = decode_jwt_state(session['omniauth.state'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback_phase\n error = request.params['error_reason'] || request.params['error']\n fail(OAuthError, error) if error\n @session_state = request.params['session_state']\n @id_token = request.params['id_token']\n @code = request.params['code']\n @claims, @header = valid... | [
"0.6256025",
"0.6163267",
"0.58738464",
"0.58547914",
"0.5821472",
"0.5784677",
"0.5772554",
"0.5758642",
"0.5741389",
"0.5727428",
"0.5707833",
"0.56802595",
"0.56574833",
"0.5651014",
"0.5642516",
"0.5630935",
"0.5601272",
"0.5531442",
"0.5514671",
"0.5511844",
"0.54920626"... | 0.709692 | 0 |
Stripe does not allow query string for callback_url. override base strategy. | def callback_url
full_host + script_name + callback_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback_url\n options.authorize_params.callback_url or super\n end",
"def callback\n @callback ||= ERB::Util.url_encode(\"#{request.url}&callback\")\n end",
"def oauth_callback_url\n end",
"def redirect_url\n\t\tcallback_url\n\tend",
"def redirect_to_url(callback_url)\n client_deta... | [
"0.6803875",
"0.64555603",
"0.62532157",
"0.620052",
"0.60099316",
"0.5995718",
"0.59663665",
"0.57776105",
"0.57776105",
"0.5768129",
"0.5765484",
"0.5765484",
"0.5765484",
"0.5758593",
"0.57413894",
"0.572413",
"0.56912905",
"0.56499004",
"0.5637418",
"0.561671",
"0.5602875... | 0.5350812 | 51 |
Initialise an outputter which turns logging messages into an OML stream param name Name of outputter param opts Options for setting up OML opts collect If set to an URL, then initialise OML otherwise assume that someone else is doing it opts domain OML domain to send to (assumes that 'collect' is set) ['log'] opts appName OML domain to send to (assumes that 'collect' is set) [fileNametimepid] | def initialize(name, opts = {})
super(name, opts)
if url = opts['collect']
h = {}
opts.each {|k, v| h[k.to_sym] = v}
opts = h
opts[:domain] ||= 'log'
opts[:appName] ||= File.basename(__FILE__, '.*')
opts[:id] ||= "#{Socket.gethostname}-#{Time.now.iso8601}-#{Process.pid}"
OML4R.init(nil, opts)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init(*opts)\n if opts.length == 0\n @logger = Logger.new(STDOUT)\n else\n @logger = Logger.new(*opts)\n end\n @logger.formatter = Ohai::Log::Formatter.new()\n level(Ohai::Config.log_level)\n end",
"def initialize(*args)\n io = args.shift if args.... | [
"0.5906852",
"0.5892154",
"0.58797693",
"0.5836179",
"0.5723001",
"0.5718163",
"0.5718163",
"0.5718163",
"0.5605676",
"0.55836684",
"0.5560132",
"0.5550914",
"0.5548238",
"0.551339",
"0.5511498",
"0.55056643",
"0.5500653",
"0.5499213",
"0.54867333",
"0.54656947",
"0.5441992",... | 0.66040665 | 0 |
Check if the strategy is responsible for handling the permission check Has to return true or false | def match?
raise NotImplementedError, 'please implement #match? '\
"for #{self.class.name} which should return true or false, "\
'depending on if it can decide #allowed?'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permission?()\n return nil\n end",
"def check_permission\n raise ActiveRecord::RecordNotFound if self.user.nil?\n raise ActiveRecord::RecordNotFound if self.group.nil?\n return true if !group.group_type.is_approval_required && self.user.can_join_groups?\n return true if (self.is_user_invit... | [
"0.79095554",
"0.7314222",
"0.71749663",
"0.7132092",
"0.7071541",
"0.7010169",
"0.7008044",
"0.7001104",
"0.69781375",
"0.69475454",
"0.69413006",
"0.69401973",
"0.69401973",
"0.69380736",
"0.6922173",
"0.6861549",
"0.6838953",
"0.6826304",
"0.6815263",
"0.6814372",
"0.68103... | 0.0 | -1 |
Check if user has necessary permission Has to return true or false | def allowed?
raise NotImplementedError, 'please implement #allowed? '\
"for #{self.class.name} which should decide if the action is allowed, "\
'based on the given attributes'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user?\n permissions == 'user'\n end",
"def can_access?\n allows_current_user_access_to? :access\n end",
"def permission?()\n return nil\n end",
"def authorization_required\n\n return true if is_admin?\n\n if !is_me?(@user)\n flash[:notice] = \"You don't have permission to do tha... | [
"0.8295847",
"0.80758685",
"0.80743384",
"0.8059282",
"0.7951835",
"0.7945234",
"0.7793191",
"0.77857393",
"0.7740768",
"0.77280366",
"0.7698637",
"0.768451",
"0.7679351",
"0.7673389",
"0.7665385",
"0.7617637",
"0.75966567",
"0.75917524",
"0.7591498",
"0.75834346",
"0.7580112... | 0.0 | -1 |
dt.to_s > string Returns a string in an ISO 8601 format (This method doesn't use the expanded representations). DateTime.new(2001,2,3,4,5,6,'7').to_s => "20010203T04:05:0607:00" | def to_s()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_to_str(dt)\r\n ret = nil\r\n if dt.nil?\r\n ret = \"\"\r\n else\r\n ret = dt.iso8601\r\n ret[10..-1] = \"Z\" if self.allday # yyyy-mm-ddZ\r\n end\r\n ret\r\n end",
"def to_string(t)\n t.respond_to?(:getutc) ? t.getutc.strftime(DATE_FORMAT) : t.strf... | [
"0.8473133",
"0.7528617",
"0.7373866",
"0.7045022",
"0.700857",
"0.69290787",
"0.6901274",
"0.68639493",
"0.68166393",
"0.68059504",
"0.678307",
"0.6758025",
"0.67461115",
"0.6741925",
"0.67377293",
"0.67377293",
"0.6725084",
"0.67235255",
"0.6709076",
"0.6709076",
"0.6701493... | 0.0 | -1 |
dt.strftime([format='%FT%T%:z']) > string Formats date according to the directives in the given format string. The directives begins with a percent (%) character. Any text not listed as a directive will be passed through to the output string. A directive consists of a percent (%) character, zero or more flags, an optional minimum field width, an optional modifier, and a conversion specifier as follows. % Flags: don't pad a numerical output. _ use spaces for padding. 0 use zeros for padding. ^ upcase the result string. change case. : use colons for %z. The minimum field width specifies the minimum width. The modifier is "E" and "O". They are ignored. Format directives: Date (Year, Month, Day): %Y Year with century (can be negative, 4 digits at least) 0001, 0000, 1995, 2009, 14292, etc. %C year / 100 (round down. 20 in 2009) %y year % 100 (00..99) %m Month of the year, zeropadded (01..12) %_m blankpadded ( 1..12) %m nopadded (1..12) %B The full month name (``January'') %^B uppercased (``JANUARY'') %b The abbreviated month name (``Jan'') %^b uppercased (``JAN'') %h Equivalent to %b %d Day of the month, zeropadded (01..31) %d nopadded (1..31) %e Day of the month, blankpadded ( 1..31) %j Day of the year (001..366) Time (Hour, Minute, Second, Subsecond): %H Hour of the day, 24hour clock, zeropadded (00..23) %k Hour of the day, 24hour clock, blankpadded ( 0..23) %I Hour of the day, 12hour clock, zeropadded (01..12) %l Hour of the day, 12hour clock, blankpadded ( 1..12) %P Meridian indicator, lowercase (``am'' or ``pm'') %p Meridian indicator, uppercase (``AM'' or ``PM'') %M Minute of the hour (00..59) %S Second of the minute (00..59) %L Millisecond of the second (000..999) %N Fractional seconds digits, default is 9 digits (nanosecond) %3N millisecond (3 digits) %15N femtosecond (15 digits) %6N microsecond (6 digits) %18N attosecond (18 digits) %9N nanosecond (9 digits) %21N zeptosecond (21 digits) %12N picosecond (12 digits) %24N yoctosecond (24 digits) Time zone: %z Time zone as hour and minute offset from UTC (e.g. +0900) %:z hour and minute offset from UTC with a colon (e.g. +09:00) %::z hour, minute and second offset from UTC (e.g. +09:00:00) %:::z hour, minute and second offset from UTC (e.g. +09, +09:30, +09:30:30) %Z Equivalent to %:z (e.g. +09:00) Weekday: %A The full weekday name (``Sunday'') %^A uppercased (``SUNDAY'') %a The abbreviated name (``Sun'') %^a uppercased (``SUN'') %u Day of the week (Monday is 1, 1..7) %w Day of the week (Sunday is 0, 0..6) ISO 8601 weekbased year and week number: The week 1 of YYYY starts with a Monday and includes YYYY0104. The days in the year before the first week are in the last week of the previous year. %G The weekbased year %g The last 2 digits of the weekbased year (00..99) %V Week number of the weekbased year (01..53) Week number: The week 1 of YYYY starts with a Sunday or Monday (according to %U or %W). The days in the year before the first week are in week 0. %U Week number of the year. The week starts with Sunday. (00..53) %W Week number of the year. The week starts with Monday. (00..53) Seconds since the Unix Epoch: %s Number of seconds since 19700101 00:00:00 UTC. %Q Number of milliseconds since 19700101 00:00:00 UTC. Literal string: %n Newline character (\n) %t Tab character (\t) %% Literal ``%'' character Combination: %c date and time (%a %b %e %T %Y) %D Date (%m/%d/%y) %F The ISO 8601 date format (%Y%m%d) %v VMS date (%e%b%Y) %x Same as %D %X Same as %T %r 12hour time (%I:%M:%S %p) %R 24hour time (%H:%M) %T 24hour time (%H:%M:%S) %+ date(1) (%a %b %e %H:%M:%S %Z %Y) This method is similar to strftime() function defined in ISO C and POSIX. Several directives (%a, %A, %b, %B, %c, %p, %r, %x, %X, %E, %O and %Z) are locale dependent in the function. However this method is locale independent. So, the result may differ even if a same format string is used in other systems such as C. It is good practice to avoid %x and %X because there are corresponding locale independent representations, %D and %T. Examples: d = DateTime.new(2007,11,19,8,37,48,"06:00") => d.strftime("Printed on %m/%d/%Y") => "Printed on 11/19/2007" d.strftime("at %I:%M%p") => "at 08:37AM" Various ISO 8601 formats: %Y%m%d => 20071119 Calendar date (basic) %F => 20071119 Calendar date (extended) %Y%m => 200711 Calendar date, reduced accuracy, specific month %Y => 2007 Calendar date, reduced accuracy, specific year %C => 20 Calendar date, reduced accuracy, specific century %Y%j => 2007323 Ordinal date (basic) %Y%j => 2007323 Ordinal date (extended) %GW%V%u => 2007W471 Week date (basic) %GW%V%u => 2007W471 Week date (extended) %GW%V => 2007W47 Week date, reduced accuracy, specific week (basic) %GW%V => 2007W47 Week date, reduced accuracy, specific week (extended) %H%M%S => 083748 Local time (basic) %T => 08:37:48 Local time (extended) %H%M => 0837 Local time, reduced accuracy, specific minute (basic) %H:%M => 08:37 Local time, reduced accuracy, specific minute (extended) %H => 08 Local time, reduced accuracy, specific hour %H%M%S,%L => 083748,000 Local time with decimal fraction, comma as decimal sign (basic) %T,%L => 08:37:48,000 Local time with decimal fraction, comma as decimal sign (extended) %H%M%S.%L => 083748.000 Local time with decimal fraction, full stop as decimal sign (basic) %T.%L => 08:37:48.000 Local time with decimal fraction, full stop as decimal sign (extended) %H%M%S%z => 0837480600 Local time and the difference from UTC (basic) %T%:z => 08:37:4806:00 Local time and the difference from UTC (extended) %Y%m%dT%H%M%S%z => 20071119T0837480600 Date and time of day for calendar date (basic) %FT%T%:z => 20071119T08:37:4806:00 Date and time of day for calendar date (extended) %Y%jT%H%M%S%z => 2007323T0837480600 Date and time of day for ordinal date (basic) %Y%jT%T%:z => 2007323T08:37:4806:00 Date and time of day for ordinal date (extended) %GW%V%uT%H%M%S%z => 2007W471T0837480600 Date and time of day for week date (basic) %GW%V%uT%T%:z => 2007W471T08:37:4806:00 Date and time of day for week date (extended) %Y%m%dT%H%M => 20071119T0837 Calendar date and local time (basic) %FT%R => 20071119T08:37 Calendar date and local time (extended) %Y%jT%H%MZ => 2007323T0837Z Ordinal date and UTC of day (basic) %Y%jT%RZ => 2007323T08:37Z Ordinal date and UTC of day (extended) %GW%V%uT%H%M%z => 2007W471T08370600 Week date and local time and difference from UTC (basic) %GW%V%uT%R%:z => 2007W471T08:3706:00 Week date and local time and difference from UTC (extended) See also strftime(3) and strptime. | def strftime(*args)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_datetime datetime, fmt=\"%F %H:%M %Z\"\n return unless datetime.present?\n datetime.strftime fmt if datetime\n end",
"def fmt_time(dt) _format_dt dt, H12_M_PM end",
"def strftime(format, time = T.unsafe(nil)); end",
"def format_datetime(t)\n format DFORMAT, t.day, t.mon, ... | [
"0.6825901",
"0.6817067",
"0.6768202",
"0.67511934",
"0.66408944",
"0.661757",
"0.6598173",
"0.65892285",
"0.6551246",
"0.6520126",
"0.6470598",
"0.6467661",
"0.6436057",
"0.6429316",
"0.6417162",
"0.63590115",
"0.6347475",
"0.6326757",
"0.63203496",
"0.6312716",
"0.6312619",... | 0.58272344 | 78 |
dt.iso8601([n=0]) > string dt.xmlschema([n=0]) > string This method is equivalent to strftime('%FT%T%:z'). The optional argument +n+ is the number of digits for fractional seconds. DateTime.parse('20010203T04:05:06.123456789+07:00').iso8601(9) => "20010203T04:05:06.123456789+07:00" | def iso8601(p1 = v1)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_iso8601\n strftime('%Y-%m-%dT%H:%M:%SZ')\n end",
"def to_iso8601(date)\n return nil unless(date)\n date = DateTime.parse(date) unless(date.respond_to?(:strftime))\n date.strftime('%Y-%m-%dT%H:%M:%SZ')\n end",
"def iso8601\n utc.strftime DATE_FORMATS[:iso8601]\n ... | [
"0.75154245",
"0.7158701",
"0.67820084",
"0.6644957",
"0.6641885",
"0.66075784",
"0.65996754",
"0.6419787",
"0.6226243",
"0.6180488",
"0.6173521",
"0.61473286",
"0.61464435",
"0.60843164",
"0.60843164",
"0.602732",
"0.59534407",
"0.5941752",
"0.59223986",
"0.59206766",
"0.591... | 0.7095791 | 2 |
dt.iso8601([n=0]) > string dt.xmlschema([n=0]) > string This method is equivalent to strftime('%FT%T%:z'). The optional argument +n+ is the number of digits for fractional seconds. DateTime.parse('20010203T04:05:06.123456789+07:00').iso8601(9) => "20010203T04:05:06.123456789+07:00" | def xmlschema(p1 = v1)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_iso8601\n strftime('%Y-%m-%dT%H:%M:%SZ')\n end",
"def to_iso8601(date)\n return nil unless(date)\n date = DateTime.parse(date) unless(date.respond_to?(:strftime))\n date.strftime('%Y-%m-%dT%H:%M:%SZ')\n end",
"def iso8601(p1 = v1)\n #This is a stub, used for ... | [
"0.7515799",
"0.7159823",
"0.70965534",
"0.678216",
"0.66435134",
"0.6642522",
"0.6607885",
"0.6600107",
"0.6420001",
"0.6227526",
"0.61787885",
"0.6174846",
"0.61490303",
"0.6147649",
"0.6085348",
"0.6085348",
"0.6027466",
"0.5954585",
"0.5943293",
"0.5923473",
"0.59196806",... | 0.0 | -1 |
dt.rfc3339([n=0]) > string This method is equivalent to strftime('%FT%T'). The optional argument n is length of fractional seconds. DateTime.parse('20010203T04:05:06.123456789+07:00').rfc3339(9) => "20010203T04:05:06.123456789+07:00" | def rfc3339(*args)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rfc2822\n strftime('%a, %d %b %Y %T ') << (utc? ? '-0000' : strftime('%z'))\n end",
"def to_rfc3339()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.AtomicDateTime_to_rfc3339(@handle.ptr)\n result\n end",
"d... | [
"0.65281487",
"0.63346064",
"0.6301956",
"0.621195",
"0.5908441",
"0.5850566",
"0.57646513",
"0.57201934",
"0.56961346",
"0.5690321",
"0.5682086",
"0.566327",
"0.5647167",
"0.56429297",
"0.56367236",
"0.56333363",
"0.56140363",
"0.56086934",
"0.55482733",
"0.5522165",
"0.5516... | 0.6775158 | 0 |
dt.jisx0301([n=0]) > string Returns a string in a JIS X 0301 format. The optional argument +n+ is the number of digits for fractional seconds. DateTime.parse('20010203T04:05:06.123456789+07:00').jisx0301(9) => "H13.02.03T04:05:06.123456789+07:00" | def jisx0301(p1 = v1)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_number(prenumber,n) \n @str = prenumber.to_s + to_n(Time.now.sec.to_s,2).to_s\n return to_n(@str,n)\n end",
"def get_yyyymmdd_hhnnss(s)\n return s.gsub('T', ' ').gsub('Z', '')\n end",
"def format(cnpj)\n cnpj = cnpj.to_s.rjust(14, \"0\")\n \"%s.%s.%s/%s-%s\" % [c... | [
"0.5184247",
"0.5166081",
"0.5096178",
"0.4983799",
"0.4948829",
"0.49453807",
"0.49395397",
"0.4923398",
"0.4884067",
"0.48667783",
"0.4758369",
"0.47555324",
"0.47383404",
"0.4732894",
"0.46594986",
"0.4651575",
"0.46276632",
"0.46196383",
"0.46160007",
"0.46159366",
"0.460... | 0.51895213 | 0 |
dt.to_time > time Returns a Time object which denotes self. | def to_time()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after?(time)\n self.convert > time.convert\n end",
"def after?(time)\n start_time > time\n end",
"def after?(time)\n start_time > time\n end",
"def as_of_time\n @_as_of_time\n end",
"def as_of_time\n @_as_of_time\n end",
"def after?(date_or_time)\n sel... | [
"0.68177074",
"0.66054755",
"0.66054755",
"0.66028726",
"0.66028726",
"0.6566522",
"0.65150875",
"0.6415729",
"0.64055294",
"0.6395224",
"0.63851875",
"0.63428247",
"0.6274532",
"0.62477535",
"0.6217191",
"0.62120944",
"0.6138598",
"0.610541",
"0.60836655",
"0.60770273",
"0.6... | 0.5603468 | 72 |
dt.to_date > date Returns a Date object which denotes self. | def to_date()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def >=(another_date)\n self.to_datetime >= another_date.to_datetime\n end",
"def <=(another_date)\n self.to_datetime <= another_date.to_datetime\n end",
"def to_date(date)\n return self if date.blank?\n\n date = date.to_date.end_of_day\n\n where(validity_end_date: ..date)\n en... | [
"0.71923625",
"0.7053579",
"0.6995534",
"0.6887009",
"0.65085036",
"0.6458297",
"0.64543796",
"0.6431401",
"0.63356584",
"0.6231271",
"0.62205416",
"0.60851955",
"0.608059",
"0.60698926",
"0.6063229",
"0.6050066",
"0.601517",
"0.6011528",
"0.5982219",
"0.5936057",
"0.5897758"... | 0.6168521 | 11 |
dt.to_datetime > self Returns self. | def to_datetime()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def <=(another_date)\n self.to_datetime <= another_date.to_datetime\n end",
"def >=(another_date)\n self.to_datetime >= another_date.to_datetime\n end",
"def <=>(other)\n @date_time_value <=> other.to_datetime\n end",
"def to_datetime\n self\n end",
"def <=>(o... | [
"0.7195552",
"0.7156201",
"0.706262",
"0.65069944",
"0.6075027",
"0.60167116",
"0.58998024",
"0.5889711",
"0.5887045",
"0.58797544",
"0.58420247",
"0.5838765",
"0.5830075",
"0.5830075",
"0.58184916",
"0.57537436",
"0.57519555",
"0.5744878",
"0.5744873",
"0.5743653",
"0.573262... | 0.5470946 | 29 |
GET /best_evers GET /best_evers.json | def index
@best_evers = BestEver.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bests = Best.all\n end",
"def show\n @bestgame = Bestgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bestgame }\n end\n end",
"def index\n @recent = Highfive.recent.approved\n @leaders = User.leaders\n \... | [
"0.63662153",
"0.618911",
"0.5974658",
"0.5876134",
"0.5803855",
"0.5777442",
"0.5766084",
"0.5730796",
"0.5727516",
"0.5725936",
"0.57209855",
"0.5684168",
"0.5662389",
"0.56584525",
"0.5645242",
"0.56190985",
"0.5613472",
"0.56022835",
"0.56000584",
"0.5586771",
"0.55760473... | 0.7371201 | 0 |
GET /best_evers/1 GET /best_evers/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @best_evers = BestEver.all\n end",
"def show\n @bestgame = Bestgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bestgame }\n end\n end",
"def index\n @bests = Best.all\n end",
"def show\n @verbo = Verbo.fi... | [
"0.71493363",
"0.6470907",
"0.64337105",
"0.6033269",
"0.6008463",
"0.59785765",
"0.59536046",
"0.59524536",
"0.59517545",
"0.5936665",
"0.59338033",
"0.59325683",
"0.59325683",
"0.59325683",
"0.58959043",
"0.584607",
"0.5803557",
"0.57598627",
"0.574529",
"0.5737959",
"0.573... | 0.0 | -1 |
POST /best_evers POST /best_evers.json | def create
@best_ever = BestEver.new(best_ever_params)
respond_to do |format|
if @best_ever.save
format.html { redirect_to @best_ever, notice: 'Best ever was successfully created.' }
format.json { render :show, status: :created, location: @best_ever }
else
format.html { render :new }
format.json { render json: @best_ever.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @best = Best.new(best_params)\n\n respond_to do |format|\n if @best.save\n format.html { redirect_to @best, notice: 'Best was successfully created.' }\n format.json { render :show, status: :created, location: @best }\n else\n format.html { render :new }\n fo... | [
"0.6750687",
"0.6104039",
"0.58835095",
"0.5748186",
"0.56977123",
"0.56924266",
"0.5481336",
"0.5449832",
"0.5447794",
"0.54094946",
"0.53712237",
"0.53637546",
"0.53634787",
"0.535215",
"0.53379905",
"0.5330773",
"0.5314304",
"0.53115577",
"0.53112066",
"0.5307651",
"0.5297... | 0.6595881 | 1 |
PATCH/PUT /best_evers/1 PATCH/PUT /best_evers/1.json | def update
respond_to do |format|
if @best_ever.update(best_ever_params)
format.html { redirect_to @best_ever, notice: 'Best ever was successfully updated.' }
format.json { render :show, status: :ok, location: @best_ever }
else
format.html { render :edit }
format.json { render json: @best_ever.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @best.update(best_params)\n format.html { redirect_to @best, notice: 'Best was successfully updated.' }\n format.json { render :show, status: :ok, location: @best }\n else\n format.html { render :edit }\n format.json { render json: @... | [
"0.67746055",
"0.622435",
"0.6187844",
"0.6187844",
"0.6168036",
"0.6155855",
"0.61445856",
"0.61037666",
"0.60828274",
"0.6064894",
"0.60506105",
"0.60313785",
"0.6017212",
"0.60122865",
"0.6010288",
"0.59937936",
"0.596783",
"0.5964651",
"0.5955861",
"0.5943511",
"0.5932148... | 0.6831952 | 0 |
DELETE /best_evers/1 DELETE /best_evers/1.json | def destroy
@best_ever.destroy
respond_to do |format|
format.html { redirect_to best_evers_url, notice: 'Best ever was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @best.destroy\n respond_to do |format|\n format.html { redirect_to bests_url, notice: 'Best was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"... | [
"0.72406787",
"0.69752717",
"0.6695739",
"0.6669645",
"0.6668165",
"0.66361094",
"0.65965885",
"0.65907806",
"0.6532073",
"0.65314984",
"0.6528864",
"0.6526013",
"0.650169",
"0.6494351",
"0.6478605",
"0.6478605",
"0.6469497",
"0.6467051",
"0.6456284",
"0.6456247",
"0.6447354"... | 0.69951546 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_best_ever
@best_ever = BestEver.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 best_ever_params
params.require(:best_ever).permit(:user, :song, :artist, :comment)
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 |
Tell if a tree has a Pokemon in it | def has_pokemon?(id)
get(id)[:column] != 0 && (Graphics.current_time - get(id)[:slather_time]) < LEAVE_TREE_TIME
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def any_pears?\n # code to check if tree has any oranges goes here\n @pears.length > 0\n end",
"def any_apples?\n # code to check if tree has any oranges goes here\n @apples.length > 0\n end",
"def any_oranges?\n # code to check if tree has any oranges goes here\n @oranges.length > 0\n end... | [
"0.7063453",
"0.67084515",
"0.6543048",
"0.63264394",
"0.6312026",
"0.62967914",
"0.6257367",
"0.6231345",
"0.62198013",
"0.61112034",
"0.6050632",
"0.5957871",
"0.5957871",
"0.5957871",
"0.5957871",
"0.5957871",
"0.5957871",
"0.5957871",
"0.5957871",
"0.5957871",
"0.5955865"... | 0.6779252 | 1 |
Tell if the tree is ready to battle | def can_battle?(id)
has_pokemon?(id) && (Graphics.current_time - get(id)[:slather_time]) > WAIT_TO_BATTLE
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ready?\n state == RUNNABLE_STATE\n end",
"def ready?\n self.state == :ready\n end",
"def ready?\n state == :READY\n end",
"def ready?\n state == :READY\n end",
"def ready?\n state == :READY\n end",
"def ready?\n ... | [
"0.6678347",
"0.6674196",
"0.6671521",
"0.6671521",
"0.6671521",
"0.6671521",
"0.6671521",
"0.6657747",
"0.6626313",
"0.6595419",
"0.65815896",
"0.65576535",
"0.64829755",
"0.6465517",
"0.6438319",
"0.6387791",
"0.6384324",
"0.63715136",
"0.6364499",
"0.63509053",
"0.63294095... | 0.0 | -1 |
Return the ID of the last tree | def last_tree_id
return $pokemon_party.user_data[:last_honey_tree] || -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_id()\n #This is a stub, used for indexing\n end",
"def last\n @children.last\n end",
"def parent_id\n parent_ids.last\n end",
"def root_id\n if is_root?\n id\n else\n root.id\n end\n end",
"def root_id\n if ancestor_ids.empty? then\n ... | [
"0.7207837",
"0.71012163",
"0.7094555",
"0.6865387",
"0.68378216",
"0.6791649",
"0.6781982",
"0.67316043",
"0.6694396",
"0.6569602",
"0.6548677",
"0.65041214",
"0.64888453",
"0.6484446",
"0.64824694",
"0.64768755",
"0.64545",
"0.64545",
"0.64545",
"0.6446864",
"0.6446548",
... | 0.76279664 | 0 |
Set the ID of the last tree | def last_tree_id=(id)
$pokemon_party.user_data[:last_honey_tree] = id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id=(value)\n @children['id'][:value] = value\n end",
"def root_id=(value)\n if value == @defaults['ai.operation.rootId']\n @values.delete 'ai.operation.rootId' if @values.key? 'ai.operation.rootId'\n else\n @values['ai.operation.rootId'] = value\n ... | [
"0.6413444",
"0.63351303",
"0.63351303",
"0.62894773",
"0.62382144",
"0.62382144",
"0.6199164",
"0.6187313",
"0.6186916",
"0.6186916",
"0.6133328",
"0.60657084",
"0.6040052",
"0.60356855",
"0.60356855",
"0.60356855",
"0.60356855",
"0.6034069",
"0.6031558",
"0.60238516",
"0.60... | 0.722189 | 0 |
Return the last index of the choosen mon in the table | def last_mon_index
$pokemon_party.user_data[:last_honey_mon_index] || 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_index\n @last_index\n end",
"def select_last\n select(@data.index($game_party.last_item.object) || 0)\n end",
"def mon_index(id)\n if id == last_tree_id\n return last_mon_index if rand(100) < LAST_MON_INDEX_CHANCES\n end\n rng_val = rand(100)\n return MON_I... | [
"0.6562534",
"0.64543635",
"0.6406623",
"0.6384954",
"0.63445604",
"0.63092315",
"0.62852746",
"0.62802875",
"0.6271895",
"0.6270605",
"0.62683403",
"0.6197107",
"0.61836785",
"0.6179454",
"0.6179454",
"0.6179454",
"0.6179454",
"0.6173796",
"0.6163167",
"0.6160724",
"0.615614... | 0.68874425 | 0 |
Set the ID of the last choosen mon in the table | def last_mon_index=(index)
$pokemon_party.user_data[:last_honey_mon_index] = index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_id()\n #This is a stub, used for indexing\n end",
"def set_key\n last_key = User.find_by_sql('select max(userId) as maxid from user')[0].maxid\n self.userId = last_key.to_i + 1\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def new_id\n @last_id ||... | [
"0.61877275",
"0.6108145",
"0.6097667",
"0.6085134",
"0.6085134",
"0.59867",
"0.5967871",
"0.5965783",
"0.5835805",
"0.58280283",
"0.5775165",
"0.571427",
"0.5712791",
"0.569671",
"0.56230414",
"0.5590054",
"0.5590054",
"0.5590054",
"0.55624574",
"0.5553516",
"0.55423695",
... | 0.5511029 | 34 |
Tell if the tree is a munchlax tree or not | def munchlax?(id)
tid = $trainer.id
return ((tid & 0xFF) % COUNT) == 0 ||
((tid >> 8 & 0xFF) % COUNT) == 0 ||
((tid >> 16 & 0xFF) % COUNT) == 0 ||
((tid >> 24 & 0xFF) % COUNT) == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_tree?\n true\n end",
"def valid_tree?\n true\n end",
"def valid_tree?\n true\n end",
"def valid_tree?\n false\n end",
"def is_valid_tree(tree)\n\nend",
"def is_leaf\n true\n end",
"def is_leaf\n true\n end",
"def leaf?\n true\n end",
"def root?\n @type =... | [
"0.7149509",
"0.7128849",
"0.7128849",
"0.71249217",
"0.666762",
"0.6650851",
"0.6650851",
"0.6650435",
"0.6545699",
"0.6542138",
"0.64794564",
"0.64363116",
"0.64226776",
"0.6409604",
"0.6405019",
"0.63892925",
"0.6384388",
"0.6384388",
"0.6380754",
"0.6371912",
"0.6341396",... | 0.0 | -1 |
Get the new column index | def column(id)
rng_val = rand(100)
return COLUMN_INDEXES[munchlax?(id)].index { |cell| cell.include?(rng_val) } || 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_column index\n return @chash[index] if @chash[index]\n # create a new entry since none present\n c = ColumnInfo.new\n c.index = index\n @chash[index] = c\n return c\n end",
"def column_index\n @column_index ||= @parent_proxy.send(:next_column_index)\n end"... | [
"0.746488",
"0.73984116",
"0.7147298",
"0.68551785",
"0.67997867",
"0.67997867",
"0.67821896",
"0.676555",
"0.6741325",
"0.66325843",
"0.6621728",
"0.6596259",
"0.6564214",
"0.65527654",
"0.6488012",
"0.6444481",
"0.6336451",
"0.6336451",
"0.6336451",
"0.6314885",
"0.63097465... | 0.58175695 | 69 |
Return the index of the current mon | def mon_index(id)
if id == last_tree_id
return last_mon_index if rand(100) < LAST_MON_INDEX_CHANCES
end
rng_val = rand(100)
return MON_INDEXES.index { |cell| cell.include?(rng_val) } || 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index_of_cur_day\n\treturn $index_of_cur_day\nend",
"def last_mon_index\n $pokemon_party.user_data[:last_honey_mon_index] || 0\n end",
"def week_of_month\n week_split.each_with_index do |o, i|\n return (i + 1) if o.include?(day)\n end\n end",
"def week_of_month\n ... | [
"0.6756656",
"0.65916336",
"0.643671",
"0.6285505",
"0.61068064",
"0.60455304",
"0.60308033",
"0.5965331",
"0.5924959",
"0.58910984",
"0.58690834",
"0.58554935",
"0.5789795",
"0.5780536",
"0.5777422",
"0.5740394",
"0.5729007",
"0.5729007",
"0.5729007",
"0.57108486",
"0.569952... | 0.7070926 | 0 |
Return the number of shakes | def shakes(column)
rng_val = rand(100)
return SHAKES_NUMBERS[column].index { |cell| cell.include?(rng_val) } || 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fish_count()\n return @fish.length()\n end",
"def shoe_count\n count = @shoe.count\n positive = count >= 0\n \"Current Deck Count: #{positive ? \"+\" : \"-\"}#{count.abs}\"\n end",
"def num_shelf\n\t\tputs \"Library has #{@shelves.length} shelves\"\n\tend",
"def sheep_count(num)\n \nend"... | [
"0.7200743",
"0.6790316",
"0.6789348",
"0.6678812",
"0.66205156",
"0.6462799",
"0.6459391",
"0.6459391",
"0.64516294",
"0.6443798",
"0.640739",
"0.6381852",
"0.63794374",
"0.6375148",
"0.6337524",
"0.6330241",
"0.63291377",
"0.6310539",
"0.6301338",
"0.62889135",
"0.6277244",... | 0.0 | -1 |
Function that asks if you want to slaghter | def honey_tree_slather_event(id)
return unless $bag.contain_item?(:honey)
if yes_no_choice(load_message(:honey_tree_slather))
$bag.drop_item(:honey, 1)
PFM::HoneyTree.slather(id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go_first?\n\n puts \"Do you want to go first and be X?\"\n puts \"Type 'y' or 'yes' for YES\"\n puts \"Type 'n' or 'no' for NO\"\n input = gets.strip.downcase\n\n case input\n when 'y', 'yes'\n true\n when 'n', 'no'\n false\n else\n go_first?\n end\n\n end",
"def as... | [
"0.65093154",
"0.646683",
"0.6382186",
"0.6325136",
"0.6262889",
"0.62337",
"0.620394",
"0.620394",
"0.620394",
"0.62021774",
"0.6195387",
"0.6184108",
"0.6176653",
"0.6174671",
"0.6128396",
"0.6097141",
"0.6096998",
"0.60904795",
"0.60889244",
"0.6066822",
"0.60649",
"0.60... | 0.0 | -1 |
GET /workout_dates/1 GET /workout_dates/1.xml | def show
@workout_date = WorkoutDate.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @workout_date }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @workout_days = WorkoutDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workout_days }\n end\n end",
"def new\n @workout_date = WorkoutDate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { re... | [
"0.6489699",
"0.6332413",
"0.62608445",
"0.62071025",
"0.6195921",
"0.6178079",
"0.616065",
"0.6049106",
"0.6033261",
"0.59936774",
"0.59267",
"0.5925144",
"0.5913575",
"0.5906674",
"0.58856726",
"0.5870383",
"0.58692247",
"0.5853142",
"0.584267",
"0.58220655",
"0.58220655",
... | 0.72435933 | 0 |
GET /workout_dates/new GET /workout_dates/new.xml | def new
@workout_date = WorkoutDate.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @workout_date }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @work_day = WorkDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work_day }\n end\n end",
"def create\n @workout_date = WorkoutDate.new(params[:workout_date])\n @workout_date.n ||= WorkoutDate.next_free_n(@workout_date.workout_id)... | [
"0.7110844",
"0.7094554",
"0.67623895",
"0.6628381",
"0.6591031",
"0.65830165",
"0.65663",
"0.655908",
"0.65151286",
"0.6474306",
"0.6464084",
"0.6463056",
"0.6461669",
"0.64303315",
"0.636889",
"0.636889",
"0.636889",
"0.636889",
"0.636889",
"0.6353108",
"0.6353108",
"0.63... | 0.76737607 | 0 |
POST /workout_dates POST /workout_dates.xml | def create
@workout_date = WorkoutDate.new(params[:workout_date])
@workout_date.n ||= WorkoutDate.next_free_n(@workout_date.workout_id)
respond_to do |format|
if @workout_date.save
format.html { redirect_to(@workout_date, :notice => 'Workout date was successfully created.') }
format.xml { render :xml => @workout_date, :status => :created, :location => @workout_date }
else
format.html { render :action => "new" }
format.xml { render :xml => @workout_date.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @workout_date = WorkoutDate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workout_date }\n end\n end",
"def update\n @workout_date = WorkoutDate.find(params[:id])\n @workout_date.n ||= WorkoutDate.next_free_n(@workout_date.workout_... | [
"0.5950956",
"0.59293854",
"0.5853527",
"0.5831682",
"0.57376343",
"0.5668289",
"0.5502845",
"0.5477103",
"0.5424921",
"0.5421833",
"0.5420984",
"0.5370019",
"0.5363112",
"0.53260446",
"0.5321018",
"0.53208524",
"0.53142303",
"0.53046966",
"0.5293175",
"0.5286475",
"0.5280144... | 0.6951896 | 0 |
PUT /workout_dates/1 PUT /workout_dates/1.xml | def update
@workout_date = WorkoutDate.find(params[:id])
@workout_date.n ||= WorkoutDate.next_free_n(@workout_date.workout_id)
respond_to do |format|
@workout_date.attributes = params[:workout_date]
@workout_date.n ||= WorkoutDate.next_free_n(@workout_date.workout_id)
if @workout_date.save
format.html { redirect_to(@workout_date, :notice => 'Workout date was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @workout_date.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n params[:workout][:workout_date] = \"#{params[:workout][:workout_date]} #{params[:workout][:time]}\"\n params[:workout] = params[:workout].slice(:workout_date, :exercises_attributes)\n @lift_name = params[:workout][:exercises_attributes][\"0\"][:lift_id]\n params[:workout][:exercises_attrib... | [
"0.6466926",
"0.6305549",
"0.62376297",
"0.62179786",
"0.62162477",
"0.61470854",
"0.6080528",
"0.6079957",
"0.60160094",
"0.5997504",
"0.5963951",
"0.5921279",
"0.59163254",
"0.59072113",
"0.590111",
"0.5874182",
"0.5834841",
"0.5828472",
"0.5825311",
"0.5823479",
"0.577128"... | 0.7209401 | 0 |
DELETE /workout_dates/1 DELETE /workout_dates/1.xml | def destroy
@workout_date = WorkoutDate.find(params[:id])
@workout_date.destroy
respond_to do |format|
format.html { redirect_to(workout_dates_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @workday = Workday.find(params[:id])\n @workday.destroy\n\n respond_to do |format|\n format.html { redirect_to(workdays_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @work_day = WorkDay.find(params[:id])\n @work_day.destroy\n\n respond_to do |format|... | [
"0.7041468",
"0.6995589",
"0.6731148",
"0.6535244",
"0.65325767",
"0.64842767",
"0.64820415",
"0.6452264",
"0.6441017",
"0.64244264",
"0.6418568",
"0.64005136",
"0.6399305",
"0.637215",
"0.6344849",
"0.63373333",
"0.62979835",
"0.62953335",
"0.62953335",
"0.6282979",
"0.62705... | 0.7478288 | 0 |
Returns a string of the names of the passed relation, joined by commas | def names_string(names)
names_array(names).join(', ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def joined_names\n values.map(&:name).join(\", \").gsub(/, ([^,]*)$/, ' and \\1')\n end",
"def print_relationships\n result = []\n self.relationships.each do |elt|\n result << elt.name\n end\n result.sort.join(', ')\n end",
"def relation_names(inclusions)\n inclusions.is_a?(H... | [
"0.71258056",
"0.69053185",
"0.6748596",
"0.66040945",
"0.6600441",
"0.6419389",
"0.6342749",
"0.6327136",
"0.6320628",
"0.6274929",
"0.6268798",
"0.6261551",
"0.625621",
"0.62458444",
"0.6230959",
"0.6222688",
"0.6222688",
"0.6215527",
"0.61948633",
"0.6187314",
"0.61628497"... | 0.63532656 | 6 |
Properly formats a users name before saving | def format_name(name)
properly_formatted_name = name.split(" ").map { |n| n.capitalize }
properly_formatted_name.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n \"#{user_name.titleize}\"\n end",
"def format_name(first, last)\n if first == \"\" || last == \"\"\n \tnil\n else \n \tfirst.gsub!(/[^A-Za-z]/, '')\n \tlast.gsub!(/[^A-Za-z]/, '')\n \tfirst = first.strip\n\tlast = last.split.join(\"\").strip\n\tuser_name = first[0] + last\n\tuser_name = user... | [
"0.7434844",
"0.73981434",
"0.7353373",
"0.72657585",
"0.7186673",
"0.7122764",
"0.70863557",
"0.7082365",
"0.7066278",
"0.7051968",
"0.7039955",
"0.70285785",
"0.7015837",
"0.6948754",
"0.6947922",
"0.6908256",
"0.6860105",
"0.68070054",
"0.68068314",
"0.6780877",
"0.6774014... | 0.0 | -1 |
Check if current user owns the bar | def ownsBar?
@bar = Bar.find(params[:id])
if current_user.partner?
if @bar.user_id != current_user.id
redirect_to @bar
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owned?\n user.present?\n end",
"def owned_by?(current_user)\n current_user && user_id == current_user.id\n end",
"def is_owner?\n Account.current ? Account.current.has_owner?(self) : false\n end",
"def is_owner\n object == current_user\n end",
"def owned_by?(u)\n self.user ==... | [
"0.7013058",
"0.6918239",
"0.6855861",
"0.6815349",
"0.67454743",
"0.6737007",
"0.6733292",
"0.67157644",
"0.6701448",
"0.66858906",
"0.66858625",
"0.6674703",
"0.66094726",
"0.66048867",
"0.66040355",
"0.659071",
"0.6569866",
"0.65680146",
"0.65594006",
"0.6551011",
"0.65479... | 0.78560495 | 0 |
GET /bars GET /bars.json | def index
@user=current_user
@bars = @user.bars
bar_num = @user.bars.count
logger.error "Bar Num: #{bar_num}"
respond_to do |format|
format.html # index.html.erb
format.json { render json: @bars }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bar = Bar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bar }\n end\n end",
"def index\n @non_smoking_bars = NonSmokingBar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { rende... | [
"0.72199893",
"0.6917442",
"0.68534553",
"0.659003",
"0.6574874",
"0.65155554",
"0.64921653",
"0.6453747",
"0.64261013",
"0.6343437",
"0.63363653",
"0.6336294",
"0.6326049",
"0.6323966",
"0.6316468",
"0.6292035",
"0.62902904",
"0.6285626",
"0.62817866",
"0.62789184",
"0.62741... | 0.7239235 | 0 |
GET /bars/1 GET /bars/1.json | def show
@bar = Bar.find(params[:id])
@user = @bar.user
@full_path = "http://#{request.host+request.fullpath}"
@week_set = @bar.week_passes.first
logger.error "#{@week_set.inspect}"
@pass_sets = @bar.pass_sets.where("selling_passes = ?", true).where("date >= ?", Date.today).order(:date)
@pass_sets_paginated = @bar.pass_sets.where("selling_passes = ?", true).where("date >= ?", Date.today).order(:date).paginate(:page => params[:valid_pass_sets_page], :per_page => 5)
@reservation_sets = @bar.pass_sets.where("selling_passes = ?", false).where("date >= ?", Date.today).order(:date)
@expired_sets= @bar.pass_sets.where("selling_passes = ?", false).where("date< ?", Date.today).order(:date).paginate(:page => params[:expired_pass_sets_page], :per_page => 5)
@expired_reservation_sets= @bar.pass_sets.where("selling_passes = ?", true).where("date< ?", Date.today).order(:date)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @bar }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bar = Bar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bar }\n end\n end",
"def show\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render j... | [
"0.7301808",
"0.6838989",
"0.67956614",
"0.6666125",
"0.6608982",
"0.65838176",
"0.64388996",
"0.6392662",
"0.632198",
"0.62877226",
"0.62600756",
"0.6169649",
"0.61664057",
"0.6162816",
"0.6145455",
"0.61089075",
"0.61079127",
"0.6088514",
"0.60845214",
"0.6034997",
"0.60336... | 0.0 | -1 |
GET /bars/new GET /bars/new.json | def new
@bar = Bar.new
@user = User.find(params[:id])
@bar.user = @user
@bar.user_id= @user.id
# @bar.pass_sets.build
# We do not want to create a default pass set when form is submitted;
respond_to do |format|
format.html # new.html.erb
format.json { render json: @bar }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @barrack = Barrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barrack }\n end\n end",
"def new\n @foobar = Foobar.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foobar }\n ... | [
"0.760679",
"0.7404021",
"0.7261965",
"0.7234801",
"0.72165775",
"0.7185467",
"0.7181618",
"0.7150022",
"0.7100442",
"0.7073419",
"0.69841903",
"0.69841903",
"0.69488084",
"0.69226027",
"0.69226027",
"0.69226027",
"0.69226027",
"0.69226027",
"0.69226027",
"0.69226027",
"0.692... | 0.0 | -1 |
POST /bars POST /bars.json | def create
@bar = Bar.new(params[:bar])
@bar.address = @bar.street_address + ", " + @bar.city + ", " + @bar.state + ", " + @bar.zip_code
@user = User.find(params[:os])
@bar.user = @user
@bar.user_id= @user.id
respond_to do |format|
if @bar.save
format.html { redirect_to user_bar_path(@bar.user,@bar), notice: 'Bar was successfully created.' }
format.json { render json: @bar, status: :created, location: @bar }
else
format.html { render action: "new" }
format.json { render json: @bar.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @bar = Bar.new(bar_params)\n\n respond_to do |format|\n if @bar.save\n format.html { redirect_to @bar, notice: 'Bar was successfully created.' }\n format.json { render :show, status: :created, location: @bar }\n else\n format.html { render :new }\n format.js... | [
"0.7015154",
"0.66229284",
"0.6622587",
"0.6475135",
"0.644973",
"0.64275193",
"0.6404741",
"0.63830215",
"0.63785934",
"0.6372432",
"0.6368599",
"0.6358431",
"0.6346333",
"0.63435334",
"0.63336086",
"0.6321769",
"0.63117814",
"0.62852633",
"0.6241753",
"0.62237",
"0.62141997... | 0.6176596 | 24 |
PUT /bars/1 PUT /bars/1.json | def update
@bar = Bar.find(params[:id])
@user = User.find(params[:os])
@pass_set = @bar.pass_sets.first
if(current_user.admin?)
respond_to do |format|
if @bar.update_attributes(params[:bar])
format.html { redirect_to user_bar_path(@bar.user,@bar), notice: 'Bar was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @bar.errors, status: :unprocessable_entity }
end
end
else
respond_to do |format|
if @bar.update_attributes(params[:bar])
format.html { redirect_to bar_path(@bar), notice: 'Bar was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @bar.errors, status: :unprocessable_entity }
end
end
end
@bar.address = @bar.street_address + " , " + @bar.city + " , " + @bar.state + " , " + @bar.zip_code
@bar.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @bar.update(bar_params)\n format.html { redirect_to @bar, notice: 'Bar was successfully updated.' }\n format.json { render :show, status: :ok, location: @bar }\n else\n format.html { render :edit }\n format.json { render json: @bar.e... | [
"0.64634204",
"0.6191418",
"0.6111844",
"0.6105332",
"0.60312885",
"0.6023805",
"0.59855235",
"0.59817237",
"0.5941277",
"0.59379",
"0.5935086",
"0.59302187",
"0.58997196",
"0.58921075",
"0.5888707",
"0.58763015",
"0.58694494",
"0.58605283",
"0.5811193",
"0.5807063",
"0.57880... | 0.5451584 | 74 |
DELETE /bars/1 DELETE /bars/1.json | def destroy
@bar = Bar.find(params[:id])
@user = @bar.user
@bar.destroy
respond_to do |format|
format.html { redirect_to @user, notice: 'Bar was successfully deleted.'}
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # Make sure the request came from an admin\n unless session[:admin_id]\n redirect_to_home\n return\n end\n \n @bar = Bar.find(params[:id])\n @bar.destroy\n\n respond_to do |format|\n format.html { redirect_to bars_url }\n format.json { head :no_content }\n en... | [
"0.724319",
"0.71792454",
"0.7177813",
"0.7165371",
"0.7165371",
"0.6990378",
"0.6988258",
"0.69763017",
"0.69685704",
"0.6950314",
"0.69499195",
"0.6913562",
"0.6891001",
"0.6868151",
"0.6860085",
"0.6858035",
"0.68447393",
"0.6841203",
"0.6836806",
"0.6824835",
"0.68147534"... | 0.6767759 | 26 |
Use callbacks to share common setup or constraints between actions. | def set_post
@post = FlaggedPost.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 post_params
params.require(:flagged_post).permit(:post_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 |
Ler valor do campo. Converte o final de linha para utilizar `universal_newline`. | def ler_campo(campo)
value = pdf.field(campo).value
value = value.encode(:universal_newline => true) if value
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_lf\n self.gsub(\"\\n\\r\",\"\\n\").gsub(\"\\r\",\"\\n\")\n end",
"def line_ending=(value)\n @line_ending = value || \"\\r\\n\"\n end",
"def get_text(value, id, field, *args)\n opt = args.extract_options!\n value = value.to_s\n if value.eql?(\"\")\n msg = \"#{field} doit ne doit... | [
"0.57211465",
"0.55917627",
"0.55690736",
"0.5446763",
"0.54405385",
"0.53510517",
"0.5330706",
"0.52826864",
"0.5273731",
"0.52631503",
"0.5261163",
"0.524567",
"0.52439344",
"0.523785",
"0.5226357",
"0.52121085",
"0.52060765",
"0.5203064",
"0.5202435",
"0.518875",
"0.518160... | 0.72110367 | 0 |
Substitui ',' e ';' por '.' | def atualiza_palavras_chave(h)
['palavras_chave', 'palabras_clave', 'keywords', 'mots_cles'].each do |p|
if(h[p])
h[p] = h[p].gsub(/[;,]/, '.')
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_period stringthing\n stringthing << \".\"\nend",
"def to_german_s\n self.to_s.gsub('.', ',')\n end",
"def substitute_with_dot(s) # Expression reguliére Numéro de téléphone\r\n puts s.sub(/(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/, '\\1.\\2.\\3.\\4.\\5')\r\nend",
"def period_separator\n '... | [
"0.6539662",
"0.63068235",
"0.63050824",
"0.6161663",
"0.6155037",
"0.61236495",
"0.6061604",
"0.60471284",
"0.6034868",
"0.6034868",
"0.6034868",
"0.6029073",
"0.60264635",
"0.60264635",
"0.6014204",
"0.5962811",
"0.5962811",
"0.5962811",
"0.5958823",
"0.5871597",
"0.5863047... | 0.5179866 | 92 |
get a nicely formatted bit of text for pasting into other services get work title, word count, and creator and add formatting for share code | def get_embed_link_title(work)
title_link = link_to(content_tag(:strong, work.title.html_safe), work_url(work)) + " (#{work.word_count} #{ts('words')})"
if work.anonymous?
profile_link = ts("Anonymous")
else
profile_link = work.pseuds.map {|pseud| link_to(content_tag(:strong, pseud.name), user_url(pseud.user))}.join(', ').html_safe
end
title_link + ts(" by ") + profile_link
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def watermark_formatted_text\n struct = export_as_mla_structure(parent_presenter)\n wrapped = wrap_text(struct[:author] + '___' + struct[:title], 150)\n parts = wrapped.split('___')\n [{ text: parts[0] },\n { text: parts[1], styles: [:italic] },\n { text: \"\\n\" + wrap_text(struct[... | [
"0.677745",
"0.6328147",
"0.63009894",
"0.62588334",
"0.62258023",
"0.62103194",
"0.6116299",
"0.60984343",
"0.609586",
"0.60921323",
"0.6019484",
"0.60093164",
"0.600712",
"0.5985196",
"0.5946165",
"0.5945285",
"0.5944827",
"0.5937534",
"0.59354365",
"0.5925769",
"0.5883614"... | 0.5799867 | 25 |
get work information for share code | def get_embed_link_meta(work)
chapters_text = ts("Chapters: ") + work.chapter_total_display + tag("br")
fandom_text = add_label_for_embed(ts("Fandom: "), work.fandoms.map {|fandom| link_to fandom.name, tag_url(fandom)}.join(', ').html_safe, tag("br"))
rating_text = add_label_for_embed(ts("Rating: "), work.ratings.map {|rating| rating.name}.join(', '), tag("br"))
warning_text = add_label_for_embed(ts("Warnings: "), work.warnings.map {|warning| warning_display_name(warning.name)}.join(', '), tag("br"))
relationship_text = add_label_for_embed(ts("Relationships: "), work.relationships.map {|rel| rel.name}.join(', '), tag("br"))
char_text = add_label_for_embed(ts("Characters: "), work.characters.map {|char| char.name}.join(', '), tag("br"))
tags_text = add_label_for_embed(ts("Additional Tags: "), work.freeforms.map {|freeform| freeform.name}.join(', '), tag("br"))
if work.series.count != 0
series_text = add_label_for_embed(ts("Series: "), series_list_for_feeds(work), tag("br"))
end
summary_text = add_label_for_embed(ts("Summary: "), sanitize_field(work, :summary))
if work.series.count != 0
[chapters_text, fandom_text, rating_text, warning_text, relationship_text, char_text, tags_text, series_text, summary_text].compact.join
else
[chapters_text, fandom_text, rating_text, warning_text, relationship_text, char_text, tags_text, summary_text].compact.join
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_work\n\n end",
"def get_work\n client.make_request('/get-work', 'post', params: {})\n end",
"def get_related_works_metadata\n pid = self.pid.split(':').last\n ActiveFedora::SolrService.query(\"is_part_of_ssim:*#{pid}\",\n {:rows => ActiveFedora::SolrService.count(\"is_part_o... | [
"0.633106",
"0.6257991",
"0.62526166",
"0.6204615",
"0.613093",
"0.6123396",
"0.591122",
"0.59081686",
"0.5837792",
"0.5768835",
"0.5635577",
"0.56336355",
"0.56281114",
"0.55948764",
"0.5444079",
"0.5435236",
"0.53702056",
"0.53601986",
"0.5315053",
"0.5315053",
"0.5315053",... | 0.0 | -1 |
combine title, word count, creator, and meta to make copy and paste share code for a work | def get_embed_link(work)
[get_embed_link_title(work), tag("br"), get_embed_link_meta(work)].compact.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tumblr_embed_link_title(work)\n title = work.title + \" (#{work.word_count} #{ts('words')})\".html_safe\n if work.anonymous?\n pseud = ts(\"Anonymous\")\n else\n pseud = work.pseuds.map {|pseud| (pseud.name)}.join(', ').html_safe\n end\n title + ts(\" by \") + pseud + ts(\" [#{Arch... | [
"0.5983379",
"0.5955121",
"0.58728397",
"0.57913786",
"0.5790801",
"0.56952477",
"0.5628711",
"0.56166023",
"0.559715",
"0.55876726",
"0.55703324",
"0.5523867",
"0.5523867",
"0.5501993",
"0.54976624",
"0.5496494",
"0.5476798",
"0.5465018",
"0.54594624",
"0.54473245",
"0.54360... | 0.0 | -1 |
get bookmark information for share code | def get_embed_link_bookmark_meta(bookmark)
if bookmark.bookmarkable.is_a?(Work)
tags_text = add_label_for_embed(ts("Bookmarker's Tags: "), bookmark.tags.map {|tag| tag.name}.join(", "), tag("br"))
bookmark_text = add_label_for_embed(ts("Bookmarker's Notes: "), raw(sanitize_field(bookmark, :notes)))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bookmark bookmark_index\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n if bookmark_index == ''\n raise 'bookmark index not specified'\n end\n \n \n str_... | [
"0.6723008",
"0.63044655",
"0.60602486",
"0.59661835",
"0.5951488",
"0.5951488",
"0.59444875",
"0.59408504",
"0.5929086",
"0.5898558",
"0.58874476",
"0.58850497",
"0.58586013",
"0.58509403",
"0.5845583",
"0.5845583",
"0.58297163",
"0.58106583",
"0.57961595",
"0.5708921",
"0.5... | 0.5989625 | 3 |
combine full copy and paste share code for a work with bookmark information to make copy and paste share code for a bookmark | def get_bookmark_embed_link(bookmark)
if bookmark.bookmarkable.is_a?(Work)
work_embed = get_embed_link(bookmark.bookmarkable)
bookmark_meta = get_embed_link_bookmark_meta(bookmark)
[work_embed, bookmark_meta].compact.join
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bookmarklet\n text 'Drag the following link to your toolbar to submit with a single click: '\n a 'bookmark-it!', :href =>\"javascript:location.href='http:#{URL(New)}?page_link='+encodeURIComponent(location.href)+'&description='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(window... | [
"0.59414124",
"0.5797773",
"0.5734673",
"0.5696541",
"0.56300026",
"0.5590035",
"0.5543198",
"0.5525168",
"0.5504943",
"0.54897076",
"0.54810566",
"0.5478469",
"0.5453751",
"0.5412441",
"0.5410088",
"0.53950024",
"0.5346066",
"0.5345692",
"0.5321601",
"0.5315556",
"0.5302797"... | 0.54049146 | 15 |
get work title, word count, and creator and add app short name, but do not add formatting so it can be link text for Tumblr sharing | def get_tumblr_embed_link_title(work)
title = work.title + " (#{work.word_count} #{ts('words')})".html_safe
if work.anonymous?
pseud = ts("Anonymous")
else
pseud = work.pseuds.map {|pseud| (pseud.name)}.join(', ').html_safe
end
title + ts(" by ") + pseud + ts(" [#{ArchiveConfig.APP_SHORT_NAME}]")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_embed_link_title(work)\n title_link = link_to(content_tag(:strong, work.title.html_safe), work_url(work)) + \" (#{work.word_count} #{ts('words')})\"\n if work.anonymous?\n profile_link = ts(\"Anonymous\")\n else\n profile_link = work.pseuds.map {|pseud| link_to(content_tag(:strong, pseud... | [
"0.66459537",
"0.6177781",
"0.61711854",
"0.61355764",
"0.5773704",
"0.5767122",
"0.5767122",
"0.5737087",
"0.56912434",
"0.56509954",
"0.5647318",
"0.5632224",
"0.5528442",
"0.5511329",
"0.5499005",
"0.5496167",
"0.5492917",
"0.5491244",
"0.5452063",
"0.54501724",
"0.5444358... | 0.69450194 | 0 |
combine work information and bookmark information to make body of link post for Tumblr sharing | def get_tumblr_bookmark_embed_link(bookmark)
if bookmark.bookmarkable.is_a?(Work)
work_meta = get_embed_link_meta(bookmark.bookmarkable)
bookmark_meta = get_embed_link_bookmark_meta(bookmark)
[work_meta, bookmark_meta].compact.join
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_embed_link_bookmark_meta(bookmark)\n if bookmark.bookmarkable.is_a?(Work)\n tags_text = add_label_for_embed(ts(\"Bookmarker's Tags: \"), bookmark.tags.map {|tag| tag.name}.join(\", \"), tag(\"br\"))\n bookmark_text = add_label_for_embed(ts(\"Bookmarker's Notes: \"), raw(sanitize_field(bookmark... | [
"0.6775335",
"0.63131684",
"0.62873596",
"0.6010329",
"0.59827715",
"0.59300524",
"0.59000385",
"0.58711743",
"0.5858448",
"0.5822137",
"0.579201",
"0.569745",
"0.5637889",
"0.56015116",
"0.5598501",
"0.55924624",
"0.55830616",
"0.5528109",
"0.5501422",
"0.5495232",
"0.548938... | 0.7089161 | 0 |
when they are passed to another. To drive home the salient aspects of variable scope and modification of one scope by another, consider the following similar sets of code. What will be printed by each of these code groups? A) | def mess_with_vars(one, two, three)
one = two
two = three
three = one
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mess_with_vars(one, two, three)\n one = two # one now points to \"two\" within the method\n two = three # two now points to \"three\" within the method\n three = one # three now points to \"one\" within the method\n # Thi... | [
"0.68632805",
"0.65819883",
"0.652805",
"0.6519202",
"0.64906853",
"0.6449798",
"0.637206",
"0.63184196",
"0.6284817",
"0.610484",
"0.610484",
"0.61010736",
"0.61010736",
"0.61010736",
"0.60431606",
"0.6042078",
"0.6016355",
"0.60109496",
"0.59895194",
"0.5980255",
"0.5957342... | 0.6214006 | 18 |
three Reassingment inside a method never changes outer scope variables B) | def mess_with_vars(one, two, three)
one = "two"
two = "three"
three = "one"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mess_with_vars(one, two, three)\n one = two # one now points to \"two\" within the method\n two = three # two now points to \"three\" within the method\n three = one # three now points to \"one\" within the method\n # Thi... | [
"0.6916111",
"0.64685756",
"0.6455309",
"0.64287907",
"0.6294201",
"0.62864244",
"0.62864244",
"0.62864244",
"0.62864244",
"0.62864244",
"0.62864244",
"0.62864244",
"0.62864244",
"0.62864244",
"0.62864244",
"0.62418205",
"0.6169313",
"0.60318154",
"0.5901867",
"0.58454067",
"... | 0.5406255 | 60 |
three Reassingment inside a method never changes outer scope variables C) | def mess_with_vars(one, two, three)
one.gsub!("one","two")
two.gsub!("two","three")
three.gsub!("three","one")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mess_with_vars(one, two, three)\n one = two # one now points to \"two\" within the method\n two = three # two now points to \"three\" within the method\n three = one # three now points to \"one\" within the method\n # Thi... | [
"0.7129785",
"0.6920698",
"0.6730664",
"0.6730664",
"0.6730664",
"0.6730664",
"0.6730664",
"0.6730664",
"0.6730664",
"0.6730664",
"0.6730664",
"0.6730664",
"0.6515306",
"0.62694323",
"0.62221247",
"0.61858654",
"0.60906506",
"0.60870874",
"0.6061937",
"0.6061937",
"0.6030887"... | 0.0 | -1 |
Generate and return unique refresh token for the resource | def uniq_refresh_token(resource)
loop do
random_token = SecureRandom.urlsafe_base64
return random_token unless refresh_tokens_for(resource).exists?(token: random_token)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_token\n self.generate_token\n end",
"def generate_refresh_token\n @raw_refresh_token = UniqueToken.generate\n secret_strategy.store_secret(self, :refresh_token, @raw_refresh_token)\n end",
"def fresh_token\n refresh! if expired?\n access_token\n end",
"def fresh_token\n ... | [
"0.83018816",
"0.8106375",
"0.7696552",
"0.7558874",
"0.75575274",
"0.73748446",
"0.7361421",
"0.7359838",
"0.73232025",
"0.728912",
"0.7160387",
"0.7153414",
"0.7144407",
"0.7128024",
"0.71083486",
"0.71083486",
"0.70963556",
"0.70921475",
"0.7071558",
"0.70662814",
"0.70485... | 0.8068825 | 3 |
Create a new refresh_token for the current resource This creates expired refresh_token if the argument 'expired_refresh_token' is true which can be used for testing. | def new_refresh_token(resource, expired_refresh_token = false)
return unless refresh_token_enabled?(resource)
refresh_tokens_for(resource).create(token: uniq_refresh_token(resource), expire_at: expired_refresh_token ? Time.now.utc : refresh_token_expire_at).token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_refresh_token(resource)\n return unless refresh_token_enabled?(resource)\n\n refresh_tokens_for(resource).create(token: uniq_refresh_token(resource)).token\n end",
"def fresh_token\n refresh! if expired?\n access_token\n end",
"def fresh_token\n refresh! if token_expired?\n... | [
"0.7788377",
"0.74793905",
"0.74458784",
"0.72631013",
"0.7175101",
"0.71589994",
"0.71254283",
"0.7030101",
"0.70175695",
"0.6974516",
"0.69256014",
"0.68904",
"0.68903506",
"0.6885607",
"0.6871024",
"0.6859389",
"0.6858554",
"0.68583083",
"0.68508655",
"0.6804896",
"0.67989... | 0.8501941 | 0 |
Number of accounts to be displayed per page | def index
@page = params.fetch(:page, 0).to_i # Current page in the table pagination
if (params.has_key?(:user_id))
# If admin is trying to view all accounts for a specific user
@accounts = get_accounts_by_user
else
@accounts = Account.all
end
# If search box has been used to query
if(params.has_key?(:search_account))
@accounts = search()
end
@accounts = filter(@accounts)
# Route for CSV file
respond_to do |format|
format.html
format.csv { send_data Account.export_csv(@accounts) } # Send the data to the Account model along with the current_user
end
paginate # Paginate the page
@accounts = @accounts[@page * ACCOUNTS_PER_PAGE, ACCOUNTS_PER_PAGE] # Set the variable to contain all accounts in the current page
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_count; pages.count; end",
"def per_page\n 6\n end",
"def total_accounts\n return @@total_accounts\n end",
"def entries_per_page\n @entries_per_page\n end",
"def per_page; end",
"def num_pages\n (count.to_f / options[:limit]).ceil\n end",
"def num_pages\n ... | [
"0.72931355",
"0.70681006",
"0.7040193",
"0.6990697",
"0.69690263",
"0.69627434",
"0.6893966",
"0.6885026",
"0.6866451",
"0.6864408",
"0.683354",
"0.68218255",
"0.68165696",
"0.68074757",
"0.6804512",
"0.6781502",
"0.6780675",
"0.67750007",
"0.6772278",
"0.6768321",
"0.676766... | 0.0 | -1 |
Function to search for certain accounts | def search
return @accounts.select{|el| el.created_at.to_s.starts_with?(params[:search_account]) || el.id.to_s.starts_with?(params[:search_account]) ||
el.user_id.to_s.starts_with?(params[:search_account]) ||
el.sortCode.to_s.starts_with?(params[:search_account]) || el.balance.to_s.starts_with?(params[:search_account]) ||
el.currency.to_s.starts_with?(params[:search_account])}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n\n @accounts = []\n \n PgSearch.multisearch(params['search-string']).where(:searchable_type => \"Account\").find_each do |document|\n @accounts << document.searchable if Account.user_readable(current_user).include?(document.searchable)\n end\n\n respond_to do |format|\n forma... | [
"0.7607556",
"0.7295856",
"0.711222",
"0.71052784",
"0.7049621",
"0.6710896",
"0.66104686",
"0.65662223",
"0.6525207",
"0.65151006",
"0.6494368",
"0.648067",
"0.6405963",
"0.63883007",
"0.6388036",
"0.63308346",
"0.63261086",
"0.63086146",
"0.6296562",
"0.62584424",
"0.624636... | 0.8454986 | 0 |
Returns all accounts of a user | def get_accounts_by_user
return User.find(params[:user_id]).accounts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_users\n result = []\n api.search(accounts_dn, ::LDAP::LDAP_SCOPE_SUBTREE, accounts_filter) do |user|\n result << user.to_hash\n end\n result\n end",
"def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end",
"def all... | [
"0.8059826",
"0.7578594",
"0.7331284",
"0.7319908",
"0.73104864",
"0.7234268",
"0.7230192",
"0.7214428",
"0.7188719",
"0.7081064",
"0.70533794",
"0.70412976",
"0.7034755",
"0.70326185",
"0.7022967",
"0.7007675",
"0.6994388",
"0.6990747",
"0.69714296",
"0.6967157",
"0.6959315"... | 0.813688 | 0 |
Function that paginates the transactions into different pages | def paginate
@max_pages = (@accounts.size/ACCOUNTS_PER_PAGE) + 1
if(@max_pages == 0)
@max_pages = 1 # Because @max_pages indexes from 0, if its 0 change it to 1
end
# Boundary conditions for pages, a user should not be able to paginate under 0 or over the max limit
if(@page >= @max_pages || @page < 0)
redirect_to admin_accounts_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate\n @max_pages = (@transactions_all.size/TRANSACTIONS_PER_PAGE) + 1\n if(@max_pages == 0)\n @max_pages = 1 # Because @max_pages indexes from 0, if its 0 change it to 1\n end\n\n # Boundary conditions for pages, a user should not be able to pagin... | [
"0.7850704",
"0.77811754",
"0.7517259",
"0.71172744",
"0.7065208",
"0.69135666",
"0.675688",
"0.6678287",
"0.6659658",
"0.6646326",
"0.6643185",
"0.66034776",
"0.65981895",
"0.6592043",
"0.6584673",
"0.65780944",
"0.65637285",
"0.65294486",
"0.65227765",
"0.650871",
"0.649458... | 0.63019985 | 37 |
and returns a sorted array containing only the numbers whose square is also in the array get_squares [9] => [] get_squares [9,3] => [3] get_squares [9,3,81] => [3, 9] get_squares [25, 4, 9, 6, 50, 16, 5] => [4, 5] This time you will have to define the method, it's called: get_squares | def get_squares(array)
squares = array.map {|item| item * item} # gives an array of the square values
in_both = squares & array # returns elements that feature in both arrays
selects = in_both.map {|x| Math.sqrt(x).to_i} # finds the square root of those elements
array.select {|x| selects.include?(x)}.sort # selects all the matching elements in the original array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_squares array\n\tnew_array = []\n\tarray.each do |number|\n\tif array.include? number**2 \n\tnew_array << number\n\tend\nend \n\treturn new_array.sort \nend",
"def get_squares(array)\n square_array = []\n for number in array\n square = number * number\n for potential_square in array\n... | [
"0.83638173",
"0.83100057",
"0.82405996",
"0.7962207",
"0.79586107",
"0.7951673",
"0.7918337",
"0.7896086",
"0.7813187",
"0.7691921",
"0.76231414",
"0.75755894",
"0.7530129",
"0.75220764",
"0.7513512",
"0.7497002",
"0.748611",
"0.73420304",
"0.73193765",
"0.7199361",
"0.70937... | 0.6928865 | 23 |
On the fly protocol, and only evaluated when the gel is cut so no cost is accrued | def cost(op)
{ materials: 0.84, labor: 1.24 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standard_cost_code; end",
"def included_in_cost\n false\n end",
"def cost\n 0.89\n end",
"def cost\n @cost = 0.89\n end",
"def cost\r\n 0\r\n end",
"def compute(object)\n @seller = self.calculable.seller if self.calculable && self.calculable.respond_to?(:seller)\n weight =... | [
"0.6304914",
"0.5815532",
"0.57563525",
"0.5739723",
"0.5721982",
"0.57071155",
"0.56437075",
"0.5632992",
"0.5602989",
"0.55863863",
"0.55743575",
"0.55717504",
"0.55717504",
"0.55601335",
"0.554685",
"0.55201083",
"0.55175394",
"0.55144346",
"0.5508427",
"0.55059355",
"0.54... | 0.57534355 | 3 |
GET /posts GET /posts.json | def index
@posts = Post.paginate(:page => params[:page], :per_page => 25).all.sort { |a,b| -(a.score <=> b.score) }
@user = current_user
@title = "Top New Action Sports Videos"
if params[:post]
@post = Post.find(params[:post])
else
@post = @posts.first
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @posts }
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n ... | [
"0.7865315",
"0.7494904",
"0.7494433",
"0.7494433",
"0.7488696",
"0.74314564",
"0.728645",
"0.728645",
"0.728645",
"0.72562826",
"0.72522277",
"0.7247287",
"0.7246305",
"0.72221965",
"0.72042215",
"0.72039723",
"0.7169929",
"0.71689725",
"0.71644753",
"0.7121855",
"0.71152896... | 0.0 | -1 |
GET /posts/1 GET /posts/1.json | def show
@post = Post.find(params[:id])
@comments = @post.comments.all
@comment = @post.comments.new
@user = current_user
@title = @post.title
respond_to do |format|
format.html # show.html.erb
format.json { render json: @post }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
... | [
"0.77110183",
"0.73537844",
"0.73433185",
"0.73379177",
"0.73228735",
"0.7293139",
"0.7275997",
"0.7256934",
"0.7161576",
"0.7158913",
"0.71552676",
"0.71552676",
"0.7119547",
"0.7094749",
"0.7094749",
"0.7094749",
"0.70943594",
"0.7071599",
"0.70607626",
"0.70452625",
"0.703... | 0.0 | -1 |
GET /posts/new GET /posts/new.json | def new
@user = User.find(params[:user_id])
@post = Post.new(:user_id => @user.id)
@title = "New Post"
respond_to do |format|
format.html # new.html.erb
format.json { render json: @post }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\... | [
"0.8041974",
"0.80156785",
"0.79855186",
"0.7931169",
"0.79215",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"0.79208946",
"... | 0.7443868 | 48 |
POST /posts POST /posts.json | def create
@user = current_user
@post = @user.posts.build(params[:post])
respond_to do |format|
if @post.save
format.html { redirect_to :action => 'index', notice: 'Post was successfully created.' }
format.json { render json: @post, status: :created, location: @post }
format.js
else
format.html { render action: "new" }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n respond_with Post.create(params[:posts])\n end",
"def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end",
"def create\n @post = Post.new(post_params)\n @po... | [
"0.74463975",
"0.73221767",
"0.73072433",
"0.7123966",
"0.7015686",
"0.701327",
"0.69841874",
"0.6939327",
"0.69313824",
"0.69053805",
"0.68196476",
"0.6812792",
"0.6793222",
"0.6792862",
"0.6779654",
"0.6779654",
"0.67625546",
"0.67602354",
"0.67515427",
"0.6735786",
"0.6698... | 0.0 | -1 |
PUT /posts/1 PUT /posts/1.json | def update
@post = Post.find(params[:id])
respond_to do |format|
if @post.update_attributes(params[:post])
format.html { redirect_to :action => 'index', notice: 'Post was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def update\n title = params[:title]\n body ... | [
"0.7308219",
"0.7123652",
"0.68159384",
"0.66432106",
"0.66181636",
"0.6607148",
"0.6583982",
"0.6564183",
"0.6552021",
"0.6532697",
"0.6511846",
"0.64877653",
"0.6446283",
"0.64321554",
"0.64155626",
"0.638547",
"0.63833165",
"0.63661736",
"0.63641906",
"0.6363359",
"0.63632... | 0.6148211 | 68 |
DELETE /posts/1 DELETE /posts/1.json | def destroy
@post = Post.find(params[:id])
@post.destroy
respond_to do |format|
format.html { redirect_to :action => 'index', :controller => 'admin' }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: param... | [
"0.8046884",
"0.76902676",
"0.7583626",
"0.75803024",
"0.7568048",
"0.75047046",
"0.75031126",
"0.74750155",
"0.74671036",
"0.74650854",
"0.746482",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"... | 0.0 | -1 |
def upvote post = Post.find(params[:id]) if post.votes? post.votes += 1 else post.votes.nil? post.votes = 1 end post.save redirect_to :action => 'index' end | def vote
#params[:answer_id][:vote]
#it can be "1" or "-1"
@post = Post.find(params[:post_id])
@post.vote!(params[:post_id][:votes])
redirect_to :action => 'index'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upvote\n @post = Post.find(params[:id])\n @post_count = Post.count\n @vote = Vote.new(user_id: session[:id], post_id: @post.id, score: 1)\n if @vote.save\n @post.update_attribute(:respect, @post.respect + 1)\n flash[:notice] = 'Post upvoted successfully'\n end\n redirect_to(action: ... | [
"0.897672",
"0.89054155",
"0.8842393",
"0.8675116",
"0.8598503",
"0.8454977",
"0.8420896",
"0.8388712",
"0.8378782",
"0.8331627",
"0.8216142",
"0.81983894",
"0.81613886",
"0.8126594",
"0.8084313",
"0.80793554",
"0.8054903",
"0.80542254",
"0.8052097",
"0.8050498",
"0.7990004",... | 0.79873025 | 21 |
def prefcontactmethod attributes = attributes_before_type_cast if attributes["prefcontactmethod"] read_attribute(:prefcontactmethod).to_sym else nil end end def prefcontactmethod=(value) write_attribute(:prefcontactmethod, value.to_s) end def gender attributes = attributes_before_type_cast if attributes["gender"] read_attribute(:gender).to_sym else nil end end def gender=(value) write_attribute(:gender, value.to_s) end def middleinitial attributes = attributes_before_type_cast if attributes["middleinitial"] read_attribute(:middleinitial).to_sym else nil end end def middleinitial=(value) write_attribute(:middleinitial, value.to_s) end def relatedas attributes = attributes_before_type_cast if attributes["relatedas"] read_attribute(:relatedas).to_sym else nil end end def relatedas=(value) write_attribute(:relatedas, value.to_s) end | def sanitize_input
# to remove whitespace, use
# self.<fieldname>.strip!
self.homephone = self.homephone.gsub(/\D/,'') if !self.homephone.blank?
self.workphone = self.workphone.gsub(/\D/,'') if !self.workphone.blank?
self.cellphone = self.cellphone.gsub(/\D/,'') if !self.cellphone.blank?
self.fax = self.fax.gsub(/\D/,'') if !self.fax.blank?
self.prefcontactmethod = :Email if self.prefcontactmethod.blank?
# self.email = self.email.downcase if self.email.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_derived_fields\n self.credit_for_mil_training = to_yes_string(vet2)\n self.vet_poc = to_yes_string(vet3)\n self.student_vet_grp_ipeds = to_yes_string(vet4)\n self.soc_member = to_yes_string(vet5)\n self.calendar = to_calendar(calsys)\n self.online_all = to_true_string(distnced)\n\n tru... | [
"0.6291056",
"0.62676156",
"0.6024319",
"0.6013294",
"0.5937663",
"0.58474886",
"0.578254",
"0.576899",
"0.5750311",
"0.5688473",
"0.5675087",
"0.5646146",
"0.56441826",
"0.5626845",
"0.5625249",
"0.561269",
"0.5579249",
"0.5570395",
"0.55640906",
"0.5558654",
"0.55461764",
... | 0.51980716 | 84 |
=begin goal: sort the array of words, using the '<' method keep two lists 1. alreadysorted words 2. stillunsorted words take the list of words finds the "smallest" word stick it at the end of the alreadysorted list do it (find the "smallest word" again, but using the stillunsorted list instead of the original list) =end =begin how do we stop the loop (how do we get to return?) find the smallest word, using '<' pass the word to each item in the array if var = true add the item to the sorted array else pass the next word to each item in the array =end | def sort some_array
some_array = some_array.downcase.split
recursive_sort some_array, []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_method(unsorted_array, sorted_array)\n if unsorted_array.length <= 0 #checking if there is any words left to sort\n return sorted_array #if no words then output is the complete sorted array\n end\n \nsmallest = unsorted_array.pop #select a word from the end of the unsorted array\nstill_uns... | [
"0.794639",
"0.79321",
"0.7755935",
"0.7740845",
"0.7659268",
"0.7609467",
"0.73563355",
"0.73428315",
"0.7117893",
"0.70132184",
"0.69462055",
"0.6934479",
"0.69057506",
"0.6895829",
"0.67031765",
"0.6688227",
"0.66349554",
"0.6593706",
"0.65816164",
"0.6574319",
"0.65742826... | 0.0 | -1 |
Destroy the working directory and its contents. | def teardown
FileUtils.rm_r(test_log_directory) if File.directory?(test_log_directory)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n FileUtils.rm_rf(@working_dir)\n end",
"def destroy\n FileUtils.rm_r(directory) if exist?\n end",
"def destroy()\n\n path = self.get_dir\n FileUtils.remove_entry_secure(path, true)\n _clean_dir(File.dirname(path))\n\n super()\n end",
"def destroy\n delete_file... | [
"0.8710346",
"0.80546916",
"0.8042535",
"0.7671243",
"0.76456404",
"0.76392275",
"0.7562076",
"0.7542549",
"0.74584264",
"0.7337562",
"0.72397196",
"0.72017103",
"0.7188622",
"0.7183379",
"0.71511066",
"0.7071274",
"0.70559454",
"0.704907",
"0.7040207",
"0.70290685",
"0.69604... | 0.0 | -1 |
projects: kickstarter.css("li.project.grid_4") title: project.css("h2.bbcard_name strong a").text image link: project.css("div.projectthumbnail a img").attribute("src").value description: project.css("p.bbcard_blurb").text location: project.css("ul.projectmeta span.locationname").text percent_funded: project.css("ul.projectstats li.first.funded strong").text.gsub("%","").to_i | def create_project_hash
# This just opens a file and reads it into a variable
# We iterate through the kickstarter nokogiri html to grab the project title of each project.
# The method converts the title to a symbol (symbols are better keys for a hash).
# The key's value, the hash, gets all the other values we found about the projects.
html = File.read('fixtures/kickstarter.html')
kickstarter = Nokogiri::HTML(html)
projects = {}
kickstarter.css("li.project.grid_4").each do |project|
title = project.css("h2.bbcard_name strong a").text
projects[title.to_sym] = {
:image_link => project.css("div.project-thumbnail a img").attribute("src").value,
:description => project.css("p.bbcard_blurb").text,
:location => project.css("ul.project-meta span.location-name").text,
:percent_funded => project.css("ul.project-stats li.first.funded strong").text.gsub("%","").to_i
}
end
# return the projects hash
projects
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_project_hash\n \n html=File.read('fixtures/kickstarter.html')\n \n kickstarter = Nokogiri::HTML(html)\n \n projects={}\n \n #iterate through the projects \n kickstarter.css(\"li.project.grid_4\").each do |project|\n title=project.css(\"h2.bbcard_name strong a\").text\n projects[title.to_s... | [
"0.6893128",
"0.68930477",
"0.6881331",
"0.6842117",
"0.68400663",
"0.6810617",
"0.6774395",
"0.67251796",
"0.66938525",
"0.6660947",
"0.6623843",
"0.6591818",
"0.6421324",
"0.6298305",
"0.585375",
"0.585375",
"0.57748455",
"0.5697666",
"0.56644326",
"0.5554022",
"0.5525418",... | 0.6302533 | 13 |
Only allow a trusted parameter "white list" through. | def staff_params
params.require(:staff).permit(:name, :title, :photo_id, :bio)
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 |
executes a select from a table | def select(table, type, where = {}, and_or = "and", equals_like = "=", order_by = "")
order = order_by.empty? ? '' : " ORDER BY #{order_by}"
sql = "select * from #{table} #{where_clause(where, and_or, equals_like)}#{order};"
execute(sql).collect { |r| type.new.from_sql(r) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select(sql, name = nil, binds = [])\n exec_query(sql, name, binds)\n end",
"def select(select)\n @query = select.statement\n end",
"def select(sql)\n raise(ArgumentError, \"Bad sql parameter\") unless sql.kind_of?(String)\n\n client = ensure_connected\n\n Pod4.logger.debug(__FILE... | [
"0.7269758",
"0.70128536",
"0.69406134",
"0.67268336",
"0.6689812",
"0.66867524",
"0.66381156",
"0.66348237",
"0.6583701",
"0.6564482",
"0.6560685",
"0.6559773",
"0.649495",
"0.649495",
"0.6475427",
"0.645299",
"0.64293367",
"0.6367067",
"0.63572764",
"0.63416386",
"0.6336849... | 0.6083229 | 35 |
returns true if an object exists | def exists(table, where = {})
count(table, where) > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists?(object); end",
"def exists?(object); end",
"def object_exist?(object_key)\n return get_objects.has_key?(object_key)\n end",
"def exists?\n assert_exists\n true\n rescue UnknownObjectException\n false\n end",
"def exists? obj\n not [obj].nil?\n end",
"def e... | [
"0.89870524",
"0.89870524",
"0.83083427",
"0.8275156",
"0.8272395",
"0.8175533",
"0.7823088",
"0.777552",
"0.77716005",
"0.77716005",
"0.7750211",
"0.77252775",
"0.77169216",
"0.77045095",
"0.7697628",
"0.76932126",
"0.7681255",
"0.7629478",
"0.75886637",
"0.75669396",
"0.755... | 0.0 | -1 |
inserts an object into the database | def insert(object, table)
sql = object.to_sql(table)
execute(sql)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_obj(obj) # :nodoc:\n chk_conn\n tx = @hibernate_session.begin_transaction\n @hibernate_session.save(obj)\n tx.commit\n obj\n end",
"def insert(object)\n key_name = attributes.key[0].name\n tuple = dump(object)\n tuple.delete(key_name)\n key_... | [
"0.7930019",
"0.738279",
"0.71437514",
"0.706038",
"0.6953891",
"0.6937682",
"0.6936122",
"0.6928717",
"0.69050187",
"0.6838862",
"0.6771521",
"0.67714673",
"0.6701866",
"0.66970515",
"0.6625636",
"0.6624334",
"0.66125506",
"0.66065407",
"0.6580311",
"0.6562522",
"0.6562038",... | 0.75577116 | 1 |
deletes objects from a table | def delete(table, where)
sql = "delete from #{table} #{where_clause(where)};"
execute sql
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy(table)\n end",
"def deletes(objs)\n if !@args[:datarow]\n objs.each do |obj|\n self.delete(obj)\n end\n else\n tables = {}\n\n begin\n objs.each do |obj|\n next if obj.deleted?\n tablen = obj.table\n\n if !tables.key?(tablen)\n ... | [
"0.73691463",
"0.73563385",
"0.73221236",
"0.72564673",
"0.7244036",
"0.72170854",
"0.7041176",
"0.6978266",
"0.69534945",
"0.69417036",
"0.6934766",
"0.6908147",
"0.689284",
"0.6852801",
"0.68008375",
"0.67858493",
"0.6777384",
"0.67652434",
"0.6740378",
"0.6737868",
"0.6737... | 0.6398445 | 69 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.