query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
5b0c32dad1f2f2931ee751d8d9377950
Defining the instance method
[ { "docid": "ba772a78e80d732cf482257c10cf56d7", "score": "0.0", "text": "def convert(number)\n drops = drops(number)\n#Here the check and return if no drop is get. As the test request \n drops.empty? ? number.to_s : drops\n end", "title": "" } ]
[ { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7670076", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7670076", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46",...
9a6732fe4cb472aaa22dd0390ea22a47
Returns the datespecific liquid attributes
[ { "docid": "9af0d2a1ff5dd829761a049a48532758", "score": "0.79064023", "text": "def liquid_date_attributes\n date_format = self.site.config['date_format']\n date_attributes = {}\n date_attributes['date_formatted'] = format_date(self.data['date'], date_format) if self.data.has_key?('d...
[ { "docid": "9989e58cfa7f3a521cd34a3440777a51", "score": "0.78392446", "text": "def liquid_date_attributes\n date_format = self.site.config['date_format']\n date_attributes = {}\n date_attributes['date_formatted'] = format_date(self.data['date'], date_format) if self.data.has_key?('d...
4324bc0398a0e378f9a8014459557af1
GET /oss/new GET /oss/new.json
[ { "docid": "da1bd82e14cb1e07f27c7084d73a7cf6", "score": "0.0", "text": "def new\n @os = Os.new\n @os.itens.build\n @os.pagamentos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @os }\n end\n end", "title": "" } ]
[ { "docid": "7b689672fb051affca32a268fdcb4736", "score": "0.6941042", "text": "def new\n\tuuid = SecureRandom.uuid\n\t@new_url = searches_url + \"/\" + uuid # creates http://localhost/search/123-34552-adsfrjha-234\n\tresponse.set_header(\"Location\", @new_url)\n respond_to do |format|\n forma...
94a9a86e29a6923cf21840b36f1406e6
definimos el head estructura html
[ { "docid": "d6b8078b92cce832a9bbce382aab29f7", "score": "0.7029836", "text": "def head()\n head = '<!DOCTYPE html>\n <html lang=\"es\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"author\" content=\"Esteban Ramirez\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale...
[ { "docid": "1907945582ae5bb63f44b3c062bddeac", "score": "0.80656356", "text": "def head\n render 'head.html'\n end", "title": "" }, { "docid": "66a464556c9c7795dcfb8e3fe79f680c", "score": "0.78444", "text": "def head\n\t%{\n <head>\n <title>Shelob</title>\n </head>\n...
8d336fb415124befa124c44fb465c72c
To be used in any controller
[ { "docid": "5128731d048d25477dfe46da14146474", "score": "0.0", "text": "def record_activity(extra)\n begin\n @activity = ActivityLog.new\n unless current_user.nil?\n @activity.user_id = current_user.id\n @activity.user = current_user.name\n end\n @activity.controller...
[ { "docid": "40f7f9a8053cda5781e8cf27340a2d71", "score": "0.71093065", "text": "def controller; end", "title": "" }, { "docid": "40f7f9a8053cda5781e8cf27340a2d71", "score": "0.71093065", "text": "def controller; end", "title": "" }, { "docid": "40f7f9a8053cda5781e8cf27340a...
3520be7ab03c183271582621987223fc
GET /departures/new GET /departures/new.xml
[ { "docid": "2f2f72237e83c40448b15869150a054e", "score": "0.7444384", "text": "def new\n @departure = Departure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @departure }\n end\n end", "title": "" } ]
[ { "docid": "f06e35ff5f6c6407ae3054299369d851", "score": "0.6855921", "text": "def new\n @dept = Dept.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dept }\n end\n end", "title": "" }, { "docid": "57d2de6224c6f35cff05fda775d...
5af897e39203a503c0128a01f9674616
PATCH/PUT /filmmakers/1 PATCH/PUT /filmmakers/1.json
[ { "docid": "313d3cfd6e634d3083144d42c7fbccd7", "score": "0.7181654", "text": "def update\n respond_to do |format|\n if @filmmaker.update(filmmaker_params)\n format.html { redirect_to @filmmaker, notice: 'Filmmaker was successfully updated.' }\n format.json { render :show, status: :...
[ { "docid": "afbbb4162a5562eb326419f976bba10e", "score": "0.7299548", "text": "def update\n @filmmaker = Filmmaker.find(params[:id])\n\n respond_to do |format|\n if @filmmaker.update_attributes(params[:filmmaker])\n format.html { redirect_to @filmmaker, notice: 'Filmmaker was successful...
9bb576243a98307bffb10f279b61dbf6
Add a song to a user
[ { "docid": "ba87406b89b0ff4fef8c7d6afe209538", "score": "0.0", "text": "def add_song(song)\n return if Song.find_by_id(song).nil?\n songs << song\n end", "title": "" } ]
[ { "docid": "c954880520c77b53853042df78b9cd4c", "score": "0.78743047", "text": "def add_user_favorite_song song_id\n params = { 'songID' => song_id }\n send_request 'addUserFavoriteSong', params\n end", "title": "" }, { "docid": "0d3ef1d3a483a70c834eabb6282aaac2", "score": "0.74939...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "5fd4edd5a763da8cba8081f3b70dcedb", "score": "0.0", "text": "def task_params\n params.require(:task).permit(:name, :category_id, :attachment)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
66e26fa055d5c8e98ebf6c1ed75cb0b0
Parses the supplied input and returned a decommented, tagified and cleaned string.
[ { "docid": "e7dbb9653548a359aa3893d6f64c2b9e", "score": "0.84885716", "text": "def parse\n tagify(decommentify(@input)).strip\n end", "title": "" } ]
[ { "docid": "0fcf26283ccac8df1664dffc3be24b1e", "score": "0.68763405", "text": "def decommentify input\n output = input.dup\n # Remove multiline comments:\n output.gsub!(/(#{Regexp.quote @block_comment_start}.+?#{Regexp.quote @block_comment_end})/m, \"\")\n # Remove inline comments:\n...
e80cebc3cf0b4e632b7bb1800342a813
Create ReturnById xml as per the api format . "params" is collection keyvalues, in this "params" holds Amount, TransactionId. It returns xml format in string.
[ { "docid": "a1c574fa6f77304cfba402f9ab10e57e", "score": "0.84495443", "text": "def returnByIdXML(params)\n begin\n Nokogiri::XML::Builder.new do |xml|\n xml.ReturnById('xmlns:i' => 'http://www.w3.org/2001/XMLSchema-instance',\n 'xmlns' => 'http://schemas.ipcommerce.com/CWS...
[ { "docid": "28ba7f3dc4e98ee0059363dcd9e1e8f6", "score": "0.6123846", "text": "def adjustXML(params)\n begin\n Nokogiri::XML::Builder.new do |xml|\n xml.Adjust('xmlns:i' => 'http://www.w3.org/2001/XMLSchema-instance',\n 'xmlns' => 'http://schemas.ipcommerce.com/CWS/v2.0/Tra...
5c2ba87f5cd8059a949d911552fff553
defines events on all elements in collection event, String, name of event minus 'on' ie, col.on("click") do ... end, sets "onclick" to block, b b, block to use for event returns self
[ { "docid": "e07c4008e87cd8cb0ec3c1dbbcfe5043", "score": "0.6956272", "text": "def on event,&b\n each do |e| \n e.on event,&b\n end\n self\n end", "title": "" } ]
[ { "docid": "a43f6bac396653ed199d25e1247be077", "score": "0.64911634", "text": "def on event,&b\n @element.set \"on#{event}\",&b\n end", "title": "" }, { "docid": "4a781fe590cb9c6c2a3a9e77372c5b66", "score": "0.63598204", "text": "def setOnClickEvent(name, &block)\n\t\t@it...
685f7253a9ebb307691604bf3080355d
Constants and Class Methods Class constructor
[ { "docid": "688fb7e873a6f5863052ddc775a22c0d", "score": "0.0", "text": "def initialize(rtime=Time.now().to_i(), stime=0, etime=0,\n last_known_id=0, queued_vm_ids=[])\n @filename = nil\n @rtime = rtime\n @etime = etime\n @stime = stime\n @last_known_i...
[ { "docid": "8e3629bb42b471c640e3e1bd665bf3b2", "score": "0.7476161", "text": "def initialize(*) end", "title": "" }, { "docid": "4b47ff77d50fd89449b4aee569683d2b", "score": "0.7328318", "text": "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"...
d6ca855b9c067fc9e3362c55ed861019
versions is already used for extend
[ { "docid": "51fcb26f1fcd44be62bc70fa22c8169c", "score": "0.0", "text": "def remote_versions\n Setting.upyun.images.versions\n end", "title": "" } ]
[ { "docid": "f9cade1d32c99f3e4129272f324bae6a", "score": "0.7597049", "text": "def installed_versions; end", "title": "" }, { "docid": "14bcc51d2301f9d77a21a4eda2f32d75", "score": "0.69541645", "text": "def get_versions(versions)\n versions.map {|v| [v,get_version(v)] }\n ...
a77f2d571dda4cf161a122b54fec3997
get the checkout sha related first level files and folders
[ { "docid": "33c67100836bcef803f70aefdff9f995", "score": "0.5631346", "text": "def first_level_fs(pr, filter = lambda { |x| true })\n sha = pr[:base_commit]\n begin\n fs = ls_tree(git.lookup(sha).tree)\n rescue StandardError => e\n log \"Cannot find commit #{sha} in base repo, head_com...
[ { "docid": "f795a6f73f714fe94fda7078179b87ee", "score": "0.7076404", "text": "def get_tree_sha(dir, tree = get_trees)\n tree['tree'].find { |t| t['path'] == dir }['sha']\n end", "title": "" }, { "docid": "2c02804ce8694a64a81eacc8d2a5bec3", "score": "0.70202565", "text": "def ...
3b2820dac12199b2c1da080b21436efc
POST /text_questions POST /text_questions.json
[ { "docid": "bc2419d35fdb61ce792ba69365663674", "score": "0.7321778", "text": "def create\n @text_question = TextQuestion.new(text_question_params)\n\n respond_to do |format|\n if @text_question.save\n format.html { redirect_to @text_question, notice: 'Text question was successfully cre...
[ { "docid": "07580a309f5df6ad5da834964117e58e", "score": "0.7354184", "text": "def create\n @text_question = @base_question.text_questions.new(params[:text_question])\n\n respond_to do |format|\n if @text_question.save\n format.html { redirect_to base_question_path(@base_question), noti...
e286b67b1636babbf6738bb7f1c09e50
Create the csar yaml This won't work, as the body just needs the yaml string.
[ { "docid": "ebc7da8ca2e6c9c7fba69418144177b4", "score": "0.69143814", "text": "def create\n megam_rest.post_csar(@yamldata)\n end", "title": "" } ]
[ { "docid": "0329a1f705a7389198ab3d738065774b", "score": "0.6847948", "text": "def body_as_yaml(yaml)\r\n @message_body_with_format = yaml\r\n format :yaml\r\n end", "title": "" }, { "docid": "f3b3ad93c5c8fa9897e733e93b5fce8b", "score": "0.6224684", "text": "def build_yam...
703e2bdba616723afcbd05ca80e95a91
Prepends content to 'content_for'
[ { "docid": "1e14a204191687d98cf0bb13dc45f406", "score": "0.5993792", "text": "def prepend_to name, content = nil, &block\n ivar = \"@content_for_#{name}\"\n content = capture(&block) if block_given?\n content ||= \"\"\n stored_content = instance_variable_get(ivar) || \"\"\n instance_varia...
[ { "docid": "0a16155c430f3a621fd5ba9f5739bd4d", "score": "0.65111756", "text": "def prepare(content)\n body = content.body\n body.gsub!('<title />', \"<h1>#{link_to_content(content)}</h1>\")\n \n if content.respond_to?(:published_at)\n body.gsub!('<timestamp />', \"<div class='...
67f60b164f890751c238ace6ae6027ac
Determines how the Fighter should select the item and on whom during battle (Use command). Return nil on error.
[ { "docid": "148364ec7f5c7ec32c525d1cd5e5f227", "score": "0.5495615", "text": "def choose_item_and_on_whom(enemy)\n C[@inventory.random_item, [self, enemy].sample]\n end", "title": "" } ]
[ { "docid": "ed4ebbb354c0eca052e10dd66c29a1b7", "score": "0.72764426", "text": "def choice_a_battle\n use_item_in_battle\n end", "title": "" }, { "docid": "35135efe5775a198c1e5cef4d7430ccc", "score": "0.6758379", "text": "def select_for_item(item)\n @cursor_fix = item.for_u...
39ac47442446682ca6dc09779afadf6b
pull the initialization vector from the front of the encoded message
[ { "docid": "a1581b8befd5d87acf402a6d1ad62289", "score": "0.0", "text": "def separate_iv_and_ciphertext(cipher, iv_and_ciphertext)\n idx = cipher.iv_len\n [iv_and_ciphertext[0..(idx - 1)], iv_and_ciphertext[idx..-1]]\n end", "title": "" } ]
[ { "docid": "871f73669031f4511408f9eb8022b23b", "score": "0.57510763", "text": "def slice_message_tail(message_vector)\n vector.new(message_vector.vector[-HASH_LENGTH / 8..-1])\n end", "title": "" }, { "docid": "41a73cd240a6eb10a2d9ea1e8e56a37c", "score": "0.5528789", "tex...
91f9679aeab766445e3872aa4eb91483
Helper: labeled_checkbox (Helpers) Draws a checkbox with a label. Usage labeled_checkbox(label, name, value[, attributes]]) Example != labeled_checkbox "I accept", :accept, true
[ { "docid": "aeefe576d3394238aded0fb41d3bcdd4", "score": "0.8500716", "text": "def labeled_checkbox(label, name, value, options={})\n id = options.delete(:id) || name\n\n attrs = options.map { |(k, v)| \" #{h k}='#{h v}'\" }.join('')\n\n [ \"<label#{attrs} class='checkbox' for='#{id}'>\",\...
[ { "docid": "11f6064510fbf1d063f80ef45360b5b6", "score": "0.7410696", "text": "def labeled_checkbox( text, checked, object, property )\n tag_id = object.to_s.gsub(/[\\[,\\]]/, \"_\") + \"_\" + property.to_s\n adds = \"checked='checked'\" if checked\n\n str = \"<input type='checkbox' ...
1f6a51acc37b6b2c275bfcf4a119a650
Set a variable to the given value.
[ { "docid": "b689a286a376e03e845b85f60d1c158b", "score": "0.7001576", "text": "def set(variable, *args, &block)\n if variable.to_s !~ /^[_a-z]/\n raise ArgumentError, \"invalid variable `#{variable}' (variables must begin with an underscore, or a lower-case letter)\"\n end\n\n ...
[ { "docid": "1bc48970053eda02d96faa1cbbfa25b6", "score": "0.8028821", "text": "def set_variable(name, value) \r\n \t\tmsg=\"SET VARIABLE \" + name + \" \" + value\r\n \t\tsend(msg)\r\n \t\treturn get_int_result()\r\n \tend", "title": "" }, { "docid": "ab860841da3f4c7c7dca83452a80b525", ...
7ec01338cb79f1ca27707fbf1352a939
Start a loop, accepting a request and handling it.
[ { "docid": "a9dea216fd34523cd539bc1070bacaa5", "score": "0.714658", "text": "def start_accepting_requests\n\t\tself.log.info \"Starting the request loop.\"\n\t\tself.reactor.start_polling( ignore_interrupts: true )\n\tend", "title": "" } ]
[ { "docid": "9e2a5fc99a7471b500718dfd13aa5f6a", "score": "0.74819785", "text": "def start\n loop do\n begin\n socket = tcp_server.accept\n\n handle_request(socket)\n ensure\n socket.close\n end\n end\n end", "title": "" }, { "docid": "d0a2529c235f89c...
2f25f93d75fcf44ec5b9927a5e3d4dc0
Bypasses the .members method so we can check for uniqueness of any newly added list item
[ { "docid": "5a3adaab437cd718a9f41907590d8744", "score": "0.67132676", "text": "def add_item(item)\n if member_labels.include?(item.pref_label)\n errors.add :members, \"must be unique\"\n else\n members << item\n end\n end", "title": "" } ]
[ { "docid": "2bcb15f09e6d3a9bdd287eca20e1d125", "score": "0.63148695", "text": "def missing_members\n new_members - (current_members & new_members)\n end", "title": "" }, { "docid": "5363c5e0c35e1ba88a739115418783da", "score": "0.6203831", "text": "def add_to_all_members(i...
57532c102d44a308313d606696a66185
GET /projects/1 GET /projects/1.json
[ { "docid": "c0fe3fa1d4745bf0b6750ab9dfb5735a", "score": "0.0", "text": "def show\n #render :text => params.to_json\n end", "title": "" } ]
[ { "docid": "b2d778e1a6b6df24139d1f5864dedb0f", "score": "0.7868971", "text": "def list\n get 'projects'\n end", "title": "" }, { "docid": "723f580541bd41ab30bb2973cfdea294", "score": "0.76979554", "text": "def listprojects\n get('listprojects.json')['projects']\n end", "t...
316b30086069e94f7aaf3dd3fd310fb8
Initiate the export of a contact list. Returns 200 if received OK.
[ { "docid": "e7762a11a2cb936e787c42d835f3415d", "score": "0.60225284", "text": "def post_outbound_contactlist_export_with_http_info(contact_list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OutboundApi.post_outbound_contactlist_export ...\"...
[ { "docid": "c5c66a5f392390cd3fdcedd2f8c966b2", "score": "0.66566724", "text": "def import\n fire_async_response('import_contacts')\n end", "title": "" }, { "docid": "afea8ee899b24246571d44d0fa9217c5", "score": "0.6543209", "text": "def add_export_contacts_activity(access_token, e...
519326bbc460242b0ca5f698f4dab6c4
Returns the value of attribute description_args.
[ { "docid": "207f17285f3d0ecad0d4f68ec9f11e46", "score": "0.739345", "text": "def description_args; end", "title": "" } ]
[ { "docid": "9a2ce8f739e7e098602d9d4e1bf1c2b4", "score": "0.7218626", "text": "def description\n attributes['description']\n end", "title": "" }, { "docid": "55ca238e83845c93b5a4c57ea05c5230", "score": "0.70798826", "text": "def description\n @attributes['description'...
61d0e096b90806575ba3a45dd482a920
See for redirect_uri reasoning
[ { "docid": "870b5117879430872e0a62b043f1bb6c", "score": "0.0", "text": "def build_access_token\n client.auth_code.get_token(\n request.params['code'],\n { redirect_uri: callback_url }.merge(token_params.to_hash(symbolize_keys: true)),\n deep_symbolize(options.auth_token...
[ { "docid": "ebd0cb55eca9f4af8c22fb569468f5f0", "score": "0.7769706", "text": "def redirect_uri\r\n @redirect_uri\r\n end", "title": "" }, { "docid": "99145c8a4adfe75e8fc1b8cebdfdbe5f", "score": "0.7619622", "text": "def default_redirect_uri_callback(uri, res)\n newuri = ...
1979a0a3ee8b6d41a9dbdf0b8cd98bc6
PATCH/PUT /evaluation_credits/1 PATCH/PUT /evaluation_credits/1.json
[ { "docid": "5f08d9fd1d47b71cbaa0fb728f103a15", "score": "0.7273072", "text": "def update\n respond_to do |format|\n if @evaluation_credit.update(evaluation_credit_params)\n format.html { redirect_to @evaluation_credit, notice: 'Evaluation credit was successfully updated.' }\n forma...
[ { "docid": "d14c238f993a5568c60a6556160c7c70", "score": "0.68048155", "text": "def update\n @credibility = Credibility.find(params[:id])\n\n respond_to do |format|\n if @credibility.update_attributes(params[:credibility])\n format.html { redirect_to @credibility, notice: 'Credibility w...
f57b117348ac9dbd710cb433fa93184c
Check if user is displaying Dashboard
[ { "docid": "fcceddd54bf2c8ce4ac497f73836499c", "score": "0.67346513", "text": "def in_dash_board?\n controller.controller_name == 'dash_board'\n end", "title": "" } ]
[ { "docid": "83bd84aae0668f47d5070b64f14601fd", "score": "0.7166879", "text": "def can_view_public_health_dashboard?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end", "title": "" }, { "docid": "c29bbdc25beddbeea7e66659b1ed3131", "score": "0.701849", "text":...
e3f8a6cfc9c169700d4e59853a4c196e
before_filter :authorise,:only => [:new, :edit, :delete]
[ { "docid": "6d6a9664b118df603e4e1c81fde15af7", "score": "0.0", "text": "def authorise\n unless signed_in?\n\t\t store_location\n redirect_to signin_path, :notice => \"Please sign in to access this page.\"\n end\n end", "title": "" } ]
[ { "docid": "2faf584a89dcdb915fe22d10611334b0", "score": "0.7381942", "text": "def edit\n authorize User\n end", "title": "" }, { "docid": "0fccedf1ebf66c2f024a215eee321c96", "score": "0.7052395", "text": "def show\n authorize! :show,Administracion::Usuario\n end", "title"...
ff20265b0f5c871835a9a47f39a884a5
Create a new element image Params: +name+:: image name file +data+:: raw data encoded in base64 format
[ { "docid": "f42def75bfaa6f9247675bb35e283635", "score": "0.67227453", "text": "def initialize(name, data = nil)\n super(name)\n\n # Create a fake ElemImage\n if not data.nil?\n @data = data\n set_preview()\n end\n\n @tags = Array.new\n end", "title": "" } ]
[ { "docid": "3ecea2222e6433864cb3e5075242aca3", "score": "0.8038413", "text": "def add_image(name, data)\n elem = ElemImage.new(name, data)\n add_element(elem)\n end", "title": "" }, { "docid": "b8c98f10b61f50970240e777c1620409", "score": "0.69392025", "text": "def create\n ...
ca0390256cb781c68c57a858d7fef8dc
Toggle rendering, enabling it if it was disabled, and viceversa.
[ { "docid": "3092d6aeb1c2de1a1ad500e3e0e14a9f", "score": "0.8671269", "text": "def toggle_rendering\n\t\t@rendering_enabled = !@rendering_enabled\n\tend", "title": "" } ]
[ { "docid": "a0a465ad921c5fbaf1062ff087bb04a8", "score": "0.7332668", "text": "def enable_rendering\n\t\t@rendering_enabled = true\n\tend", "title": "" }, { "docid": "7735206c60a8a31e97093a12da649662", "score": "0.69366026", "text": "def disable_rendering\n\t\t@rendering_enabled = fal...
53d54a8042670f938b69266753afeb9d
find deuplicates and its count in an array using group_by method
[ { "docid": "7c67bced0cbe4b9b1259ef8d7dd9e11a", "score": "0.74002624", "text": "def duplicates_count(arr)\n arr.group_by { |x| arr.count(x) }\nend", "title": "" } ]
[ { "docid": "5acdcb2be3adae0682955c2e27d559c5", "score": "0.6762638", "text": "def grouped_duplicates(collection); end", "title": "" }, { "docid": "29e37938b4c0b50208acafa453d89bcc", "score": "0.66713643", "text": "def no_dupes?(arr)\n count = Hash.new(0)\n arr.each { |e...
c1e4d4be5c2cc86af8977016ed85505f
Turn the clock one year forward
[ { "docid": "c1accbf859d90e3f49c44386373f9448", "score": "0.0", "text": "def one_year_passes\n if @age >= 46\n puts \"The orange tree has died at the age of #{@age}\"\n exit\n end\n @age +=1\n @height += 0.8\n\n if fruit_bearing?\n @bears_fruit = true\n end\n puts \"Al...
[ { "docid": "4747a97c7a1773032074bd83f2c29b33", "score": "0.731467", "text": "def advance_years(years)\n advance_to_date(to_date >> (years*12))\n end", "title": "" }, { "docid": "7be38327f35f7cb9d06e375b6131f70f", "score": "0.6926607", "text": "def next_year(years = 1)\n advanc...
4f95cccc616c9fb6bcf866524d280696
renders link with icon
[ { "docid": "a47811c0a747aba8e3c488df2027e469", "score": "0.7504087", "text": "def wrap_with_icon(link, icon)\n content_tag(:span, '', :style => 'float: left; margin-right: 0.3em; margin-left: -5px',\n :class => \"ui-icon ui-icon-%s\" % icon) + link\n end", "title": "" } ]
[ { "docid": "5d65503ce1a8767aee20ed4ad6e63d81", "score": "0.7991619", "text": "def icon_link(title, options = {}, icon = \"\")\n content_tag(:a, options) do\n content_tag(:i, \"\", class: icon) + content_tag(:span, title)\n end\n end", "title": "" }, { "docid": "82d5b9ad68bfb2c46d...
898dcf9c1ccb67d8890a7020572de76f
Traverses in an array, and tests each element with the 'predicate'. If the result of the test is true, applies the function to the element exactly once.
[ { "docid": "e61b0e40d675345b514cc87b4edcbacd", "score": "0.53250706", "text": "def replace(exp, predicate, function)\n if predicate.call(exp) and array?(exp)\n function.call(exp.collect { |item| replace(item, predicate, function) })\n elsif predicate.call(exp) and (not(array?(exp)))\n fu...
[ { "docid": "7eb22ee6b11db7f3653bdc8d0bef3167", "score": "0.6390763", "text": "def my_one?(array, &prc)\n results = array.select {|ele| prc.call(ele)}\n return 1 == results.length\nend", "title": "" }, { "docid": "efc0d88c460b803cb9b2447e5781f67e", "score": "0.6083891", "text": ...
3b8ed56ebfb182ba19f7b803cc449663
GET /course/1/intervals GET /course/1/intervals.xml
[ { "docid": "3a80fcdf585aede19b449e69afe31ad6", "score": "0.7444021", "text": "def index\n @course = Course.find(params[:course_id])\n @intervals = @course.intervals.find(:all, :limit => @course.repetitions + 1 )\n \n respond_to do |format|\n format.html # index.html.erb\n format.xm...
[ { "docid": "c9c17bb4e5a4da88c6d5dc5b6aa8c97c", "score": "0.63793004", "text": "def instrument_get_active_intervals(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: InstrumentApi#instrument_get_active_intervals ...\"\n end\n \n # resource path...
7dc7f069db6343f5b74000dec1b5d880
The default dataset class to use for the database
[ { "docid": "3ce1b66e226d058c6920158ade193d06", "score": "0.8824762", "text": "def dataset_class_default\n self.class.const_get(:DatasetClass)\n end", "title": "" } ]
[ { "docid": "42028f4ac6f6ea92d18e05889febca3d", "score": "0.75380605", "text": "def dataset\n implemented_in_subclass\n end", "title": "" }, { "docid": "9d9cfac38eaf1d9af87735c2c4248a07", "score": "0.7146395", "text": "def dataset(name)\n datasets[name] = dataset_cl...
0787b808791bb93c43ca2e79d6482525
Gets all the subscribed events from a certain bookie
[ { "docid": "4edd4697c16b5848e938a182bfa5adc5", "score": "0.662725", "text": "def getSubscribedEventsFrom (email)\n @users[email].subscribedEvents\n end", "title": "" } ]
[ { "docid": "25509ee988e1d9ea19ceb7e66d146967", "score": "0.6712599", "text": "def subscribed_events\n adapter.subscribers.map(&:meta)\n end", "title": "" }, { "docid": "46845641fe8196ad1268b1b4e585b331", "score": "0.65943307", "text": "def subscribers\n event.subscribe...
2964d2644cadae830ae13a3de07600bf
all of the methods
[ { "docid": "23e8ac60b5fdae0ecd56abf1351a2e68", "score": "0.0", "text": "def parse_operator(op, args)\n raise_unimplemented\n end", "title": "" } ]
[ { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.8471483", "text": "def methods; end", "title": "" }, { "docid": "b327a885692d528cdbf7b43ff9735d01", "score": "0.82936794", "text": "def methods\n\t\tend", "title": "" }, { "docid": "f3aa8ccef9ba023692217c09c4d3cb1...
a2096018a4f6f3d0ab663a8a5dcfb25a
PUT /archivos/1 PUT /archivos/1.json
[ { "docid": "3156eb9e85b86c13e4a8d985508849d7", "score": "0.654414", "text": "def update\n @archivo = Archivo.find(params[:id])\n\n respond_to do |format|\n if @archivo.update_attributes(params[:archivo])\n format.html { redirect_to @archivo, :notice => 'Archivo was successfully updated...
[ { "docid": "8dfc66e3284735bb097b8723333f3daf", "score": "0.68434274", "text": "def update\n\n params[:archivo][:url] = \"#{Rails.root}/attachments/archivos/\"+params[:archivo][:url]\n\n @archivo = Archivo.find(params[:id])\n\n respond_to do |format|\n if @archivo.update_attributes(params[:...
0ce390a52c08b17d1c82810393473a18
adds filters to this context. this does not register the filters with the main Template object. see Template.register_filter for that
[ { "docid": "d1086f5938c6d9349a3615f9c8ee51d6", "score": "0.5614385", "text": "def add_filters(filters)\n filters = [filters].flatten.compact\n\n filters.each do |f|\n raise ArgumentError, \"Expected module but got: #{f.class}\" unless f.is_a?(Module)\n strainer.extend(f)\n e...
[ { "docid": "d5c163c58ae74080e5739b62d25853c2", "score": "0.6609158", "text": "def add_collection_filters\n @template.collection_filters.each do |collection_filter|\n collection_filter.duplicate!(\n assign_collection: @collection,\n )\n end\n end", "title": "" }, { "do...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "fd375e7fa01b97cf8ac364cb50a91fd0", "score": "0.0", "text": "def new_translation_params\n params.except(:project_id).permit(:key_id, :locale_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
6b71a848773d75d41a9c562747253152
Gets the default arguments used to start a master instance of TokyoTyrant.
[ { "docid": "b97103987c909cd4977ff4a7693faaf3", "score": "0.62984234", "text": "def default_master_server_arguments(port, date)\n {\n :sid => '1',\n :thnum => '16',\n :format => 'tch',\n :bnum => '503316469',\n :apow => '11',\n :fpow => '18',\n :ncnum...
[ { "docid": "3b2d597ef3c45406085348c1a9007303", "score": "0.65190816", "text": "def default_jvmargs\n [ ]\n end", "title": "" }, { "docid": "ed4f95d4f4231c24c454bf60abd8de59", "score": "0.64784163", "text": "def default_old_master_server_arguments(port, date)\n default_master...
c7f555b25a321a79387acef2a7617caf
same as the following
[ { "docid": "8e999419fd8f41c06a7a664f3b8f4795", "score": "0.0", "text": "def name=(value)\r\n @name = value\r\n end", "title": "" } ]
[ { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.64513505", "text": "def desired; end", "title": "" }, { "docid": "3d45e3d988480e2a6905cd22f0936351", "score": "0.64160514", "text": "def for; end", "title": "" }, { "docid": "3d45e3d988480e2a6905cd22f0936351", ...
daa3527e63e0a283877feaa277fa08d1
DELETE /palliative_cares/1 DELETE /palliative_cares/1.json
[ { "docid": "3ed1e9c8c19554a1de3e0defe60394a4", "score": "0.6708026", "text": "def destroy\n @palliative_care.destroy\n respond_to do |format|\n format.html { redirect_to palliative_cares_url, notice: 'Palliative care was successfully destroyed.' }\n format.json { head :no_content }\n ...
[ { "docid": "223cbf256c487232bc58c2b2af61d319", "score": "0.7136497", "text": "def destroy\n @causale = Causale.find(params[:id])\n @causale.destroy\n\n respond_to do |format|\n format.html { redirect_to causali_url }\n format.json { head :no_content }\n end\n end", "title": ""...
1fd95aa6b9286e1777f711112d229b65
GET /user_authors/new GET /user_authors/new.json
[ { "docid": "a66f9c295c34da37e6d524a677535611", "score": "0.78689355", "text": "def new\n @user_author = UserAuthor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_author }\n end\n end", "title": "" } ]
[ { "docid": "e7e258e8fe044feb9f812a94a0a12bad", "score": "0.7717221", "text": "def new\n @author = Author.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @author }\n end\n end", "title": "" }, { "docid": "5119fd77183ed6840d7dacf4e17...
0986ab6ab36c596b997a4df5a75d962d
Read the metadata and content from the post or page
[ { "docid": "312eb9962a861e896cdc5870ceede9ca", "score": "0.6815001", "text": "def read_file\n\n # Load the Jekyll post or page\n self.content = File.read(@filename)\n\n begin\n\n # define a regular expression to find the YAML header \n if /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m.match(s...
[ { "docid": "856eb347f6319874151375ff1437861b", "score": "0.74100435", "text": "def read_metadata\n meta = read_pairs!(\"metadata.txt\")\n meta.views = meta.views.split\n meta.tags = meta.tags.split\n RuneBlog.blog.post = meta\n meta\n end", "title": "" }, { "docid": "ea14052...
f8b8cf1197a776a9fe8c6b741a45aede
calculate total user has pledged for this project
[ { "docid": "db7b4751a51af5ecaf9f87d872db920d", "score": "0.7118034", "text": "def backer_pledged(user)\n total = 0\n self.pledges.each do |pledge|\n if pledge.user == user\n total += pledge.dollar_amount\n end\n end\n return total\n end", "title": "" } ]
[ { "docid": "71a359bf3c8d9b66cf6ba4bb292aba06", "score": "0.6840665", "text": "def individual_final_amount\n self.final_amount / self.users.length\n end", "title": "" }, { "docid": "d6dc4bea121879e49ecd7305f5995fb3", "score": "0.677181", "text": "def money_charity\n total_gener...
7c9d16407651ea441f36507c02e5147a
Helper method to display friendly name instead of select value
[ { "docid": "86cf233477b5dd2a9e089fa8e74e6f4a", "score": "0.0", "text": "def opportunity_availability_friendly(opportunity)\n if opportunity.availability == 0\n 'Tiempo completo'\n elsif opportunity.availability == 1\n 'Medio tiempo'\n elsif opportunity.availability == 2\n 'Menos ...
[ { "docid": "e652f1fe8a3db30efbe30374fb0e19e3", "score": "0.7590055", "text": "def dropdown_display_name\n \"#{name} (#{email.presence || 'no email'}, user ##{id})\"\n end", "title": "" }, { "docid": "9313304b9e6e6ff14b8eb7ac84207c9f", "score": "0.75744647", "text": "def choice_fi...
6dcfa46348ed54bd0fb7b1c95aa08985
list of all rss feed url
[ { "docid": "8e65f203050f33bd8b656ecd33d328b7", "score": "0.0", "text": "def index \n if params[:id]\n @feed_url = FeedUrl.find(params[:id])\n else\n @feed_url = FeedUrl.new\n end \n end", "title": "" } ]
[ { "docid": "3aff586f71def02bac36e56b770b16c1", "score": "0.8051392", "text": "def feeds\n @all_feeds ||= begin\n @doc.match(FEED_MATCHES).map do |url|\n case url\n when String\n if url.start_with? \"http\"\n url\n elsif @url\n ...
b724ca343c6b7c4c4a8206661d6dab70
GET /posts GET /posts.json
[ { "docid": "21deba23d264576fe19ca9c1d76c3f0a", "score": "0.0", "text": "def index\n @posts = Post.all\n if current_user == User.first && !current_user.try(:admin?) && User.count == 1\n current_user.update_attribute :admin, true\n end\n end", "title": "" } ]
[ { "docid": "fb578f587fdfe1b0a8d3ac27001f9611", "score": "0.7634022", "text": "def index\n render json: @posts\n end", "title": "" }, { "docid": "4e694f9f0a0313f64d4c0582953f2972", "score": "0.754337", "text": "def show\r\n @posts = Post.find(:all)\r\n\r\n respond_to do ...
7e2d76b9adf21dd43bf85346d044e35d
Make sure eql? works the same as ==.
[ { "docid": "41e2689c65f2f8fdaa384bd909a68955", "score": "0.8119481", "text": "def eql?(other)\n self == other\n end", "title": "" } ]
[ { "docid": "b30da7dcac64c9d3d33950e39817b993", "score": "0.8919459", "text": "def eql?(*) end", "title": "" }, { "docid": "83b7f053c4b18617ae9369dae0621ad7", "score": "0.88555115", "text": "def eql?(other); self == other; end", "title": "" }, { "docid": "69537a5ae9840382a...
9ffdddae386a866e56a3dc7e49b80305
Calls curl_exec This method exists so it can easily be overridden and mocked.
[ { "docid": "60e5a2f3d9b79f8288dc00f58d2bb7f4", "score": "0.68085855", "text": "def curl_exec(curl_handle, request)\n to_return = nil\n curl_exec_arguments = CurlExecArguments.new(to_return)\n emit('curlExec', [curl_exec_arguments])\n (to_return,) = curl_exec_arguments.to_a\n\...
[ { "docid": "2ba260502f9375d41a6d0c0323e7506f", "score": "0.5980432", "text": "def run_request(method, url, body, headers); end", "title": "" }, { "docid": "7f01544acaf55bb4411551ddec9d645a", "score": "0.58743936", "text": "def curl( opts={} )\n opts[:type] ||= 'yaml'\n\n ...
1f328d5ecf93e1b28b717fac90f8e197
WORKSPACE PROPERTIES > Number of slots
[ { "docid": "3fe98582ebf3e3273d8c454f44737f81", "score": "0.64502513", "text": "def capacity\n\t\t@slots.length\n\tend", "title": "" } ]
[ { "docid": "0b041d82523193db5ba84cce529104e8", "score": "0.6466804", "text": "def number_of_slots\n @number_of_slots ||= placements.size\n end", "title": "" }, { "docid": "99000855555955d0cc502ed6f42e28e6", "score": "0.6447161", "text": "def slots_used\n @jobs_run.list.size - ...
1f53cfb68fc9296cdbf33649e2c9f09d
Get the current value for the specified attribute, if the attribute has changed.
[ { "docid": "9e4ad406fa2c84fe94c6443aca56e9ac", "score": "0.63974893", "text": "def attribute_change(attr)\n [changed_attributes[attr], attributes[attr]] if attribute_changed?(attr)\n end", "title": "" } ]
[ { "docid": "53bbced1bbf0ce6846415fd95d47594b", "score": "0.72612715", "text": "def attribute_previously_was(attr)\n attribute_previously_changed?(attr) ? attribute_previous_change(attr).first : attribute_was(attr)\n end", "title": "" }, { "docid": "631dc1d04024d47d9953b9450c51614...
89e641df54c970c360091c2d0b0703dd
returns an array of row of info
[ { "docid": "69f5505da9f85212b5a1a500d0bdbab4", "score": "0.0", "text": "def rownode_to_row(rownode)\n rownode.xpath('td').map &:text\nend", "title": "" } ]
[ { "docid": "d225c3c2af57d1f3b44ea8029e84749e", "score": "0.7486403", "text": "def rows\n @array\n end", "title": "" }, { "docid": "e07c838da6a51602b6609b8e4bf76756", "score": "0.7042674", "text": "def row; end", "title": "" }, { "docid": "838cff6ddfc2ac713e725cb8e5625...
3741283059e064d2463a92b1c1dd60c9
managers and members only
[ { "docid": "25f1bcb95de81a8fbabcf76652a16102", "score": "0.0", "text": "def role_memberships\n if self.member?\n self.memberships\n else\n self.role_clubs.map{ |c| c.memberships }.flatten\n end\n end", "title": "" } ]
[ { "docid": "f358519f85b70e8dd43a68b06e399262", "score": "0.683985", "text": "def manager\n end", "title": "" }, { "docid": "f358519f85b70e8dd43a68b06e399262", "score": "0.683985", "text": "def manager\n end", "title": "" }, { "docid": "3d70b6884e54b5bb6e443edd3fbc3016",...
a265d981f0ad959f14df1b8a7c6e61cc
def index time = Time.zone.now.hour logger.info "hello" doc2 = Nokogiri::HTML(open(' array = doc2.css('td').to_a
[ { "docid": "bc9374e376d2313a30ab93e1f88dd1d6", "score": "0.6516413", "text": "def today\n\n\t\ttime = Time.zone.now.hour\n\t\tlogger.info \"hello\"\n\t\tdoc2 = Nokogiri::HTML(open('http://app2.nea.gov.sg/anti-pollution-radiation-protection/air-pollution/psi/past-24-hour-psi-readings'))\n\t\tarray = doc2...
[ { "docid": "256baaf554c4a93a3f1c1a79a8b3f207", "score": "0.6142688", "text": "def print_html_time()\n @noko.css(\"li.g:first-of-type\").each do |e|\n puts e\n end\n end", "title": "" }, { "docid": "e5c35e19022c1e041614ee9923d2bad5", "score": "0.57693136", ...
758d3a9cc4b4c30e534af7c735b36f2c
The product model has a relation to the user model and has an image attached to it
[ { "docid": "57400d4145eb81eb58f533e22bb24ff7", "score": "0.0", "text": "def can_edit?(user)\n return user == self.user || user.has_role?(:admin)\n end", "title": "" } ]
[ { "docid": "c4d9dc8b6868b4233720d02a438645e8", "score": "0.71660346", "text": "def image\n product.image\n end", "title": "" }, { "docid": "b7d480b4fa609f6c9ed8a974ff7ebfcc", "score": "0.6799131", "text": "def set_product_image\n @product_image = ProductImage.find(para...
7711752999db370e46b37b5bfafbd8e9
Sign and send a request to the AWS REST API. Method is defined as an "Action" parameter. parameters is an array because order is important for the signing process.
[ { "docid": "176e0bee10b40522e0c215afc0a82842", "score": "0.58783334", "text": "def query(parameters, endpoint, access_key, secret_key, token = nil)\n timestamp = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n\n parameters += [\n ['AWSAccessKeyId', access_key ],\n ['SignatureVersion', ...
[ { "docid": "53b1b750d17c588dee954ca3d0fc77fc", "score": "0.74963677", "text": "def request(action, params = {})\n # Use a copy so that we don't modify the caller's Hash, remove any keys that have nil or empty values\n params = params.reject { |key, value| value.nil? or value.empty?}\n ...
9ec8665ecc4fcf9f20f20e6836dc86e4
Accesses the current user from the session. Future calls avoid the database because nil is not equal to false.
[ { "docid": "6ebaf874d01bc7bc75cd7714da2cbb8d", "score": "0.7849185", "text": "def current_user\n @current_user ||= (login_from_session) unless @current_user == false\n end", "title": "" } ]
[ { "docid": "1e18c3c1350a659fd2c853c420d264d3", "score": "0.814083", "text": "def current_user\n # Memoization -- we will only make the network call the first time and future calls just return the value\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "title": "" ...
1f443bb606e88d9927c27699e682634c
method to check user number input to confirm they gave a valid entry
[ { "docid": "e7634875bab4833791b6aae624ef29f0", "score": "0.0", "text": "def num_check num, number_type\n until num.class == Integer || num.class == Float\n puts \"I'm sorry that doesn't seem to be a number.\"\n puts \"Do you have some else in mind?\"\n num = float_or_integer(number_type)\n ...
[ { "docid": "92c10f4267972dd955fd4007e1bbc39b", "score": "0.8094338", "text": "def valid_number?(number_string) # this method will check if the user submitted a valid number that we can use in our program\n number_string.to_i.to_s == number_string\nend", "title": "" }, { "docid": "deb9fd310...
43700fc6bd72419c91bc042bb663f2cf
caracteres, utilizando .select .
[ { "docid": "5e00b12068925460dc26fca159046a18", "score": "0.49641606", "text": "def select_largo_may_5(names)\n imp= names.select{|nombres|nombres.length >5} \n print \"los nombres que son más largos de 5#{imp} \\n\"\nend", "title": "" } ]
[ { "docid": "32d823942f10fda4a947f8dbe06c8ffb", "score": "0.7074299", "text": "def select_chars(&block)\n chars.select(&block)\n end", "title": "" }, { "docid": "2c79799a7a682072924da27ec999fe6f", "score": "0.6338609", "text": "def test_character_classes_give_options_for_a_cha...
163db73770cfcd69c4675ffff2f2dc80
PATCH/PUT /mixes/1 PATCH/PUT /mixes/1.json
[ { "docid": "1b746e2c12d5b4ecb61ab46d711563d8", "score": "0.5818874", "text": "def update\n @mix = Mix.friendly.find(params[:id])\n\n respond_to do |format|\n if @mix.update(mix_params)\n format.html {\n if params[:mix][:avatar].present?\n render \"crop\"\n ...
[ { "docid": "3a5db9b3e30d1a95c0de9d00b590b893", "score": "0.6853158", "text": "def update\n respond_to do |format|\n if @mix.update(mix_params)\n format.html { redirect_to @mix, notice: 'Mix was successfully updated.' }\n format.json { render :show, status: :ok, location: @mix }\n ...
0e10f658611c5e12edd30987d0a5101e
Set Top Row row : row shown on top
[ { "docid": "d5f18f33533008b3d88bd777dd04d65b", "score": "0.7395049", "text": "def top_row=(row)\n # If row is less than 0, change it to 0\n if row < 0\n row = 0\n end\n # If row exceeds row_max - 1, change it to row_max - 1\n if row > row_max - 1\n row = row_max - 1\n end\n ...
[ { "docid": "0a0499827522473363ec44d814ecd10d", "score": "0.74246645", "text": "def top_row=(row)\n row = 0 if row < 0\n row = row_max - 1 if row > row_max - 1\n self.oy = @all_line_ys.empty? ? row * item_height : @all_line_ys[row]\n update_padding_bottom\n end", "title": "" }, { ...
9cdf484dd7cd6fd70631b3159fd55403
This allows for more declarative subclassing of strategies by allowing default options to be set using a simple configure call.
[ { "docid": "6fe90161b8a0b0a80511902f7a5ad4a3", "score": "0.0", "text": "def configure_options(options = nil)\n if block_given?\n yield default_options\n else\n default_options.deep_merge!(options)\n end\n end", "title": "" } ]
[ { "docid": "20c1959d731fe7c769b02617cd46b796", "score": "0.7310064", "text": "def configure_with strategy = :default, options = {}, &block\n @options[:strategy] = strategy\n configuration.strategy = strategy\n # use configuration to load adapter!\n configuration.load_adapter\n\n ...
3743c3de29db9e5aa344b8bbffdf2877
The nutricional indicator of an Aliment is described by a number from 0 to 3 which means that the food has a Low nutricional impact if this item is within 0 and 1; it has a Regular impact if it's within 1 and 2 or an High impact if it's withing 2 and 3.
[ { "docid": "9bdbad24baf5e8a9e1ae14cf41c57273", "score": "0.7137873", "text": "def nutricional_indicator()\n\t\t\t\t(indicator_energia() + indicator_carbono())/2\n\t\t\tend", "title": "" } ]
[ { "docid": "d5d94bc2159130fedb5d95d9fe5ea829", "score": "0.65989566", "text": "def huella_nutricional\n ((get_impacto_energia + get_impacto_gei)/2).ceil(2)\n end", "title": "" }, { "docid": "c2e702c90d6a2ab81afd483bb46cbff5", "score": "0.6366289", "text": "def huella_nutric...
9b143d6627e6106e5432e4a4dabf30c8
GET /estoques/1 GET /estoques/1.xml
[ { "docid": "0e9ac458547eb9781803d5ff531c2a16", "score": "0.6875047", "text": "def show\n @estoque = Estoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estoque }\n end\n end", "title": "" } ]
[ { "docid": "e75e677adbb21f72d7fbb42e8fe8b081", "score": "0.7281696", "text": "def index\n @estoques = Estoque.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estoques }\n end\n end", "title": "" }, { "docid": "4159dec1fcfba12b...
91204b53bf87072901d2190cc3854d16
PUT /attempts/1 PUT /attempts/1.xml
[ { "docid": "db3c7d97104172f23bc0cf4e09a528f3", "score": "0.5763596", "text": "def update\n @attempt = Attempt.find(params[:id])\n\n if @attempt.update_attributes(params[:attempt])\n redirect_to(@attempt, :flash => { :success => 'Contact Attempt successfully updated' })\n else\n @title...
[ { "docid": "3d067ffa4baab8b2ecc0828eed14c94a", "score": "0.64279157", "text": "def update\n @attempt = Attempt.find(params[:id])\n\n respond_to do |format|\n if @attempt.update_attributes(params[:attempt])\n format.html { redirect_to(@attempt, :notice => 'Attempt was successfully updat...
90c59a933b824d2757fc69cfd4f1b84e
Function that will print one line according to the selected format
[ { "docid": "f16a4ee3dae834426100ed456a043e2a", "score": "0.0", "text": "def pretty_print(format, separator, hash, commit, line, line_nb, commit_count)\n desc = format.\n gsub(/%Ccommit/, commit[:color]).\n gsub(/%H/, hash).\n gsub(/%h/, hash[0,10]).\n gsub(/%an/, commit[:au...
[ { "docid": "11c25d01f8bd2b890e114b62b8ca8a65", "score": "0.7183405", "text": "def print_linetype_4_helper(line, prefix_format, specline_format, pdf)\n pdf.spec_box \"#{line.txt1.text}.\", prefix_format.merge(:at => [26.mm, pdf.y])\n pdf.spec_box \"#{line.txt4.text}\", specline_format.merge(:at =>[...
077e5a3af650ffe53812099d2eefa1ac
Public: Initialize a new ip address object ip_address The ip address socket_type The address familly of this ip address. Socket::AF_INET for ip v4 Socket::AF_INET6 for ip v6 Examples IpLookUp.new("192.168.0.1", Socket::AF_INET) IpLookUp.new("ff02::1", Socket::AF_INET6) Returns the object
[ { "docid": "cf5db9197ad569a36216120addbf5cc9", "score": "0.7629243", "text": "def initialize(ip_address, socket_type)\n @ip_address = IPAddr.new(ip_address, socket_type)\n end", "title": "" } ]
[ { "docid": "c364de75bb0672f1367bb167744218e5", "score": "0.6994686", "text": "def find_for_ip(string)\n begin\n ip = IPAddr.new(string)\n type = ip.ipv4? ? TYPE_IPV4 : TYPE_IPV6\n _definitions(type).each do |_, definition|\n return factory(type, *definition) ...
a28e478681ac9d29c5dd796aa824781d
PATCH/PUT /users/1 PATCH/PUT /users/1.json
[ { "docid": "ffc3d5d53a32b27737c1e3e70476cbfa", "score": "0.0", "text": "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to :back, flash: {success: 'Podatki uspešno spremenjeni.'} }\n format.json { render :show, status: :ok, location: @use...
[ { "docid": "f0686f191a0def3b6c3ad6edfbcf2f03", "score": "0.72427535", "text": "def update_user(email)\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users/2.json'\n ).to_s\n\n puts RestClient.patch(\n url,\n { user: { email: email } }\n ...
b048378aadc73d1df7f549acfe048668
$ rake 2:1 Write a program that reads in two integers typed on the keybaord and outputs their sum, difference, and product Standard input will be like "9 2\n" and will expect you to print "11\n7\n18\n" to standard output.
[ { "docid": "034778eeb7c7a1a8254376ea341f55a3", "score": "0.7313733", "text": "def sum_difference_product\n # your code goes here\n #puts 'test'\n line = gets.chomp.split(' ')\n #line = line.chomp.split(' ')\n # puts line[0]\n # puts line[1]\n\n # arg1 = line[0].to_i\n # arg2 = line[1].to_i\n\n ...
[ { "docid": "9352c9272e7fe029e246c08126a59e7f", "score": "0.79588056", "text": "def sum_difference_product\n a , b = gets.split.map { |num| num.to_i }\n puts a + b\n puts a - b\n puts a * b\n end", "title": "" }, { "docid": "d1e9bfef5cb0bd35cee1dc28a7237a47", "score": "0.7936...
d538a9ba620050d707fab6bcf24af26d
check whether the uri contains any alias or script_alias keys
[ { "docid": "1b28edc8d29f9d7a60ad60850b666298", "score": "0.0", "text": "def match? type\n match_result = false\n keys = search_space type\n keys.each do |e| \n match_result = @uri.include? e\n if match_result then break end\n end\n match_result\n end", "titl...
[ { "docid": "05280b45f00c16cecdca6cf604e8e2e7", "score": "0.8441824", "text": "def script_alias?(uri)\n @script_alias.any? {|k,v| uri.include?(k)}\n end", "title": "" }, { "docid": "95eec4d28d9e6eb00f63e867573e0190", "score": "0.7916682", "text": "def alias?(uri)\n ...
2448469ebd227d45a3a21231a7fa25ba
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.hello.subject
[ { "docid": "d7cd47a2889b7d821e25b26ff03213a1", "score": "0.0", "text": "def hello(user)\n @greeting = \"Hi\"\n attachments[\"hello.zip\"] = File.read(\"c:\\archiv.zip\")\n mail to: user.email\n \n end", "title": "" } ]
[ { "docid": "ea740e704e8f1173fb87b45dfcaaf989", "score": "0.80438447", "text": "def subject_for(key)\n I18n.t(:subject, scope: [:mailer, key])\n end", "title": "" }, { "docid": "8928fe4f050d7ebd3e9aa992b07e320a", "score": "0.78464913", "text": "def subject_for\n ActiveSuppo...
fc711f62b38c39ac33c7810aff68584f
returns snow info for the given resort
[ { "docid": "1dae761f842902ff73918d453d6ce4aa", "score": "0.7812233", "text": "def snow_info_for_resort(resort)\n resort_id = resort.SyndicObjectID\n @snow_svc.Objects.filter(\"STATION eq '#{resort_id}'\").order_by(\"Updated\")\n @snow_svc.execute\n end", "title": "" } ]
[ { "docid": "e97688117b43443e97d05f760aee4f96", "score": "0.6475013", "text": "def info_for_resort(resort_name)\n @resort_svc.Objects.filter(\"NOMSTATION eq '#{resort_name}'\")\n @resort_svc.execute\n end", "title": "" }, { "docid": "9e248125a22b30a8d73a9a4890c7702d", "score"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "37233775ca0b328fa9828eec6f53a69c", "score": "0.0", "text": "def set_skip_content_rule\n @skip_content_rule = SkipContentRule.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.6032574", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015663", "text": "def...
a9bd81d67c0ebccc3275925d4f2854f4
GET /region_lethalities GET /region_lethalities.json
[ { "docid": "368f19656ca393a0bfee6eb1399d2dd5", "score": "0.7768989", "text": "def index\n @region_lethalities = RegionLethality.all\n end", "title": "" } ]
[ { "docid": "c3b6e075e2f1989f9d71701ce5b4f9b1", "score": "0.63730067", "text": "def set_region_lethality\n @region_lethality = RegionLethality.find(params[:id])\n end", "title": "" }, { "docid": "8e466dd4d014383bf56af4d36f638ddc", "score": "0.6319834", "text": "def cities_in_regio...
f435b8948398a2da9b0aa75a61fbbd61
subsequence for that Array. You may assume that the Array always contains at least one number. def sum_of_sums(numbers) sum_total = 0 1.upto(numbers.size) do |count| sum_total += numbers.slice(0, count).reduce(:+) end sum_total end
[ { "docid": "2203708b56d83851ec0bb99ae18a7b72", "score": "0.8483748", "text": "def sum_of_sums(numbers)\n sum_total = 0 # variable to collect the total sum\n 1.upto(numbers.size) do |count| # used to generate the correct size of the numbers in the array\n sum_total += numbers.slice(0, count)...
[ { "docid": "4f633b9a25effc106296643778de9291", "score": "0.8660823", "text": "def sum_of_sums(array)\n \n total_sum = 0\n subsequence_sum = 0\n array.each do |num|\n subsequence_sum += num\n total_sum += subsequence_sum\n end\n total_sum\nend", "title": "" }, { "docid": "3cda4695...
db29c607d06a11c2c704336bfed4018c
Returns a Note object from the notes hash
[ { "docid": "5c69219cc40fb10e875b1c16f163283a", "score": "0.56674", "text": "def notes(options = {})\n options = {\n id: nil,\n type: nil\n }.update(options)\n notes_found = Hash.new do |h, k|\n h[k] = {}\n end\n _notes.filter(options[:id])....
[ { "docid": "8efd87a634fc274eb169544262a7bb85", "score": "0.652366", "text": "def notes_get(id)\n options = create_params({})\n note = self.class.get(\"/notes/#{id}\", options)['note']\n\n return nil unless note\n\n # Complete hack, because the API is still broken\n content = '__...
e8986e84adc6a52e649c8b3ec67a2736
This method downloads and installs the java build
[ { "docid": "2977c4664ae65a31d047c467166ae8b5", "score": "0.68147165", "text": "def install_build(entry, java_home, version)\n installer = File.join(Dir.tmpdir, \"ibmjava\" + version.to_s + \"-installer\")\n properties = File.join(Dir.tmpdir, \"installer.properties\")\n expected_checksum =...
[ { "docid": "258beeeed51534788e11217f01492afa", "score": "0.7179834", "text": "def install_build(entry, java_home, version)\n binary = File.join(Dir.tmpdir, \"openjdk\" + version.to_s + \"_openj9.tgz\")\n # Download the Openjdk build from source url to the local machine\n remote_file binar...
634652a8052bf80c025728db8187d16e
Method to update the quantity of an item input:list, item, quantity steps: update list to passed in quantity output: list
[ { "docid": "6638ca56b827cdde11aa56b61560a65d", "score": "0.76147354", "text": "def update_item(list, item, quantity)\n\tlist[item] = quantity\n\treturn list\nend", "title": "" } ]
[ { "docid": "00220631c0081c97ea4c5988d06a91f1", "score": "0.8526499", "text": "def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend", "title": "" }, { "docid": "94d5e4d9ab2fd4bb2cd99ed6f8224e40", "score": "0.84101313", "text": "def update_quantity(list, ite...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "219fdda3b207ea07a262c469acdcbbf6", "score": "0.0", "text": "def set_location\n @location = Location.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
5e6abb6f044065ccf1214c4dc70051c0
Add and remove favorite recipes for current_user
[ { "docid": "9e1202fa185e511ef7fda6069c0b95ad", "score": "0.6074319", "text": "def favorite\n type = params[:type]\n if type == \"favorite\"\n current_user.favorites << @recipe\n redirect_to pages_favoritas_path, notice: 'You favorited #{@recipe.name}'\n\n elsif type == \"unfavorite\"\...
[ { "docid": "b2a55c7a7548411db39bebbd4291fb34", "score": "0.73621935", "text": "def add_recipe_to_favorites(recipe)\n UserFavorite.find_or_create_by_recipe_id_and_user_id(:recipe_id => recipe.id, :user_id => self.id)\n end", "title": "" }, { "docid": "7b190d53d478ae77ffe5f9e7e4920cc2", ...
169ca518c86684abf5bb6f2d660b0c6e
GET /blabs GET /blabs.json
[ { "docid": "22964602fb3c6e77bab5bd9c6a46d3b2", "score": "0.7193773", "text": "def index\n\t\t@search = Blab.search(params[:q])\n\t\t@blabs = @search.result\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blabs }\n end\n end", "title": "" } ]
[ { "docid": "a83730b65ceaefadc49a3ce371b518df", "score": "0.692829", "text": "def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "title": "" }, { "docid": "7737786d9969d55bc4ef094a74eb821...
e15298b27578d8908a8b8e41ad38e353
generates NokokGiri data from selected movies IMDB page
[ { "docid": "6e3f0252d777610df1e6a20452d0835a", "score": "0.0", "text": "def trivia_url(selected_movie)\r\n movie_page = movie_page(selected_movie)\r\n movie_url = movie_url(selected_movie)\r\n resource = movie_page.css(\"div#trivia a.nobr\")[0][\"href\"].to_s\r\n trivia_url =...
[ { "docid": "df5b2be2fb48a9d447befb771f89ed01", "score": "0.7494284", "text": "def movie_page(selected_movie)\r\n movie_html = movie_url(selected_movie)\r\n Nokogiri::HTML(open(movie_html))\r\n end", "title": "" }, { "docid": "f7771437af9b09ba2e9e093014acec5c", "score": "...
12a862c73df20dd995e7b6c34629e12d
Whether the end of this input method has been reached, returns +true+ if there is no more data to read. See IOeof? for more information.
[ { "docid": "9f663cd14cc2f4c4c1bda01d6352bdbc", "score": "0.8012307", "text": "def eof?\n @eof\n end", "title": "" } ]
[ { "docid": "7efb7bd15fe0e51bab09723fee77e806", "score": "0.8427429", "text": "def eof?\n @input.eof?\n end", "title": "" }, { "docid": "37aca095aebd40ec4c37ab990ac5972f", "score": "0.832628", "text": "def eof?\n @io.eof?\n end", "title": "" }, { "docid": "37ac...
deaffe302290823e37b5dd328344d7db
Check if the host is responding.
[ { "docid": "f70410d1defd1350ea9ba7b5c65495fb", "score": "0.0", "text": "def port_open?(host, port)\n begin\n Timeout::timeout(1) do\n begin\n s = TCPSocket.new(host, port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n...
[ { "docid": "d83de2a8136f35719999b2ae307aab36", "score": "0.73534924", "text": "def alive?(host)\n puts \"Checking host: #{host}\"\n Timeout::timeout(@timeout) do\n result = `ping -c 1 #{host}`\n if result.include?(\"time=\")\n return true\n end\n end\n rescue\n return ...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "ff4b8f132e6c7f8a499bdad2a803d7f4", "score": "0.0", "text": "def request_params\n params.require(:request).permit(:start_city, :start_street_address, :start_zip, :end_city, :end_street_address, :end_zip, :trip_time, :distance, :highest_price_to_pay, :matched_availability_id, :request_sta...
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69480115", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6813417", "text": "def strong_params\n params.require(:listing_member).permi...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "bfce5f87de24f081bf8820e373a19b6a", "score": "0.0", "text": "def set_report\n @report = Report.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60320485", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6013371", "text": "de...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "4bf36d229c62cf82112ea67f3925ae14", "score": "0.0", "text": "def find_delivery\n @delivery = Delivery.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60310465", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60152966", "text": "d...
77404931075fd3c652d999cd7e17f508
all field is the same about except other_tex dont' exest.
[ { "docid": "ab7afd9f7ff7a1d08138f797f026ef71", "score": "0.0", "text": "def test_summary_warnings_42\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"2\",\n \"2\",...
[ { "docid": "8e82a100523ec4b856b8e83a5105ddce", "score": "0.5452911", "text": "def duplicate?\n\t\tother = Ng2::WordDetail.find(@word).last\n\t\t!other.nil? &&\n\t\tother.file_path == self.file_path &&\n\t\tother.line_no == self.line_no &&\n\t\tother.word_no == self.word_no\n\tend", "title": ""...
33fa950185bc7e2277d30d15897eb6c7
Gets a push zone specified by the zone_id parameter
[ { "docid": "add5136c753d78651960295ecaf128e3", "score": "0.8457574", "text": "def get_push_zone zone_id, options={}\n request :get, \"/{self.company_alias}/zones/push.json/#{zone_id}?#{options.to_q}\"\n end", "title": "" } ]
[ { "docid": "1c1f9cfd9330b7355bccc14432294d15", "score": "0.7370819", "text": "def zone zone_id\n ensure_connection!\n resp = connection.get_zone zone_id\n if resp.success?\n Zone.from_gapi resp.data, connection\n else\n nil\n end\n end", "tit...
62bbef3777d9f30f9494e01aaac7b628
PUT /panel/organization_invitations/1 PUT /panel/organization_invitations/1.json
[ { "docid": "7f656ef330f7b7c0f8f981a34fbdb0fe", "score": "0.76772195", "text": "def update\n @panel_organization_invitation = Panel::OrganizationInvitation.find(params[:id])\n\n respond_to do |format|\n if @panel_organization_invitation.update_attributes(params[:panel_organization_invitation])...
[ { "docid": "b4492824a9e6106cb7d32a5515a76abc", "score": "0.71569407", "text": "def organization_invite\n params['host'] = Ind.http_api\n params['api_key'] = Accounts.new.find_by_email(params['email']).api_key\n\n org_res = Organizations.new.list(params).orgs\n\n org_res[0][:related_orgs] << ...
dfb5c21b1741eabeafd8715ca8cf3040
The brand and model number of the camera that took the photo.
[ { "docid": "dcc1d6ca57b65cb382b931206607d719", "score": "0.7301788", "text": "def camera_model\n object[\"camera_model\"]\n end", "title": "" } ]
[ { "docid": "282c22dfaa8ff6664685658a4245119c", "score": "0.76330024", "text": "def brand_with_model\n fetch('camera.brand_with_model')\n end", "title": "" }, { "docid": "e6835a9f39b99d0b9b95e89cf708f6cd", "score": "0.72515863", "text": "def camera_make\n object[\"cam...
e7afe295102c0ad60dc6f8d122a59074
Because is difrent scope between method and this parrameter has difrent name
[ { "docid": "e42f1fb8aa685ff827d931d838179663", "score": "0.0", "text": "def set_box\n @box = Box.friendly.find(params[:box_id])\n end", "title": "" } ]
[ { "docid": "a9c3d6a9cee3eb85d330b5e72e96f90a", "score": "0.6709706", "text": "def scope; end", "title": "" }, { "docid": "a9c3d6a9cee3eb85d330b5e72e96f90a", "score": "0.6709706", "text": "def scope; end", "title": "" }, { "docid": "a9c3d6a9cee3eb85d330b5e72e96f90a", "...
9bf262cf8a9bcc7977ccbe1295457a56
filtro para validar q el usuario esta logado en cualquier accion del controlador de administracion
[ { "docid": "d57856989d86182f874ca68a58142ee9", "score": "0.0", "text": "def check_authentication\n unless session[:user]\n session[:intended_action] = action_name\n session[:intended_controller] = controller_name \n redirect_to :action => \"signin\"\n end\n end", "title": ...
[ { "docid": "9e322c53d009596b9952dc3462a87245", "score": "0.66421837", "text": "def validarLogIn\n\n if (params[:nombreDeUsuario].present? && params[:clave].present?) \n admin=Administrator.where(nomUsuario: params[:nombreDeUsuario],password: params[:clave] )\n if admin.blank? then\n ...
2a20c47e9ed1bff15882256c4506f600
Metodo para establecer por default el estado del juego, se usa para la carga previa del nivel
[ { "docid": "77518f118398c7d853969caa8f860f1c", "score": "0.0", "text": "def setup\n super\n @background = Image['Bg level1.png']\n viewport.lag = 0\n viewport.game_area = [0, 0, 3000, 1000]\n @gilbert = Gilbert.create(x: 50, y: 900, limited: viewport.game_area.width)\n @level = File.jo...
[ { "docid": "e92e8859ba9a495f8a8ce17ecc6844e2", "score": "0.5879561", "text": "def valores_por_default\n \t\tself.costo ||= 0\n \tend", "title": "" }, { "docid": "8b121d3a9b7bc0164136cd7e30a93ae5", "score": "0.57018423", "text": "def set_default_status\n\t self.status = 0 \n\tend",...