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 |
|---|---|---|---|---|---|---|
Never trust parameters from the scary internet, only allow the white list through. | def url_params
params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)
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.5992201 | 53 |
+li+ tag with the 'active' class added if the url is the current one with a link inside it pointing to that url. | def activable_li_tag_with_link(title, *url)
activable_li_tag *url do
link_to(title, url.first)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nav_active(url)\n active_nav_class = \"current\"\n\n if (url.instance_of? String)\n current_resource.url == url_for(url) ? {class: active_nav_class} : {}\n elsif (url.instance_of? Array)\n url.map { |url| url_for(url) }.include?(current_resource.url) ? {class: active_nav_class} : {}\n els... | [
"0.74003303",
"0.73618233",
"0.7360548",
"0.7267344",
"0.72488534",
"0.7169484",
"0.7169484",
"0.7159959",
"0.70005214",
"0.69910365",
"0.6962675",
"0.691394",
"0.69114465",
"0.6879398",
"0.68735826",
"0.68157303",
"0.68157303",
"0.6813813",
"0.6810136",
"0.67405295",
"0.6709... | 0.0 | -1 |
def list_tasks_task_action controller.list_tasks_task_action end def create_tasks_task_action controller.create_tasks_task_action end def edit_tasks_task_action controller.edit_tasks_task_action end def complete_tasks_task_action controller.complete_task_task_action end def run_task_menu(project_name) view.print_task_m... | def real_puts message = ""
$stdout.puts message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_task_management_menu\n loop do\n system \"clear\"\n self.view_tasks\n puts \"\"\n choice = PROMPT.select(\"What would you like to do for your goal?\".light_white) do |menu|\n menu.choice 'Create New Tasks'.light_white, '1'\n menu.choice 'Delete Task'.l... | [
"0.71651375",
"0.6940298",
"0.6725844",
"0.6418946",
"0.64142907",
"0.62632257",
"0.6232328",
"0.6231454",
"0.6224932",
"0.6217372",
"0.6185048",
"0.6183097",
"0.6151595",
"0.6147367",
"0.6134832",
"0.6092321",
"0.6072719",
"0.60461104",
"0.60439694",
"0.6033779",
"0.60330987... | 0.0 | -1 |
////// // // // // // // // // // /////////// ///// Question Answer Logic Starts Here //// ///// // // // // // // // // // //////////____________________ | def answer_to_question(answer)
@recipients = answer.question.profile.email
@subject = "Your question has been answered"
self.body = {:question => answer.question, :answer => answer,
:profile_url => url_for(:controller => :profiles, :action => :show, :id => answer.profile_id),
:question_url => u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prapor_quest; end",
"def who_we_are\r\n end",
"def find_answer\nend",
"def q3_page\n\"\n\n\n\n\n\n\n\n\n\n What is your Food Mood?\n\n *-------------------* *-------------------* *-------------------*\n | ... | [
"0.6147879",
"0.61033773",
"0.5989831",
"0.5969488",
"0.5938336",
"0.5935493",
"0.5892898",
"0.58628786",
"0.5857635",
"0.5847956",
"0.58397216",
"0.5819048",
"0.57810897",
"0.5780488",
"0.57799315",
"0.5769298",
"0.57669115",
"0.5765418",
"0.5764097",
"0.57512146",
"0.574416... | 0.0 | -1 |
Overwriting the sign_out redirect path method | def after_sign_out_path_for(resource_or_scope)
Rails.env.development? ? root_path : FrontEndApp::ROOT_URL
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def after_sign_out_path_for(_resource_or_scope)\n '/'\n end",
"def after_sign_out_path_for(resource_or_scope); end",
"def signout_url\n {:controller => 'auth', :action => 'signout'}\n end",
"def after_sign_out_path_for(reso... | [
"0.8102037",
"0.8007481",
"0.7984188",
"0.79324496",
"0.7897868",
"0.78892565",
"0.7874593",
"0.78685254",
"0.7857867",
"0.78436327",
"0.78436327",
"0.78436327",
"0.78436327",
"0.7842701",
"0.7821579",
"0.77880424",
"0.7748489",
"0.77373666",
"0.7731692",
"0.77291566",
"0.772... | 0.0 | -1 |
The message version is the 1B encoding of the `VERSION` above. It is encoded using Arraypack 'C' (8bit unsigned integer). The max value it can encode is 255 (`(2 8) 1`). | def msg_version; @msg_version ||= PackedHeader.new(1, 'C').encode(VERSION); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_version\n msg['_version']\n end",
"def message_version\r\n\t\t\tCURRENT_VERSION\r\n\t\tend",
"def version\na = unpack\nv = (a[2] & 0xF000).to_s(16)[0].chr.to_i\nreturn v if (1..5).include? v\nreturn nil\nend",
"def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end"... | [
"0.68111587",
"0.66897714",
"0.6539145",
"0.6185384",
"0.6054243",
"0.5982473",
"0.5863531",
"0.58546376",
"0.585361",
"0.585361",
"0.585361",
"0.585361",
"0.585361",
"0.57980716",
"0.5789196",
"0.5775429",
"0.57546926",
"0.5741168",
"0.5719009",
"0.5622509",
"0.56210524",
... | 0.7580419 | 0 |
The message size is encoded using Arraypack 'N'. This encoding represents a 32bit (4 byte) unsigned integer. The max value that can be encoded in 4 bytes is 4,294,967,295 (`(2 32) 1`) or a size of ~4GB. | def msg_size; @msg_size ||= PackedHeader.new(4, 'N'); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n to_payload.bytesize\n end",
"def total_payload_size\n length + 16 * character_count\n end",
"def size\r\n @pack.size\r\n end",
"def length\n pack.length\n end",
"def size\n (@bit_length*@length*@count)/8.0\n end",
"def byte_size(); @data.byte_size + 4; end",... | [
"0.66808796",
"0.6674084",
"0.6663601",
"0.65916175",
"0.63128614",
"0.6294512",
"0.62791353",
"0.62791353",
"0.6266398",
"0.6248313",
"0.6179435",
"0.6147006",
"0.6145162",
"0.61416656",
"0.61341494",
"0.6125885",
"0.6041502",
"0.6033389",
"0.60078526",
"0.60053056",
"0.5999... | 0.72234046 | 0 |
THe message body is encoded using BSON. | def msg_body; @msg_body ||= BsonBody.new; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(data); ::BSON.serialize(data).to_s; end",
"def to_bson\n [ self ].pack(bson_pack_directive)\n end",
"def to_bson\n data.bytesize.to_bson + SUBTYPES.fetch(type) + data\n end",
"def to_bson(buffer = ByteBuffer.new)\n position = buffer.length\n buffer.put_int32(0)\n buf... | [
"0.6660244",
"0.65159535",
"0.6455533",
"0.64504915",
"0.6373777",
"0.6351061",
"0.6295756",
"0.628682",
"0.6257544",
"0.6227274",
"0.62202144",
"0.61677545",
"0.61517864",
"0.6133742",
"0.61247176",
"0.60864556",
"0.6074265",
"0.6021508",
"0.59797966",
"0.59219116",
"0.58857... | 0.7670512 | 0 |
BSON returns a byte buffer when serializing. This doesn't always behave like a string, so convert it to one. | def encode(data); ::BSON.serialize(data).to_s; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_binary(s)\n s = s.dup if s.frozen? || s.encoding != Encoding::ASCII_8BIT\n ::BSON::Binary.new(s)\n end",
"def to_bson(buffer = ByteBuffer.new)\n to_s.to_bson(buffer)\n end",
"def to_bson(buffer = ByteBuffer.new)\n buffer\n end",
"def to_s\n data.unpack(\"H*\")... | [
"0.7851469",
"0.7756517",
"0.7677009",
"0.75692385",
"0.7357522",
"0.7342663",
"0.71870923",
"0.7080933",
"0.70724297",
"0.70724297",
"0.70724297",
"0.7022939",
"0.7022939",
"0.694147",
"0.6941039",
"0.6875041",
"0.68029934",
"0.669292",
"0.6673658",
"0.6615697",
"0.6615697",... | 0.6818904 | 16 |
BSON returns an ordered hash when deserializing. This should be functionally equivalent to a regular hash. | def decode(binary); ::BSON.deserialize(binary); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bson_ordered_hash_to_hash(bson_ordered_hash)\n new_hash = {}\n # loop through the BSON::OrderedHash\n bson_ordered_hash.each { |key, val|\n # if the element is a BSON::OrderedHash, then iterate, else if it is\n # an Array, check each element of the array to see if any of them are\n... | [
"0.6293328",
"0.61925036",
"0.619222",
"0.61392343",
"0.61002564",
"0.6097594",
"0.60710585",
"0.6041954",
"0.6025704",
"0.5973566",
"0.5967965",
"0.592084",
"0.592084",
"0.58972055",
"0.58871055",
"0.58871055",
"0.58871055",
"0.58871055",
"0.58871055",
"0.58871055",
"0.58648... | 0.0 | -1 |
=begin isaacs = TomcatUtility::TomcatDeploymentsCache.instance.get_isaac_deployments isaacs.first.tomcat.name isaacs.first.get_db_uuid isaacs.first.get_name isaacs.first.komets.first.get_name isaacs.first.komets.first.get_isaac_db_uuid will match with isaacs.first.get_db_uuid include TomcatUtility TomcatDeploymentsCach... | def get_indifferent_cached_deployments
HashWithIndifferentAccess.new get_cached_deployments
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deployment_hash\n deployment = deployments\n if deployment.size == 1\n deployment[0]\n elsif deployment.size > 1\n next_deployment_after_measured\n else\n {}\n end\n end",
"def deployed_at() ; info_time(:deployed_datetime) ; end",
"def deployed_at() ; info_time... | [
"0.64817715",
"0.5889312",
"0.5889312",
"0.5880407",
"0.5748293",
"0.5628184",
"0.5487089",
"0.5376809",
"0.5224653",
"0.52022636",
"0.51979077",
"0.51937354",
"0.51916146",
"0.5180423",
"0.517036",
"0.5150626",
"0.5133205",
"0.5132308",
"0.5040332",
"0.50386935",
"0.5038627"... | 0.59113157 | 1 |
GET /invites GET /invites.json | def index
@invites = current_user.invites
respond_to do |format|
format.html # index.html.erb
format.json { render json: @invites }
end
session[:new_invite_error] = nil
session[:new_invite_error_url] = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n ... | [
"0.7959769",
"0.79404175",
"0.79404175",
"0.79404175",
"0.7742536",
"0.76677245",
"0.76677245",
"0.76677245",
"0.76677245",
"0.76677245",
"0.76200795",
"0.7401339",
"0.72609353",
"0.7259135",
"0.72381604",
"0.7088142",
"0.70818603",
"0.7015903",
"0.700781",
"0.7004371",
"0.69... | 0.7490277 | 11 |
GET /invites/1 GET /invites/1.json | def show
@invite = Invite.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @invite }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites ... | [
"0.7688263",
"0.7688263",
"0.7688263",
"0.74287134",
"0.73801136",
"0.73801136",
"0.73801136",
"0.73801136",
"0.73801136",
"0.7367896",
"0.7329601",
"0.70713496",
"0.7045998",
"0.699091",
"0.69735",
"0.695193",
"0.6947367",
"0.69188094",
"0.6821972",
"0.674742",
"0.6738955",
... | 0.7069864 | 14 |
GET /invites/new GET /invites/new.json | def new
flag_no_problem = current_user.problems.count + current_user.code_problems.count
flag_no_collection = current_user.collections.count
flag_no_balance = current_user.invite_balance
if flag_no_problem == 0
error_message = (t 'invite.errors.no_problem')
error_message_url = new_problem_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end",
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n... | [
"0.77566123",
"0.77566123",
"0.77566123",
"0.7493549",
"0.7443391",
"0.71866524",
"0.70564896",
"0.7012656",
"0.6996705",
"0.6996705",
"0.69863653",
"0.69833046",
"0.6968096",
"0.69313127",
"0.6828738",
"0.6754267",
"0.6735638",
"0.6729011",
"0.67265517",
"0.66909343",
"0.664... | 0.6172485 | 91 |
POST /invites POST /invites.json | def create
@invite = Invite.new(params[:invite])
@invite.user_id = current_user.id
@invite.url_hash = get_new_invite_hash
candidate = User.find_or_create(@invite.candidate_email, @invite.candidate_name, 'candidate')
if candidate.nil?
render action: "new"
return
end
@invite.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@ema... | [
"0.69848865",
"0.6835423",
"0.665867",
"0.6657357",
"0.66251135",
"0.6613855",
"0.66080153",
"0.6599364",
"0.6599364",
"0.6599364",
"0.65854967",
"0.6575549",
"0.65548944",
"0.65405744",
"0.65033305",
"0.64781004",
"0.64531684",
"0.64299184",
"0.6427502",
"0.6420567",
"0.6420... | 0.0 | -1 |
No edit , update or destroy on invite GET /invites/1/edit | def edit
@invite = Invite.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n \t@user = User.find_by_invite_token!(params[:id])\n end",
"def edit\n @invite_user = User.where(:invite_token => params[:id], :status => \"invitee\").first\n @role = @invite_user.roles.first\n @inviter = User.where(:id => @role.invite_user_id).first\n @course = @role.cour... | [
"0.739073",
"0.73263067",
"0.6957787",
"0.69538087",
"0.6876259",
"0.6871937",
"0.6871937",
"0.6871937",
"0.68659145",
"0.68556875",
"0.68451524",
"0.67601275",
"0.67601275",
"0.6760038",
"0.66684943",
"0.6647012",
"0.6647012",
"0.6647012",
"0.6647012",
"0.66464335",
"0.66464... | 0.8278068 | 0 |
PUT /invites/1 PUT /invites/1.json | def update
@invite = Invite.find(params[:id])
respond_to do |format|
if @invite.update_attributes(params[:invite])
format.html { redirect_to @invite, notice: (t 'invite.update') }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user... | [
"0.67971027",
"0.65787655",
"0.65787655",
"0.65787655",
"0.6515703",
"0.6389459",
"0.6334293",
"0.6333119",
"0.63229674",
"0.6315305",
"0.6275967",
"0.6265954",
"0.6194329",
"0.6194329",
"0.6194329",
"0.6194329",
"0.61791176",
"0.6152989",
"0.6152989",
"0.611643",
"0.6109015"... | 0.6617818 | 1 |
Given a card, insert it on the bottom your deck | def add_card(card)
@deck.add(card, :back)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_bottom (card)\n @cards.unshift(card);\n end",
"def add_card_to_bottom(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == 1)\n # Decrese the orders for the cards above in the old deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card... | [
"0.826293",
"0.8149494",
"0.78617173",
"0.75007695",
"0.7479656",
"0.7441609",
"0.74125063",
"0.7366898",
"0.73449177",
"0.7342745",
"0.7334327",
"0.7331764",
"0.72779423",
"0.72772646",
"0.7261177",
"0.7246629",
"0.7169112",
"0.71673834",
"0.71518415",
"0.7144674",
"0.713853... | 0.81820077 | 1 |
Mix around the order of the cards in your deck | def shuffle # You can't use .shuffle!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_deck\n CARD_SUITS.product(CARD_VALUES).shuffle\nend",
"def reshuffle\n discard.each do |modifier|\n deck.push modifier\n end\n @discard = []\n shuffle\n end",
"def initialize_deck\n SUITS.product(VALUES).shuffle\nend",
"def initialize_deck\n VALUES.product(SUITS).shuffle\nend",... | [
"0.69107836",
"0.6739678",
"0.67210054",
"0.66971433",
"0.66793084",
"0.66206455",
"0.6620253",
"0.65783685",
"0.6576435",
"0.6559651",
"0.6551457",
"0.65489596",
"0.65349287",
"0.65342915",
"0.6522916",
"0.65169555",
"0.6502207",
"0.6496645",
"0.6453775",
"0.6448532",
"0.643... | 0.0 | -1 |
Remove the top card from your deck and return it | def deal_card
@deck.remove(:front)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop_card_top\n @cardList.pop\n end",
"def remove_card\n cards.shift\n return cards\n end",
"def remove_card\n @cards.shift\n end",
"def remove_card\n @cards.shift\n\n end",
"def remove_card\n @cards.delete_at(0)\n end",
"def remove_card\n self.cards.delete_at(0)\n end... | [
"0.8080477",
"0.797509",
"0.795018",
"0.78866357",
"0.78304535",
"0.7752167",
"0.7716863",
"0.74881166",
"0.7431325",
"0.7344642",
"0.7321089",
"0.7269207",
"0.7224345",
"0.7137483",
"0.7137167",
"0.71336883",
"0.7132554",
"0.71280104",
"0.705911",
"0.70585537",
"0.70545757",... | 0.74016935 | 9 |
Reset this deck with 52 cards | def create_shuffled_deck
# value = (2..10).to_a
ranks = (2..10).to_a + ["J", "Q", "k", "A"]
values = (2..14).to_a
suits = ["Spades", "Diamonds", "Hearts", "Clubs"]
# suits.each do |suit|
# ranks.each_with_index do |rank|
# @deck << Card.new(rank, value[index], suit)
# end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @cards = Card.suits.keys.map do |suit|\n Card.values.map {|i| Card.new(suit, i)}\n end.flatten\n @dealt = []\n self\n end",
"def reset!\n @cards = load_cards\n end",
"def reset!\n self.cards = CARDS.dup\n end",
"def reset!\n @hands.each(&:discard!)\n... | [
"0.77629274",
"0.7316694",
"0.73152006",
"0.7235672",
"0.7161999",
"0.70690644",
"0.6839646",
"0.6708019",
"0.66941214",
"0.66939616",
"0.66676503",
"0.6655808",
"0.66557175",
"0.660112",
"0.6550918",
"0.654736",
"0.6534253",
"0.64918154",
"0.6455401",
"0.64467067",
"0.641774... | 0.5949235 | 100 |
Reset this deck with 52 cards | def create_52_card_deck
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @cards = Card.suits.keys.map do |suit|\n Card.values.map {|i| Card.new(suit, i)}\n end.flatten\n @dealt = []\n self\n end",
"def reset!\n @cards = load_cards\n end",
"def reset!\n self.cards = CARDS.dup\n end",
"def reset!\n @hands.each(&:discard!)\n... | [
"0.77629274",
"0.7316694",
"0.73152006",
"0.7235672",
"0.7161999",
"0.70690644",
"0.6839646",
"0.6708019",
"0.66941214",
"0.66939616",
"0.66676503",
"0.6655808",
"0.66557175",
"0.660112",
"0.6550918",
"0.654736",
"0.6534253",
"0.64918154",
"0.6455401",
"0.64467067",
"0.641774... | 0.63362664 | 27 |
You will need to play the entire game in this method using the WarAPI | def play_game
num_turns = 0
# @deck = Deck.new
@deck.create_shuffled_deck
deal_cards
until (@player1.hand.deck.front == nil && @player1.hand.deck.back == nil) || (@player2.hand.deck.front == nil && @player2.hand.deck.back == nil)
num_turns += 1
p1_card = @player1.hand.deal_card
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_game\n # WarAPI.play_turn()\n end",
"def play\n #calls to all the methods that produce game!\n end",
"def play\n board_setup\n gameplay_setup\n end",
"def play\n\t\tgame_loop\n\tend",
"def play\n \n end",
"def play\n end",
"def play\n greeting\n get_tiles\n ... | [
"0.841135",
"0.78189",
"0.7248748",
"0.7238757",
"0.71277416",
"0.7107483",
"0.7082697",
"0.70531464",
"0.70269275",
"0.70221245",
"0.7016833",
"0.7016833",
"0.7016833",
"0.7016833",
"0.7015383",
"0.6993416",
"0.69844455",
"0.6973542",
"0.6973542",
"0.6957744",
"0.69462305",
... | 0.0 | -1 |
You will need to play the entire game in this method using the WarAPI | def play_game
# WarAPI.play_turn()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n #calls to all the methods that produce game!\n end",
"def play\n board_setup\n gameplay_setup\n end",
"def play\n\t\tgame_loop\n\tend",
"def play\n \n end",
"def play\n end",
"def play\n greeting\n get_tiles\n move_sequence\n end",
"def play\n\t\t@current_tu... | [
"0.78186065",
"0.724834",
"0.7237337",
"0.71275693",
"0.7107241",
"0.7082583",
"0.7052699",
"0.702659",
"0.70212364",
"0.70166296",
"0.70166296",
"0.70166296",
"0.70166296",
"0.70144576",
"0.69931406",
"0.6984065",
"0.69730777",
"0.69730777",
"0.6957336",
"0.69454926",
"0.692... | 0.8411591 | 0 |
GET /sources GET /sources.xml | def index
# 最新发布的
@sources = Source.where("status != 0").order("created_at DESC").limit(20)
# 最新翻译的
@translations = Translation.order("created_at DESC").limit(20)
@untrans_sources = Source.where("status = 1").order("created_at DESC").limit(20)
# 排行榜
@trans_rank = TranRank.where("campaign = '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end",
"def get_sources\n @page.all(input_elements[:sources_list])\n end",
"def account_sources(source)\n get('account/sources', {'source' => source})\n end",
"def sources(source: nil)\n ... | [
"0.7759113",
"0.72316724",
"0.7025272",
"0.69071704",
"0.690646",
"0.68049103",
"0.6757319",
"0.6757319",
"0.67452633",
"0.66782093",
"0.66533446",
"0.658766",
"0.6563072",
"0.6543264",
"0.6455132",
"0.6452723",
"0.63742065",
"0.63558364",
"0.6331486",
"0.63245726",
"0.632057... | 0.0 | -1 |
GET /sources/1 GET /sources/1.xml | def show
@source = Source.find(params[:id])
# 查出所有提交的翻译
@translations = Translation.where("source_id = ?", @source.id)
ActiveRecord::Base.connection.update("update sources set views = views+1 where id = " + @source.id.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end",
"def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @source }\n end\n end",
"def show\n ... | [
"0.70315856",
"0.695209",
"0.695209",
"0.6656253",
"0.66518486",
"0.64756626",
"0.64272195",
"0.63835055",
"0.63739395",
"0.6361889",
"0.6335869",
"0.63204426",
"0.62775093",
"0.6235374",
"0.61902493",
"0.6179728",
"0.6164457",
"0.6162462",
"0.6138677",
"0.61130255",
"0.61029... | 0.0 | -1 |
GET /sources/new GET /sources/new.xml | def new
@source = Source.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end",
"def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n e... | [
"0.7374626",
"0.7374626",
"0.6909008",
"0.68649274",
"0.6847748",
"0.6708436",
"0.67030066",
"0.66780704",
"0.664164",
"0.6622738",
"0.65624833",
"0.6518019",
"0.64827365",
"0.63327026",
"0.63276005",
"0.6270805",
"0.6270672",
"0.62413555",
"0.6209693",
"0.6183195",
"0.616978... | 0.57023495 | 87 |
POST /sources POST /sources.xml | def create
@source = Source.new(params[:source])
@source.user_id = session[:login_user_id]
@source.dz_user_id = session[:login_user].uid
@source.username = session[:login_user].username
@source.source_type_id = params[:source_type]
@source.source_lang_id = params[:source_lang]
@source.excred... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sources_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_post ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access... | [
"0.68065745",
"0.6458434",
"0.6198028",
"0.6032349",
"0.5934093",
"0.58439803",
"0.5824321",
"0.5771149",
"0.5746699",
"0.5745752",
"0.57402295",
"0.5729624",
"0.57243955",
"0.57214",
"0.56978345",
"0.5644379",
"0.5634924",
"0.5625314",
"0.5618868",
"0.55762357",
"0.5572174",... | 0.0 | -1 |
PUT /sources/1 PUT /sources/1.xml | def update
@source = Source.find(params[:id])
if params[:excredits]
if @source.status != 3
@source.update_attributes({:excredits => params[:excredits]})
return
end
end
if @source.update_attributes(params[:source])
flash[:message] = "成功编辑译文"
redirect_to my_sources... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n ... | [
"0.66505885",
"0.6490155",
"0.6490155",
"0.6281938",
"0.62671787",
"0.61757547",
"0.61559135",
"0.6146965",
"0.608336",
"0.60009795",
"0.5989421",
"0.59857684",
"0.59816825",
"0.59474546",
"0.58372015",
"0.5792429",
"0.56985694",
"0.56742305",
"0.56605566",
"0.56448853",
"0.5... | 0.0 | -1 |
DELETE /sources/1 DELETE /sources/1.xml | def destroy
@source = Source.find(params[:id])
@source.destroy
respond_to do |format|
format.html { redirect_to(sources_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @content_source = ContentSource.find(params[:id])\n @content_source.destroy\n\n respond_t... | [
"0.73130286",
"0.6986069",
"0.6858216",
"0.6787762",
"0.6787762",
"0.67873",
"0.6654224",
"0.6617284",
"0.6586534",
"0.6504256",
"0.64952487",
"0.64908856",
"0.64877266",
"0.64129955",
"0.6409706",
"0.6380726",
"0.63590765",
"0.6334079",
"0.63039297",
"0.62941515",
"0.6282236... | 0.737422 | 3 |
GET /products GET /products.json | def index
@products = Product.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def products\n request :public, :get, :products\n end",
"def index\n @products = Product.all\n render json: @products\n end",
"def index\n begin\n ... | [
"0.79500145",
"0.7929853",
"0.79054135",
"0.77477723",
"0.76619905",
"0.7622153",
"0.762195",
"0.762195",
"0.762195",
"0.76070404",
"0.75873625",
"0.75828224",
"0.7578298",
"0.75750685",
"0.7565435",
"0.7565435",
"0.7565435",
"0.7565435",
"0.7530454",
"0.7523024",
"0.75097287... | 0.0 | -1 |
GET /products/1 GET /products/1.json | def show
@product_images = @product.product_images.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end",
"def show\n @product = Product.find(params[:id])\n\n render json: @product\n end",
"def index\n @api_v1_products = Product.all\n jso... | [
"0.7721764",
"0.7633201",
"0.76317674",
"0.76065314",
"0.75760347",
"0.75513494",
"0.75068873",
"0.7484816",
"0.7455574",
"0.745028",
"0.74380666",
"0.7421378",
"0.73614496",
"0.73191535",
"0.7318936",
"0.7318936",
"0.7318936",
"0.7315924",
"0.7311919",
"0.73092216",
"0.72942... | 0.0 | -1 |
POST /products POST /products.json | def create
@product = Product.new(name: product_params[:name], description: product_params[:description], product_type: product_params[:product_type],
dimensions: product_params[:dimensions], weight: product_params[:weight], material: product_params[:material], product_code: product_params[:product_code],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n if params[:products]\n params[:products].each do |product|\n @... | [
"0.7674954",
"0.7589692",
"0.756074",
"0.7531862",
"0.7531213",
"0.7507928",
"0.7420413",
"0.7391407",
"0.7374718",
"0.7355908",
"0.73231804",
"0.72869605",
"0.7144144",
"0.7050259",
"0.7047559",
"0.70415026",
"0.7037288",
"0.7037288",
"0.7037288",
"0.70322204",
"0.70255643",... | 0.0 | -1 |
PATCH/PUT /products/1 PATCH/PUT /products/1.json | def update
respond_to do |format|
if @product.update(product_params)
# if product_params[:product_images_attributes]
# product_params[:product_images_attributes].each do |pi|
# # @product.product_images.create(product_image: pi[:product_image])
# product_image_aux = P... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @colle... | [
"0.7269931",
"0.6935652",
"0.68690825",
"0.6846676",
"0.68126076",
"0.67678404",
"0.6749974",
"0.6741848",
"0.67151767",
"0.6700884",
"0.6686023",
"0.66597176",
"0.6654553",
"0.66536564",
"0.664067",
"0.664067",
"0.66382414",
"0.6631012",
"0.6631012",
"0.6627257",
"0.6620688"... | 0.0 | -1 |
DELETE /products/1 DELETE /products/1.json | def destroy
@product.destroy
respond_to do |format|
format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end",
"def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end",
"def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end",
... | [
"0.7716767",
"0.7593029",
"0.7548404",
"0.75026053",
"0.7501899",
"0.74741083",
"0.7439505",
"0.7417943",
"0.74088925",
"0.7370336",
"0.73533446",
"0.73478407",
"0.73357344",
"0.73357344",
"0.73357344",
"0.73308176",
"0.73308176",
"0.73308176",
"0.73308176",
"0.73308176",
"0.... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_product
@product = Product.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def product_params
params.require(:product).permit(:name, :description, :product_type, :dimensions, :weight, :material,
:product_code, :is_new_release, :collection, :collection_id,
:sub_collection, :sub_collection_id, product_images_attributes: [:product_image, :product, :product_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 |
TODO: Need to test this! | def build(nested_params, name, options, &block)
klass_name = name.to_s.split('_').collect(&:capitalize).join
name_symbol = name.to_sym
Class.new(nested_params).tap do |klass|
@parent.send(:remove_const, klass_name) if @parent.const_defined?(klass_name)
@parent.const_set(klass_name, kla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def schubert; end",
"def refutal()\n end",
"def weber; end",
"def implementation; end",
"def implementation; end",
"def identify; end",
"def spec; end",
"def spec; end",
... | [
"0.7605122",
"0.65433544",
"0.65433544",
"0.65433544",
"0.65433544",
"0.6514919",
"0.63611645",
"0.60728747",
"0.605367",
"0.60287654",
"0.60287654",
"0.60279983",
"0.5926429",
"0.5926429",
"0.58493704",
"0.5841001",
"0.5841001",
"0.5841001",
"0.5841001",
"0.5787723",
"0.5787... | 0.0 | -1 |
bookings made on my rooms | def your_reservations
@rooms = current_user.rooms
@reservations = Reservation.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def book_room(type, number)\n select_room_flag = false\n @rooms.each_with_index do |room, i|\n if room[:type].downcase == type.downcase\n select_room_flag = true\n if room[:avilable].to_i < (room[:booked].to_i + number.to_i)\n puts \"Sorry we have only #{room[:avilable].to... | [
"0.6921091",
"0.68915206",
"0.6840275",
"0.6808785",
"0.68030566",
"0.67906773",
"0.6740227",
"0.67316204",
"0.66916287",
"0.66754675",
"0.6671842",
"0.6665861",
"0.6619604",
"0.66143066",
"0.65822005",
"0.65603197",
"0.65576744",
"0.64798486",
"0.64718807",
"0.64704436",
"0.... | 0.0 | -1 |
Some details about the helper method that might be picked up in the documentation. | def a_helper_method
puts "performs some operation"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def helper_method(*methods); end",
"def define_helpers; end",
"def helper\n @helper\n end",
"def helper\n @helper\n end",
"def helper(_method)\n ActionController::Base.helpers.method(_method)\n end",
"de... | [
"0.7692924",
"0.7692924",
"0.7692924",
"0.68851626",
"0.66039",
"0.6559716",
"0.6559716",
"0.6462119",
"0.6350121",
"0.63115746",
"0.62891185",
"0.62449414",
"0.62195504",
"0.62195504",
"0.62195504",
"0.62195504",
"0.6145554",
"0.61398965",
"0.61136436",
"0.61136436",
"0.6113... | 0.0 | -1 |
bomb in the 2D gridlike field in front of you. Write a function mineLocation/MineLocation that accepts a 2D array, and returns the location of the mine. The mine is represented as the integer 1 in the 2D array. Areas in the 2D array that are not the mine will be represented as 0s. The location returned should be an arr... | def mineLocation field
coords = []
field.each_index do | i |
field[i].each_index do | j |
if field[i][j] == 1
coords << i
coords << j
end
end
end
coords
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains_mine?(row, col)\n mine_locations.include?([row, col])\n end",
"def contains_mine?(row, col)\n if mine_locations.include?([row, col])\n true\n else\n false\n end\n end",
"def mine_locations\n mine_array = []\n until mine_array.length == 9\n row = (0..9).to_a.sampl... | [
"0.68042094",
"0.67441136",
"0.6648272",
"0.6566782",
"0.6532259",
"0.65184504",
"0.63955855",
"0.6298916",
"0.6191949",
"0.608033",
"0.6029884",
"0.6006745",
"0.598417",
"0.5980205",
"0.5951131",
"0.58934844",
"0.58675253",
"0.5850481",
"0.5830921",
"0.5801239",
"0.5793308",... | 0.6766224 | 1 |
Get PgVersion that is released at the given date. Return nil if not have. | def get_released_version(date)
@minor_versions.each do |pv|
if pv.release_date == date then
return pv
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_date\n release_dates.first[:date] rescue nil\n end",
"def release_date(version = Origen.app.version.prefixed)\n time = release_time(version)\n time ? time.to_date : nil\n end",
"def release_date\n document[\"release\"][\"releaseDate\"] rescue nil\n end",
"def prerelea... | [
"0.69371414",
"0.679275",
"0.63974357",
"0.5946498",
"0.59137017",
"0.5878385",
"0.579597",
"0.5723556",
"0.57207483",
"0.57120687",
"0.5627439",
"0.5588903",
"0.55780953",
"0.55757266",
"0.5521762",
"0.5470397",
"0.5386423",
"0.53670657",
"0.5330954",
"0.53030103",
"0.530259... | 0.85417295 | 0 |
Already release note file exists? | def exist?()
return File.exist?(@r_note_filepath)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkReleaseNotes(iReleaseDir, iReleaseInfo)\n assert(File.exists?(\"#{iReleaseDir}/Documentation/ReleaseNote.html\"))\n assert(File.exists?(\"#{iReleaseDir}/Documentation/ReleaseNote.txt\"))\n end",
"def is_new?\n !File.exists? @filename\n end",
"def file_exists\n end",
"def ... | [
"0.65962934",
"0.64236635",
"0.6143156",
"0.6142977",
"0.60162115",
"0.5997049",
"0.5989373",
"0.5959471",
"0.5959471",
"0.5952987",
"0.59493744",
"0.59235567",
"0.59226215",
"0.58932346",
"0.585563",
"0.5837311",
"0.5826832",
"0.58176714",
"0.58006704",
"0.5791112",
"0.57897... | 0.7161358 | 0 |
Save release note html file into ReleaseNoteDir | def save_release_note()
puts "Saving the release note of " + @version + " ..."
r_note = Nokogiri::HTML(open(@release_note_url))
File.open(@r_note_filepath, "w") do |f|
f.puts(r_note)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateReleaseNote_HTML\r\n rSuccess = true\r\n\r\n logOp('Generating release note in HTML format') do\r\n lLastChangesLines = []\r\n getLastChangeLog.each do |iLine|\r\n lLastChangesLines << iLine.\r\n gsub(/\\n/,\"<br/>\\n\").\r\n gsub(/^=== (.*)$/, '<h... | [
"0.6573925",
"0.61920804",
"0.61546034",
"0.60735035",
"0.6034229",
"0.6020748",
"0.60170573",
"0.5995989",
"0.59736466",
"0.59657705",
"0.5914977",
"0.58825105",
"0.588186",
"0.58807033",
"0.5863057",
"0.58536613",
"0.5851847",
"0.58517694",
"0.58483016",
"0.5839252",
"0.583... | 0.82210606 | 0 |
then feeds the words into the shift method" | def caesar_cipher(string, s_num)
i = 1
n_words = []
words = string.split(" ")
words.each do |w|
n_words.push(shift(w, s_num))
end
n_words.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift\n ret = @tokens.shift\n get_next_tokens\n ret\n end",
"def shift() end",
"def shift() end",
"def shiftl(word)\n word[1..-1] << word[0]\nend",
"def puts_first_word(words)\n word = words.shift() #Error 11: Again, no such method as 'poop', using inbuilt string method shift on words.\n ... | [
"0.6929532",
"0.68239164",
"0.68239164",
"0.68040204",
"0.67875063",
"0.6692798",
"0.6692798",
"0.6514204",
"0.6514204",
"0.6514204",
"0.6488341",
"0.6347762",
"0.62729573",
"0.62341136",
"0.61902374",
"0.619012",
"0.6167596",
"0.61621195",
"0.6130978",
"0.6125852",
"0.610249... | 0.0 | -1 |
questID should be the symbolic name of the quest, e.g. :Quest1 | def activateQuest(quest,color,story)
if !quest.is_a?(Symbol)
raise _INTL("The 'quest' argument should be a symbol, e.g. ':Quest1'.")
end
for i in 0...@active_quests.length
if @active_quests[i].id == quest
pbMessage("You have already started this quest.")
return
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quest(quest_id); $game_party.quests[quest_id]; end",
"def set_quest\n @quest = Quest.find(params[:id])\n end",
"def set_quest\n @quest = Quest.find(params[:id])\n end",
"def set_quest\n @quest = Quest.find(params[:id])\n end",
"def set_quest\n @quest = Quest.fi... | [
"0.81825674",
"0.7392934",
"0.7392934",
"0.7392934",
"0.7392934",
"0.7389347",
"0.7315458",
"0.7190625",
"0.7122943",
"0.6913735",
"0.6656532",
"0.6647309",
"0.65953064",
"0.6494504",
"0.6426543",
"0.64225906",
"0.6405718",
"0.6343753",
"0.62924314",
"0.6264734",
"0.62425",
... | 0.6187569 | 23 |
=============================================================================== Helper and utility functions for managing quests =============================================================================== Helper function for activating quests | def activateQuest(quest,color=colorQuest(nil),story=false)
return if !$PokemonGlobal
$PokemonGlobal.quests.activateQuest(quest,color,story)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quest; end",
"def activateQuest(quest,color,story)\n if !quest.is_a?(Symbol)\n raise _INTL(\"The 'quest' argument should be a symbol, e.g. ':Quest1'.\")\n end\n for i in 0...@active_quests.length\n if @active_quests[i].id == quest\n pbMessage(\"You have already started this quest.\"... | [
"0.72086614",
"0.7181531",
"0.7138753",
"0.7120502",
"0.7077674",
"0.7058291",
"0.6826155",
"0.6770229",
"0.65837616",
"0.65448",
"0.6452135",
"0.6424945",
"0.6424945",
"0.6424945",
"0.6424945",
"0.642236",
"0.6414558",
"0.6372918",
"0.62991464",
"0.6292872",
"0.6277443",
"... | 0.73231465 | 0 |
Helper function for marking quests as completed | def completeQuest(quest,color=nil,story=false)
return if !$PokemonGlobal
$PokemonGlobal.quests.completeQuest(quest,color,story)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markDone\n if @complete == \"Item incomplete\"\n @complete = \"Item complete\"\n else\n @complete = \"Item complete\"\n end\n end",
"def mark_as_completed!\n mark_state_complete!\n end",
"def completed\n end",
"def completed\n @status = 'complete'\n end",
"def... | [
"0.74331534",
"0.7159824",
"0.69868654",
"0.6976418",
"0.69690347",
"0.69168",
"0.68974924",
"0.6866751",
"0.685567",
"0.68422735",
"0.68111753",
"0.6794352",
"0.6789346",
"0.6775018",
"0.67507005",
"0.6741173",
"0.67223877",
"0.66876227",
"0.66868323",
"0.6685593",
"0.662619... | 0.65183604 | 33 |
Helper function for marking quests as failed | def failQuest(quest,color=nil,story=false)
return if !$PokemonGlobal
$PokemonGlobal.quests.failQuest(quest,color,story)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failed?; state == 'failed'; end",
"def failed?; state == 'failed'; end",
"def mark_failure\n self.failure_occurred = true\n end",
"def mark_failure\n self.failure_occurred = true\n end",
"def failed?; failed_to_start? || (@success == false) end",
"def failed!\n @success = false\n... | [
"0.64380085",
"0.64380085",
"0.63974255",
"0.63974255",
"0.6386845",
"0.6324332",
"0.62693053",
"0.625873",
"0.625873",
"0.625873",
"0.6201395",
"0.619108",
"0.61764365",
"0.61525196",
"0.6132045",
"0.6125698",
"0.6119402",
"0.61165553",
"0.6100646",
"0.6072988",
"0.6069385",... | 0.68772 | 0 |
Helper function for advancing quests to given stage | def advanceQuestToStage(quest,stageNum,color=nil,story=false)
return if !$PokemonGlobal
$PokemonGlobal.quests.advanceQuestToStage(quest,stageNum,color,story)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activateQuest(quest,color=colorQuest(nil),story=false)\n return if !$PokemonGlobal\n $PokemonGlobal.quests.activateQuest(quest,color,story)\nend",
"def quest; end",
"def calculate_stage(game, stage)\n game.cycle = self\n game.result.each { |result| stage[result - 1] += 1 }\n stages << stage\n e... | [
"0.57296294",
"0.57182324",
"0.571017",
"0.56700176",
"0.5653914",
"0.56302047",
"0.5585278",
"0.5565238",
"0.5515287",
"0.55095565",
"0.54952955",
"0.53983873",
"0.53963214",
"0.53963214",
"0.53699756",
"0.5367081",
"0.53667486",
"0.5360327",
"0.5336824",
"0.53367835",
"0.53... | 0.71767396 | 0 |
Get symbolic names of active quests Unused | def getActiveQuests
active = []
$PokemonGlobal.quests.active_quests.each do |s|
active.push(s.id)
end
return active
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == false\n end\n\n end",
"def lesson_plan_item_actable_names\n []\n end",
"def used_names; end",
"def defined_names\n @lhs_names\n end",
"def related_names_in_use\n @in_use.ma... | [
"0.617534",
"0.5931871",
"0.58520836",
"0.58183587",
"0.5790985",
"0.57345754",
"0.5594455",
"0.55781186",
"0.5558778",
"0.5539813",
"0.5539057",
"0.55273706",
"0.5502031",
"0.5472204",
"0.5449715",
"0.54429585",
"0.5400919",
"0.5392848",
"0.539003",
"0.533629",
"0.53264123",... | 0.5572735 | 8 |
Get symbolic names of completed quests Unused | def getCompletedQuests
completed = []
$PokemonGlobal.quests.completed_quests.each do |s|
completed.push(s.id)
end
return completed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == false\n end\n\n end",
"def completed_quests; $game_variables[17]; end",
"def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.s... | [
"0.64709145",
"0.6108061",
"0.59939396",
"0.5953557",
"0.58078766",
"0.56050587",
"0.55726904",
"0.5569817",
"0.5561762",
"0.55098194",
"0.5463352",
"0.5459464",
"0.54468244",
"0.5428521",
"0.53907114",
"0.53527",
"0.5345816",
"0.52985424",
"0.5290342",
"0.5251468",
"0.523097... | 0.5570121 | 7 |
Get symbolic names of failed quests Unused | def getFailedQuests
failed = []
$PokemonGlobal.quests.failed_quests.each do |s|
failed.push(s.id)
end
return failed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failing_modules\n modules.reject {|m| %w(passed softfailed running none).include? m['result']}.map {|m| m['name'] }\n end",
"def verify_unused(names,flags,switches,context) # :nodoc:\n names.each do |name|\n verify_unused_in_option(name,flags,\"flag\",context)\n verify_unused_in_option(n... | [
"0.61377",
"0.55914456",
"0.55671275",
"0.5499207",
"0.54338914",
"0.5429478",
"0.54044485",
"0.53673255",
"0.5342061",
"0.5331159",
"0.53132546",
"0.5295025",
"0.5266962",
"0.525107",
"0.5232682",
"0.5230677",
"0.5217739",
"0.52134484",
"0.52079004",
"0.51857936",
"0.5170335... | 0.62398887 | 0 |
Get name of quest giver | def getQuestGiver(quest)
return "#{QuestModule.const_get(quest)[:QuestGiver]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n @gapi ? @gapi[\"name\"] : @name\n end",
"def name\n @gapi[\"name\"]\n end",
"def name\n @gapi[\"name\"]\n end",
"def name\n @game_info['name']\n end",
"def name\n @gapi.name\n end",
"def name\n @gapi.name\n end",
... | [
"0.6607635",
"0.6561576",
"0.6561576",
"0.6528959",
"0.65129274",
"0.6440821",
"0.64353913",
"0.6405718",
"0.6319761",
"0.6312193",
"0.63046086",
"0.6271073",
"0.6251253",
"0.62409055",
"0.62362516",
"0.6233459",
"0.6233459",
"0.62158597",
"0.6206141",
"0.61976737",
"0.618479... | 0.78256774 | 0 |
Get array of quest stages | def getQuestStages(quest)
arr = []
for key in QuestModule.const_get(quest).keys
arr.push(key) if key.to_s.include?("Stage")
end
return arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stages\n return @stages\n end",
"def stages\n return @stages\n end",
"def stage_names\n @stages.keys\n end",
"def getActiveQuests\n active = []\n $PokemonGlobal.quests.active_quests.each do |s|\n active.push(s.id)\n end\n return active\ne... | [
"0.6830067",
"0.6830067",
"0.61889935",
"0.59292173",
"0.59120125",
"0.5834044",
"0.57828534",
"0.5767325",
"0.57462835",
"0.5743583",
"0.5738883",
"0.5694336",
"0.56836957",
"0.5673413",
"0.56726485",
"0.5645226",
"0.5608514",
"0.55898213",
"0.5585968",
"0.55788153",
"0.5576... | 0.80295444 | 0 |
Get overall quest description | def getQuestDescription(quest)
return "#{QuestModule.const_get(quest)[:QuestDescription]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def descr\n return text_get(2, id)\n end",
"def description\n text_get(7, @id)\n end",
"def description\n return @description if @description\n \n parts = []\n \n tp = trial_period(false)\n parts << \"#{tp}-day trial\" if tp && tp > 0\n \n sa = setup_amount(false)\n p... | [
"0.7065177",
"0.70596975",
"0.6922498",
"0.69074833",
"0.68928367",
"0.6856413",
"0.6760685",
"0.6734638",
"0.67250705",
"0.66907924",
"0.66221803",
"0.6583001",
"0.6558498",
"0.65495914",
"0.65452635",
"0.65243983",
"0.6521471",
"0.6512449",
"0.6503124",
"0.64869064",
"0.647... | 0.8123579 | 0 |
Get current task location | def getStageLocation(quest,stage)
loc = ("Location" + "#{stage}").to_sym
return "#{QuestModule.const_get(quest)[loc]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_loc\r\n\t\treturn driver.location\r\n\tend",
"def get_current_location\n\t \tif Rails.env.test? || Rails.env.development?\n\t \t\t[43.648209, -79.397865] # Hello HackerYou!\n\t \telse\n\t \t\trequest.location\n\t \tend\n\t end",
"def getCurrentLocation\n nil\n end",
"def location\n ... | [
"0.7338161",
"0.71840775",
"0.7132401",
"0.68587494",
"0.6845513",
"0.67206126",
"0.66920763",
"0.667796",
"0.667796",
"0.6611901",
"0.6611901",
"0.6609358",
"0.65347",
"0.6491789",
"0.64660543",
"0.6439193",
"0.64293504",
"0.63915515",
"0.63754165",
"0.6331876",
"0.6317313",... | 0.0 | -1 |
Get summary of current task | def getStageDescription(quest,stage)
stg = ("Stage" + "#{stage}").to_sym
return "#{QuestModule.const_get(quest)[stg]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summary\n @summary ||= HTML::Pipeline::TaskList::Summary.new(record.task_list_items)\n end",
"def what_task\n if running_task?\n puts \"Current task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n else\n puts \"No task running!\"... | [
"0.7704578",
"0.7395565",
"0.73943114",
"0.72888577",
"0.72435576",
"0.7167506",
"0.6887434",
"0.6883904",
"0.682446",
"0.6818422",
"0.6818422",
"0.6818422",
"0.6805448",
"0.67691916",
"0.674125",
"0.674125",
"0.67317307",
"0.67301863",
"0.669316",
"0.6684633",
"0.66448915",
... | 0.0 | -1 |
Get maximum number of tasks for quest | def getMaxStagesForQuest(quest)
quests = getQuestStages(quest)
return quests.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_task_count\n variables.has_key?(:task_count) ? variables[:task_count] : 14\n end",
"def tasks_total_count\n tasks.length\n end",
"def total_tasks\n tasks.count\n end",
"def task_count()\n @tasks.size\n end",
"def max_queue_count()\n @max_queue_count\n end... | [
"0.70064133",
"0.6908555",
"0.675357",
"0.6669237",
"0.66600496",
"0.6603714",
"0.6390325",
"0.6351163",
"0.6274227",
"0.62049484",
"0.6155755",
"0.6142336",
"0.6129812",
"0.6095859",
"0.6093563",
"0.6093563",
"0.60773253",
"0.6073894",
"0.6063058",
"0.60590833",
"0.60535693"... | 0.6930273 | 1 |
=============================================================================== Class that contains utility methods to return quest properties =============================================================================== Utility function to check whether the player current has any quests | def hasAnyQuests?
if $PokemonGlobal.quests.active_quests.length >0 ||
$PokemonGlobal.quests.completed_quests.length >0 ||
$PokemonGlobal.quests.failed_quests.length >0
return true
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".... | [
"0.6926412",
"0.68074673",
"0.6314898",
"0.6099784",
"0.6074462",
"0.59012276",
"0.57835287",
"0.5622351",
"0.55206466",
"0.5518889",
"0.5451204",
"0.5374794",
"0.5361204",
"0.53589755",
"0.53361446",
"0.5306457",
"0.5283109",
"0.52714807",
"0.5264498",
"0.5262639",
"0.524865... | 0.6944552 | 0 |
Creates a competitor instance | def initialize(kernel, id, url)
@kernel, @id, @base_url = kernel, id, url
@browser = Waw::WSpec::Browser.new(url)
@logged = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\t\t@competitor=Competitor.new\n\tend",
"def create\n @competitor = Competitor.new(params[:competitor])\n\n respond_to do |format|\n if @competitor.save\n format.html { redirect_to @competitor, notice: 'Competitor was successfully created.' }\n format.json { render json: @compet... | [
"0.6566123",
"0.6186139",
"0.6151295",
"0.60796285",
"0.5994616",
"0.59778684",
"0.59422135",
"0.59255385",
"0.5859046",
"0.5844704",
"0.58171433",
"0.57836956",
"0.5757123",
"0.57419735",
"0.5709396",
"0.57029086",
"0.57025623",
"0.56908786",
"0.5640841",
"0.56271875",
"0.56... | 0.0 | -1 |
Logs the competitor in | def login_logout
if @logged
puts "Competitor #{@id} is going to log out"
@browser.invoke_action(@kernel.resources.controllers.people.logout)
raise "Logout action failed" unless @browser.last_action_result == ["success", "ok"]
@logged = false
else
puts "C... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logging_in\n end",
"def logging_in\n \t\t\n \tend",
"def log\n end",
"def log_in\n end",
"def logging_in\n logger.debug \"ApplicationController:logging_in >>> \"\n current_user.transfer_data(guest_user)\n end",
"def log_user_event\n depositor.log_event( event ) if depositor.respond_to?... | [
"0.65025175",
"0.6403714",
"0.61328286",
"0.6070707",
"0.60577536",
"0.60282683",
"0.600166",
"0.600166",
"0.600166",
"0.600166",
"0.600166",
"0.600166",
"0.600166",
"0.600166",
"0.59717184",
"0.59443665",
"0.59229016",
"0.58729225",
"0.5857296",
"0.5856763",
"0.58112717",
... | 0.5412943 | 82 |
Visits a static page | def visit_static_page
visiting = STATIC_LOCATIONS[Kernel.rand(STATIC_LOCATIONS.size)]
puts "Competitor #{@id} is visiting #{visiting}"
@browser.location = @base_url + visiting
raise "Visiting #{visiting} led to an error" unless @browser.is200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_mandate\n # renders static page\n end",
"def accessibility_statement\n # renders static page\n end",
"def load_page\n page.visit('')\n end",
"def show\n page = params[:page]\n puts \"the page is#{page}\"\n render \"statics#{page}\"\n end",
"def visit_page \n visi... | [
"0.7374358",
"0.7279139",
"0.69864595",
"0.686534",
"0.6844059",
"0.6788788",
"0.67241484",
"0.6723106",
"0.66264635",
"0.6612763",
"0.6612763",
"0.6612763",
"0.6482587",
"0.6482501",
"0.6482501",
"0.6482501",
"0.6482501",
"0.6482501",
"0.6482501",
"0.6482501",
"0.6482501",
... | 0.7803893 | 0 |
takes current_page and maximum to produce pagination array | def getPaginationArray(current_page, maximum, window = WINDOW, minimum = 1)
return((minimum+window<current_page ? minimum.upto(window).collect : minimum.upto(current_page+window).collect) + (current_page-window > minimum+window ? [".."] : []) + (current_page>minimum+window ? (current_page-window > minimum+window ? ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginated_pages(current_page, total_pages) # rubocop:disable Metrics/MethodLength\n paginated_pages = []\n pages = prepare_pages(current_page, total_pages)\n pages.each_with_index do |page, index|\n if (pages.size == index + 1) || (pages[index + 1] - page == 1)\n paginated_pages << page\n ... | [
"0.7356153",
"0.727306",
"0.7216143",
"0.7207415",
"0.7133741",
"0.6868365",
"0.6846854",
"0.6814351",
"0.6745161",
"0.6718364",
"0.6591143",
"0.65344787",
"0.6528539",
"0.64752436",
"0.6467507",
"0.64656174",
"0.6465026",
"0.64492476",
"0.6447451",
"0.6426955",
"0.6425104",
... | 0.7689271 | 0 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
if !@bank_aba_code.nil? && @bank_aba_code.to_s.length > 9
invalid_properties.push('invalid value for "bank_aba_code", the character length must be smaller than or equal to 9.')
end
if !@bank_account_name.nil? && @bank_account_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.... | [
"0.76497203",
"0.76497203",
"0.76497203",
"0.76497203",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7356452",
"0.7334807",
"0.72685325",
"0.7238964",
"0.7231359",
"0.72258264",
"0.7208294",
"0.71760833",
"0.717024... | 0.0 | -1 |
Check to see if the all the properties in the model are valid | def valid?
return false if !@bank_aba_code.nil? && @bank_aba_code.to_s.length > 9
return false if !@bank_account_name.nil? && @bank_account_name.to_s.length > 50
return false if !@bank_account_number.nil? && @bank_account_number.to_s.length > 50
bank_account_type_validator = EnumAttributeValidat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.78992486",
"0.78992486",
"0.70971805",
"0.70782334",
"0.7032205",
"0.7031276",
"0.69510347",
"0.6869891",
"0.6858077",
"0.6858077",
"0.68287027",
"0.6823878",
"0.6820306",
"0.68144894",
"0.6794656",
"0.6752167",
"0.66843414",
"0.6676546",
"0.6667755",
"0.66296124",
"0.6618... | 0.0 | -1 |
Custom attribute writer method with validation | def bank_aba_code=(bank_aba_code)
if !bank_aba_code.nil? && bank_aba_code.to_s.length > 9
fail ArgumentError, 'invalid value for "bank_aba_code", the character length must be smaller than or equal to 9.'
end
@bank_aba_code = bank_aba_code
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def bank_account_name=(bank_account_name)
if !bank_account_name.nil? && bank_account_name.to_s.length > 50
fail ArgumentError, 'invalid value for "bank_account_name", the character length must be smaller than or equal to 50.'
end
@bank_account_name = bank_account_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.64714426",
"0.6314092",
"0.6314092",
"0.62843996",
"0.6279117",
"0.6212286",
"0.6188891",
"0.6179444",
"0.6065791",
"0.6032525",
"0.5996907",
"0.5990497",
"0.5959816",
"0.5938802",
"0.59287214",
"0.5895985",
"0.58595186",
"0.5852596",
"0.5847984",
"0.58444107",
"0.58343303... | 0.0 | -1 |
Custom attribute writer method with validation | def bank_account_number=(bank_account_number)
if !bank_account_number.nil? && bank_account_number.to_s.length > 50
fail ArgumentError, 'invalid value for "bank_account_number", the character length must be smaller than or equal to 50.'
end
@bank_account_number = bank_account_number
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method checking allowed values (enum). | def bank_account_type=(bank_account_type)
validator = EnumAttributeValidator.new('String', ['Checking', 'Savings'])
unless validator.valid?(bank_account_type)
fail ArgumentError, 'invalid value for "bank_account_type", must be one of #{validator.allowable_values}.'
end
@bank_account_type... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end",
"def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n ... | [
"0.7088127",
"0.64820594",
"0.6429773",
"0.6227689",
"0.61418885",
"0.5809922",
"0.57507086",
"0.5743216",
"0.5736045",
"0.5708027",
"0.57014966",
"0.56777334",
"0.5601988",
"0.55947953",
"0.55464065",
"0.55371004",
"0.55344343",
"0.5528221",
"0.5434983",
"0.54312384",
"0.541... | 0.0 | -1 |
Custom attribute writer method with validation | def bank_name=(bank_name)
if !bank_name.nil? && bank_name.to_s.length > 50
fail ArgumentError, 'invalid value for "bank_name", the character length must be smaller than or equal to 50.'
end
@bank_name = bank_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method checking allowed values (enum). | def bank_owner_type=(bank_owner_type)
validator = EnumAttributeValidator.new('String', ['Personal', 'Business'])
unless validator.valid?(bank_owner_type)
fail ArgumentError, 'invalid value for "bank_owner_type", must be one of #{validator.allowable_values}.'
end
@bank_owner_type = bank_o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end",
"def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n ... | [
"0.7087152",
"0.6480326",
"0.6429858",
"0.62265116",
"0.61428237",
"0.58098733",
"0.57501006",
"0.5743426",
"0.57373345",
"0.5708213",
"0.56996876",
"0.5677225",
"0.5603006",
"0.5594775",
"0.5547809",
"0.5538741",
"0.5535209",
"0.55286884",
"0.5435018",
"0.5430014",
"0.541900... | 0.0 | -1 |
Custom attribute writer method with validation | def customer_tax_id=(customer_tax_id)
if !customer_tax_id.nil? && customer_tax_id.to_s.length > 9
fail ArgumentError, 'invalid value for "customer_tax_id", the character length must be smaller than or equal to 9.'
end
@customer_tax_id = customer_tax_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def drivers_license_dob=(drivers_license_dob)
if !drivers_license_dob.nil? && drivers_license_dob.to_s.length > 10
fail ArgumentError, 'invalid value for "drivers_license_dob", the character length must be smaller than or equal to 10.'
end
@drivers_license_dob = drivers_license_dob
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def drivers_license_number=(drivers_license_number)
if !drivers_license_number.nil? && drivers_license_number.to_s.length > 50
fail ArgumentError, 'invalid value for "drivers_license_number", the character length must be smaller than or equal to 50.'
end
@drivers_license_number = drivers_lice... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.5832836... | 0.0 | -1 |
Custom attribute writer method with validation | def drivers_license_state=(drivers_license_state)
if !drivers_license_state.nil? && drivers_license_state.to_s.length > 2
fail ArgumentError, 'invalid value for "drivers_license_state", the character length must be smaller than or equal to 2.'
end
@drivers_license_state = drivers_license_stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{at... | [
"0.64714426",
"0.6314092",
"0.6314092",
"0.62843996",
"0.6279117",
"0.6212286",
"0.6188891",
"0.6179444",
"0.6065791",
"0.6032525",
"0.5996907",
"0.5990497",
"0.5959816",
"0.5938802",
"0.59287214",
"0.5895985",
"0.58595186",
"0.5852596",
"0.5847984",
"0.58444107",
"0.58343303... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
bank_aba_code == o.bank_aba_code &&
bank_account_name == o.bank_account_name &&
bank_account_number == o.bank_account_number &&
bank_account_type == o.bank_account_type &&
bank_name == o.bank_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.7291717",
"0.7188103",
"0.70395297",
"0.7007927",
"0.68874705",
"0.6861532",
"0.6707156",
"0.6660597",
"0.66147524",
"0.658478",
"0.6584619",
"0.6580019",
"0.65543133",
"0.6543933",
"0.65068495",
"0.6479513",
"0.6456241",
"0.6415999",
"0.6412208",
"0.6412208",
"0.6412208",... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[bank_aba_code, bank_account_name, bank_account_number, bank_account_type, bank_name, bank_owner_type, customer_tax_id, drivers_license_dob, drivers_license_number, drivers_license_state].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.638... | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ... | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.666... | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s... | [
"0.7330944",
"0.7273544",
"0.72500145",
"0.72457504",
"0.72181696",
"0.72135216",
"0.71906066",
"0.7182661",
"0.717915",
"0.717915",
"0.717915",
"0.717915",
"0.717915",
"0.717915",
"0.717915",
"0.7178786",
"0.7178786",
"0.7178786",
"0.7178786",
"0.7178786",
"0.7178786",
"0.... | 0.7228586 | 16 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"de... | [
"0.901024",
"0.89506465",
"0.84703195",
"0.83409667",
"0.8337169",
"0.8337169",
"0.8332247",
"0.82546586",
"0.8145818",
"0.8144667",
"0.81357557",
"0.812714",
"0.8093436",
"0.8086725",
"0.8073356",
"0.8039774",
"0.80308646",
"0.80064154",
"0.80064154",
"0.80064154",
"0.800641... | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.84283537",
"0.8347048",
"0.8347048"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n ... | [
"0.8270299",
"0.78767854",
"0.78726953",
"0.7802364",
"0.7789188",
"0.77806795",
"0.7775915",
"0.7767511",
"0.7760525",
"0.7760525",
"0.77559966",
"0.7731286",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",... | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @va... | [
"0.67211187",
"0.67211187",
"0.666904",
"0.6657421",
"0.65874577",
"0.6453551",
"0.64165586",
"0.64165586",
"0.63830626",
"0.63459253",
"0.63054734",
"0.6224601",
"0.6152671",
"0.61033845",
"0.60806715",
"0.60806715",
"0.60736424",
"0.6036857",
"0.60224265",
"0.5937387",
"0.5... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_news
@news = News.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def news_params
params.require(:news).permit(:title, :body)
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 |
and every lowercase letter by its uppercase version. All other characters should be unchanged. You may not use Stringswapcase; write your own version of this method. solution 1 | def swapcase(string)
swapped_case = string.chars.map do |char|
if char =~ /[a-z]/ then char.upcase
elsif char =~ /[A-Z]/ then char.downcase
else char.downcase
end
end
swapped_case.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swapcase(str)\n result_str = ''\n str.each_char do |char|\n if char.count('a-z') > 0\n result_str += char.upcase\n else\n result_str += char.downcase\n end\n end\n result_str\nend",
"def swapcase_bk(str)\n str.gsub(/([a-z]|[A-Z])/) { |letter| letter =~ /[a-z]/ ? letter.upcase : letter... | [
"0.8157635",
"0.8122964",
"0.8031129",
"0.8013708",
"0.7938107",
"0.7935862",
"0.7905794",
"0.7901973",
"0.78828865",
"0.78770584",
"0.7863463",
"0.78574294",
"0.7839315",
"0.7828488",
"0.7827201",
"0.7826694",
"0.7824953",
"0.7824405",
"0.7817813",
"0.78119236",
"0.777812",
... | 0.7379173 | 91 |
the Annual Percentage Rate (APR) the loan duration From the above, you'll need to calculate the following two things: monthly interest rate loan duration in months Given a loan amount of L and APR of y% over z years monthly interest rate v=apr/12 /100 This will give a decimal representing the monthly interest rate. loa... | def prompt(message)
puts "=> #{message}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_apr\n payment_ratio = monthly_payment_with_fees / loan_amount\n f = lambda {|k| (k**(self.period + 1) - (k**self.period * (payment_ratio + 1)) + payment_ratio)}\n f_deriv = lambda { |k| ((self.period + 1) * k**self.period) - (self.period * (payment_ratio + 1) * k**(self.period - 1))}\n... | [
"0.77986",
"0.76595396",
"0.75249624",
"0.7318206",
"0.72526187",
"0.7088119",
"0.6930633",
"0.67913395",
"0.67086416",
"0.6664624",
"0.65877956",
"0.6523387",
"0.6499343",
"0.64012754",
"0.6324625",
"0.6200358",
"0.6188956",
"0.61625856",
"0.61589515",
"0.6126233",
"0.608566... | 0.0 | -1 |
GET /homeworks/1 GET /homeworks/1.json | def show
if(filters)
#Revisamos si incio sesion
if(!session[:user_id])
flash[:error] = "Acceso denegado"
redirect_to home_path
return
end
#Si no es admin, dueño o participante, chao
if( (User.find(session[:user_id]).admin) || (Homework.find(params[:id]).user.id == session[:user_id]) || (Participa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end",
"def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n... | [
"0.7221033",
"0.7221033",
"0.70669985",
"0.6909496",
"0.68681705",
"0.67669284",
"0.67596513",
"0.6753722",
"0.673994",
"0.673994",
"0.66785383",
"0.66776884",
"0.66482407",
"0.6560151",
"0.6539761",
"0.6509684",
"0.6509684",
"0.64965427",
"0.64931756",
"0.64786094",
"0.63898... | 0.0 | -1 |
GET /homeworks/new GET /homeworks/new.json | def new
if(filters)
#Revisamos si incio sesion
if(!session[:user_id])
flash[:error] = "Acceso denegado"
redirect_to home_path
return
end
end
@homework = Homework.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @homework }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @homework = Homework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @homework }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end",
"def new\n @work = Wo... | [
"0.7740934",
"0.76035714",
"0.7601485",
"0.759514",
"0.759514",
"0.7205977",
"0.7186256",
"0.7180083",
"0.71278244",
"0.7060748",
"0.7051293",
"0.7050734",
"0.7049303",
"0.7026071",
"0.69925964",
"0.69300413",
"0.6922538",
"0.69192827",
"0.68677866",
"0.6844349",
"0.6811454",... | 0.6848242 | 19 |
POST /homeworks POST /homeworks.json | def create
if(filters)
#Revisamos si incio sesion
if(!session[:user_id])
flash[:error] = "Acceso denegado"
redirect_to home_path
return
end
end
#Contamos las tareas para asegurarnos de que no tenga sobre 20
userid = session[:user_id]
if(User.find(userid).homeworks.count > 20)
flash[:er... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @homework = current_user.homeworks.new(homework_params)\n\n respond_to do |format|\n if @homework.save\n format.html { redirect_to @homework, notice: 'Homework was successfully created.' }\n format.json { render :show, status: :created, location: @homework }\n else\n ... | [
"0.71885186",
"0.6889955",
"0.66597414",
"0.6620454",
"0.6558115",
"0.65466493",
"0.654357",
"0.6496788",
"0.6496788",
"0.6447532",
"0.6447532",
"0.6430973",
"0.63929",
"0.6389309",
"0.6355741",
"0.6348551",
"0.6342085",
"0.6301178",
"0.62824434",
"0.62394273",
"0.6222122",
... | 0.0 | -1 |
PUT /homeworks/1 PUT /homeworks/1.json | def update
if(filters)
#Revisamos si incio sesion
if(!session[:user_id])
flash[:error] = "Acceso denegado"
redirect_to home_path
return
end
#Revisamos que sea su tarea
if(Homework.find(params[:id]).user.id != session[:user_id])
flash[:error] = "Acceso denegado"
redirect_to home_path
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @homework.update(homework_params)\n format.html { redirect_to @homework, notice: 'Homework was successfully updated.' }\n format.json { render :show, status: :ok, location: @homework }\n else\n format.html { render :edit }\n format.j... | [
"0.66425145",
"0.6622895",
"0.6362117",
"0.6356922",
"0.630972",
"0.62722087",
"0.62626",
"0.62434226",
"0.62061757",
"0.61460084",
"0.6137347",
"0.61283636",
"0.60916406",
"0.605979",
"0.605979",
"0.605979",
"0.605979",
"0.60586536",
"0.6057261",
"0.60353494",
"0.60246944",
... | 0.0 | -1 |
DELETE /homeworks/1 DELETE /homeworks/1.json | def destroy
if(filters)
#Revisamos si incio sesion
if(!session[:user_id])
flash[:error] = "Acceso denegado"
redirect_to home_path
return
end
#Revisamos que sea su tarea
if(Homework.find(params[:id]).user.id != session[:user_id])
flash[:error] = "Acceso denegado"
redirect_to home_path
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @homework = Homework.find(params[:id])\n @homework.destroy\n\n respond_to do |fo... | [
"0.7036413",
"0.68691933",
"0.6853342",
"0.68320596",
"0.6797311",
"0.6794649",
"0.67910594",
"0.6747574",
"0.67384756",
"0.6736223",
"0.670999",
"0.6704891",
"0.6663203",
"0.6649097",
"0.66440535",
"0.6643531",
"0.6613686",
"0.6613686",
"0.6613686",
"0.6613686",
"0.6610697",... | 0.0 | -1 |
Invite people to this homework | def invite
if(filters)
#Revisamos si incio sesion
if(!session[:user_id])
flash[:error] = "Acceso denegado"
redirect_to home_path
return
end
#Revisamos que sea su tarea
if(Homework.find(params[:id]).user.id != session[:user_id])
flash[:error] = "Acceso denegado"
redirect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invite_people\n end",
"def invite\n \n end",
"def existing_workplace_invite(sender, invite, recipient_email, recipient_name, workplace)\n @sender = sender\n @invite = invite\n @recipient_email = recipient_email\n @recipient_name = recipient_name\n @workpla... | [
"0.7445946",
"0.68268937",
"0.6749575",
"0.64790535",
"0.64690304",
"0.6419441",
"0.6377431",
"0.6339624",
"0.62758493",
"0.6163723",
"0.6158972",
"0.6153506",
"0.6086437",
"0.608313",
"0.608025",
"0.60781646",
"0.60591066",
"0.5987101",
"0.59848523",
"0.59735113",
"0.5967652... | 0.589504 | 28 |
Good one Shaggy! We all love to watch Scooby Doo, Shaggy Rogers, Fred Jones, Daphne Blake and Velma Dinkley solve the clues and figure out who was the villain. The story plot rarely differed from one episode to the next. Scooby and his team followed the clue then unmasked the villain at the end. Task Your task is to in... | def scoobydoo(villian, villians)
letters = ('a'..'z').to_a
numbers = (0..25).to_a
letters_to_numbers = letters.zip(numbers).to_h
numbers_to_letters = numbers.zip(letters).to_h
villians_downcase = villians.map { |v| v.downcase.delete(' ') }
villians_hash = (villians_downcase).zip(villians).to_h
s = villi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reveal_matches(letter)\n hits = []\n i = 0\n @secret.split(\"\").each do |c|\n hits << i if c == letter\n i += 1\n end\n hits.each do |i|\n @solution[i] = letter\n end\n return @solution\n end",
"def vogal(str)\n vogals = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n cons = [\"... | [
"0.5957531",
"0.57288206",
"0.5694276",
"0.5670013",
"0.5528298",
"0.54866487",
"0.5469473",
"0.54055536",
"0.54025483",
"0.5397446",
"0.53881043",
"0.537353",
"0.5345706",
"0.53359437",
"0.5328988",
"0.53200656",
"0.5292794",
"0.5286432",
"0.52838755",
"0.52832794",
"0.52823... | 0.5669547 | 4 |
called after we enter income (we know benefits == no) | def rate_type
if state_benefits?
if @number_of_shared_care_nights > 0
:nil
else
:flat
end
else
# work out the rate based on income
@calculator_data[:rates].find { |r| capped_income <= r[:max] }[:rate]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nonprofit\n end",
"def income_not_pending\n return if @income.pending?\n\n flash[:danger] = t \"income.noti.no_edit\"\n return redirect_to admin_incomes_path if current_user.admin?\n\n redirect_to manager_incomes_path\n end",
"def pay_interest!(entity)\n owed = interest_owed(entity)\... | [
"0.6203122",
"0.61615586",
"0.5987316",
"0.59773004",
"0.5957404",
"0.5946024",
"0.592978",
"0.58939916",
"0.5890423",
"0.58793324",
"0.58602214",
"0.5858547",
"0.5848111",
"0.5846483",
"0.58438784",
"0.5832177",
"0.5824982",
"0.5783358",
"0.5755007",
"0.57528013",
"0.57527",... | 0.0 | -1 |
only used in the 2012 scheme | def calculate_basic_plus_rate_payment
basic_plus_rate = capped_income - (capped_income * relevant_other_child_multiplier)
basic_qualifying_child_amount = (BASIC_PLUS_RATE_THRESHOLD * basic_rate_multiplier)
additional_qualifying_child_amount = ((basic_plus_rate - BASIC_PLUS_RATE_THRESHOLD) * basic_plus... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def probers; end",
"def schumann; end",
"def formation; end",
"def stderrs; end",
"def verdi; end",
"def suivre; end",
"def malts; end",
"def intensifier; end",
"def terpene; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def spe... | [
"0.69243294",
"0.6569358",
"0.6562518",
"0.6445506",
"0.6445372",
"0.62776935",
"0.62731624",
"0.6181241",
"0.6179366",
"0.6173474",
"0.6171393",
"0.6153712",
"0.6153712",
"0.6153712",
"0.6153712",
"0.6081211",
"0.60807437",
"0.6054048",
"0.60005826",
"0.59885603",
"0.5976059... | 0.0 | -1 |
never use more than the net (or gross) income maximum in calculations | def capped_income
max_income = SCHEME_MAX_INCOME
@income > max_income ? max_income : @income
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_consumption_price\n dataset_get(:max_consumption_price) || marginal_costs\n end",
"def max_profit(prices)\n buy1 = Float::INFINITY\n buy2 = Float::INFINITY\n profit1 = 0\n prices.reduce(0) do |total_profit, price|\n buy1 = [buy1, price].min\n profit1 = [profit1, price - buy1].max\n ... | [
"0.7039826",
"0.69743913",
"0.69299847",
"0.6902769",
"0.6832776",
"0.67691475",
"0.67678267",
"0.6765757",
"0.6748349",
"0.67467314",
"0.67103744",
"0.6697186",
"0.66824484",
"0.66499215",
"0.6644036",
"0.6616279",
"0.6604594",
"0.656939",
"0.656939",
"0.6555219",
"0.6547768... | 0.68505913 | 4 |
GET /gears GET /gears.json | def index
@gears = Gear.all
@hash = Gmaps4rails.build_markers(@gears) do |gear , marker|
marker.lat gear.latitude
marker.lng gear.longitude
marker.infowindow gear.title
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def index\n @geopoints = Geopoint.all\n @jsons = @geopoints.to_gmaps4rails\n respond_... | [
"0.65027606",
"0.61816555",
"0.616994",
"0.61403424",
"0.61261564",
"0.61101073",
"0.6106715",
"0.6047167",
"0.6028472",
"0.6006025",
"0.597696",
"0.5968287",
"0.5960822",
"0.5958917",
"0.59413534",
"0.5934045",
"0.59064263",
"0.587133",
"0.58640677",
"0.5857912",
"0.5852912"... | 0.57244086 | 36 |
GET /gears/1 GET /gears/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n... | [
"0.6345778",
"0.63266045",
"0.6292802",
"0.61679953",
"0.6159783",
"0.6118803",
"0.6098425",
"0.60803026",
"0.6062443",
"0.6061925",
"0.60604405",
"0.6047547",
"0.60302484",
"0.6008703",
"0.60005224",
"0.5980798",
"0.59760755",
"0.5957241",
"0.59496224",
"0.59491116",
"0.5938... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.