query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
21340fbe56f7dba0e049acbf5ebed737
GET /note_books/1 GET /note_books/1.json
[ { "docid": "76446f7a67e280e76cd4d8ca1f9364e3", "score": "0.6789764", "text": "def show\n @note_book = NoteBook.find(params[:id])\n end", "title": "" } ]
[ { "docid": "78b07a4d08504506a9e2dcdaf2c43935", "score": "0.70411676", "text": "def index\n @note_books = NoteBook.all\n end", "title": "" }, { "docid": "c8dae1dc3f09e95b223733f80165b6c6", "score": "0.6999473", "text": "def index\n\t\trender json: current_user.noteBooks.as_json(:i...
1232dfa6b409565e91572e34a642a5a3
Hands method and argument on to instance if it responds to method, otherwise calls super
[ { "docid": "eda793193a4375396097f8b3aa9c5071", "score": "0.6445681", "text": "def method_missing(method_name, *args, &block)\n if @instance.respond_to?(method_name)\n @instance.send method_name, *args, &block\n else\n super\n end\n end", "title": "" } ]
[ { "docid": "11721651bcbbc63b4d63fc06d9997982", "score": "0.69326174", "text": "def method_missing(method, *args, &block)\n super unless original_self\n original_self.send method, *args, &block\n end", "title": "" }, { "docid": "18b440ffded9b7dbb9eb2e5577a1fe05", "score": "0....
e577aa2b24d7ba3dbcdb0d51115ae816
Remove Guest domain disk
[ { "docid": "9e8d917f7d6830afb6b5d799764af252", "score": "0.7049392", "text": "def remove_gdom_disk(options)\n vds_disk = options['name']+\"_vdisk0\"\n message = \"Information:\\tRemoving disk \"+vds_disk+\" from Virtual Disk Server\"\n command = \"ldm remove-vdisk #{vds_disk} #{options['name']}\"\n ...
[ { "docid": "b0f22d8be7ff45db01fecbab2ba81174", "score": "0.73257536", "text": "def delete_gdom_disk(options)\n gdom_dir = $ldom_base_dir+\"/\"+options['name']\n client_disk = gdom_dir+\"/vdisk0\"\n message = \"Information:\\tRemoving disk \"+client_disk\n command = \"rm #{client_disk}\"\n execut...
1abb4d0eb0d2bcedfd185761444665b3
By analogy to Concise Bounded Description.
[ { "docid": "1042c71c431f6a7c0b3e95a4838c4082", "score": "0.0", "text": "def initialize(source_graph, starting_node, ancestors = [])\n @source_graph = source_graph\n @starting_node = starting_node\n @ancestors = ancestors\n end", "title": "" } ]
[ { "docid": "a6081ef338a9bd2eccf3f6180eac86f4", "score": "0.68840206", "text": "def base_description(_); end", "title": "" }, { "docid": "458a77e482e9c6618587ca550a659789", "score": "0.6855507", "text": "def desc(description); end", "title": "" }, { "docid": "3ae0aa06c9e19...
acbb240667d2d032ffe14e52b9b5fd5b
creates new instance of song with info provided from above form redirects user to list of all songs via index path.
[ { "docid": "dc7370a6a663e051baa1039d8ab6a18f", "score": "0.71132994", "text": "def create\n @song = Song.new(song_params)\n if @song.save\n flash[:success] = \"You have successfully created a new track!\"\n redirect_to @song\n else\n flash[:alert] = \"Oops...your track was not saved....
[ { "docid": "46b98367104e34f769ac20b3b6f66db2", "score": "0.79573387", "text": "def create\n if @song = Song.create(song_params)\n redirect_to songs_path\n else\n render :new\n end\n end", "title": "" }, { "docid": "bae4ce0f22a3640dd296a18a387590c9", "score": "0.787513...
0a3f082a8053dbf3185a4a28f6a1e9e3
Accepts a list of issue labels and creates them for the target repo.
[ { "docid": "dad6e3680d61afd1282999882561ba3b", "score": "0.7738123", "text": "def create_labels(labels)\n initialize\n labels.each do |l|\n @client.add_label(@targetRepo, l.name, l.color)\n end\n end", "title": "" } ]
[ { "docid": "24c3075ab0b9a00565c1dc79b7e80d36", "score": "0.76083827", "text": "def add_labels(labels)\n @repo ||= pr_json.base.repo.full_name\n @number ||= pr_json.number\n api.add_labels_to_an_issue(@repo, @number, Array(labels))\n end", "title": "" }, { "docid": "ab2932c7...
061fdc74ac1d274101987c776ae260b2
Sets an image as terminal background, assumes the presentation run in iTerm2.
[ { "docid": "6b660fa05f3812fb4783a796cde93f74", "score": "0.8343522", "text": "def set_background_image(image_path)\n system %(osascript -e 'tell application \"iTerm\" to set background image path of current session of current terminal to \"#{image_path}\"')\nend", "title": "" } ]
[ { "docid": "4d77a5ba06651381db3509d5f1dd0256", "score": "0.7255484", "text": "def setasbackground(filename, curr_path)\n #puts `feh --bg-center #{curr_path}/#{filename}` # centers the image in the middle\n #puts `feh --bg-scale #{curr_path}/#{filename}` # scales the image to fit the whole screen\n %x...
ac88ed908cbee39e3ada4a3db03e2606
POST /shares POST /shares.json
[ { "docid": "a7de500c2e9537bd3ca12cc13f9b8339", "score": "0.6071193", "text": "def create\n @share = Share.new(share_params)\n respond_to do |format|\n if @share.save\n format.html { redirect_to \"/documents/new/#{@share.id}\", notice: 'Share was successfully created.' }\n format...
[ { "docid": "9ae2596f8dc56445bc24ee92fa1f244f", "score": "0.7583921", "text": "def share(options={})\n post(\"/shares\", options)\n end", "title": "" }, { "docid": "c33150938330d0507384ac03707bfb5f", "score": "0.7547088", "text": "def share(options={})\r\n post(\"/people/...
cf270d216ace102016a558622ee5bd25
select_plan is he name of filter ,that will only happen when user goes to sign up pages ( new )
[ { "docid": "e0406425fadced64aa51630058c3b6d5", "score": "0.5763551", "text": "def create #adding to the devise \"create\" action so we can create more than jus user name, ect.\n super do |resource|\n if params[:plan] \n resource.plan_id = params[:plan] # storing in the database which pla...
[ { "docid": "a5d67c7d65263bd392cd84b9dc06d18f", "score": "0.7305965", "text": "def select_plan\n unless params[:plan] && (params[:plan] == '1' || params[:plan] == '2')\n flash[:alert] = \"Please select a membership od plans to sign up.\"\n redirect_to root_path\n end\n...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "3beaf3fd1ed5893bd7024cc2f9909ab6", "score": "0.0", "text": "def set_school\n @school = School.find_by_id(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...
d90b6757da0cf6640dabbc20934096f8
Create a method minmax_by that accepts a list and a block. The method should return an array containing the min and max list elements, based on their return values from the block
[ { "docid": "398aa56ce6deb7d0c2c04e85594c6ded", "score": "0.86831146", "text": "def minmax_by list, &block\n list.minmax_by(&block)\nend", "title": "" } ]
[ { "docid": "75c9aef704bb3bbb03da755254d2e6f1", "score": "0.77131504", "text": "def minmax(&block)\n un_defined = MaglevUndefined\n mino = un_defined\n maxo = un_defined\n if block_given?\n self.each { |o|\n\tif mino._equal?(un_defined)\n\t mino = o\n\t maxo = o\n\telse\n\t c = block....
6838b6fcfe65325dd20b2f390842ade7
Publishes a NATS::Msg that may include headers.
[ { "docid": "04b4f29e664d6805517880fb8b22179e", "score": "0.72892696", "text": "def publish_msg(msg)\n raise TypeError, \"nats: expected NATS::Msg, got #{msg.class.name}\" unless msg.is_a?(Msg)\n raise NATS::IO::BadSubject if !msg.subject or msg.subject.empty?\n\n msg.reply ||= ''\n m...
[ { "docid": "d50a6f143820efcf3ba32784f08e640c", "score": "0.66004425", "text": "def publish(destination, message, headers = {})\n headers[:destination] = destination\n transmit(\"SEND\", headers, message)\n end", "title": "" }, { "docid": "a9fbba017dd3bfc3faac16fa5406d583", "...
0d1f258ab066548c0ea5bbd9037be6a7
remove cache of user group after new member, new admin and member removed
[ { "docid": "dcb5687750330037df0799f6d148833a", "score": "0.7443688", "text": "def clear_user_group_cache\n if groupable.is_a?(UserGroup)\n Rails.cache.delete \"UserGroup:is_in_group_#{groupable_id}_#{user_id}\"\n Rails.cache.delete \"UserGroup:is_admin_#{groupable_id}_#{user_id}\"\n end\...
[ { "docid": "a2a9ad3e11d6fe60247e69f91d3fc481", "score": "0.6365666", "text": "def update_groups\n unless group_ids.nil?\n self.groups_members.each do |m|\n m.destroy unless group_ids.include?(m.group_id.to_s)\n group_ids.delete(m.group_id.to_s)\n end\n group_ids.each do |...
f825c83eaa8fe976e8611d33ae2ea534
Sets the user's +activated_at+ field to nil, effectively suspending that user.
[ { "docid": "678e3eaedcf2306c82b0a11b95e30d5d", "score": "0.81874305", "text": "def suspend!\n self.update_attribute(:activated_at, nil)\n end", "title": "" } ]
[ { "docid": "f34e0a12118a795dd8a462c6988a70f5", "score": "0.65692043", "text": "def activate\n @user.activation_code = nil\n @user.activation_expires_at = nil\n @user.activated_at = Time.zone.now\n @user.save\n end", "title": "" }, { "docid": "b4295be2c879e7e4e5db6c3d74d5c88a", ...
c567a65edd8e9248b544bcc76acfecae
Use Entrez.ESearch to get document summaries from ids.
[ { "docid": "abbce6017a128fa7c9dcf916284f9858", "score": "0.6841392", "text": "def get_results_from_ids\n @response = Entrez.ESummary(ncbi_database_name, id: @ids)\n # URL is too long, probably because there are too many results for NCBI server.\n raise SearchTooBroad.new(@ids) if @respons...
[ { "docid": "689cd58d93613f2829214c07475efebb", "score": "0.74519026", "text": "def find_summaries_by_ids(ids)\n @request = setup_request \"#{@@resource_url}s\"\n @request.query = { productLineIds: ids.to_s }\n @request\n end", "title": "" }, { "docid": "9fbe9bc7171e3d4999af...
0fec4fbbccae87b9b6acfbc3990a1a4d
happy hour > everyone's wellbeing, soft_skills improves 2 points
[ { "docid": "bc6033508c452cfda1699e446666da77", "score": "0.0", "text": "def happy_hour\n event_display(\"It's HAPPY HOUR! Everybody let's loose.\")\n group_event_hash_creator({soft_skills: 2, wellbeing: 2})\n end", "title": "" } ]
[ { "docid": "f8311c7aead0d98a655878979c7da1b1", "score": "0.70065874", "text": "def mood\n if self.happiness && self.nausea\n mood = self.happiness - self.nausea\n mood > 0 ? \"happy\" : \"sad\"\n end\nend", "title": "" }, { "docid": "8d258838739718912c00ab1dcde83ab8", "score": "0...
88ae050f4bef207bb5b2835a58878455
Sets the attribute page
[ { "docid": "28ac7359d7e64ee7b7a76baf096dfd97", "score": "0.0", "text": "def page=(_arg0); end", "title": "" } ]
[ { "docid": "7c45d83ed5fa5c9b506823d1faff8337", "score": "0.70283693", "text": "def set_page\n end", "title": "" }, { "docid": "d9de7f9e3b1d69b76a0248d8a7ebd778", "score": "0.6613735", "text": "def set_show_page_attributes\n @show_page_attributes = [:group, :names, :contact,...
a5dce20aa10dd510dba5266b51d2e795
Log in as a particular agent.
[ { "docid": "89b151f5e167bbb77cbbf2c335531fb7", "score": "0.76418567", "text": "def log_in_as(agent, password: 'password', remember_me: '1')\n post agents_login_path, params: { session: { email: agent.email,\n password: password,\n ...
[ { "docid": "8d94ed2b69238bf80ef45ce3493781ad", "score": "0.7805249", "text": "def log_in_as(agent)\n session[:agent_id] = agent.id\n end", "title": "" }, { "docid": "de55f3972b9fadf0a98a398399ca9ab2", "score": "0.7458316", "text": "def log_in_as(agent, options = {})\n password...
801a9fbef26bd9a3845445e9a7b0a664
PATCH/PUT /voti/1 PATCH/PUT /voti/1.json
[ { "docid": "bf4fd3247a683a600c06da262fb82ed7", "score": "0.5821848", "text": "def update\n respond_to do |format|\n if @voto.update(voto_params)\n format.html { redirect_to @voto, notice: 'Voto was successfully updated.' }\n format.json { render :show, status: :ok, location: @voto ...
[ { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.68121177", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.68121177", "t...
9313fed6fdd19dc712aefe336df1e14f
Initialize a new object with a foreign key to the parent
[ { "docid": "501877b76539ff555dcbb709d1aee368", "score": "0.57942164", "text": "def build(attributes = {})\n attributes.merge! foreign_key_association\n @klass.build(attributes.merge(owner_path))\n end", "title": "" } ]
[ { "docid": "28ed5fcb46cef5e25ad1caab43697aef", "score": "0.7050761", "text": "def initialize(parent, model, relation_name, foreign_key)\n super(model)\n @parent, @relation_name, @foreign_key = parent, relation_name, foreign_key\n conditions.merge!(@foreign_key => @parent)\n end...
8fe3453027f84f5a135863f744f0a082
Returns the value of attribute lex_state. source://yard//lib/yard/parser/ruby/legacy/ruby_lex.rb431
[ { "docid": "9561e9413ccd3397cc9d85ee56847865", "score": "0.76147467", "text": "def lex_state; end", "title": "" } ]
[ { "docid": "bda191df538bfbbf69a72df73c5a01ef", "score": "0.6730847", "text": "def getstate()\r\n return getvalue(SVTags::STATE)\r\n end", "title": "" }, { "docid": "cc1cfb823cb6760533d1ebc768de722c", "score": "0.65305865", "text": "def state\n attributes[:state]\n end", ...
8034b0c53cbd81c7c9cbe3922e6d70c8
Given property data and an OD1 object, returns either the object, or a modified object
[ { "docid": "ee976920890711f623bc0cc6d599190e", "score": "0.0", "text": "def process(data, object)\n data[:function].blank? ? object.to_s : send(data[:function].to_sym, object.to_s)\n end", "title": "" } ]
[ { "docid": "2f05a06c8f4a21d879f7738ae2315d03", "score": "0.5658984", "text": "def get_new_obj(obj, type='query')\n tmp_obj = self.new\n tmp_obj.send 'object'.to_sym, \"{#{obj['object'].to_s}}\"\n tmp_obj.send 'source_id'.to_sym, get_source_id\n ...
88560f685115ef84e7bec34bfa0c353c
GET /posts/1 GET /posts/1.xml
[ { "docid": "300dab2e16a9adb15cee049d7afc88da", "score": "0.66654295", "text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end", "title": "" } ]
[ { "docid": "3f07ca52f1cff324dc15bb3d68551cc2", "score": "0.72230846", "text": "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end", "title": "" }, { "docid": "7227a2d41...
8ac05ada94ea25447dd77e1bd72eb3a7
Stops the running Oy! daemon (if any).
[ { "docid": "05411be06611db9a8031f642b7c0b6e8", "score": "0.76329327", "text": "def stop\n unless File.file?(trait[:pidfile])\n abort(\"Oy! not running? (check #{trait[:pidfile]}).\")\n end\n\n puts \"Stopping Oy!.\"\n\n pid = File.read(trait[:pidfile], 20).strip\n FileUti...
[ { "docid": "94803610ccdbb7bb816531f3e7c65bb2", "score": "0.74278075", "text": "def stop\n system(\"pkill -f #{DAEMON}\")\n end", "title": "" }, { "docid": "ef268e7fe30bf75cd05678afbcb920b8", "score": "0.7299384", "text": "def stop!\n # Permissions are handled by the script, ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "a7641bf52479dfa05878ecc2d5d93f12", "score": "0.0", "text": "def set_appointment\n @appointment = Appointment.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...
e84293afc7f0aa0d82b1d0d848338d0a
This is the default environment for using camunda Spin in Ruby applications. expose Spin's S(...) function globally
[ { "docid": "2d7e4efbb998623c6e973c6e0cb8ed7a", "score": "0.59682345", "text": "def S(*args)\n org.camunda.spin.Spin.S(*args)\nend", "title": "" } ]
[ { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.66591763", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.66591763", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "sc...
72d3f06f0106a88a4cd1ebe7c404689f
Is overriding ActiveRecord::Basesave bad? Better way to do it?
[ { "docid": "604c65ae022ae888bcfe798965bde2ef", "score": "0.0", "text": "def save *args, &block \n super \n rescue ActiveRecord::StatementInvalid => e ...
[ { "docid": "0a59bd9ad837d02a4ed6cb0036e43d48", "score": "0.79983485", "text": "def _save\n raise NotImplementedError, 'override #_save in a subclass'\n end", "title": "" }, { "docid": "9132dff4adaf6a1aaf44c8a08dbf3927", "score": "0.7547562", "text": "def _save\n raise NotImple...
365c0200a10a24e24f6b365cd8469a93
PUT /medium_atk_infos/1 PUT /medium_atk_infos/1.json
[ { "docid": "dcdd6e6494c4774003d31381d8814489", "score": "0.7828748", "text": "def update\n @medium_atk_info = MediumAtkInfo.find(params[:id])\n\n respond_to do |format|\n if @medium_atk_info.update_attributes(params[:medium_atk_info])\n format.html { redirect_to @medium_atk_info, notic...
[ { "docid": "d8c1700fdbf8f6f16beca9bf0fe96422", "score": "0.7048476", "text": "def create\n @medium_atk_info = MediumAtkInfo.new(params[:medium_atk_info])\n\n respond_to do |format|\n if @medium_atk_info.save\n format.html { redirect_to @medium_atk_info, notice: 'Medium atk info was suc...
d89565512cf7e387a838cf302cce74a2
returns winning marker or nil
[ { "docid": "af85608550a03f715c1f667dc9b93f11", "score": "0.83611864", "text": "def winning_marker\n WINNING_LINES.each do |line|\n if marked_same?(@squares.values_at(*line))\n return @squares[line.first].marker\n end\n end\n nil\n end", "title": "" } ]
[ { "docid": "16659fdf6f5b04fa7952e5837ee17f77", "score": "0.84445524", "text": "def winning_marker\r\n WINNING_LINES.each do |line|\r\n squares = @squares.values_at(*line)\r\n if three_identical_markers?(squares)\r\n return squares.first.marker\r\n end\r\n end\r\n nil\r\n ...
a3843ccee19f17ecbff334e58e647592
The following methods accept x and y coordinates and return a Placement or nil if out of bounds.
[ { "docid": "ca8790f4d974da45dd294bc6142742a4", "score": "0.6055105", "text": "def north_of(x, y)\n Placement.new(x, y + 1, NORTH) unless y + 1 == @height\n end", "title": "" } ]
[ { "docid": "07ff67e935f8e03f963e80a07a087adc", "score": "0.66789615", "text": "def place(x = nil, y = nil, orientation = nil)\n placement = Placement.new x, y, orientation\n (@status = INVALID_PLACEMENT) && return unless placement.valid?\n\n if table.coordinate_exists? placement.x, placem...
87e4ab8f5d87de8868637317bb984bbc
Translates the given local and key. See the I18n API documentation for details.
[ { "docid": "d91e571d990b675c41422f30ac189f3f", "score": "0.0", "text": "def translate(locale, key, options = {})\n content = super(locale, key, options)\n if CopyTunerClient.configuration.inline_translation\n content = (content.is_a?(Array) ? content : key.to_s)\n end\n\n if !...
[ { "docid": "2a029fefdb69c22c0fefc81fe92149c7", "score": "0.7092838", "text": "def translate(key, options = {})\n translator.translate key, { scope: I18n.scope }.merge(options)\n end", "title": "" }, { "docid": "f534d16aebdd5bd47e0ff1277f707d58", "score": "0.707416", "text...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "fdef0b9e48f5bab24d26f5ad256d2788", "score": "0.0", "text": "def set_branch_product\n @branch_product = BranchProduct.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...
6ab174e377657ef6daf39510d914192c
GET /menus/1 GET /menus/1.json
[ { "docid": "4c3ca8e33a70f958a23f097f005d52a0", "score": "0.0", "text": "def show\n @menu_recipes = @menu.menu_recipes\n @recipes = @menu.recipes\n @main_recipe = @recipes.select{|recipe| recipe.recipe_select == 1}.first\n @side_recipes = @recipes.select{|recipe| recipe.recipe_select == 2}\n ...
[ { "docid": "a1f69b0cf34290856a33a9e5e6de3f90", "score": "0.80005735", "text": "def get_menu()\n res = get(\"menu/get\")\n return MultiJson.load(res.body)\n end", "title": "" }, { "docid": "bdbd5f8752a90ad3cd7ab6858be2916c", "score": "0.7749154", "text": "def index\n @...
af5bbfdae38bbc3b447aad0cde541b5d
Flashes (change background color to a new color and back a few times) element.
[ { "docid": "018cc8a24eed4d6381615908e97781c9", "score": "0.63694537", "text": "def flash(preset = :default, color: 'red', flashes: 10, delay: 0.1)\n presets = {\n fast: {delay: 0.04},\n slow: {delay: 0.2},\n long: {flashes: 5, delay: 0.5},\n rainbow: {flashes: 5, color: ...
[ { "docid": "a0dfc6de8343e0974de381894cc551e2", "score": "0.7221261", "text": "def flash\n @original_styles = {}\n 10.times do\n count=0\n @form.elements.each do |element|\n highlight(:set , element , count)\n count...
c9808e699b9eddefd69de5754be279a0
get details about instance's node RETURN: Map: name => values for one node NOTES: calls rpc_get_facts_direct
[ { "docid": "d001db9400933c56a4beb77ee5b3a8d0", "score": "0.7881396", "text": "def get_node_details(name_list)\n rpc_get_facts_direct(name_list)\n end", "title": "" } ]
[ { "docid": "ce35e9f0aeda97259643f1dfae4a329a", "score": "0.6870153", "text": "def get_facts(nodename)\n facts_puppetdb = Hash.new\n response_facts = RestClient.get\"http://#{Tayu.puppetdb_server}:#{Tayu.puppetdb_port}/facts/\" + nodename, { :accept => :json}\n\n # json string holds ...
bcf6a2026fdd18ce603955819eb2d63b
reset job to new
[ { "docid": "7ea62e27c0bdf9eeeb92e8c8d4fbfb52", "score": "0.0", "text": "def reset_new\n self.update_attributes(:status =>'new',:errormsg=>nil)\n end", "title": "" } ]
[ { "docid": "e9453a93a4ee208d7d9586d3fd00d2c3", "score": "0.72479254", "text": "def reset\n @status = nil\n FileUtils.rm_rf(job_folder) if Dir.exist?(job_folder)\n end", "title": "" }, { "docid": "6a56ab5ee2447e593d556e167b45bae0", "score": "0.71602684", "text": "def rese...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5a6f84250d5477075bc21ef94d44ca33", "score": "0.0", "text": "def set_cms_help_category\n @cms_help_category = CMS::HelpCategory.friendly.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...
b878be4397537646dc051147b6fc3ec1
PATCH/PUT /statistics/1 PATCH/PUT /statistics/1.json
[ { "docid": "da7048fee24e016c893fb2288ee165fc", "score": "0.59055144", "text": "def update\n respond_to do |format|\n if @statistic.update(statistic_params)\n format.html { redirect_to @statistic, notice: 'Fighter\\'s data was successfully updated.' }\n format.json { render :show, s...
[ { "docid": "f86576413b29af953de9278de726059f", "score": "0.6986067", "text": "def update\n statistic = Statistic.find(params[:id_statistic])\n if statistic.update(params_statistic)\n render json: statistic, status: 200\n else\n render json: statistic.errors, status:...
0cafdd400fa6049429e12e8a2825a7ad
kpf.find_path([2,1]) returns [][0,0], [2,1]]
[ { "docid": "d6f097625c2af3ad24e58c4958e86844", "score": "0.0", "text": "def bfs(target_value)\n queue = [self] # this is initial queue with your root value\n\n until queue.empty?\n # shift the first element of the queue\n el = queue.shift\n\n return el if el.value == target_value\n el.chil...
[ { "docid": "75f229ce91de4ec99cd133d11ed686dd", "score": "0.71161014", "text": "def find_path\n\t\tdecision_stack = [@maze.grid[1][1]]\n\t\tresult = find_path_helper(decision_stack)\n\t\treturn result\n\tend", "title": "" }, { "docid": "25460b43fc48a02e9f5fd6053a5d9aae", "score": "0.69899...
2cbbf43bc444014b3e07da8a459d5ea1
Render a submit button and a cancel link for this form.
[ { "docid": "bc12dd5485c91ab7a7d3633dbc38974b", "score": "0.6964986", "text": "def standard_actions(submit_label = ti('button.save'), cancel_url = nil)\n tag.div(class: 'col-md-offset-2 col-md-8') do\n safe_join([submit_button(submit_label),\n cancel_link(cancel_url)],...
[ { "docid": "47be5fdf95448594b754acb32bcf28e8", "score": "0.75739914", "text": "def submit_or_cancel(options = {})\n cancel_path = options.delete(:cancel_path)\n disable_with = options.delete(:disable_with) || default_disable_with\n cancel_button = cancel_path ? @template.link_to('Cancel', cance...
058f4841407f527a02e94b3b62c52607
Todo: may not be access concurrently!
[ { "docid": "5d1526817a875b7c7f516332c39886c1", "score": "0.0", "text": "def nextToken\n loop {\n if @buffer.empty?\n tok = @stream.nextToken\n res = @filter.filter(tok)\n if res.nil?\n next \n elsif res.is_a? Array\n @buffer.push(*res)\n ...
[ { "docid": "f6d4a510b1064cdde36cfabb37bc801a", "score": "0.7502042", "text": "def threadsafe; end", "title": "" }, { "docid": "48aa6ae56116baa2a62ba9233aa5fbd0", "score": "0.70597583", "text": "def threadsafe?; end", "title": "" }, { "docid": "711c764f1a0d24d73da19944bacd...
683a09f50448d7a2ac728d94bfec1216
so far param: name is not being used
[ { "docid": "311ce23ef98817dfbdafca579001dd7d", "score": "0.0", "text": "def global(name)\n\n table_body = render_to_string(:partial => 'side_panel/table_body/global/index')\n table_footer = render_to_string(:partial => 'side_panel/table_foot/total_deadweight')\n respond_to do |forma...
[ { "docid": "6e1ada2a1ca2235d1d4411d51623a583", "score": "0.725355", "text": "def name; end", "title": "" }, { "docid": "6e1ada2a1ca2235d1d4411d51623a583", "score": "0.725355", "text": "def name; end", "title": "" }, { "docid": "6e1ada2a1ca2235d1d4411d51623a583", "scor...
b78869290312ee410729c4c026aed80e
catching the sortables generator
[ { "docid": "a0a5bf262bbbcfc034078d264f750237", "score": "0.0", "text": "def sortable_element_js(id, options={})\n rightjs_include_module 'dnd', 'sortable'\n \n script = \"new Sortable('#{id}'\"\n \n # processing the options\n options[:url] = escape_javascript(url_for(options[:url])) if...
[ { "docid": "d2e34790a5f00c7b936666332829e97b", "score": "0.6879014", "text": "def main_sort_copy; end", "title": "" }, { "docid": "26099efd43b3fb2bd6679aba4d538d65", "score": "0.6834049", "text": "def sort # :yields: a, b\n LazyList.from_enum(super)\n end", "title": "" ...
681d0bdc04a6f327a6e345a99f4382d4
GET /mathematical_model_constant_values/1 GET /mathematical_model_constant_values/1.json
[ { "docid": "03ea65b13d5a9cad11099db1cb2af34f", "score": "0.7913197", "text": "def show\n @mathematical_model_constant_value = MathematicalModelConstantValue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mathematical_model_constan...
[ { "docid": "870759a7e59c6b30b31cbaa6c6a541b9", "score": "0.7421851", "text": "def new\n @mathematical_model_constant_value = MathematicalModelConstantValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mathematical_model_constant_value }\n e...
9bfabcf1abd86a3f5782fd09b5836bbc
def highest_paid_actor all_characters = []
[ { "docid": "46b0833a8cdc46e1304029ec69e21cc1", "score": "0.8163758", "text": "def highest_paid_actor\n all_characters\n .max_by { |char| char.salary }\n .actor\n end", "title": "" } ]
[ { "docid": "e996ff9f4c9c1d26492243a2d5311dda", "score": "0.79638344", "text": "def highest_paid_actor\n @characters.max_by do |character|\n character.salary\n end.actor\n end", "title": "" }, { "docid": "98890e43650eb2ceb360431375b33284", "score": "0.6553777", "text": "de...
5da8f32f6eeb783a13dc33d659a53fd0
Sets the attribute lex_en_expr_beg
[ { "docid": "f1bd05253fd57b6fa967146a7e929a87", "score": "0.7842794", "text": "def lex_en_expr_beg=(_arg0); end", "title": "" } ]
[ { "docid": "d9913106a32ab1587c20c48b681bbd56", "score": "0.80163574", "text": "def lex_en_expr_beg; end", "title": "" }, { "docid": "d9913106a32ab1587c20c48b681bbd56", "score": "0.80163574", "text": "def lex_en_expr_beg; end", "title": "" }, { "docid": "d9913106a32ab1587c...
a2d57ba6ae606ef2780af8093adc3319
Method to initialize a welcome email upon user signup
[ { "docid": "147d608ba6149673b0c06dfa3af0048b", "score": "0.66788137", "text": "def welcome_email(user)\n RestClient.post API_URL+\"/messages\",\n :from => \"postmaster@sandbox1152.mailgun.org\",\n :to => user.email,\n :subject => \"Welcome to Urop.io\",\n :text => \"Thanks for sig...
[ { "docid": "9cfb44ef8b4d47a2aed1fead4ead6b1c", "score": "0.7778914", "text": "def welcome_email\n # User welcome email sent.\n end", "title": "" }, { "docid": "264a0085d110eea2d346be5dbcc3c40a", "score": "0.75600195", "text": "def send_welcome_email(user)\n mail to: user.email...
2df22a31fea23e3c986bd2bc75f101b5
Return the localized string for the logical connector displayed between filter values.
[ { "docid": "7f818352c8cc177445fc55689a1aa1b4", "score": "0.6606491", "text": "def filter_connector(op = nil)\n op ||= 'OR'\n t(\"blacklight.#{op.downcase}\", default: op).upcase\n end", "title": "" } ]
[ { "docid": "baf0bde81689e02c012881a509c75098", "score": "0.5996805", "text": "def filter_help\n \"(Filter: #{@filter.join.inspect})\"\n end", "title": "" }, { "docid": "b505d5478e8ab549f3daaa308a1fa8a0", "score": "0.58934134", "text": "def to_connector_name\n lef...
a34c2cb75230b4ef230222c465063dba
Installs all dependencies and then the gem itself. Skips installation if after installing the dependencies the gem is already installed. You can force the gem to be installed even if the gem is already installed by setting Config.force? to true.
[ { "docid": "df8156e2904e618e72da1a02377afae3", "score": "0.7946864", "text": "def install!\n install_dependencies!\n \n if !Config.force? && File.exist?(install_path)\n log(:debug, \"Already installed `#{@gem_spec}'\")\n else\n log(:info, \"Installing `#{@ge...
[ { "docid": "7f7b2fba5716de404192597b23735d01", "score": "0.717693", "text": "def _install\n _build_gem\n _uninstall\n sh \"gem install --no-rdoc --no-ri --local #{gem_name}-#{version}.gem\"\n end", "title": "" }, { "docid": "c28fecbf7cd10655959deb8dc95bf87b", "s...
56fd4567f905ca92a748ee5ee5dce778
This method fetches results from the Google Places API and computes a hash for each result with the following information.
[ { "docid": "62e567826e9d2b00a6de90f76502a5e1", "score": "0.60657126", "text": "def fetch(url)\n response = RestClient.get(url)\n data = JSON.parse(response)\n @google_results = data[\"results\"].first(15).map do |result|\n {\n name: result[\"name\"],\n address: result[\"forma...
[ { "docid": "8fc4d9af5e219af080c9f407f08c47d3", "score": "0.6331881", "text": "def search(start_lat, start_long, end_lat, end_long, radius, term)\n latitude=start_lat\n longitude=start_long\n puts latitude\n puts end_lat\n # place = []\n # address= []\n places_hash={\n \n }...
98c683053693c2b2e8b972b393ac0b7a
Tells if the type is fixed point.
[ { "docid": "f4fec4929dfc8f7f23f3239e74c687f4", "score": "0.6125085", "text": "def fixed?\n return @base.signed?\n end", "title": "" } ]
[ { "docid": "f22d1ea0452cd2e83d6fe3b0865bb773", "score": "0.77560085", "text": "def fixed?\n @type == :fixed\n end", "title": "" }, { "docid": "62b9e565524767e52e429e1277ec1991", "score": "0.722025", "text": "def floating?\n not fixed?\n end", "title": "" ...
dc43db20940bb3b0c5e5edced047da59
The particularly unsafe call. This is because the request type is only checked if it is a GET and then assumes that it is a POST otherwise.
[ { "docid": "77e7563dca0f5a4d9296063ef5ecbc62", "score": "0.78922445", "text": "def unsafe\n @request_type = request.method_symbol\n\n # Makes the assumption that only GET and POST requests can be here, even though HEAD can also hit this endpoint\n if(@request_type == :get)\n ...
[ { "docid": "67e0563ab2c8210a766f2aca1883b791", "score": "0.7035361", "text": "def get_request_type\n if request.path_info.include? \"get\"\n return \"GET\"\n elsif request.path_info.include? \"post\"\n return \"POST\"\n elsif request.path_info.include? \"put\"\n return \"PUT\"\n end\n # Re...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0945d2ac8b0abbe35e7dad7634fa1f12", "score": "0.0", "text": "def set_liquido\n @liquido = Liquido.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...
e1ef8ffae42a6df6f2c7f37435e882b4
Permitted parameters when uploading a file. This is used for security reasons.
[ { "docid": "8f5927ef221297dc927d6399a01bd2e6", "score": "0.0", "text": "def data_mapper_params\n params.require(:data_mapper).permit(:title, :file_type, :original_file)\n end", "title": "" } ]
[ { "docid": "6a20cd630823ae37ee1d8d5f8378231b", "score": "0.7614482", "text": "def file_params\n permit_params\n end", "title": "" }, { "docid": "bed458334a2b78115731a587a0c2213a", "score": "0.75539184", "text": "def filepath_params\n # Since this is read-only, we have no...
53345de93d9668b36dba060192d8d049
GET /faq_sections GET /faq_sections.json
[ { "docid": "08fe6af4d9efb014a2e6c1a299301c16", "score": "0.7425655", "text": "def index\n @faq_sections = FaqSection.all\n end", "title": "" } ]
[ { "docid": "3243ba64e018b4ea8de8caf832b316df", "score": "0.67597014", "text": "def index\n \n load_quiz\n load_sections\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end", "title": "" }, ...
1c9da513e87fe10fa8fea8dd24c17371
DELETE /admin/field_types/1 DELETE /admin/field_types/1.json
[ { "docid": "e1e9ed45663598e8df4815b7f9419328", "score": "0.83029395", "text": "def destroy\n @admin_field_type = Admin::FieldType.find(params[:id])\n @admin_field_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_field_types_url }\n format.json { head :no_conte...
[ { "docid": "811852ec58f37cab5de45a94ae94f5fd", "score": "0.7757908", "text": "def destroy\n authorize! :edit, CustomForms::FieldType\n @field_type.destroy\n respond_to do |format|\n format.html { redirect_to field_types_path, notice: 'Field type was successfully destroyed.' }\n ...
fef050cb3cbe3dadd005d9f7eb91d637
Returns id of current application.
[ { "docid": "b4f0c37a37ae9bcbd97d381e71d4fd12", "score": "0.8247339", "text": "def app_id\n @app.id\n end", "title": "" } ]
[ { "docid": "4e77b9003d25836fb171be7107b892ca", "score": "0.81527394", "text": "def app_identifier\n return @app_identifier\n end", "title": "" }, { "docid": "2487aba7653c0e2bca5a22a86ad332ce", "score": "0.799841", "text": "def app_id\n return ...
b2e959b9f68da8cd88e1977772139ad8
PUT /email_receives/1 PUT /email_receives/1.xml
[ { "docid": "69f9e4cad73d2a5a2f37e15a3e9688f2", "score": "0.6163996", "text": "def update\n @email_receive = EmailReceive.find(params[:id])\n\n respond_to do |format|\n if @email_receive.update_attributes(params[:email_receive])\n format.html { redirect_to(supplier_jobs_path(params[:sup...
[ { "docid": "77586331dbfc55739b3b6ae9a1016b12", "score": "0.5938433", "text": "def update\n @email = @recipient.emails.find(params[:id])\n\n respond_to do |format|\n if @email.update_attributes(params[:email])\n format.html { redirect_to recipient_emails_path, notice: 'Email was success...
660b84c3a5c340d0e03577ad0ca2da95
Name: populate_relation_init Desc: convenience method, put_relation for list of relations for specified key (coll_A/key_A)
[ { "docid": "58e95a8053a7c2887465749a3801cfcc", "score": "0.7580344", "text": "def populate_relation_init(args)\n\tfilename = \"#{@root_name}-#{args[:coll_A]}-#{args[:key_A]}-#{args[:coll_B]}-#{args[:jmc]}-relation.json\"\n\tkeys_B = JSON.parse(open(\"#{@src_dir}/#{filename}\").read)[args[:keys_B]]\n\tke...
[ { "docid": "6e22f5c11854aafc528e7bb7f7deea30", "score": "0.76701885", "text": "def populate_relation(args)\n\tget_relation_list(args).each do |key_B|\n\t\tshow_response args[:client].put_relation({\n\t\t\tcollection_A: args[:collection_A], key_A: args[:key_A], relation: args[:relation],\n\t\t\tcollectio...
bd35cccd65e3043ffa5d00f1d75be35a
GET /join/XXXXXX join a section as a new student
[ { "docid": "a5ac74ec427fd954a7a17ec1aed79870", "score": "0.59494585", "text": "def student_user_new\n @section = Section.find_by_code(params[:section_code])\n\n # make sure section_code is in the path (rather than just query string)\n if request.path != student_user_new_path(section_code: param...
[ { "docid": "f5c7e640a89eb5cab0c872f097b0b4e3", "score": "0.6657769", "text": "def join\t\n\t\t@course = Course.find(params[:id])\n\n\t\taccess = Access.new\n\t\taccess.role = Role.find_by_name(\"Student\")\n\t\taccess.course = @course\n\t\taccess.user = @current_user\n\t\taccess.save\n\n\t\tLogsControll...
54f4d23625d2a697426ae2c233eb2e17
List nexus related to a tax form Retrieves a list of nexus related to a tax form. The concept of `Nexus` indicates a place where your company has sufficient physical presence and is obligated to collect and remit transactionbased taxes. When defining companies in AvaTax, you must declare nexus for your company in order...
[ { "docid": "94c8ae6637b9d4115357061defe5bf9b", "score": "0.7005068", "text": "def list_nexus_by_form_code(formCode) path = \"/api/v2/definitions/nexus/byform/#{formCode}\"\n get(path, {}, AvaTax::VERSION) end", "title": "" } ]
[ { "docid": "0c5d8f9b1207b2895317d274b988d7f3", "score": "0.6827458", "text": "def list_nexus(options={}) path = \"/api/v2/definitions/nexus\"\n get(path, options, AvaTax::VERSION) end", "title": "" }, { "docid": "c92949db27fcb232015a88dc19279f86", "score": "0.6232336",...
12e068292e28f800298914a91221e7a4
POST /fares POST /fares.json
[ { "docid": "60ee032673b0df17a4e20262ef94f562", "score": "0.0", "text": "def create\n @fare = Fare.new(fare_params)\n\n respond_to do |format|\n if @fare.save\n format.html { redirect_to @fare, notice: 'Fare was successfully created.' }\n format.json { render :show, status: :crea...
[ { "docid": "9647e5286ea8403742c173160ec066e3", "score": "0.6533888", "text": "def create\n @festa = Festa.new(festa_params)\n\n respond_to do |format|\n if @festa.save\n format.html { redirect_to @festa, notice: 'Festa was successfully created.' }\n format.json { render :show, s...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "44f5c18ae2cad770a077d547511a4d0a", "score": "0.0", "text": "def video_params\n params.require(:video).permit(:title, :source, :board_id, :iFrame_Source, :type)\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...
d9e8375a92fd901b89fe73bccd94df5b
POST /parking_spaces POST /parking_spaces.json
[ { "docid": "f884ccca1b6467f244b0b438ef28709d", "score": "0.7065924", "text": "def create\n @parking_space = ParkingSpace.new(params[:parking_space])\n @parking_space.location_x = @parking_space.location_x.to_s\n @parking_space.location_y = @parking_space.location_y.to_s\n @parking_space.user...
[ { "docid": "b3a822704ad1981499271f2454ed6b16", "score": "0.7493488", "text": "def create\n @parking_space = current_user.parking_space.new(post_params)\n\n respond_to do |format|\n if @parking_space.save\n format.html { redirect_to @parking_space, notice: 'Parking space was successfull...
e55f2ec953964eb39194df5ee0e64ae8
PATCH/PUT /tags/1 PATCH/PUT /tags/1.json
[ { "docid": "792ad41e2a69e11f977bbd4e567909b7", "score": "0.6353617", "text": "def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag }\n ...
[ { "docid": "2c1d562ec964eee9463cfb7293ea74da", "score": "0.70441467", "text": "def update\n @tag.update(tag_params)\n render json: @tag\n end", "title": "" }, { "docid": "2630f0ef272ef5070065909506fa3a9b", "score": "0.70224214", "text": "def update\n begin\n ...
8e60acecd0bb6e439be808b076fa2b17
Registers a callback that will run immediately after the classes are unloaded. source://activesupport//lib/active_support/reloader.rb43
[ { "docid": "32c9383334cfd28560a4460a5f3e070d", "score": "0.7200524", "text": "def after_class_unload(*args, &block); end", "title": "" } ]
[ { "docid": "a365081065eabc717fcbde0a9a286fc5", "score": "0.7224827", "text": "def before_class_unload(*args, &block); end", "title": "" }, { "docid": "0c7554e4ee9676c73b02624a96acbe73", "score": "0.6414249", "text": "def clear_dead_callbacks; end", "title": "" }, { "docid...
c461595ba4c80614b28d6dfd0045ed5b
check the agrument length and parse option , if two return true else false
[ { "docid": "3cfebb9c2aff3d0d78e54e1044c0147d", "score": "0.66429263", "text": "def validate_parameters?\n opts = OptionParser.new\n opts.parse!(@parameters) rescue return false\n @parameters.length >= 2\n end", "title": "" } ]
[ { "docid": "98341347bb2e14f2564414603c0f996d", "score": "0.6725732", "text": "def options_ok?\n end", "title": "" }, { "docid": "610c5412e5a903eed95aa5fd12bc7e6c", "score": "0.66917807", "text": "def validate_arguments\n if(!@options.parse || !@@sections.include?(@options.par...
1205c3faae10fca20990c8f005a2108d
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge [by myself, it's solo challenge ]. 1. Pseudocode What is the input? What is the output? (i.e. What should the code return?) What are ...
[ { "docid": "da055f0e41d4dc6dd7c72890630904e9", "score": "0.80833256", "text": "def median(arr)\n\t#arr is an array\n\tarr.sort!\n\tlength = arr.length\n\ti = length/2\n\tif length % 2 == 0\n\t\treturn (arr[i-1] + arr[i])/2.0\n\telse\n\t\treturn arr[i]\n\tend\nend", "title": "" } ]
[ { "docid": "ee8c26c848cb0edb6935f44a695a488d", "score": "0.86614674", "text": "def median array\n array = array.sort\n if array.length%2 == 1 #odd\n array[(array.length.to_f/2)]\n else # even\n mid1 = array[(array.length/2) - 1]\n mid2 = array[(array.length/2)]\n (mid2 - mid1).to_f/2 + m...
77404a6824c121c22106f5d9178d7b7a
The follow_location param determines the difference between a redirect trace that runs through every nested redirect and one that stops at the first redirect in the trace. (A nested redirect meaning that the destination of one redirect is the source of another)
[ { "docid": "b78eef92263c9dcdc21163dcf19818e0", "score": "0.0", "text": "def resolve\n respond_to do |format|\n format.js do\n # The last redirect in a chain should always follow its location through,\n # because that's the only way afaik to retrieve 404/500 and other faulty\n ...
[ { "docid": "a78a4968afa4ab2fbadaccbf8e7285c4", "score": "0.7193116", "text": "def follow_redirect!\n unless last_response.redirect?\n raise Error.new(\"Last response was not a redirect. Cannot follow_redirect!\")\n end\n\n get(last_response[\"Location\"])\n end", "...
9fc11590c0a4b5b80f7236d83e0777cf
POST /motivosprorroga POST /motivosprorroga.xml
[ { "docid": "9393dfadf515e87448d4b369094cfb76", "score": "0.6579782", "text": "def create\n @motivoprorroga = Motivoprorroga.new(params[:motivoprorroga])\n\n respond_to do |format|\n if @motivoprorroga.save\n format.html { redirect_to(@motivoprorroga, :notice => 'Motivoprorroga was succ...
[ { "docid": "a8653742e81298af7bd41923a0d27fa8", "score": "0.668411", "text": "def create\n @motivo = Motivo.new(params[:motivo])\n\n respond_to do |format|\n if @motivo.save\n format.html { redirect_to(@motivo, :notice => 'Motivo was successfully created.') }\n format.xml { rend...
3510302825a55f5784e268ee8fed5ef8
currently does not support :if option
[ { "docid": "5428288682b2ff896a29e34cf464f1a7", "score": "0.0", "text": "def validate_inclusion_of(attr, options = { })\n EdgeCase::RSpecExpectationMatchers::ProvidesFor::ActiveRecord::ValidatesInclusionOf.new(attr, options)\n end", "title": "" } ]
[ { "docid": "7d6992e5d00ba9f5ebdebf76e7a8e9c1", "score": "0.74723387", "text": "def if_proc; end", "title": "" }, { "docid": "0142d3a7d72d7e7c3c62ea13de2b2a05", "score": "0.7218332", "text": "def conditionally(*) end", "title": "" }, { "docid": "0142d3a7d72d7e7c3c62ea13de2...
73e0161d447a96647f05cc2144d900cf
Changes font bold settings of cell
[ { "docid": "4f44d7e5c27f8c17d72a6faf223193d1", "score": "0.8333081", "text": "def change_font_bold(bolded=false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end", "title": "" } ]
[ { "docid": "24fd56eddea964302e5fac60d1e96b1e", "score": "0.8302406", "text": "def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end", "title": "" }, { "docid": "685ea7b3d64139...
4b3f8035a5401b00e16327c0cc7afb12
Q(17)This method displays length of given string
[ { "docid": "4c4ff27026e534394f230cd417d6da82", "score": "0.78666705", "text": "def find_length_of(string)\n print \"\\n\\nLength of given string is: #{string.length}\" \nend", "title": "" } ]
[ { "docid": "902b431f6c9a11e7ae48d26ca586f584", "score": "0.82570916", "text": "def run_length(str)\r\n\r\nend", "title": "" }, { "docid": "d4a106f7c2e354c602c9b2cfad1c2db1", "score": "0.8114315", "text": "def length\n string.length\n end", "title": "" }, { "docid"...
3afb1baf6f99ecbe6138d22f5538d304
converts a date range array back to string to persist select options
[ { "docid": "014ca55541337c487590d9f8de516bbf", "score": "0.62350214", "text": "def date_range_to_string(date_range)\n \"%s - %s\" % [date_range[0], date_range[1]] rescue nil \n end", "title": "" } ]
[ { "docid": "ba154e6c392578eb132d1ba8813ef474", "score": "0.6200254", "text": "def date_range_select_tag(name_prefix, field, options = {})\n html = []\n [:start, :end].each do |part|\n html << calendar_date_select_tag(\n \"#{name_prefix}[#{field}][#{part}]\",\n (options...
a11719e6f20e98274b1ca6c82c00f933
Replays the command history on the remote server.
[ { "docid": "467f3d5fdbf44c050becea51fe9e8c8c", "score": "0.8206218", "text": "def replay\n ssh(self.join) unless @history.empty?\n end", "title": "" } ]
[ { "docid": "0a8e901e9a022a48e1f75f27b8fe3094", "score": "0.6385726", "text": "def cmd_history argv\n setup argv\n msg run_cmd(\"history\")\n end", "title": "" }, { "docid": "94d2d68d996318c7e252470cea13051c", "score": "0.5946922", "text": "def replay(game)\n\t\t@moves.each { |...
a137209eb5d1e4d65899a4f047755245
The prefix for table names of gricer database tables. Default value is 'gricer_'
[ { "docid": "48955b3ed7525869e9433cc83e7f1735", "score": "0.88935685", "text": "def table_name_prefix \n @table_name_prefix ||= 'gricer_'\n end", "title": "" } ]
[ { "docid": "a8bc5c0da7bd8921418436bc3aef10b0", "score": "0.80942893", "text": "def table_name_prefix; end", "title": "" }, { "docid": "e486a62673eaf37466175bcf06288f89", "score": "0.7722725", "text": "def table_name_prefix\n \"ext_#{self.registered_name.to_s.underscore}_\"\n...
73b7ff21d5891799e56c07b6987a5532
Populates the board with game pieces in their starting locations
[ { "docid": "5b35000c643e7ca2f880dee28d732045", "score": "0.0", "text": "def new_game\n #Pawns \n 8.times do |i|\n @squares[1][i] = Pawn.new(1)\n end\n 8.times do |i|\n @squares[6][i] = Pawn.new(2)\n end\n\n #Rooks \n @squares[0][0] = Rook.new(1)\n @squares[0][7] = Rook....
[ { "docid": "8b3fc4b2879c67380756c7f3380dcdc2", "score": "0.8226032", "text": "def set_up #places all pieces at their starting locations, can also work as a restart baord in the middle of a game\n\n @grid.each_with_index do |row, row_idx|\n if row_idx.between?(0, 2)\n row.do_if_odd {|s...
4435d73111ce0b142a9a1ab85c6ca76b
public: Return a new hash with keys as strings
[ { "docid": "54263f70df99d79ed7fba22d91219e92", "score": "0.71308637", "text": "def stringify_keys(hash)\n hash.each_with_object({}) do |(k, v), memo|\n memo[k.to_s] = v\n end\n end", "title": "" } ]
[ { "docid": "3db1a67b820f37991410def7f79fe36d", "score": "0.76874053", "text": "def to_h_with_string_keys\n result = {}\n to_h.each { |key, val| result[key.to_s] = val }\n result\n end", "title": "" }, { "docid": "3edb5abac89ab1b7e1cd4980b7f301ad", "score...
85c92a84108ff39d74d1de8c06d6c778
checks the index to see if 1) the position is already taken and 2) if it is a number between 0 8
[ { "docid": "a4ac8460e98c56906d55fca700397341", "score": "0.68675923", "text": "def valid_move?(board, index)\n \nif position_taken?(board, index) === false && index.between?(0, 8)\n return true\nelse \n return false\nend\nend", "title": "" } ]
[ { "docid": "66cd196f735ee0c0b9fae0b08420c312", "score": "0.7302734", "text": "def invalid_position(index)\n nums = [1,2,3,4,5,6,7,8,9]\n unless nums.include?(index)\n TRUE\n end\n end", "title": "" }, { "docid": "bb25bc72c2abf26b2451114dda67e97b", "score": "0.7232047", ...
62af54830002a252876e3da883b67480
Determines if we've a new manifest file.
[ { "docid": "2633213a3b442b9e0e80a17998f1a295", "score": "0.8235417", "text": "def new_manifest?\n return @new_manifest\n end", "title": "" } ]
[ { "docid": "bc9a472bbc7467a85ba439b8b7244fa7", "score": "0.751181", "text": "def has_manifest?\n\t\treturn self.manifest_file.readable?\n\tend", "title": "" }, { "docid": "ceabff99d8f0bfa2f662899bc35ac359", "score": "0.7156545", "text": "def is_new?\n !File.exists? @filename\n ...
682b7d9e2fea21d95ac1a5df3d1cf15a
`Newman::Recorderread` looks up a record by `id` and returns a `Newman::Record` object.
[ { "docid": "54f8deef4b71606d063377e4201c7f25", "score": "0.72233945", "text": "def read(id)\n store.read do |data|\n Record.new(column, id, data[:columns][column][id])\n end\n end", "title": "" } ]
[ { "docid": "1d4dabc7ff70d8dc15157dff4667fd11", "score": "0.7310123", "text": "def record(record_id, params = {})\n Record.new(record_id, params).get\n end", "title": "" }, { "docid": "1d4dabc7ff70d8dc15157dff4667fd11", "score": "0.7310123", "text": "def record(record_id, para...
f63faf9162b63e0dc3cc93756a45c9d5
p not_better_by_much_anagram("gizmaasdfsdfo", "saasdfasdflly") p not_better_by_much_anagram("elvasdfisasdf", "liasasdfdfves")
[ { "docid": "c6b63ee0d1ea6b7def617d3b8b9d06a3", "score": "0.7820277", "text": "def slightly_better_by_much_anagram(string1, string2)\n hsh1 = Hash.new(0)\n\n string1.chars.each do |ch|\n hsh1[ch] += 1\n end\n\n string2.chars.each do |ch|\n hsh1[ch] -= 1\n end\n\n return true if hsh1.values.al...
[ { "docid": "f2e6622c2f422bea09c367d1aa331ab1", "score": "0.82539445", "text": "def third_anagram?(string1, string2) #0(log n)\n string1.sort == string2.sort\nend", "title": "" }, { "docid": "f4062bf722d43e19efc8a034bea76c21", "score": "0.8175513", "text": "def third_anagram?(str1,st...
df929a65d9131598cb34e752e5e495f4
Get all scheduled achievements for a user, if name is passed then only find scheduled achievements belonging to that achievement
[ { "docid": "85578ec3b753784280d9e188f0ca4d8a", "score": "0.69766754", "text": "def scheduled_achievements\n @scheduled_achievements ||=\n ScheduledAchievement\n .joins(:achievement)\n .where(achiever_achievements: { subject_id: primary_key_value })\n end", "title": "...
[ { "docid": "ed50163236b2e0fb53968820920fdc90", "score": "0.69792616", "text": "def achievement(name)\n achievements.find_by(name: name)\n end", "title": "" }, { "docid": "194fe8d005f2ff4eb9b48ab741493fc7", "score": "0.6496826", "text": "def find_achievement(name)\n Achieve...
428900dfa0840a464a1e54537ee2ba84
used for testing connection autorecovery
[ { "docid": "07da94dcc84696394c8c5e17f54ea0db", "score": "0.0", "text": "def conn_error?(key)\n c = get_connection_by_key(key)\n c && c.error?\n end", "title": "" } ]
[ { "docid": "ad21efe30c678e65d5a0eb2a5e13800a", "score": "0.78165233", "text": "def test_connection\n end", "title": "" }, { "docid": "ffdf4b41ec930e17399060950add76ab", "score": "0.7070263", "text": "def test_connection\n synchronize{|conn|}\n true\n end", "titl...
500a0f6b20501385f20af93d1f718440
Creates an HTML tag with given name, content, and options.
[ { "docid": "773d0ac1eaac4a3a8a81eb9d3fc29ea5", "score": "0.7198569", "text": "def content_tag(name, content = nil, options = nil, &block)\n if block_given?\n options = content if content.is_a?(Hash)\n content = capture_html(&block)\n end\n\n options = parse_data...
[ { "docid": "67149b139d0943093569c0f135b95097", "score": "0.84290826", "text": "def tag(name,content,options={})\n with_opts = \"<#{name.to_s} #{options.to_html_attrs}>#{content}</#{name}>\"\n no_opts = \"<#{name.to_s}>#{content}</#{name}>\"\n options.blank? ? no_opts : with_opts\n end"...
81500ed8d8a1265d42d54961d493b60f
Returns the base URI for this vocabulary class.
[ { "docid": "138b7e2164fd5adb77d613e2df4e5df8", "score": "0.0", "text": "def to_uri\n RDF::URI.intern(@@uris[self].to_s)\n end", "title": "" } ]
[ { "docid": "46787a9ff2b3d75a685d5993081dd9b9", "score": "0.77113557", "text": "def base_uri\n self.class.base_uri\n end", "title": "" }, { "docid": "b994ad3d260fadf4e472c8f93d885321", "score": "0.74551934", "text": "def base_uri\n RDF::URI(@options[:base_uri])\n end",...
98e444f5ac4223d95f5746c30b81a894
Assume keys are identical for all structs, so use the first as a template for all.
[ { "docid": "477871d5bb9e69045f9a419f302172e2", "score": "0.0", "text": "def attribute_keys\n @attribute_keys ||= proto_records.first.to_h.keys.map { |key| key.to_s.underscore.to_sym }\n end", "title": "" } ]
[ { "docid": "a37334f7c59d7f1198f7d86d6163be81", "score": "0.58188325", "text": "def each_template\n if @processed.nil?\n @processed, @rest = templates.keys.sort_by{|template| template.to_s}.partition { |k| k.to_s.include? \".\" }\n end\n\n @processed.each do |k|\n yield k, templates[k]...
ce5170e7c6231aec7c447ed18275b037
put source node into queue and mark as visited remove recently visited node add each unvisited adjacents to queue and mark as visited
[ { "docid": "f0c5d185365d4c6ac8f5ce8bc333ae12", "score": "0.0", "text": "def has_path_to(node)\n\t\t@visited.include?(node)\n\tend", "title": "" } ]
[ { "docid": "f08ac7f7f4a30a416d41639d14eba3e6", "score": "0.68423605", "text": "def add_to_queue(graph, queue, node, visited)\n graph.vertices[node].each do |child|\n unless visited[child]\n queue.push(child)\n visited[child] = true\n end\n end\n end", "ti...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "8c0aab9ee25d4908f405a758b74f10e3", "score": "0.0", "text": "def trac_params\n params.require(:trac).permit(:flight, :airline)\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...
d4187e303cab2f618f4aa8a7cdf40398
Randomize the starting point of the starting pattern zeros flag will hold the starting point to the 0,0 point
[ { "docid": "b722459bc7b464ba01b4dff306f471fe", "score": "0.66755664", "text": "def generate_seed(size, pat, zeros = nil)\n @seeded ||= nil\n y = size - pat.length \n x = size - pat[0].length\n if zeros.nil?\n @seeded = [(rand * x).floor, (rand * y).floor] if @seeded.nil?\n else\n @s...
[ { "docid": "8c7b16a3311bad6bc386d976f9ae94a9", "score": "0.68145204", "text": "def initialize\n @offset = rand(0...BOUNDARY)\n end", "title": "" }, { "docid": "0cefa9b4d2e163e23bb8c431db19efd3", "score": "0.64765406", "text": "def make_valid_incomplete seed=2\n pattern = Arr...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "7b0430906be0aaeaa92fd3de7c6870e1", "score": "0.0", "text": "def set_persona\n @persona = Persona.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60315156", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6018921", "text": "de...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "3f163c4fc6ed8154b572857efb575191", "score": "0.0", "text": "def set_item\n @item = Item.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
0e143e2d46216420220d97a84576542b
If there are ID3 tags present, sort by disk number (ID3v2 only) then by track number, otherwise sort by filename.
[ { "docid": "13c750d81c2fb1b0ba02986f0b747181", "score": "0.482862", "text": "def <=>(other)\n if @disknum != other.disknum\n @disknum <=> other.disknum\n elsif @tracknum != other.tracknum\n @tracknum <=> other.tracknum\n else\n @filename <=> other.filename\n end\n end", "...
[ { "docid": "f3fd7847d828822d763b17218ae850af", "score": "0.65122265", "text": "def sort_files!; end", "title": "" }, { "docid": "cb0bb1ab1cf30dfdf44345ec6a3177af", "score": "0.6098876", "text": "def sorted_files\n sort_file_name_by_semver(all_files.select { |f| semver_file?(f)...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1c4ed41f6188b1c9550a6d30d6b3fe43", "score": "0.0", "text": "def set_comment10\n @comment10 = Comment10.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
60a5b3e93ea217b71db6a6f571e0860e
test if we really got an API Object
[ { "docid": "896d6d700570b451ce9a58fbedceff91", "score": "0.66330916", "text": "def test_api_class\n assert_instance_of EAAL::API, @api\n end", "title": "" } ]
[ { "docid": "316d397b35a18dc31e30f466614cb891", "score": "0.7315742", "text": "def is_api?\n true\n end", "title": "" }, { "docid": "316d397b35a18dc31e30f466614cb891", "score": "0.7315742", "text": "def is_api?\n true\n end", "title": "" }, { "docid": "e8c3...
e9bf9c1590ab37826fa809f198ebe3e7
Action to do when the LEFT key is pressed Returns : the object itself
[ { "docid": "dca02cc13863302307917986e18f3200", "score": "0.78366786", "text": "def key_left_pressed\n\t\tself.moveDir(0, -1)\n\t\treturn self\n\tend", "title": "" } ]
[ { "docid": "21347221da5282c87d94985d58839ad2", "score": "0.72513103", "text": "def left\n @key_up.left || @key_held.left || a\n end", "title": "" }, { "docid": "ba8fcddc55ba36d49ffe9426322c5e9b", "score": "0.7153133", "text": "def leftClicked\n\t\t@first.leftClicked\n\tend", ...
0ac9cd8e885e3543ea0ef79aec205ba8
Will go through all source files and mark lines that are wrapped within :nocov: comment blocks as skipped. source://simplecov//lib/simplecov/source_file.rb181
[ { "docid": "56e4ff4911b1472a04a1f1b5ed4b51c3", "score": "0.5929585", "text": "def process_skipped_lines(lines); end", "title": "" } ]
[ { "docid": "7f46b798c883790a40e5db4fc2a09a42", "score": "0.7469568", "text": "def uncovered_relevant_lines\n lineno = 0\n File.open(@filename, \"rb\").each_line do |line|\n if @coverage[lineno] == Bashcov::Line::IGNORED && revelant?(line)\n yield lineno\n end\n li...
5522a5eb407a218e6030bc1b791820d5
next Return the next object in cursor's current context.
[ { "docid": "0fa4c441ac3b11fd2d6af0d1d2f45efb", "score": "0.0", "text": "def next( count = 1 )\n next_values = super\n if next_values.is_a?( ::Array )\n next_values.each do |this_value|\n this_value.attrs_atomic!\n end\n elsif next_values\n next_values.attrs_atomic!\n en...
[ { "docid": "29e72ccdaa24dfd75aef2cad202bab5b", "score": "0.7836737", "text": "def next_cursor\n @_next_cursor ||= all.last.try(:id)\n end", "title": "" }, { "docid": "1f037c06b640b1d0a7827267b7293ef1", "score": "0.78352237", "text": "def next_cursor\n last.public_send(cu...
b04d5c7b9787eff72e82b3736647d356
before_action :set_cors, :only => [:create, :loggedin_user]
[ { "docid": "54eed36c9616b41c583bc458060664be", "score": "0.0", "text": "def create\n\t\t@user = User.new(user_params)\n\n\t\tif @user.save\n\t\t\trender 'create.json.jbuilder', :status => 201\n\t\telse\n\t\t\trender :json => { :message => @user.errors.full_messages.to_sentence }, :status => 409\n\t\tend...
[ { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.6530807", "text": "def before_action \n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.6530807", "text": "def before_action \n end", "title": "" }, { "docid": "5c3c...
de870cafb743021f7143bd022812b6a4
This method adds the winnings to the player's bankroll.
[ { "docid": "9558c4591907c32250acc4d83aa2f503", "score": "0.8096037", "text": "def win_bet(winnings)\n @bankroll += winnings\n @@bankroll += winnings\n end", "title": "" } ]
[ { "docid": "24fc3a958e37278bf15d33c1360a5104", "score": "0.7704638", "text": "def take_winnings(winnings)\n\t\t@bankroll += winnings\n\t\t@net_winnings += winnings\n\tend", "title": "" }, { "docid": "9cf97d04c76c36f8b2e07d0a02fb328a", "score": "0.7452603", "text": "def add_winnings(w...