query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
get the page that lets you edit an existing post
def edit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n end", "def edit\n @post = Post.find(params[:post_id])\n\n assert(@post.kind_of?(Post))\n\n return @post\n end", "def edit\r\n @post = Post.find(params[:id])\r\n end", "def edit\n # @post = Post.find(...
[ "0.7815621", "0.76617306", "0.7585463", "0.7578561", "0.75766695", "0.7572105", "0.7558112", "0.75522447", "0.75522447", "0.7546631", "0.7536902", "0.7526222", "0.7526222", "0.7526222", "0.7526222", "0.7526222", "0.7526222", "0.7526222", "0.7524478", "0.75001323", "0.7495716"...
0.0
-1
put the data you just filled out to edit the post back to the serber so it can perform the updated
def update if @listing.update(listing_params) redirect_to "/listings/#{@listing.id}" else flash[:warning] = 'Y U DO THIS' render :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updated_data\n\tend", "def edit\n \n end", "def update\n validate_save_and_respond(load_change_set, :edit)\n end", "def update\n\n\tend", "def update\n\n\tend", "def update\n\t\tend", "def update\n\t\tend", "def update\n validate_save_and_respond(update_change_set, :edit)\n ...
[ "0.66186893", "0.65684605", "0.6561305", "0.6552876", "0.6552876", "0.65500325", "0.65500325", "0.65133214", "0.6485604", "0.64667314", "0.64452916", "0.6431905", "0.6427693", "0.6419288", "0.6414134", "0.6414134", "0.6414134", "0.6414134", "0.6397871", "0.6397871", "0.639787...
0.0
-1
delete one specific post by sending a delete request to the server
def destroy @listing.destroy redirect_to "/listings" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_post\n\t \n \tend", "def delete\n @post = Post.find(params[:id])\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete(id, post)\n File.unlink(post_path(post))\n\n update_digests do |digests|\n digests.delete(id)\n end\n end", "def destroy\...
[ "0.80192304", "0.76795584", "0.74897903", "0.7422145", "0.73755056", "0.73445046", "0.73435605", "0.73238945", "0.7284451", "0.72810245", "0.72650707", "0.7259744", "0.723818", "0.72066754", "0.7176677", "0.71586996", "0.7156068", "0.71224886", "0.7111127", "0.71048844", "0.7...
0.0
-1
To support object equality tests
def hash expr.hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def === obj\n #This is a stub, used for indexing\n end", "def eq(_obj)\n raise NotImplementedError\n end", "def ==(other); false; end", "def eql?(*) end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other)...
[ "0.7874092", "0.7811582", "0.7697245", "0.76817495", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", "0.7481989", ...
0.0
-1
expand_hash_conditions_for_aggregates assumes our hash keys can be converted to symbols, so this has to be implemented, but it doesn't really have to do anything useful.
def to_sym nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_hash_conditions_for_aggregates(attrs) # :nodoc:\n conditions = super\n enums.each do |name, reflection|\n if conditions.key?(name)\n value = conditions.delete(name)\n elsif conditions.key?((string_name = name.to_s))\n value = conditions.delete(strin...
[ "0.71716416", "0.53500956", "0.5294393", "0.5188842", "0.5148199", "0.50564456", "0.50068414", "0.49903038", "0.4976921", "0.49376142", "0.4923076", "0.4907806", "0.49004897", "0.4891337", "0.48866627", "0.48831445", "0.4878997", "0.48743153", "0.48596075", "0.48596075", "0.4...
0.0
-1
Indicates whether the tunnel is busy.
def busy? status == "busy" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def busy?\n @busy\n end", "def busy?\n @busy\n end", "def busy?\n status == :busy\n end", "def busy?()\n @mutex.synchronize() do\n return @busy\n end\n end", "def busy?\n !(@status == :wait || @status == :disabled || @status == :error)\n end", "def busy...
[ "0.7779011", "0.7779011", "0.7715679", "0.76334006", "0.76183325", "0.7596095", "0.7508368", "0.7464069", "0.7182531", "0.7127738", "0.7063052", "0.6934519", "0.69339556", "0.68022513", "0.677755", "0.6773345", "0.6770824", "0.6620363", "0.65954554", "0.65731025", "0.6544448"...
0.7538359
6
Save putting the btn and btnmini bootstrap classes in every link below...
def workflow_action_link(title, link, opts={}) link_to(title, link, {:class=>'btn btn-mini'}.merge(opts)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primary_button_small\n \"highlight-button-dark btn btn-small button\"\n end", "def payment_button_classes(additional_classes = [])\n %w(btn btn-secondary btn-sm) + additional_classes\n end", "def bootstrap_button(text, *params)\n options = params.extract_options!.symbolize_keys\n if options.i...
[ "0.64986676", "0.63702714", "0.623094", "0.6145121", "0.6108558", "0.6061235", "0.59464854", "0.58921236", "0.5888644", "0.5885242", "0.58772016", "0.5852658", "0.5801371", "0.57563955", "0.5754397", "0.57404435", "0.5713552", "0.57047224", "0.5696664", "0.5684216", "0.564600...
0.55981475
23
Last push button helper. push_job_class is FtpPushJob, RhnStagePushJob or RhnLivePushJob
def last_push_link(push_job_class, errata) if (last_push = push_job_class.last_push(errata)) push_job_link(last_push, 'Last job') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_prepush_link(push_job_class, errata)\n jobs_since_respin = errata.push_jobs_since_last_state(push_job_class, 'NEW_FILES')\n if (job = jobs_since_respin.nochannel.order('id desc').first)\n push_job_link(job, 'Pre-push')\n end\n end", "def push_history_link(push_job_class, errata)\n if p...
[ "0.6802253", "0.61952704", "0.5845433", "0.55359304", "0.5486763", "0.5283278", "0.527172", "0.5262423", "0.5229707", "0.51936495", "0.5119092", "0.50789666", "0.50741094", "0.50379235", "0.50308204", "0.50261736", "0.50074834", "0.5000444", "0.49806094", "0.49791196", "0.496...
0.757782
0
Shows link to last nochannel job, if any. This is represented to the user as a "prepush" of the live content
def last_prepush_link(push_job_class, errata) jobs_since_respin = errata.push_jobs_since_last_state(push_job_class, 'NEW_FILES') if (job = jobs_since_respin.nochannel.order('id desc').first) push_job_link(job, 'Pre-push') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_push_link(push_job_class, errata)\n if (last_push = push_job_class.last_push(errata))\n push_job_link(last_push, 'Last job')\n end\n end", "def latest_comic\r\n \tif sorted_articles.index(item) == 0\r\n\t\t\t# apply the inactive html and css\r\n\t\t\t'<h7 id=\"last-comic\" title=\"This is t...
[ "0.6312599", "0.6038397", "0.58215123", "0.5786872", "0.5678297", "0.5531721", "0.5429605", "0.52930015", "0.52412164", "0.5236328", "0.5225987", "0.5205947", "0.5195419", "0.51747936", "0.5166242", "0.5154464", "0.5154326", "0.51509583", "0.5146319", "0.51402384", "0.5121867...
0.68830806
0
Won't show the link if here are no pushes of the given type since having the button there tends to imply there might be a relevant push job to look at.
def push_history_link(push_job_class, errata) if push_job_class.for_errata(errata).any? workflow_action_link("Push History", { :controller => 'push', :action => 'push_history_for_errata', :id => errata }) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_variant_target_disabled_warning(errata, type)\n variants = errata.release_variants.uniq\n unsupported = variants.reject{|v| v.supported_push_types.include?(type)}.sort_by(&:name)\n return if unsupported.none? || unsupported.count == variants.count\n\n popover = block_render('shared/help_popove...
[ "0.59146005", "0.5837964", "0.580161", "0.55455494", "0.551946", "0.55175835", "0.54928124", "0.5478899", "0.54756474", "0.5400246", "0.5371835", "0.52965075", "0.5287611", "0.52856845", "0.5276128", "0.5229828", "0.5210949", "0.519913", "0.5198304", "0.51646775", "0.5105727"...
0.584095
1
Each step method return a hash of things that can be rendered. (Might refactor this later... Maybe should make classes for these things instead of hashes. eg, have a base class and subclasses for each different 'step'...)
def workflow_step_helper(step_name) raise "Unknown step #{step_name}" unless WorkflowHelper.private_method_defined? step_name method(step_name).call end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def steps\n %w[\n household_member_demographics_step\n household_member_address_step\n household_member_address_search_results_step\n household_member_citizenship_step\n household_member_education_step\n household_member_employments_step\n househo...
[ "0.639915", "0.6030999", "0.5954047", "0.59138244", "0.5865732", "0.5861129", "0.58035946", "0.57344097", "0.5700654", "0.568578", "0.5684771", "0.561813", "0.5599878", "0.5590496", "0.5588678", "0.5579954", "0.55239284", "0.55152494", "0.54987663", "0.54930204", "0.54833716"...
0.0
-1
constuctor called on item must set item to valid disabled state
def add_with_id item id = @id_gen.gen #here we automatically mix in the IdManaged protocol item.extend IdManaged item.id_manager = self item.pool_id =id @arr << item end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_item(index)\n draw_item(index, disabled_color)\n end", "def disabled; end", "def disabled?; end", "def disabled?; end", "def invalid_items\n @items.select { |item| item.valid == false }\n end", "def initialize(item_description)\n @description = item_description\n @comple...
[ "0.59228885", "0.59176385", "0.59083134", "0.59083134", "0.58846754", "0.5801658", "0.57933956", "0.57691705", "0.573534", "0.5732904", "0.5725638", "0.57125163", "0.5692871", "0.5684329", "0.5679834", "0.5679834", "0.5679834", "0.5679834", "0.5679834", "0.5679834", "0.565869...
0.0
-1
this returns valid disabled item
def next_free #need to increment before returning value, because returning exits function sizeup if @next_free >= @max @next_free+=1 # puts "item #{arr[@next_free-1].pool_id} allocated" return @arr[@next_free-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invalid_items\n @items.select { |item| item.valid == false }\n end", "def disabled\n @attributes[:disabled]\n end", "def enable?(item); true; end", "def current_item_enabled?\n return !@data[index].nil?\n end", "def enable?(item)\n true\n end", "def enable?(item)\n true...
[ "0.7152933", "0.6904475", "0.6467445", "0.6383143", "0.6382674", "0.6382674", "0.6263258", "0.62595016", "0.62431616", "0.62431616", "0.62196296", "0.62161297", "0.62089", "0.6206224", "0.6205927", "0.6205927", "0.6205927", "0.6205927", "0.6205927", "0.6205927", "0.62040395",...
0.0
-1
have we requested the approval for the venue?
def approval_requested? !([STATE_UNKNOWN, STATE_BLOCK_REQUESTED, STATE_BLOCKED, STATE_UNAVAILABLE, STATE_CANCELLED, STATE_EXPIRED, STATE_AVAILABLE_EXPIRED].include?(self.state)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approved?\n !self.pending\n end", "def approved?\n (status == APPROVED)\n end", "def check_if_approval_is_required\n !offer_request.blank?\n end", "def approved?\n !pending\n end", "def approved?\n !approved_on.nil?\n end", "def approved?\n status == STATUS_APPROVED\n ...
[ "0.75232476", "0.73368865", "0.7237259", "0.72161156", "0.71513957", "0.7057874", "0.70507216", "0.69595367", "0.695576", "0.69305474", "0.69214153", "0.6919999", "0.69042087", "0.689699", "0.6882513", "0.68550414", "0.6839505", "0.67807174", "0.6778059", "0.67617196", "0.670...
0.7193077
4
has the payment been approved for the venue?
def approved? !([STATE_UNKNOWN, STATE_BLOCK_REQUESTED, STATE_BLOCKED, STATE_APPROVAL_REQUESTED, STATE_UNAVAILABLE, STATE_CANCELLED, STATE_EXPIRED, STATE_AVAILABLE_EXPIRED].include?(self.state)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approved?\n (status == APPROVED)\n end", "def approved?\n if order_status == 'approved'\n return true\n else\n return false\n end\n end", "def approved?\n !self.pending\n end", "def payment_success?\n @fields['decision'] == 'ACCEPT'\n end", "def approved?\n ...
[ "0.76204294", "0.7472865", "0.74674994", "0.72933835", "0.72615093", "0.71616435", "0.7159396", "0.71418124", "0.71379435", "0.7126172", "0.7055744", "0.69969577", "0.694285", "0.6906789", "0.690443", "0.68866384", "0.6863279", "0.68529123", "0.68520194", "0.68104196", "0.680...
0.6665339
27
GET /educations or /educations.json
def index @educations = Education.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @educations\n end", "def index\n @educations = Education.all\n render json: @educations\n end", "def index\n @educations = Education.all\n end", "def index\n @educations = Education.all\n end", "def educations\r\n @education_levels = Education.find(:all)\r\n e...
[ "0.72872424", "0.7071079", "0.64314055", "0.64314055", "0.6372139", "0.6195221", "0.5962236", "0.591486", "0.589699", "0.589699", "0.5887036", "0.5867752", "0.5849413", "0.58353686", "0.5831324", "0.5830363", "0.5827697", "0.5811196", "0.57681644", "0.57679933", "0.572583", ...
0.63766515
4
GET /educations/1 or /educations/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @educations\n end", "def index\n @educations = Education.all\n render json: @educations\n end", "def show\n raise Exceptions::EducatorNotAuthorized unless current_educator.districtwide_access\n educator = Educator.find(params[:id])\n render json: educator.as_json({\n...
[ "0.70480907", "0.6866035", "0.6196898", "0.6093557", "0.60901046", "0.6021141", "0.6021141", "0.59815854", "0.5966388", "0.58582604", "0.58540934", "0.5822059", "0.5789844", "0.5748052", "0.5747645", "0.57330906", "0.57135963", "0.5711395", "0.56712866", "0.5654757", "0.56540...
0.0
-1
POST /educations or /educations.json
def create @education = Education.new(education_params) respond_to do |format| if @education.save format.html { redirect_to @education, notice: "Education was successfully created." } format.json { render :show, status: :created, location: @education } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @education.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @educator = Educator.new(params[:educator])\n ong_desc = params[:ong_desc]\n union_movement_desc = params[:union_movement_desc]\n educator_years = params[:educator_years]\n educator_popular_education_years = params[:educator_popular_education_years]\n respond_to do |format|\n if...
[ "0.5985395", "0.5958767", "0.5955284", "0.5929506", "0.58746797", "0.5873889", "0.58625704", "0.5855006", "0.5814467", "0.5802802", "0.5754194", "0.57334805", "0.57017183", "0.56983155", "0.56978935", "0.56553966", "0.56525874", "0.5645124", "0.5629646", "0.56071794", "0.5601...
0.5606241
20
PATCH/PUT /educations/1 or /educations/1.json
def update respond_to do |format| if @education.update(education_params) format.html { redirect_to @education, notice: "Education was successfully updated." } format.json { render :show, status: :ok, location: @education } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @education.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @educator.update(educator_params)\n format.html { redirect_to @educator, notice: 'Paperwork successfully updated.' }\n format.json { render :show, status: :ok, location: @educator }\n else\n format.html { render :edit }\n format.json...
[ "0.6535016", "0.64650285", "0.6450497", "0.641519", "0.64008754", "0.6315527", "0.6306497", "0.6294004", "0.62910867", "0.62828135", "0.6277845", "0.6275925", "0.6250888", "0.6216633", "0.6210616", "0.6196383", "0.616762", "0.6156594", "0.6138315", "0.6131525", "0.6110002", ...
0.630507
7
DELETE /educations/1 or /educations/1.json
def destroy @education.destroy respond_to do |format| format.html { redirect_to educations_url, notice: "Education was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @educate.destroy\n respond_to do |format|\n format.html { redirect_to educates_url, notice: 'Educate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @educator.destroy\n respond_to do |format|\n format.html { redirect_to e...
[ "0.7240971", "0.71797454", "0.70778954", "0.70734257", "0.70734257", "0.7018013", "0.69895476", "0.68607074", "0.6834521", "0.68175495", "0.6783619", "0.6772397", "0.6768961", "0.67619485", "0.6752582", "0.673875", "0.6728924", "0.6712811", "0.6712792", "0.66844714", "0.66789...
0.707934
2
Use callbacks to share common setup or constraints between actions.
def set_education @education = Education.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Only allow a list of trusted parameters through.
def education_params params.require(:education).permit(:year, :institution, :achievement, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
preferred way is to use create/replace to make sure there are no collisions
def force_set_document(key, value, args={}) return nil unless key DocumentStore.force_set_document(key, value, args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace identifier, object\n create(identifier, object)\n end", "def prepareForReuse; end", "def conflicting_or_created_record\n conflict || create\n end", "def sneaky_save!(avoid_insert_conflict: nil)\n sneaky_create_or_update(avoid_insert_conflict: avoid_insert_conflict)\n end", "...
[ "0.61222976", "0.58143175", "0.5786557", "0.5651678", "0.56407976", "0.56407976", "0.5626262", "0.5580272", "0.557615", "0.5565731", "0.5546614", "0.5483208", "0.5467056", "0.54599893", "0.54502577", "0.5447695", "0.5447695", "0.54429686", "0.5442114", "0.5423087", "0.5411410...
0.0
-1
preferred way is to use create/replace instead of this to make sure there are no collisions
def force_set_document(key, value, args={}) return nil unless key CB.quiet = args[:quiet] || true CB.set(key, value, args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepareForReuse; end", "def replace identifier, object\n create(identifier, object)\n end", "def sneaky_save!(avoid_insert_conflict: nil)\n sneaky_create_or_update(avoid_insert_conflict: avoid_insert_conflict)\n end", "def conflicting_or_created_record\n conflict || create\n end", "...
[ "0.61050004", "0.59576637", "0.5795676", "0.5783677", "0.5742637", "0.5725174", "0.5696934", "0.5696934", "0.5637039", "0.5621519", "0.56118476", "0.55736077", "0.5567819", "0.5563574", "0.5563366", "0.5542047", "0.54775226", "0.54725885", "0.5455294", "0.5447595", "0.5433796...
0.0
-1
GET /responses/1 GET /responses/1.xml
def show @problem_set = ProblemSet.find(params[:problem_set_id]) @question = Question.where(:problem_set_id => @problem_set.id, :count=> params[:question_id].to_i).first @response = Response.find(params[:id]) if session[:user_id].nil? session[:redirect_url] = "/problem_sets/#{@problem_set.id}/questions/#{@question.count}/responses/#{@response.id}" redirect_to("/login/") else if session[:user_id].to_i != 126126126126126 flash[:notice] = "NO PERMISSION!" redirect_to :action => "index" else @answer = Answer.find(@response.answer_id) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @response } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @response = Response.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @response }\n end\n end", "def index\n \t @responses = Response.all\n end", "def index\n @responses = @survey.responses.find(:all)\n\n respond_to do...
[ "0.6611357", "0.65834016", "0.65214777", "0.6380083", "0.6380083", "0.6380083", "0.6380083", "0.6380083", "0.628083", "0.62119764", "0.6200801", "0.6161339", "0.6130926", "0.61021715", "0.6049733", "0.6032557", "0.6001512", "0.5944939", "0.5919158", "0.58811265", "0.5866713",...
0.0
-1
GET /responses/new GET /responses/new.xml
def new @problem_set = ProblemSet.find(params[:problem_set_id]) @question = Question.where(:problem_set_id => params[:problem_set_id])[params[:question_id].to_i - 1] if session[:user_id].nil? session[:redirect_url] = "/problem_sets/#{@problem_set.id}/questions/#{@question.count}/responses/new/" redirect_to("/login/") else if session[:user_id].to_i != 126126126126126 flash[:notice] = "NO PERMISSION!" redirect_to :action => "index" else @response = Response.new @answer = Answer.where(:question_id => @question.id) respond_to do |format| format.html # new.html.erb format.xml { render :xml => @response } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @resp = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resp }\n end\n end", "def new\n @response = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @response }\n ...
[ "0.7710032", "0.75292087", "0.7465536", "0.6997893", "0.68774444", "0.6856296", "0.68490314", "0.6823025", "0.6823025", "0.6823025", "0.6800443", "0.67931616", "0.67931616", "0.67634577", "0.67557555", "0.67425245", "0.672749", "0.66938365", "0.66781324", "0.6675242", "0.6671...
0.0
-1
POST /responses POST /responses.xml
def create if not session[:user_id] session[:user_id] = params[:user_id] redirect_to(problem_set_question_path(session[:prob_id], session[:ques_id])) else @problem_set = ProblemSet.find(params[:problem_set_id]) @question = Question.find(params[:question_id]) @answer = Answer.find(params[:response]) @response = Response.new( :answer_id => @answer.id, :result => @answer.correct, :question_id => @question.id, :problem_set_id => @problem_set.id, :user_id => session[:user_id]) if @problem_set.question_count > @question.count next_question = Question.where(:problem_set_id => @problem_set.id, :count => @question.count + 1).first result = problem_set_question_path(@problem_set.id, next_question.count) else result = "/problem_sets/#{@problem_set.id}/result/" end respond_to do |format| if @response.save format.html { redirect_to(result, :notice => 'Response was successfully created.') } format.xml { render :xml => @response, :status => :created, :location => @response } else format.html { render :action => "new" } format.xml { render :xml => @response.errors, :status => :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\n resource.post(request, response)\n end", "def create\n @response = Response.new(params[:response])\n\n respond_to do |format|\n if @resp.save\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to(response_url(@questionnaire, @resp)) }\n ...
[ "0.62504095", "0.6156207", "0.6133566", "0.5935353", "0.5925132", "0.5860173", "0.5820687", "0.581216", "0.5797686", "0.57748365", "0.5772565", "0.5762797", "0.57511526", "0.57357574", "0.57157063", "0.567918", "0.5654427", "0.5640099", "0.5635376", "0.5635376", "0.5635376", ...
0.0
-1
PUT /responses/1 PUT /responses/1.xml
def update @response = Response.find(params[:id]) @problem_set = ProblemSet.find(params[:problem_set_id]) @question = Question.find(params[:question_id]) respond_to do |format| if @response.update_attributes(params[:response]) format.html { redirect_to(@response, :notice => 'Response was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @response.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n ...
[ "0.65792966", "0.6283583", "0.61865425", "0.6160115", "0.61238897", "0.6104857", "0.59766275", "0.5972306", "0.59721243", "0.5808603", "0.57450926", "0.5711256", "0.5698454", "0.5674579", "0.5653516", "0.56380016", "0.5578995", "0.5578995", "0.5573072", "0.5565632", "0.555668...
0.6076822
6
DELETE /responses/1 DELETE /responses/1.xml
def destroy @problem_set = ProblemSet.find(params[:problem_set_id]) @question = Question.find(params[:question_id]) @response = Response.find(params[:id]) @response.destroy respond_to do |format| format.html { redirect_to(problem_set_question_responses_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @response = Response.find(params[:id])\n @response.destroy\n\n respond_to do |format|\n format.html { redirect_to(responses_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPS...
[ "0.7279104", "0.71932954", "0.70773745", "0.69844586", "0.69844586", "0.6975257", "0.6908023", "0.6900086", "0.6899077", "0.6836118", "0.6818586", "0.6818586", "0.6810788", "0.6763918", "0.66575164", "0.66140133", "0.66140133", "0.66140133", "0.66008335", "0.66008335", "0.660...
0.6487527
25
People that merged (not necessarily through pull requests) up to months_back from the time the built PR was created. if months_back is nil, don't take create time into consideration
def merger_team(pr, months_back = nil) recently_merged = prs.find_all do |b| close_reason[b[:github_id]] != :unknown and (months_back.nil? ? true : b[:created_at].to_i > (pr[:created_at].to_i - months_back * 30 * 24 * 3600)) end.map do |b| b[:github_id] end q = <<-QUERY select u1.login as merger from reduced_users u, reduced_projects p, reduced_pull_requests pr, reduced_pull_request_history prh, reduced_users u1 where prh.action = 'closed' and prh.actor_id = u1.id and prh.pull_request_id = pr.id and pr.base_repo_id = p.id and p.owner_id = u.id and u.login = ? and p.name = ? and pr.pullreq_id = ? QUERY log q recently_merged.map do |pr_num| a = db.fetch(q, pr[:login], pr[:project_name], pr_num).first if not a.nil? then a[:merger] else nil end end.select {|x| not x.nil?}.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merger_team(pr, months_back)\n @close_reason.map do |k,v|\n created_at = @prs.find{|x| x[:github_id] == k}\n [created_at[:created_at], v[2]]\n end.find_all do |x|\n x[0].to_i > (pr[:created_at].to_i - months_back * 30 * 24 * 3600)\n end.map do |x|\n x[1]\n end.select{|x| x != '...
[ "0.7629515", "0.6281422", "0.6254648", "0.6060206", "0.5967748", "0.59566426", "0.57506216", "0.57431036", "0.570729", "0.56563514", "0.56417954", "0.5641268", "0.5569643", "0.552081", "0.5494232", "0.54296106", "0.53806823", "0.53354704", "0.5262917", "0.5236211", "0.5223105...
0.7125968
1
People that committed (not through pull requests) up to months_back from the time the PR was created. if months_back is nil, don't take create time into consideration
def committer_team(pr, months_back = nil) q = <<-QUERY select distinct(u.login) as committer from reduced_commits c, reduced_project_commits pc, reduced_pull_requests pr, reduced_users u, reduced_pull_request_history prh where pr.base_repo_id = pc.project_id and not exists (select * from reduced_pull_request_commits where commit_id = c.id) and pc.commit_id = c.id and pr.id = ? and u.id = c.committer_id and u.fake is false and prh.pull_request_id = pr.id and prh.action = 'opened' and c.created_at < prh.created_at QUERY if !months_back.nil? q += " and c.created_at > DATE_SUB(prh.created_at, INTERVAL #{months_back} MONTH)" end log q db.fetch(q, pr[:id]).all.map{|x| x[:committer]} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merger_team(pr, months_back)\n @close_reason.map do |k,v|\n created_at = @prs.find{|x| x[:github_id] == k}\n [created_at[:created_at], v[2]]\n end.find_all do |x|\n x[0].to_i > (pr[:created_at].to_i - months_back * 30 * 24 * 3600)\n end.map do |x|\n x[1]\n end.select{|x| x != '...
[ "0.72327995", "0.65584755", "0.6424126", "0.6356405", "0.62760776", "0.60861886", "0.60754174", "0.5970819", "0.5953093", "0.5898598", "0.5798232", "0.5768537", "0.57659304", "0.5731905", "0.5495602", "0.5482154", "0.54321533", "0.5351258", "0.5346539", "0.53366613", "0.53030...
0.59545904
8
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.postman.reject_email.subject
def reject_email(email) @greeting = "Hi" mail to: email, subject: "Your ASES Application Decision" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject\n self['subject'] || msg['subject']\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n ...
[ "0.67341834", "0.67223066", "0.66650224", "0.66178936", "0.66082585", "0.6521546", "0.652035", "0.6479755", "0.6478398", "0.64651394", "0.63472366", "0.633526", "0.63203436", "0.63082427", "0.6226839", "0.61381406", "0.60977274", "0.60828424", "0.60763305", "0.602071", "0.598...
0.61616987
15
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.postman.first_round_email.subject
def first_round_email(email) @greeting = "Hi" mail to: email, subject: "Your ASES Application Decision" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def subject\n self['subject'] || msg['subject']\n end", "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n ...
[ "0.7400115", "0.7283536", "0.7065765", "0.70454586", "0.7006847", "0.69586855", "0.6958134", "0.6928366", "0.6907777", "0.6906616", "0.68791604", "0.68710226", "0.6869364", "0.6836125", "0.67405045", "0.6694067", "0.66846067", "0.66758597", "0.66560847", "0.66388935", "0.6609...
0.0
-1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.postman.second_round_email.subject
def second_round_email(email) @greeting = "Hi" mail to: email, subject: "Your ASES Application Decision" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def subject\n self['subject'] || msg['subject']\n end", "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n ...
[ "0.7323762", "0.7307878", "0.7194845", "0.70432377", "0.69531965", "0.69468546", "0.6920641", "0.68654954", "0.6847382", "0.6846045", "0.6813904", "0.6806319", "0.6802816", "0.68010646", "0.67940706", "0.67171264", "0.66831803", "0.66424847", "0.6608241", "0.6586665", "0.6559...
0.5652793
91
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.postman.accept_email.subject
def accept_email(email) @greeting = "Hi" mail to: email, subject: "Your ASES Application Decision" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def subject\n @options.fet...
[ "0.7105351", "0.7104342", "0.71019906", "0.70898575", "0.7073604", "0.7072669", "0.704648", "0.694429", "0.68222576", "0.6802428", "0.67607385", "0.6745693", "0.6596819", "0.64904445", "0.64786154", "0.6452022", "0.6452022", "0.6452022", "0.6452022", "0.6452022", "0.6452022",...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_product @product = Product.find_by( :id => params[:id] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Only allow a trusted parameter "white list" through.
def product_params params.require(:product).permit(:name, :description, :price, :stock) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7123669", "0.7054077", "0.69472784", "0.6902165", "0.6736001", "0.671985", "0.6687218", "0.6676269", "0.66602534", "0.6556639", "0.6527985", "0.645892", "0.645072", "0.64494324", "0.6445436", "0.64350927", "0.6415061", "0.6415061", "0.6393001", "0.6378958", "0.6378958", ...
0.0
-1
GET /insider_deals/1 GET /insider_deals/1.json
def show @insider_deal = InsiderDeal.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @insider_deal } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def show_deal(id)\n get(\"deals/#{id}\")\n end", "def deal_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"deals/#{id}\", params)\n end", "def index\n...
[ "0.7412967", "0.71145", "0.67918414", "0.669748", "0.6598033", "0.6585533", "0.6582518", "0.6530764", "0.6454494", "0.64372647", "0.64152926", "0.64152926", "0.64152926", "0.64042854", "0.63962364", "0.6380398", "0.63709396", "0.6348071", "0.63344115", "0.6306824", "0.6272823...
0.7190072
1
GET /insider_deals/new GET /insider_deals/new.json
def new @insider_deal = InsiderDeal.new respond_to do |format| format.html # new.html.erb format.json { render json: @insider_deal } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @deal = Deal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deal }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "d...
[ "0.7199966", "0.7170282", "0.7170282", "0.711566", "0.70683414", "0.69980395", "0.69536483", "0.6943725", "0.6940352", "0.69215024", "0.68828124", "0.68227285", "0.6812683", "0.6812683", "0.681171", "0.6795089", "0.67920256", "0.6788213", "0.67855793", "0.6744758", "0.6739235...
0.76673234
0
POST /insider_deals POST /insider_deals.json
def create end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_deal(**args)\n params = parameters(args) do\n required_params :title\n optional_params :title, :value, :currency, :user_id, :person_id, :org_id, :stage_id, :status, :probability, :lost_reason, :add_time, :visible_to\n end\n request(:post, 'deals', params)\n en...
[ "0.63605803", "0.6168347", "0.60774106", "0.59992594", "0.59076625", "0.5889277", "0.58401847", "0.582287", "0.575156", "0.5708979", "0.5652409", "0.5634795", "0.5625492", "0.5609421", "0.5551504", "0.5489959", "0.54839295", "0.5475055", "0.54646707", "0.5435021", "0.54192626...
0.0
-1
PUT /insider_deals/1 PUT /insider_deals/1.json
def update @insider_deal = InsiderDeal.find(params[:id]) respond_to do |format| if @insider_deal.update_attributes(params[:insider_deal]) format.html { redirect_to @insider_deal, notice: 'Insider deal was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @insider_deal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_deal(id, params)\n put(\"deals/#{id}\", deal: params)\n end", "def update_deal(id:, **args)\n params = parameters(args) do\n optional_params :title, :value, :currency, :user_id, :person_id, :org_id, :stage_id, :status, :probability, :lost_reason, :visible_to\n end\n ...
[ "0.70068854", "0.6845842", "0.6303114", "0.6112209", "0.60578895", "0.6015678", "0.5994354", "0.5973067", "0.59025025", "0.5893698", "0.58505094", "0.57922506", "0.5790554", "0.5773207", "0.57716906", "0.5769531", "0.5755647", "0.57473904", "0.57334137", "0.5710389", "0.56948...
0.6650477
2
DELETE /insider_deals/1 DELETE /insider_deals/1.json
def destroy @insider_deal = InsiderDeal.find(params[:id]) @insider_deal.destroy respond_to do |format| format.html { redirect_to insider_deals_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_deals(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'deals', params)\n end", "def delete_deal(id)\n delete(\"deals/#{id}\")\n end", "def destroy\n @indication_for_meal.destroy\n...
[ "0.72750014", "0.7159613", "0.7132272", "0.70671576", "0.69881845", "0.6947858", "0.6928096", "0.6927918", "0.69083047", "0.68798894", "0.68449533", "0.68394977", "0.68361306", "0.68330336", "0.6819761", "0.681649", "0.681649", "0.6807833", "0.68037516", "0.68017596", "0.6776...
0.7527548
0
Layouts that are required before any other layout can be loaded. This is because other layouts reference these. They cannot extend any layout that isn't defined in itself.
def pre_layouts ['layouts/borders.yml', 'layouts/debug.yml'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _conditional_layout?; end", "def place_in_layout?; end", "def place_in_layout?; end", "def layout\n nil\n end", "def layouts; end", "def layouts; end", "def layout\n nil\n end", "def allow_layout?\n true\n end", "def no_layout?; end", "def static_layout\n ...
[ "0.66217864", "0.65565944", "0.65565944", "0.64124334", "0.6405608", "0.6405608", "0.63531554", "0.62986344", "0.62765014", "0.6244893", "0.6230476", "0.61325073", "0.6119497", "0.61140275", "0.60864526", "0.60819787", "0.603059", "0.60141945", "0.5983115", "0.59819293", "0.5...
0.62447655
10
Layouts added after print and import specific layouts are included.
def base_layouts ['layouts/constants.yml'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layouts; end", "def layouts; end", "def place_in_layout?; end", "def place_in_layout?; end", "def print_layouts\n STDOUT.puts @layouts.join(\"\\n\")\n exit 0\n end", "def set_layout\n @layoutme = 1\n end", "def place_in_layouts(content, payload, info)\n output = content.dup\...
[ "0.68598837", "0.68598837", "0.66209686", "0.66209686", "0.6521669", "0.6471198", "0.64672756", "0.64308906", "0.6391312", "0.63870806", "0.638481", "0.6361285", "0.63353616", "0.63321793", "0.63163805", "0.6298113", "0.6274739", "0.62632906", "0.62258065", "0.61966306", "0.6...
0.0
-1
disable the callbacks that are used for workflow; this ensures that we control sgtate changes, etc better during ingest, and various other
def disable_workflow_callbacks # disable the allocate DOI callback LibraWork.skip_callback( :save, :after, :allocate_doi ) LibraWork.skip_callback( :update, :before, :update_doi ) # disable the email send callback LibraWork.skip_callback( :save, :after, :determine_email_behavior ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_callback_methods\n StashEngine::Resource.skip_callback(:create, :after, :init_state_and_version)\n # StashEngine::Resource.skip_callback(:create, :after, :create_share)\n end", "def disable_after_run_callback\n @after_run_callback_disabled = true\n end", "def replicate_disabl...
[ "0.7336373", "0.69859374", "0.66282904", "0.6617495", "0.6591407", "0.65790856", "0.650868", "0.64940804", "0.6459439", "0.6358537", "0.6334271", "0.62552506", "0.6249956", "0.6248471", "0.6225756", "0.61620253", "0.6152404", "0.6111194", "0.60100377", "0.5995013", "0.5961907...
0.84497714
0
the default user for various admin activities
def default_user_email return default_email( DEFAULT_USER ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_user\n users.first\n end", "def default_user\n if (user_id = config.user_id).present?\n User.where(:id => user_id).first\n else\n nil\n end\n end", "def get_user\n @current_user = current_admin || current_user\n end", "def admin_user\n @admin_user ||= U...
[ "0.7851572", "0.781541", "0.76362175", "0.75131553", "0.7493067", "0.7466492", "0.73747045", "0.73410666", "0.73356956", "0.732719", "0.73068404", "0.7218112", "0.7218112", "0.71682733", "0.71344995", "0.7119609", "0.7115692", "0.710015", "0.70796853", "0.7062434", "0.7040629...
0.6999327
26
construct a default email address given a computing Id
def default_email( cid ) return "#{cid}@#{DEFAULT_DOMAIN}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_generated_mail_id\n if is_hr_or_info\n formatted_domain = website.gsub(/https:\\/\\/|http:\\/\\//, \"\").gsub(/www\\./, \"\")\n fname = first_name.gsub(/\\s/, \"\")\n lname = last_name.gsub(/\\s/, \"\")\n self.generated_mail_id1 = fname + \".\" + lname + \"@\" + formatted_domain\n...
[ "0.67331576", "0.6715855", "0.6645171", "0.6630673", "0.6395465", "0.63555706", "0.6354021", "0.63397956", "0.63042146", "0.62972015", "0.6291707", "0.6291707", "0.6281802", "0.6241662", "0.6191692", "0.6167345", "0.61480343", "0.6112714", "0.6111396", "0.6093498", "0.6084712...
0.7266355
0
get a work by the specified ID
def get_work_by_id( work_id ) begin return LibraWork.find( work_id ) rescue => e end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_work\n client.make_request('/get-work', 'post', params: {})\n end", "def find_work\n work_id = params[:id]\n @work = Work.find_by_id(params[:id])\n head :not_found unless @work\nend", "def get_work(data=nil)\n request('getwork', data)\n end", "def get_work\n works = batched_get(...
[ "0.70607543", "0.7024595", "0.69218475", "0.6889775", "0.6687124", "0.66437113", "0.65612954", "0.65611994", "0.6551745", "0.65248555", "0.6515824", "0.6504505", "0.6499102", "0.6499102", "0.6499102", "0.6499102", "0.6499102", "0.6499102", "0.6499102", "0.6499102", "0.6499102...
0.801705
0
download a random cat image
def get_random_image( ) print "getting image... " dest_file = "#{File::SEPARATOR}tmp#{File::SEPARATOR}#{SecureRandom.hex( 5 )}.jpg" Net::HTTP.start( "lorempixel.com" ) do |http| resp = http.get("/640/480/cats/") open( dest_file, "wb" ) do |file| file.write( resp.body ) end end puts "done" return dest_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_image\n \"banners/#{ rand(35) + 1 }.jpg\"\n end", "def cover_url\n [\"condition_headache.jpeg\",\"condition_chair.jpeg\",\"condition_time.jpeg\",\"condition_med.jpeg\"][rand(4)] \n end", "def randomOctocat\n\t\tcURL($baseURL+\"?random\")\n\tend", "def random_image(query = 'safe, cute'...
[ "0.6988688", "0.6918402", "0.6712526", "0.66827035", "0.65710175", "0.65266716", "0.65016913", "0.6251399", "0.6185399", "0.6150518", "0.60608083", "0.6057675", "0.60356116", "0.6012253", "0.6006735", "0.5994157", "0.5989509", "0.5982584", "0.59241086", "0.58936983", "0.58634...
0.79044473
0
get user information from an email address
def user_info_by_email( email ) id = User.cid_from_email( email ) return user_info_by_cid( id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_by_email(email)\n get(\"get_user_by_email&email=#{email}\")\n end", "def getUserBy_email( email)\n params = Hash.new\n params['email'] = email\n return doCurl(\"get\",\"/user/by_email\",params)\n end", "def by_email address, options={}, headers={}\n params = options.merg...
[ "0.77538776", "0.7613378", "0.75917184", "0.7409586", "0.7385936", "0.7366133", "0.73501873", "0.7350163", "0.73037636", "0.72684425", "0.7234839", "0.7199344", "0.716516", "0.71455127", "0.7140261", "0.71402013", "0.71342325", "0.712018", "0.71042573", "0.7077971", "0.704588...
0.80510473
0
get user information from a computing id
def user_info_by_cid( id ) print "Looking up user details for #{id}..." # lookup the user by computing id user_info = Helpers.lookup_user( id ) if user_info.nil? puts "not found" return nil end puts "done" return user_info end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_user(id)\n client.user(id)\n end", "def user; User.find_by_id(user_id); end", "def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end", "def user(id)\n @users[id.resolve_id]\n end", "def user\n user_id.get_object\n end", "def user(id)\n self.class.get(\"/us...
[ "0.71896064", "0.69202936", "0.691275", "0.6888319", "0.68710905", "0.6865562", "0.6799513", "0.6727998", "0.6717491", "0.67016494", "0.66736007", "0.6673272", "0.66628355", "0.6644424", "0.66267776", "0.66216415", "0.6586932", "0.65833235", "0.6575809", "0.65728354", "0.6570...
0.7585293
0
lookup a user by computing id and create their account if we locate them
def lookup_and_create_account( id ) # lookup locally with the default email user = User.find_by_email( User.email_from_cid( id ) ) return user if user.present? # if we cannot find them, lookup in LDAP user_info = user_info_by_cid( id ) return nil if user_info.nil? # now look them up with the located email user = User.find_by_email( user_info.email ) return user if user.present? # create their account return User.new_user( user_info, user_info.email ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_user_account\n Account.create(user_id: self.id) \t\n end", "def associate_with_user\n if user_id.nil? || user.email == Address::PLACEHOLDER_EMAIL\n self.user_id = User.find_or_create_by_details(\n email: email_address, name: billing_full_name\n ).id\n end\n end", "def cre...
[ "0.67742336", "0.6773403", "0.668789", "0.6681846", "0.6617749", "0.6611668", "0.65838003", "0.6583433", "0.6515639", "0.6507259", "0.64511025", "0.6434905", "0.6411974", "0.6391272", "0.63751304", "0.637097", "0.6344418", "0.63415676", "0.6316173", "0.6314543", "0.6310543", ...
0.81069696
0
delete the specified file from the specified work on behalf of the specified user
def delete_fileset( user, fileset ) print "deleting file set #{fileset.id} (#{fileset.label})... " file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, user ) file_actor.destroy puts "done" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n work_id = params[:work]\n respond_to do |format|\n errors = WorkFile.destroy( current_user, params[:id] )\n if !errors\n format.html { redirect_to \"/works/#{work_id}\", notice: 'File was successfully removed.' }\n format.json { render json: {}, status: :ok }\n el...
[ "0.66906035", "0.66807526", "0.6663661", "0.66518617", "0.6639899", "0.6581516", "0.65436244", "0.63847363", "0.63835806", "0.6378853", "0.6345853", "0.62254953", "0.6213368", "0.6204843", "0.62027824", "0.6155135", "0.6155135", "0.6149683", "0.6148678", "0.61435777", "0.6136...
0.62440485
11
batch process a group of SOLR works
def batched_process_solr_works( solr_works, &f ) solr_works.each do |gw_solr| begin gw = LibraWork.find( gw_solr['id'] ) f.call( gw ) rescue => e puts e end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_bulk; end", "def send_batch(batch)\n return if batch.empty?\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n begin\n resp = @http_client.post @solr_update_url, json_package, \"Content-type\" => \"application/json\"\n rescue StandardError => exception\n end\n\n if e...
[ "0.61693203", "0.60873973", "0.6084905", "0.59042245", "0.5902048", "0.58922154", "0.5884926", "0.58821285", "0.5831383", "0.5831383", "0.581307", "0.57927036", "0.5787895", "0.57803464", "0.5716339", "0.57033634", "0.57032394", "0.5653601", "0.5645989", "0.56376886", "0.5618...
0.7796205
0
show full details of a libra work
def show_libra_work( work ) return if work.nil? j = JSON.parse( work.to_json ) j.keys.sort.each do |k| val = j[ k ] if k.end_with?( '_id' ) == false && k.end_with?( '_ids' ) == false show_field( k, val, ' ' ) end end show_field( 'visibility', work.visibility, ' ' ) Author.sort( work.authors ).each_with_index do |p, ix| show_person( " author #{ix + 1}:", p ) end Contributor.sort( work.contributors ).each_with_index do |p, ix| show_person( " contributor #{ix + 1}:", p ) end if work.file_sets file_number = 1 fs = work.file_sets.sort { |x, y| x.date_uploaded <=> y.date_uploaded } fs.each do |file_set| puts " file #{file_number} => #{file_set.label}/#{file_set.title[0]} (/downloads/#{file_set.id})" file_number += 1 end end puts '*' * 40 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workspace_info\n link_to_workspace_info(\"http://library.nyu.edu/info/myworkspace.html\", \"left\")\n end", "def show_details(workspace)\n begin\n puts workspace.show_details\n rescue => exception\n puts \"Error: #{exception.message}\"\n end\nend", "def show\n render_default_forma...
[ "0.6527745", "0.6361649", "0.6350302", "0.62399715", "0.6149119", "0.6148327", "0.6130828", "0.6034295", "0.6028256", "0.6017531", "0.5982396", "0.5982396", "0.592682", "0.591022", "0.5899939", "0.58746207", "0.5872047", "0.58624816", "0.58400434", "0.58334535", "0.58300734",...
0.72610444
0
show the contents of a person subfield
def show_person( title, person ) #puts "#{title} #{person}" puts "#{title}" show_field( 'ix', person.index, ' ' ) show_field( 'cid', person.computing_id, ' ' ) show_field( 'first_name', person.first_name, ' ' ) show_field( 'last_name', person.last_name, ' ' ) show_field( 'department', person.department, ' ' ) show_field( 'institution', person.institution, ' ' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_content\n f = ''\n subfields.each do |sf|\n f += \"|#{sf.code}#{sf.value}\"\n end\n f\n end", "def add_show_field(*) super end", "def render_person_info(person)\n partial :sidebar_person_info, :locals => {:person => person}\n end", "def subfield(tag)\n subfi...
[ "0.6345041", "0.5971252", "0.5925871", "0.57882094", "0.57867664", "0.56752175", "0.56466365", "0.564341", "0.56142503", "0.5609505", "0.55953133", "0.55819607", "0.5578387", "0.55635995", "0.5549511", "0.54991406", "0.54991406", "0.54991406", "0.54991406", "0.5495332", "0.54...
0.7020725
0
show a field if it is not empty
def show_field( name, val, indent ) return if val.nil? return if val.respond_to?( :empty? ) && val.empty? puts "#{indent}#{name} => #{val}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty?()\n fields.empty?\n end", "def empty?\n @fields.empty?\n end", "def empty?\n\t\treturn self.fields.empty?\n\tend", "def empty?\n @fields.values.empty?\n end", "def field?\n false \n end", "def blank?\n true\n end", "def text_field?(field_name); end...
[ "0.6946621", "0.69020337", "0.6788965", "0.65098995", "0.6470843", "0.6434844", "0.6415562", "0.6391451", "0.6364682", "0.631447", "0.631447", "0.631447", "0.6312858", "0.6284911", "0.6277242", "0.6248132", "0.62451744", "0.62451744", "0.62451744", "0.6243429", "0.6243429", ...
0.7372356
0
upload the specified file to the specified work on behalf of the specified user
def upload_file( user, work, filename, title, visibility ) print "uploading #{filename}... " fileset = ::FileSet.new fileset.title << title unless title.nil? file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, user ) file_actor.create_metadata( work ) file_actor.create_content( File.open( filename ) ) fileset.visibility = visibility fileset.save! puts "done" return fileset end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(file, someone)\n end", "def file_upload(params_userfile)\n content_upload(params_userfile.read)\n end", "def creator_upload(username, file_name, file)\r\n dir = \"creators/#{username}\"\r\n file.original_filename = file_name + (File.extname file.original_filename)\r\n return write(di...
[ "0.77202815", "0.6761699", "0.67311305", "0.66025543", "0.6534689", "0.6488298", "0.6375653", "0.63280386", "0.6318654", "0.631007", "0.6294155", "0.6236812", "0.6234402", "0.6234402", "0.6152242", "0.6110015", "0.61081517", "0.61026263", "0.61013734", "0.6051725", "0.6035774...
0.6789401
1
get a list of assets in the specified directory that match the supplied pattern
def get_directory_list( dirname, pattern ) res = [] begin Dir.foreach( dirname ) do |f| if pattern.match( f ) res << f end end rescue => e end return res.sort { |x, y| directory_sort_order( x, y ) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asset_files\n asset_files = []\n Find.find(assets_path).each do |path|\n next if File.directory?(path)\n next if path.include?(stylesheets_path) || path.include?(images_path)\n asset_files << path.sub(assets_path, 'assets')\n end\n asset_files\n end",...
[ "0.68234223", "0.6680393", "0.6609134", "0.6456328", "0.6447481", "0.64322364", "0.6403267", "0.6348924", "0.63369113", "0.6301843", "0.6247889", "0.6241501", "0.6174241", "0.6120743", "0.6104419", "0.60969365", "0.60952514", "0.60825455", "0.60699666", "0.60671216", "0.60601...
0.0
-1
so we can process the directories in numerical order
def directory_sort_order( f1, f2 ) n1 = File.extname( f1 ).gsub( '.', '' ).to_i n2 = File.extname( f2 ).gsub( '.', '' ).to_i return -1 if n1 < n2 return 1 if n1 > n2 return 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortFilesFromDirs array, dir #array is elements in current directory: dir\n\n #temp arrays to hold files vs dirs\n dirs = Array.new\n files = Array.new\n\n array.each do |elem|\n\n #path to current entity interested in\n currentPath = dir + \"/\" + elem\n #puts \"currentPath: \" + cu...
[ "0.6484504", "0.641921", "0.6282252", "0.62172365", "0.6177203", "0.6176937", "0.6139749", "0.61335576", "0.61319464", "0.61286837", "0.6115474", "0.6036333", "0.6036333", "0.6033609", "0.6033289", "0.60153216", "0.6005804", "0.59692466", "0.5959485", "0.5923042", "0.5919943"...
0.6317015
2
load a file containing json data and return a hash
def load_json_doc( filename ) begin File.open( filename, 'r') do |file| json_str = file.read( ) doc = JSON.parse json_str return doc end rescue => ex puts "ERROR: loading #{filename} (#{ex})" return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_hash(file_path) \n file=File.read(file_path)\n JSON.parse(file)\n end", "def load_hash(file_path) \n file=File.read(file_path)\n JSON.parse(file)\n end", "def getHashFromJson(filename)\n File.open( filename, \"r\" ) do |f|\n JSON.load(f)\n end\nend", "def get_data_from_json_file(f...
[ "0.8352166", "0.8352166", "0.8264029", "0.81349295", "0.7763567", "0.76565486", "0.7504367", "0.7393502", "0.7145566", "0.71415883", "0.7082485", "0.7082485", "0.70593697", "0.70428085", "0.6992506", "0.69494915", "0.6867012", "0.6795381", "0.67388004", "0.67374027", "0.67246...
0.0
-1
load a file containing xml data and return an oga document
def load_xml_doc( filename ) File.open( filename, 'r') do |file| return Oga.parse_xml( file ) end puts "ERROR: loading #{filename}" return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_xml file\n f = File.open file\n doc = Nokogiri::XML f\n f.close\n doc\n end", "def load_xml_document file_name\n xml_file = File.new file_name, \"r\"\n return Document.new xml_file\n end", "def load_xml(file_path)\n # Read the source XML file.\n puts \"file_path: #{file_path}\"\n...
[ "0.8043625", "0.7516769", "0.73990804", "0.7349184", "0.68753755", "0.6873936", "0.6824196", "0.6785871", "0.6611146", "0.6534131", "0.6530477", "0.64658266", "0.6459023", "0.64540166", "0.6415907", "0.63967764", "0.6384703", "0.63408023", "0.6334972", "0.62992394", "0.625030...
0.8251758
0
GET /ab_teams GET /ab_teams.json
def index @ab_teams = AbTeam.all @years = AbTeam.pluck(:year).map{|x| x}.uniq.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end", "def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n end", "def teams\n render json: @team_query\n end", "def index\n @teams = Team.all\n render json: @teams\n en...
[ "0.8089409", "0.7722675", "0.7667677", "0.75290096", "0.74835384", "0.7479208", "0.7467527", "0.7453771", "0.7303393", "0.7292536", "0.7292536", "0.7270572", "0.7262126", "0.72603416", "0.72526795", "0.72526795", "0.723421", "0.71872026", "0.7187004", "0.71711326", "0.7157632...
0.0
-1
GET /ab_teams/1 GET /ab_teams/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end", "def team(id)\n get \"/teams/#{id}\"\n end", "def index\n @teams = @club.teams\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n ...
[ "0.77725244", "0.76465213", "0.7453878", "0.74052495", "0.73499167", "0.731784", "0.73118573", "0.7290316", "0.7250941", "0.72421795", "0.722624", "0.722624", "0.7187703", "0.7187703", "0.71351486", "0.71341795", "0.7127563", "0.712015", "0.7108229", "0.7082558", "0.7078025",...
0.0
-1
POST /ab_teams POST /ab_teams.json
def create @ab_team = AbTeam.new(ab_team_params) respond_to do |format| if @ab_team.save format.html { redirect_to @ab_team, notice: 'Record was created.' } format.json { render :show, status: :created, location: @ab_team } else format.html { render :new } format.json { render json: @ab_team.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_teams\r\n response = HTTParty.get('https://www.balldontlie.io/api/v1/teams')[\"data\"]\r\n response.each do |i|\r\n team = Team.new\r\n \r\n team.full_name = i[\"full_name\"]\r\n team.division = i[\"division\"]\r\n team.conference = i[\"conference\"]\r\n\r\...
[ "0.72925115", "0.72475654", "0.70817024", "0.68737936", "0.67273307", "0.6681657", "0.66148525", "0.6566181", "0.65511274", "0.6533834", "0.65294397", "0.65180445", "0.6505581", "0.64950085", "0.6470361", "0.6469675", "0.6469675", "0.6469675", "0.6463963", "0.6438598", "0.642...
0.7013171
3
PATCH/PUT /ab_teams/1 PATCH/PUT /ab_teams/1.json
def update respond_to do |format| if @ab_team.update(ab_team_params) format.html { redirect_to @ab_team, notice: 'Record was updated' } else format.html { render :edit } format.json { render json: @ab_team.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end", "def update\n team_name = params[:name]\n team_description = params[:description]\n team_id ...
[ "0.71269506", "0.6930876", "0.6919916", "0.6902893", "0.6799178", "0.67901677", "0.6749086", "0.67454", "0.6745371", "0.67306083", "0.6722188", "0.6722188", "0.67100656", "0.67100656", "0.67100656", "0.67100656", "0.67100656", "0.67100656", "0.67082393", "0.66853124", "0.6669...
0.67578584
6
DELETE /ab_teams/1 DELETE /ab_teams/1.json
def destroy @ab_team.destroy respond_to do |format| format.html { redirect_to ab_teams_url, notice: 'Record was destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @team = @club.teams.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to club_teams_url(@club.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n team.destroy\n\n respond_to do |format|\n format.html { redirect_...
[ "0.7415762", "0.7352768", "0.725395", "0.72512186", "0.72512186", "0.72512186", "0.72512186", "0.72512186", "0.72512186", "0.72512186", "0.72512186", "0.72512186", "0.72512186", "0.72512186", "0.72512186", "0.7239285", "0.7222529", "0.7222529", "0.7222529", "0.7222529", "0.71...
0.7438262
0
Use callbacks to share common setup or constraints between actions.
def set_ab_team @ab_team = AbTeam.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def ab_team_params params.require(:ab_team).permit(:skater_id, :team_id, :year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
returns a xml of the url to gets directly
def http_get_direct(url) log("http get : #{url}") if $opt["debug"] begin html = Net::HTTP.get_response(URI.parse(url)).body # XXX must fix the rescue its not working rescue => err log("Error: #{err}") exit 2 end html end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geturl() \n\t\treturn self.response.geturl()\n end", "def get(url); end", "def url\n Addressable::URI.new :scheme => 'http',\n :host => endpoint.host,\n :path => '/onca/xml',\n :query_valu...
[ "0.7261925", "0.7104539", "0.70842385", "0.6907188", "0.686918", "0.6806073", "0.6665297", "0.665751", "0.6652347", "0.66441536", "0.6614061", "0.6594597", "0.6586119", "0.6586119", "0.65776885", "0.6572553", "0.6556506", "0.6549474", "0.6549474", "0.6549474", "0.6549474", ...
0.0
-1
GET /items def index
def create @game = Game.new(game_params) @game.user_id = params[:game][:user].first[:id] @game.item_id = params[:game][:item].first[:id] if @game.save render json: @game, status: :created, location: @game else render json: @game.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "...
[ "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.837347", "0.83734...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_game @game = Game.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Only allow a trusted parameter "white list" through.
def game_params params.require(:game).permit() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7123669", "0.7054077", "0.69472784", "0.6902165", "0.6736001", "0.671985", "0.6687218", "0.6676269", "0.66602534", "0.6556639", "0.6527985", "0.645892", "0.645072", "0.64494324", "0.6445436", "0.64350927", "0.6415061", "0.6415061", "0.6393001", "0.6378958", "0.6378958", ...
0.0
-1
Denies access for public users to private projects
def require_proj_access if params[:gr] @project ||= Group.find(params[:gr]).project else @project = Project.find(params[:id] || params[:pr]) end if ((not is_logged?) || current_user.is_public?) && @project.is_private? flash_msgs(1, "Access denied.") redirect_to root_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_unauthorized_proc\n # no-op\n end", "def define_global_privileges\n can :read, Project, public_can_view?: true\n can :index, Project\n can :read, Group\n end", "def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_access\n end\n true\n end", ...
[ "0.7277191", "0.7218941", "0.7210982", "0.7198158", "0.7187759", "0.7020269", "0.7002725", "0.6990869", "0.6851059", "0.67871827", "0.6787141", "0.6766111", "0.67153335", "0.67153335", "0.67153335", "0.6681467", "0.6669373", "0.6658646", "0.66570187", "0.66124827", "0.6602400...
0.75092643
0
The number will be passed in as a string of only digits. It should return a five digit integer. The number passed may be as large as 1000 digits. 283910 91 is the greatest sequence of 2 digits. The method will be for 5 digits
def largest_five(digits) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(digits)\n digits.scan(/\\d{5}/).max.to_i\nend", "def solution(digits)\n digits.to_s.split(\"\").each_cons(5).max.join.to_i\nend", "def solution(digits)\n digits.split('').each_cons(5).max.join.to_i\nend", "def maxNumber(num)\n \n num.digits.sort {|a,b| b <=> a}.join.to_i\n \nend", "def s...
[ "0.7970989", "0.74801236", "0.7467983", "0.7159385", "0.715295", "0.6978879", "0.69550556", "0.6925982", "0.69242203", "0.6923695", "0.68725497", "0.6770586", "0.6758361", "0.6739801", "0.67067766", "0.66976756", "0.66780496", "0.6676357", "0.66540116", "0.664578", "0.6613756...
0.72620165
3
GET /step_commands GET /step_commands.json
def index @step_commands = StepCommand.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def states_to_commands(states, timestep)\n diff_states = objectify_json(states_to_diff_states(refine_states(states), timestep).to_json)\n...
[ "0.6461117", "0.6175543", "0.61444855", "0.60349464", "0.6008792", "0.5862901", "0.5835542", "0.57502186", "0.5742752", "0.571677", "0.5697392", "0.5643747", "0.56167805", "0.5600292", "0.5594215", "0.55886674", "0.5573473", "0.55557066", "0.55469584", "0.55469584", "0.554695...
0.7444896
0
GET /step_commands/1 GET /step_commands/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @step_commands = StepCommand.all\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def create\n @step_command = StepCommand.new(step_command_params)\n\n resp...
[ "0.7163539", "0.6556283", "0.62362355", "0.6160644", "0.61228", "0.61228", "0.61228", "0.59111863", "0.58725196", "0.58522624", "0.58506435", "0.58409035", "0.5790016", "0.57700557", "0.57681084", "0.56802523", "0.5677451", "0.56744397", "0.56687266", "0.5645199", "0.5606066"...
0.0
-1
POST /step_commands POST /step_commands.json
def create @step_command = StepCommand.new(step_command_params) respond_to do |format| if @step_command.save format.html { redirect_to @step_command, notice: 'Step command was successfully created.' } format.json { render :show, status: :created, location: @step_command } else format.html { render :new } format.json { render json: @step_command.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_command_params\n params.require(:step_command).permit(:step_id, :command_id)\n end", "def create\n @step = Step.new(params[:step])\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step.phase_template, notice: 'Step was successfully added.' }\n form...
[ "0.67982787", "0.6147115", "0.61442214", "0.61372846", "0.61294156", "0.60697025", "0.60692036", "0.6057771", "0.60301673", "0.59866357", "0.594803", "0.59067166", "0.58722496", "0.58406174", "0.5789548", "0.5762389", "0.5720796", "0.57131755", "0.5712075", "0.5710178", "0.57...
0.7359506
0
PATCH/PUT /step_commands/1 PATCH/PUT /step_commands/1.json
def update respond_to do |format| if @step_command.update(step_command_params) format.html { redirect_to @step_command, notice: 'Step command was successfully updated.' } format.json { render :show, status: :ok, location: @step_command } else format.html { render :edit } format.json { render json: @step_command.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @step = Step.find(params[:id])\n\n respond_to do |format|\n if @step.update_attributes(params[:step])\n format.html { redirect_to @step, notice: 'Step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n...
[ "0.6554455", "0.6538388", "0.6530585", "0.6492778", "0.6480338", "0.6408168", "0.6397069", "0.6397069", "0.6358154", "0.63412404", "0.6307371", "0.62299204", "0.6205627", "0.61104476", "0.6104414", "0.6048825", "0.6005242", "0.59993017", "0.59847736", "0.5973864", "0.5953699"...
0.69682074
0
DELETE /step_commands/1 DELETE /step_commands/1.json
def destroy @step_command.destroy respond_to do |format| format.html { redirect_to step_commands_url, notice: 'Step command was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @step = Step.find(params[:id])\n @step.status = \"deleted\"\n @step.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end", "def destroy\n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html ...
[ "0.7437388", "0.7244521", "0.7208565", "0.70813864", "0.6999222", "0.69943357", "0.69943357", "0.69943357", "0.69943357", "0.69869477", "0.6973408", "0.6933595", "0.68245447", "0.6823274", "0.68181705", "0.6816827", "0.6814283", "0.6811396", "0.6802149", "0.67974985", "0.6762...
0.7589281
0
Use callbacks to share common setup or constraints between actions.
def set_step_command @step_command = StepCommand.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def step_command_params params.require(:step_command).permit(:step_id, :command_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
do not require login for feedback permit "feedback_admin", :except => [:index, :new, :create]
def index new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorized_user\n @feedback = current_user.feedbacks.find_by_hashed_id(params[:id])\n redirect_to feedbacks_path, notice: \"Not authorized to edit this feedback\" if @feedback.nil?\n end", "def ignore_request_unless_permitted\n return if permitted?\n flash_notice(:permission_denied.t)\n ...
[ "0.67702556", "0.6682841", "0.6556267", "0.6510401", "0.64803153", "0.64803153", "0.64803153", "0.6440691", "0.6427315", "0.6423005", "0.63905466", "0.6361235", "0.634025", "0.63273245", "0.6309206", "0.62967724", "0.6268982", "0.6258446", "0.6243287", "0.6240538", "0.6231929...
0.0
-1
Remember that we can access an array element at particular index with the following syntax: array[index_number] !!!
def position_taken?(board,index) if board[index] == " " false elsif board[index] == "" false elsif board[index] == nil false else board[index] == "X" || "O" true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at(index)\n \t@array[index]\n end", "def retrieve_element_from_index(array, index_number)\n array[index_number]\nend", "def retrieve_element_from_index(array, index_number)\n array[index_number]\nend", "def retrieve_element_from_index(array, index_number)\n return array[index_number]\nend", "def...
[ "0.8498926", "0.81891465", "0.81891465", "0.81244844", "0.8106756", "0.8051382", "0.7925698", "0.7925468", "0.7889423", "0.78102285", "0.77996475", "0.77171576", "0.7704119", "0.76779974", "0.76263857", "0.74634", "0.7406151", "0.73249674", "0.7315973", "0.72953916", "0.72841...
0.0
-1
Create a SmartView connection for the specified provider URL.
def initialize(provider_url, logger=nil) @url = provider_url @req = Request.new @preferences = Preferences.new @http = HTTPClient.new @http.proxy = nil unless logger require 'logger' logger = Logger.new(STDOUT) end @logger = logger end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(driver_url, config)\n super(driver_url, config)\n\n uri = URI(driver_url)\n @connect_options = {\n provider: 'vsphere',\n host: uri.host,\n port: uri.port,\n use_ssl: uri.use_ssl,\n insecure: uri.insecure,\n path: uri.path\n }\n\n if...
[ "0.5747511", "0.56846124", "0.56257814", "0.5373718", "0.5366145", "0.5270639", "0.5259747", "0.51902616", "0.51664376", "0.5135227", "0.51301056", "0.5121687", "0.50935215", "0.505513", "0.50501424", "0.50497156", "0.50401026", "0.5023072", "0.49926826", "0.49881086", "0.498...
0.49561828
24
Sets the preferences to be applied to this session.
def preferences=(prefs) unless prefs.kind_of? Preferences raise InvalidPreference, "Preference settings must be an instance of SmartView::Preferences" end @preferences = prefs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_preferences( opts={} )\n options.merge!( opts )\n end", "def set_preferences\n unless current_user.preference\n pref = Preference.create(user_id: current_user.id,theme: \"default-right\",bgcolor: \"white\",rows: 20, wallpaper: false)\n else\n pref = Preference.where(user_i...
[ "0.723686", "0.71732646", "0.66902983", "0.6452161", "0.6273506", "0.61761403", "0.59947884", "0.59088665", "0.589031", "0.5856656", "0.5852435", "0.57856405", "0.5726554", "0.5705812", "0.565109", "0.5616993", "0.5522836", "0.5482973", "0.5471249", "0.5431318", "0.53080773",...
0.69856644
2
Connect to the SmartView provider and obtain a session id. Two methods of connection are supported: 1. Userid and password 2. SSO token If only a single parameter is passed, the SSO method is assumed; if two parameters are passed, these are assumed to be userid and password.
def connect(user_or_sso, password = nil) if @provider raise AlreadyConnected, "Cannot change provider once connected" if @provider end # Obtain a session id if password.nil? # Connect via SSO token @sso = user_or_sso @logger.info "Connecting to #{@url} using SSO token" @req.ConnectToProvider do |xml| xml.ClientXMLVersion CLIENT_XML_VERSION xml.sso @sso xml.lngs({:enc => 0}, "en_US") end else # Connect via userid and password @user = user_or_sso @password = password @logger.info "Connecting to #{@url} using userid/password" @req.ConnectToProvider do |xml| xml.ClientXMLVersion CLIENT_XML_VERSION xml.usr @user xml.pwd @password xml.lngs({:enc => 0}, "en_US") end end doc = invoke @session_id = doc.at('//res_ConnectToProvider/sID').inner_html set_provider doc.at('//res_ConnectToProvider/provider').inner_html end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect\n configuration = VSphereAutomation::Configuration.new.tap do |c|\n c.host = config[:vcenter_host]\n c.username = config[:vcenter_username]\n c.password = config[:vcenter_password]\n c.scheme = \"https\"\n c.verify_ssl = config[:vcenter_disable_ssl_ve...
[ "0.66164184", "0.64917696", "0.63756776", "0.63701886", "0.6324099", "0.63041717", "0.62165165", "0.62163514", "0.6191902", "0.61862093", "0.61747026", "0.6160866", "0.614915", "0.61008275", "0.60882986", "0.60718054", "0.60709864", "0.59751415", "0.59738153", "0.5973302", "0...
0.6722323
0
Open an application via the configured SmartView provider.
def open_app(server, app, cube) raise NotConnectedError, "No provider connection established" unless @session_id && @provider # Reset app state @dimensions = nil # Connect to application @logger.info "Opening cube #{app}.#{cube} on #{server}" @req.OpenApplication do |xml| xml.sID @session_id if @sso xml.sso @sso else xml.usr @user xml.pwd @password end xml.srv server xml.app app end invoke # Obtain an SSO token for subsequent use unless @sso @req.GetSSOToken do |xml| xml.sID @session_id end @sso = invoke.at('//res_GetSSOToken/sso').inner_html @password = nil # Don't remember password any longer than we need to end # Open cube @req.OpenCube do |xml| xml.sID @session_id xml.srv server xml.app app xml.cube cube end invoke @app = app @cube = cube # Get default POV default_pov end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def launch_app\n @bridge.launch_app\n end", "def open\n app = heroku.info(extract_app)\n url = app[:web_url]\n display \"Opening #{url}\"\n Launchy.open url\n end", "def open_url(url)\n unless url.is_a?(NSURL)\n url = NSURL.URLWithString(url)\n end\n UIApplica...
[ "0.6452501", "0.62408775", "0.5983889", "0.5983889", "0.59739333", "0.5931315", "0.59281135", "0.5878003", "0.58317566", "0.5740969", "0.5739149", "0.5651114", "0.5651114", "0.560409", "0.56026983", "0.5595554", "0.5594757", "0.5579299", "0.55691963", "0.5557053", "0.5515799"...
0.55792034
18
Close the connection to the current application cube.
def close_app if @session_id && @app @logger.info "Disconnecting from #{@app}.#{@cube}" @req.Logout do |xml| xml.sID @session_id end invoke @app = nil @cube = nil @dimensions = nil @default_pov = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close()\n\t\t@connection.disconnect\n\t\t@connection = nil\n\tend", "def close\n inactive!\n close_connections\n end", "def close\n @ole_connection.Close\n end", "def close!\n live_queries = @volt_app.channel_live_queries[@channel]\n\n if live_queries\n live_queries.each do |l...
[ "0.67616844", "0.6703403", "0.670213", "0.66807425", "0.66695905", "0.6618604", "0.6584358", "0.6582413", "0.64775676", "0.64548224", "0.63691366", "0.63080263", "0.62713736", "0.62651277", "0.6244815", "0.624187", "0.624187", "0.624187", "0.624187", "0.6206425", "0.61956555"...
0.7440572
0
Retrieve a list of dimensions for the current connection.
def get_dimensions check_attached @logger.info "Retrieving list of dimensions" @req.EnumDims do |xml| xml.sID @session_id xml.alsTbl @preferences.alias_table end @dimensions = [] invoke.search('//res_EnumDims/dimList/dim').each do |dim| @dimensions[dim['id'].to_i] = dim['name'] end @dimensions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dimensions\n @dimensions ||= extract_dimensions\n end", "def dimensions\n data[:dimensions]\n end", "def dimensions\n return @dimensions if @dimensions\n @dimensions = {}\n (raw['Dimensions'] || {}).each do |name, values|\n values = [values] unless Array === values...
[ "0.7612927", "0.7491795", "0.7119689", "0.7065461", "0.69859594", "0.6833041", "0.6635644", "0.65700686", "0.6449944", "0.63648355", "0.6354532", "0.62309235", "0.6223252", "0.62107784", "0.6142987", "0.61411935", "0.6124049", "0.6081948", "0.60598814", "0.60243237", "0.60033...
0.8324431
0
Returns a list of available member filters for the specified dimension. A filter can be used to restrict a member query to a certain subset of members, such as the members in a member list.
def get_filters(dimension, force = false) check_attached if @fiters && @filters[dimension] && !force @logger.debug "Retrieving filters for #{dimension} from cache" filters = @filters[dimension] else @logger.info "Retrieving list of available member filters for #{dimension}" @req.EnumFilters do |xml| xml.sID @session_id xml.dim dimension end filters = [] invoke.search('//res_EnumFilters/filterList/filter').each do |filter| filters << Filter.new(filter) end @filters = {} unless @filters @filters[dimension] = filters end filters end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_members(dimension, filter_spec = nil, all_gens = true)\n check_attached\n\n @logger.info \"Retrieving list of members for #{dimension}\"\n filter_name, filter_args = process_filter(dimension, filter_spec)\n @req.EnumMembers do |xml|\n xml.sID @session_id\n ...
[ "0.66000456", "0.6113546", "0.5663793", "0.558727", "0.5541264", "0.5440236", "0.5352249", "0.5334504", "0.5318193", "0.52901834", "0.5235585", "0.51865315", "0.5149339", "0.50871384", "0.5058165", "0.5041862", "0.504061", "0.50391406", "0.50339425", "0.50339425", "0.5019519"...
0.6618161
0
Retrieves a list of members for the specified dimension, optionally satisfying a filter.
def get_members(dimension, filter_spec = nil, all_gens = true) check_attached @logger.info "Retrieving list of members for #{dimension}" filter_name, filter_args = process_filter(dimension, filter_spec) @req.EnumMembers do |xml| xml.sID @session_id xml.dim dimension xml.memberFilter do |xml| xml.filter('name' => filter_name) do |xml| insert_filter_args xml, filter_args end end xml.getAtts '0' xml.alsTbl @preferences.alias_table xml.allGenerations all_gens ? '1' : '0' end doc = invoke members = doc.at('//res_EnumMembers/mbrs').to_plain_text.split('|') members end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(arg, members)\n begin\n rescue\n members = []\n end\n\n return members\n end", "def find_member(dimension, pattern, filter_spec = nil)\n check_attached\n\n @logger.info \"Finding members of #{dimension} matching '#{pattern}'\"\n filter_name, filter_ar...
[ "0.6106037", "0.5892731", "0.5737507", "0.5628034", "0.5616825", "0.54674816", "0.5147688", "0.50660956", "0.50398475", "0.5007623", "0.50068593", "0.5006542", "0.49880135", "0.49544948", "0.49335697", "0.4933323", "0.492662", "0.490732", "0.48770645", "0.48370168", "0.481069...
0.7164167
0
Search for the specified member name or pattern in a dimension. Returns an array of arrays, each inner array representing a path to a matching member.
def find_member(dimension, pattern, filter_spec = nil) check_attached @logger.info "Finding members of #{dimension} matching '#{pattern}'" filter_name, filter_args = process_filter(dimension, filter_spec) @req.FindMember do |xml| xml.sID @session_id xml.dim dimension xml.mbr pattern xml.filter 'name' => filter_name do |xml| insert_filter_args xml, filter_args end xml.alsTbl @preferences.alias_table end doc = invoke path_list = [] doc.search('//res_FindMember/pathList/path').each do |path| path_list << path.at('mbrs').to_plain_text.split('|') end path_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children_lookup(cube_unique_name, member = nil, recursive = false)\n return dimensions cube_unique_name if member.nil?\n\n if member.split(\".\").length == 1\n cube(cube_unique_name).get_dimensions.reject { |dimension| dimension.get_unique_name != member }.first.get_hierarchies.map { |hierarch...
[ "0.58633673", "0.50954473", "0.50358456", "0.49046034", "0.48188692", "0.47691846", "0.47646478", "0.47630084", "0.47506502", "0.47243878", "0.46803775", "0.46600533", "0.45607966", "0.45484754", "0.45322666", "0.45157522", "0.45046684", "0.44887182", "0.44867975", "0.44701588"...
0.6749866
0
Sets the current POV
def pov=(new_pov) new_pov @pov = pov.merge(new_pov) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pv\n @pv = Pv.find(params[:id])\n end", "def set_vprob\n @vprob = Vprob.find(params[:id])\n end", "def set_officev\n @officev = Officev.find(params[:id])\n end", "def set_poset\n @poset = Poset.find(params[:id])\n end", "def set_votacion\n @votacion = Votacion.f...
[ "0.6170124", "0.58831656", "0.5805392", "0.57393426", "0.5681483", "0.56764996", "0.55454487", "0.55406404", "0.55344963", "0.54906285", "0.5462184", "0.5428256", "0.54158354", "0.5414618", "0.5406406", "0.5395552", "0.53927726", "0.53619075", "0.53532916", "0.53532916", "0.5...
0.61672235
1
Returns a hash indicating the current POV
def pov default_pov unless @pov @pov end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n @vbits.hash\n end", "def hash\n name.hash ^ version.hash\n end", "def hash\n 0\n end", "def hash\n [dpv_confirmation, dpv_cmra, dpv_vacant, dpv_active, dpv_footnotes, ews_match, lacs_indicator, lacs_return_code, suite_return_code].hash\n end", "def hash\...
[ "0.64884", "0.6146446", "0.6048215", "0.5984799", "0.5946371", "0.58862656", "0.5800202", "0.57888734", "0.5781309", "0.5768036", "0.5759176", "0.5740839", "0.5723677", "0.57196873", "0.57196873", "0.57196873", "0.57196873", "0.57196873", "0.57196873", "0.57196873", "0.571274...
0.0
-1
Get the default POV
def default_pov # Make sure we are connected check_attached @logger.info "Retrieving default POV" @req.GetDefaultPOV do |xml| xml.sID @session_id xml.getAtts '0' xml.alsTbl @preferences.alias_table end doc = invoke dims = doc.at('//res_GetDefaultPOV/dims').to_plain_text.split('|') @dimensions = dims unless @dimensions mbrs = doc.at('//res_GetDefaultPOV/mbrs').to_plain_text.split('|') @pov = {} 0.upto(dims.size-1) do |i| @pov[dims[i]] = mbrs[i] end @pov end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pov\n default_pov unless @pov\n @pov\n end", "def default\n find(\"Default\")\n end", "def get_default\n if self.current_defaults\n self.current_defaults.first\n else\n raise \"Cette instance ne possède de #{self.class.name} par default\"\n end\n ...
[ "0.5939354", "0.59290737", "0.5922274", "0.5554738", "0.55447453", "0.55122954", "0.5501516", "0.55004627", "0.5482217", "0.54771745", "0.54033804", "0.53995204", "0.5362484", "0.5357589", "0.5341343", "0.5334122", "0.5328234", "0.53162336", "0.53162336", "0.5245872", "0.5224...
0.7644387
0
Gets a default grid with the specified POV
def default_grid # Make sure we are attached to a cube check_attached @logger.info "Retrieving default grid" @req.GetDefaultGrid do |xml| xml.sID @session_id @preferences.inject_xml xml, @provider_type xml.backgroundpov do |xml| pov.each do |dim,mbr| xml.dim :name => dim, :pov => mbr end end end doc = invoke Grid.from_xml(doc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_grid\n Array.new(7) { Array.new(6) { Cell.new } }\n end", "def default_pov\n # Make sure we are connected\n check_attached\n\n @logger.info \"Retrieving default POV\"\n @req.GetDefaultPOV do |xml|\n xml.sID @session_id\n xml.getAtts ...
[ "0.5971977", "0.5965197", "0.575852", "0.5713396", "0.53836936", "0.53076774", "0.524211", "0.5237517", "0.5233897", "0.52206445", "0.51251656", "0.50248826", "0.49595135", "0.48569524", "0.48031297", "0.47750446", "0.4755351", "0.46816182", "0.46778807", "0.4622908", "0.4622...
0.65902126
0
Refresh a grid from the current provider
def refresh(grid) # Make sure we are attached to a cube check_attached @logger.info "Refreshing grid" @req.Refresh do |xml| xml.sID @session_id @preferences.inject_xml xml, @provider_type grid.to_xml(xml) end doc = invoke Grid.from_xml(doc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @grid.update\n end", "def refresh\n\t\t@frame.updateGrid\n\t\tself.update\n\t\treturn self\n\tend", "def refresh!\n raise NotImplementedError, \"#refresh! is not implemented on #{@provider}:#{@type}\"\n end", "def refresh(provider)\n $evm.log(\"info\", \"Refreshing provider #{pr...
[ "0.7269299", "0.7165706", "0.6832801", "0.66368824", "0.6595634", "0.65622294", "0.65622294", "0.6493063", "0.640858", "0.6334815", "0.63031816", "0.63031816", "0.62334484", "0.62334484", "0.62175953", "0.61877894", "0.6185085", "0.6173953", "0.61363024", "0.6100245", "0.6078...
0.7629953
0
Return a grid for the spcified rows and columns and optional POV The rows must be a hash whose key is a single dimension name, or array of dimension names. The value of the hash must be an array containing tuples of member names for the dimension(s) in the rows. The cols must be a hash whose key is a single dimension name, or array of dimension names. The value of the hash must be an array containing tuples of member names for the dimension(s) in the cols. The pov is an optional POV that will be merged with the current POV to determine the retrieved POV.
def free_form_grid(rows, cols, grid_pov=nil) # Make sure we are attached to a cube check_attached get_dimensions unless @dimensions # Update the POV if one is specified if grid_pov self.pov = grid_pov end grid = Grid.define(@dimensions, pov, rows, cols) @logger.info "Retrieving free-form grid" @req.ProcessFreeFormGrid do |xml| xml.sID @session_id @preferences.inject_xml xml, @provider_type xml.backgroundpov do |xml| pov.each do |dim,mbr| xml.dim :name => dim, :pov => mbr end end grid.to_xml(xml, false) grid.dims_to_xml(xml) end doc = invoke grid = Grid.from_xml(doc) # The grid returned does not contain data, so perform a refresh refresh(grid) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid\n @grid ||=\n {\n rows: lines_to_ranges(lines[:horizontal]),\n columns: lines_to_ranges(lines[:vertical])\n }\n end", "def create_grid\n @grid = {\"1a\" => \" \", \"1b\" => \" \", \"1c\" => \" \", \"1d\" => \" \", \"1e\" => \" \",\n ...
[ "0.64313143", "0.61897457", "0.61006105", "0.59698695", "0.59622866", "0.594811", "0.5921769", "0.5847691", "0.5672701", "0.55957943", "0.55472404", "0.55231", "0.55002207", "0.54943144", "0.5494288", "0.5479013", "0.54585916", "0.54568464", "0.54427224", "0.54367685", "0.540...
0.67455137
0
Checks to see that a session has been established, raising a NotConnected exception if one has not.
def check_connected raise NotConnected unless @session_id && @sso && @provider end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_server_connection\n\t\tsession[:foo] = \"bar\" unless session.id \n\t\traise \"session.id is nil\" unless session.id\n\t\tunless @client = ClientConnections.get(session.id.public_id)\n\t\t\tredirect_to root_path, flash: { error: \"Please connect to a formulary server\" }\n\t\tend\n\tend", "def check...
[ "0.68034667", "0.68034667", "0.67881316", "0.67881316", "0.67720455", "0.677098", "0.6672164", "0.66430384", "0.6632717", "0.66123366", "0.66106296", "0.6603487", "0.6565453", "0.6565453", "0.6543456", "0.6520118", "0.6489656", "0.6470741", "0.6449875", "0.6448576", "0.643180...
0.79844135
0