query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
GET /line_destinations GET /line_destinations.json
def index @line_destinations = LineDestination.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_flight_destinations\n @flights = Flight.all.map(&:destination)\n end", "def get_destinations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.get_destinations ...'\n end\n # resource path\n ...
[ "0.642937", "0.6342397", "0.6016483", "0.59665376", "0.5958714", "0.5948643", "0.59105057", "0.59074074", "0.58959484", "0.5877479", "0.58273005", "0.5752508", "0.5683408", "0.56816554", "0.5662989", "0.558983", "0.5580443", "0.5572349", "0.5561302", "0.55530626", "0.5514585"...
0.7743551
0
POST /line_destinations POST /line_destinations.json
def create destination = Destination.find(params[:destination_id]) @line_destination = @plan.add_destination(destination.id) respond_to do |format| if @line_destination.save format.html { redirect_to @line_destination.plan, notice: 'Line destination was successfully created.' } format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @line_destinations = LineDestination.all\n end", "def line_destination_params\n params.require(:line_destination).permit(:destination_id, :plan_id)\n end", "def set_line_destination\n @line_destination = LineDestination.find(params[:id])\n end", "def create\n @destination =...
[ "0.6639006", "0.6593108", "0.6301531", "0.6178634", "0.59259605", "0.5810589", "0.5743956", "0.57063353", "0.56617916", "0.5513739", "0.5491601", "0.54840004", "0.5476672", "0.54665875", "0.54665685", "0.54612404", "0.5418316", "0.5400803", "0.53866494", "0.53824914", "0.5380...
0.6773432
0
PATCH/PUT /line_destinations/1 PATCH/PUT /line_destinations/1.json
def update respond_to do |format| if @line_destination.update(line_destination_params) format.html { redirect_to @line_destination, notice: 'Line destination was successfully updated.' } format.json { render :show, status: :ok, location: @line_destination } else format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @shipping_line = ShippingLine.find(params[:id])\n\n respond_to do |format|\n if @shipping_line.update_attributes(params[:shipping_line])\n format.html { redirect_to @shipping_line, :notice => 'Shipping line was successfully updated.' }\n format.json { head :no_content }\n ...
[ "0.6438662", "0.63544863", "0.6346638", "0.6315294", "0.6275322", "0.6252122", "0.61914515", "0.6190539", "0.6179571", "0.6137683", "0.60762715", "0.60315263", "0.6000197", "0.59485865", "0.59453785", "0.5937492", "0.5911243", "0.5901368", "0.5887122", "0.58835125", "0.588208...
0.71718687
0
DELETE /line_destinations/1 DELETE /line_destinations/1.json
def destroy @line_destination.destroy respond_to do |format| format.html { redirect_to line_destinations_url, notice: 'Line destination was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |...
[ "0.67035", "0.6682395", "0.66671354", "0.65862906", "0.6562961", "0.6550406", "0.65248895", "0.64999706", "0.6480687", "0.64735466", "0.6408842", "0.64042133", "0.64042133", "0.640356", "0.64025486", "0.63977885", "0.63977885", "0.63977885", "0.63977885", "0.63644946", "0.635...
0.72329146
0
Checks if a particular block has been defined within the current block scope. Options: [+name+] The name of the block to check
def defined?(name) !blocks[name].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def defined?(name)\n !blocks[name.to_sym].nil?\n end", "def has_block(name)\n @blocks.key?(name.to_s)\n end", "def check_block name\n raise \"No such block: #{name}\" unless @source.key? name\n end", "def get_block name\n name = name.to_sym\n block = @blocks.find {|b| b....
[ "0.7929647", "0.7727793", "0.7575643", "0.648453", "0.6267494", "0.6252901", "0.6176375", "0.61619455", "0.61015606", "0.6094068", "0.58873636", "0.5861491", "0.58416367", "0.578623", "0.57466495", "0.57462734", "0.57136166", "0.5701837", "0.5625596", "0.56244653", "0.5624341...
0.79147595
1
Define a block, unless a block by the same name is already defined. "1", :parameter2 => "2" do |options| %> and Options: [+name+] The name of the block being defined (either a string or a symbol or a Proc) [+options+] The default options for the block definition. Any or all of these options may be overridden by whomeve...
def define(name, options={}, &block) collection = options.delete(:collection) if collection collection.each do |object| define(call_with_params(name, object, options), options, &block) end else self.define_block_container(name, options, &block) end nil ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define(name, options={}, &block)\n # Check if a block by this name is already defined.\n if blocks[name.to_sym].nil?\n # Store the attributes of the defined block in a container for later use\n block_container = BuildingBlocks::Container.new\n block_container.name = name\n ...
[ "0.79023236", "0.68490136", "0.6795098", "0.6732078", "0.6394409", "0.6391756", "0.63572186", "0.63399476", "0.63368434", "0.6305341", "0.6289439", "0.61833805", "0.615229", "0.6132293", "0.6122384", "0.6120324", "0.59682924", "0.5964644", "0.5927705", "0.5924114", "0.5904602...
0.7043358
1
Skip the rendering of a particular block when blocks.render is called for the a particular block name My output Options: [+name+] The name of the block to skip rendering for
def skip(name) blocks[name] = nil skipped_blocks[name] = true self.define_block_container(name) do end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_block(name, context, blocks = {}, use_blocks = true)\n # ob_start();\n display_block(name, context, blocks, use_blocks)\n # return ob_get_clean();\n end", "def render_parent_block(name, context, blocks = {})\n # ob_start();\n display_parent_block(name, context, blocks)\n ...
[ "0.6153384", "0.6086669", "0.6039716", "0.59651756", "0.5871876", "0.5795725", "0.5795725", "0.5789088", "0.5735014", "0.56427854", "0.56366086", "0.5627823", "0.5627823", "0.56263053", "0.5623758", "0.56109864", "0.56109864", "0.56101745", "0.56096", "0.56039566", "0.5590809...
0.74185246
0
Add a block to render before another block. This before block will be put into an array so that multiple before blocks may be queued. They will render in the order in which they are declared when the "blocksrender" method is called. Any options specified to the before block will override any options specified in the bl...
def before(name, options={}, &block) self.add_block_container_to_list("before_#{name.to_s}", options, &block) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before &block\n @before_blocks ||= []\n @before_blocks << block if block\n end", "def before(&block)\n if !block_given? || block.arity != 1\n raise InvalidBlockSpecification, \"before proc should have an arity of 1 (Array: values)\"\n end \n @options[:before] = block\n...
[ "0.7220903", "0.71276605", "0.6682045", "0.6654923", "0.6637286", "0.6603937", "0.6568894", "0.64873666", "0.64247715", "0.6413482", "0.6413482", "0.6394118", "0.6378209", "0.6295552", "0.62211317", "0.6186277", "0.60403633", "0.5953866", "0.5946286", "0.5883547", "0.58593214...
0.7241095
0
Add a block to render after another block. This after block will be put into an array so that multiple after blocks may be queued. They will render in the order in which they are declared when the "blocksrender" method is called. Any options specified to the after block will override any options specified in the block ...
def after(name, options={}, &block) self.add_block_container_to_list("after_#{name.to_s}", options, &block) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after(&block)\n @blocks << block\n end", "def render_after_blocks(name_or_container, *args)\n render_before_or_after_blocks(name_or_container, \"after\", *args)\n end", "def after_each(&block)\n @after_each_blocks << block\n end", "def after(&block)\n @after << block\n ...
[ "0.7319272", "0.6946847", "0.6595663", "0.65939915", "0.6538661", "0.6490435", "0.6461255", "0.6358121", "0.6338884", "0.6295388", "0.6295388", "0.62704086", "0.62017024", "0.62017024", "0.62017024", "0.62017024", "0.6073884", "0.60102373", "0.6002562", "0.5883354", "0.586635...
0.7211461
1
Add a block to render around another block. This around block will be put into an array so that multiple around blocks may be queued. They will render in the order in which they are declared when the "blocksrender" method is called, with the last declared around block being rendered as the outermost code, and the first...
def around(name, options={}, &block) self.add_block_container_to_list("around_#{name.to_s}", options, &block) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after(&block)\n @blocks << block\n end", "def render_before_or_after_blocks(name_or_container, before_or_after, *args)\n options = args.extract_options!\n\n block_options = {}\n if (name_or_container.is_a?(Blocks::Container))\n name = name_or_container.name.to_sym\n block...
[ "0.6547473", "0.6404702", "0.6208435", "0.6163087", "0.6052626", "0.60484743", "0.5930488", "0.59015363", "0.58985853", "0.5874048", "0.58688915", "0.57699996", "0.5756182", "0.5737291", "0.56953084", "0.56941867", "0.5691556", "0.5662967", "0.5647241", "0.5642331", "0.56421"...
0.68984526
0
Return a unique name for an anonymously defined block (i.e. a block that has not been given a name)
def anonymous_block_name self.anonymous_block_number += 1 "block_#{anonymous_block_number}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_name \n to_sym\n end", "def block_name_declaration(block_name)\n buff_code \"#{block_name} = __blocks.delete('#{block_name}') { __create_block('#{block_name}') }\"\n end", "def block_name \n :CodeBlock \n end", "def block_name \n ...
[ "0.7266279", "0.711747", "0.6894549", "0.6894549", "0.6743855", "0.64937365", "0.64157474", "0.62972915", "0.6205214", "0.6133405", "0.6133405", "0.6036275", "0.60225195", "0.58905625", "0.5851871", "0.5851871", "0.58397675", "0.58160347", "0.58117604", "0.57431936", "0.57295...
0.83050674
0
Render all the before blocks for a partial block
def render_before_blocks(name_or_container, *args) render_before_or_after_blocks(name_or_container, "before", *args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_block\n end", "def pre_block\n end", "def before &block\n @before_blocks ||= []\n @before_blocks << block if block\n end", "def before_each(&block)\n @before_each_blocks << block\n end", "def _Gvn_before(&block)\n _Gvn_before_blocks << block\n end", "def ren...
[ "0.6681968", "0.6681968", "0.6535729", "0.628239", "0.6227567", "0.6167728", "0.6129468", "0.6096138", "0.6042019", "0.6012528", "0.5984095", "0.5890831", "0.5873981", "0.584487", "0.5820287", "0.57442856", "0.5726144", "0.56941485", "0.56887496", "0.5676654", "0.56675607", ...
0.7268148
0
Render all the after blocks for a partial block
def render_after_blocks(name_or_container, *args) render_before_or_after_blocks(name_or_container, "after", *args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_render(&block)\n @after_render_block = block\n end", "def after(&block)\n @blocks << block\n end", "def after_each(&block)\n @after_each_blocks << block\n end", "def after(&block)\n @after << block\n end", "def after_block_boundary?; end", "def render_before_or_a...
[ "0.68821067", "0.6662712", "0.6319804", "0.6187833", "0.6153579", "0.6002141", "0.5995399", "0.59916854", "0.59323484", "0.59323484", "0.5906733", "0.5799515", "0.5763784", "0.5727507", "0.57124907", "0.56906766", "0.5674781", "0.56679696", "0.565864", "0.56512755", "0.564593...
0.7496595
0
Utility method to render either the before or after blocks for a partial block
def render_before_or_after_blocks(name_or_container, before_or_after, *args) options = args.extract_options! block_options = {} if (name_or_container.is_a?(Blocks::Container)) name = name_or_container.name.to_sym block_options = name_or_container.options else name = name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_partial(context, options, &block); end", "def render_before_blocks(name_or_container, *args)\n render_before_or_after_blocks(name_or_container, \"before\", *args)\n end", "def render_partial(*ignore_args); end", "def render_after_blocks(name_or_container, *args)\n render_before_or_af...
[ "0.69064844", "0.66394305", "0.63921726", "0.6139292", "0.6085669", "0.6035155", "0.5979546", "0.59664035", "0.58847994", "0.58707213", "0.58612597", "0.58612597", "0.5859913", "0.58227104", "0.58227104", "0.581345", "0.581345", "0.581345", "0.581345", "0.57896", "0.5780207",...
0.7122868
0
Build a Blocks::Container object given the passed in arguments
def build_block_container(*args, &block) options = args.extract_options! anonymous = false if args.first name = args.shift else name = self.anonymous_block_name anonymous = true end block_container = Blocks::Container.new block_container.name = name.to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_block_container(*args, &block)\n block_container = self.build_block_container(*args, &block)\n blocks[block_container.name] = block_container if blocks[block_container.name].nil? && block_given?\n block_container\n end", "def build(*args)\n # create the container they ask for ...
[ "0.7367841", "0.7033346", "0.6462313", "0.6360746", "0.633526", "0.62938404", "0.61372554", "0.61268455", "0.59123755", "0.5905156", "0.5814367", "0.5787508", "0.57627004", "0.5741977", "0.5713474", "0.5704639", "0.5678478", "0.5651259", "0.5611382", "0.55782515", "0.55489695...
0.8039163
0
Build a Blocks::Container object and add it to the global hash of blocks if a block by the same name is not already defined
def define_block_container(*args, &block) block_container = self.build_block_container(*args, &block) blocks[block_container.name] = block_container if blocks[block_container.name].nil? && block_given? block_container end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define(name, options={}, &block)\n # Check if a block by this name is already defined.\n if blocks[name.to_sym].nil?\n # Store the attributes of the defined block in a container for later use\n block_container = BuildingBlocks::Container.new\n block_container.name = name\n ...
[ "0.74327475", "0.6817441", "0.67584366", "0.6169531", "0.6115075", "0.6104901", "0.60795325", "0.6035718", "0.5856504", "0.58524126", "0.5851874", "0.58500856", "0.5845006", "0.5844824", "0.5768412", "0.57348526", "0.573268", "0.5695212", "0.5606382", "0.5598131", "0.55494285...
0.72267526
1
Return the X509 certificate. If it hasn't been passed in, return a selfsigned one
def to_x509() @cert end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x509\n @x509 ||= OpenSSL::X509::Certificate.new(as_pem)\n end", "def certificate_get\n return @cert unless @cert.nil?\n cert_path = File.join(resource[:cert_dir], resource[:cert_name])\n @cert = if Pathname.new(cert_path).exist?\n file = File.read(cert_path)\n ...
[ "0.7381351", "0.73387355", "0.72972775", "0.72907573", "0.7288836", "0.7214728", "0.70404077", "0.6888398", "0.68689144", "0.6818264", "0.67947125", "0.6793299", "0.6769461", "0.6719156", "0.66315323", "0.6616392", "0.6553652", "0.6520329", "0.64659774", "0.64501065", "0.6432...
0.7512672
0
Evaluates the expression. Uses the postfix representation and integer arithmetic.
def evaluate() # operand stack opStack = [] # iterate over the tokens @postfix.split("").each do |c| # check if an operator if %w[+ - * / ^].include? c # pop the stack for the two operands where # a [operator] b b, a = opStack.pop, opStack.pop ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_postfix(postfix_expression)\n operands = Set['+', '-', '*', '/'] # assume only these four operands for now\n stack = Stack.new # track operation results\n\n postfix_expression.each_char do |c| # assume expresion is valid\n if operands.include?(c) # is operand\n b = stack.pop # get second nu...
[ "0.7586155", "0.75738376", "0.7543657", "0.7537", "0.752676", "0.7480811", "0.74662673", "0.7454852", "0.7355399", "0.73471344", "0.7335417", "0.7334055", "0.7334055", "0.7334055", "0.7334055", "0.7334055", "0.7334055", "0.7334055", "0.7334055", "0.7334055", "0.7334055", "0...
0.76909465
0
================================================================================= Create the thead process for the Jekyll server Params: +preview+:: the preview
def jekyll_thread preview terminal_add preview, terminal_info(I18n.t('preview.message.start')) Rails.application.executor.wrap do Thread.new do Rails.application.reloader.wrap do Rails.application.executor.wrap do start_jekyll preview end end end e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview_title_and_toc\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_title_toc-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.title_...
[ "0.642627", "0.55547947", "0.54683995", "0.5409561", "0.5348179", "0.5309905", "0.52735263", "0.5262009", "0.52282965", "0.5199787", "0.51580495", "0.5153248", "0.5153248", "0.5111445", "0.508971", "0.50816727", "0.50076956", "0.49763697", "0.49747205", "0.49747205", "0.48802...
0.5884167
1
================================================================================= Start the Jekyll server for a preview Params: +preview+:: the preview
def start_jekyll preview path = get_dest_path preview Dir.chdir path Bundler.with_clean_env do ActiveSupport::Dependencies.interlock.permit_concurrent_loads do begin continue = true # Test if bundle was previously updated out, status = Open3.capture2e("bundle chec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jekyll_thread preview\n terminal_add preview, terminal_info(I18n.t('preview.message.start'))\n Rails.application.executor.wrap do\n Thread.new do\n Rails.application.reloader.wrap do\n Rails.application.executor.wrap do\n start_jekyll preview\n end\n end\n ...
[ "0.766323", "0.73429805", "0.6549405", "0.6487804", "0.6260098", "0.6255539", "0.61358005", "0.6128708", "0.6066154", "0.60524046", "0.5980425", "0.5856681", "0.5842496", "0.568482", "0.56844234", "0.5656416", "0.5656416", "0.56339175", "0.5616568", "0.5582136", "0.55745834",...
0.7350539
1
GET /contract_doc_categories GET /contract_doc_categories.json
def index @contract_doc_categories = ContractDocCategory.all respond_to do |format| format.html # index.html.erb format.json { render json: @contract_doc_categories } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contractor_categories = ContractorCategory.all\n end", "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categor...
[ "0.69252735", "0.67598003", "0.673712", "0.6678443", "0.6576718", "0.65489995", "0.65432817", "0.64964265", "0.64686626", "0.64140546", "0.6370414", "0.63575125", "0.63302326", "0.6323264", "0.63148177", "0.630736", "0.6271636", "0.6251189", "0.6238842", "0.623381", "0.623291...
0.7734442
0
GET /contract_doc_categories/1 GET /contract_doc_categories/1.json
def show @contract_doc_category = ContractDocCategory.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @contract_doc_category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contract_doc_categories = ContractDocCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contract_doc_categories }\n end\n end", "def index\n @contractor_categories = ContractorCategory.all\n end", "def GetCategories params =...
[ "0.77587914", "0.6861526", "0.67619574", "0.6758411", "0.65605724", "0.6559104", "0.65535885", "0.6548796", "0.6535411", "0.64795077", "0.63826764", "0.6365459", "0.63415504", "0.63379645", "0.6326459", "0.6304687", "0.6299475", "0.62989205", "0.629847", "0.624121", "0.623838...
0.6912725
1
GET /contract_doc_categories/new GET /contract_doc_categories/new.json
def new @contract_doc_category = ContractDocCategory.new respond_to do |format| format.html # new.html.erb format.json { render json: @contract_doc_category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @contract_doc_category = ContractDocCategory.new(params[:contract_doc_category])\n\n respond_to do |format|\n if @contract_doc_category.save\n format.html { redirect_to contract_doc_categories_path, notice: 'Contract doc category was successfully created.' }\n format.json { re...
[ "0.7617293", "0.69698524", "0.68557256", "0.67465174", "0.6687359", "0.6627671", "0.66260815", "0.6623843", "0.6615223", "0.66048545", "0.66048545", "0.66048545", "0.66048545", "0.66048545", "0.66048545", "0.66048545", "0.66048545", "0.66048545", "0.65653014", "0.6564173", "0...
0.77531904
0
POST /contract_doc_categories POST /contract_doc_categories.json
def create @contract_doc_category = ContractDocCategory.new(params[:contract_doc_category]) respond_to do |format| if @contract_doc_category.save format.html { redirect_to contract_doc_categories_path, notice: 'Contract doc category was successfully created.' } format.json { render json: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contract_doc_categories = ContractDocCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contract_doc_categories }\n end\n end", "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payl...
[ "0.65566033", "0.63240516", "0.6303891", "0.6094285", "0.6030948", "0.5988808", "0.5985044", "0.5959302", "0.5939959", "0.5842369", "0.5757353", "0.5753555", "0.57221884", "0.5650957", "0.5624956", "0.5618818", "0.56053704", "0.55904347", "0.5585924", "0.5581721", "0.5570876"...
0.71983665
0
PUT /contract_doc_categories/1 PUT /contract_doc_categories/1.json
def update @contract_doc_category = ContractDocCategory.find(params[:id]) respond_to do |format| if @contract_doc_category.update_attributes(params[:contract_doc_category]) format.html { redirect_to @contract_doc_category, notice: 'Contract doc category was successfully updated.' } format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end", "def create\n @contract_doc_cat...
[ "0.71546346", "0.66962844", "0.6478813", "0.6278743", "0.6203736", "0.5856204", "0.583044", "0.5796072", "0.5766279", "0.5672686", "0.56694543", "0.5644705", "0.5630154", "0.56238836", "0.56124693", "0.5612258", "0.5565249", "0.5546055", "0.5505531", "0.54985297", "0.5494529"...
0.68047667
1
DELETE /contract_doc_categories/1 DELETE /contract_doc_categories/1.json
def destroy @contract_doc_category = ContractDocCategory.find(params[:id]) @contract_doc_category.destroy respond_to do |format| format.html { redirect_to contract_doc_categories_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @contract_document.destroy\n respond_to do |format|\n format.html { redirect_to contract_documents_url }\n format.json { head :no_content }\n end\n end", "def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end", ...
[ "0.6751191", "0.6737136", "0.6669458", "0.66687363", "0.6652359", "0.6650014", "0.66235083", "0.6591029", "0.6556768", "0.65394855", "0.65357304", "0.6524285", "0.65047705", "0.65026826", "0.6485148", "0.64774173", "0.6464808", "0.64556545", "0.6451928", "0.6448894", "0.64394...
0.8030113
0
Method that checks if an object given to it is an album.
def isa? instance_of?(Album) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isa?\n\t\tinstance_of?(Album)\n\tend", "def album_unique?(album_object, artist_object)\n\n albums = self.albums.select{|album| album.artist.present?}\n non_nil_albums = albums.select{|album| album.artist.name == artist_object.name} << album_object.name\n non_nil_albums.length == non_nil_albums.uniq....
[ "0.8194015", "0.6476874", "0.6432577", "0.61883134", "0.61166966", "0.6001967", "0.59991974", "0.5900762", "0.57883006", "0.578643", "0.5775798", "0.57714975", "0.5757246", "0.5710056", "0.5710056", "0.5693423", "0.5691528", "0.56720376", "0.56223154", "0.5598594", "0.5591569...
0.81016976
1
Create Logger from environment variables. The following environment variables are supported: WEATHER_SAGE_LOG_LEVEL: Log level. One of "fatal", "error", "warning", "info", or "debug". Defaults to "warn". WEATHER_SAGE_LOG_PATH: Path to log file. Defaults to standard error.
def initialize(env) # get log level (default to "warn" if unspecified) log_level = (env.get('LOG_LEVEL', DEFAULT_LEVEL)).upcase # create logger from log path (default to STDERR) super(env.get('LOG_PATH', STDERR)) # set log level (default to WARN) self.level = ::Logger.const_get(log_level) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_logger\n path = Hanami.root.join(\"log\", [\"emergency_log.\", Hanami.env].join)\n Logger.new(path)\n end", "def create_logger path\n #path = File.join(ENV[\"LOGDIR\"] || \"./\" ,\"canis14.log\")\n _path = File.open(path, File::WRONLY|File::TRUNC|File::CREAT) \n ...
[ "0.58802617", "0.5512693", "0.548365", "0.54493564", "0.5412021", "0.5330148", "0.53199464", "0.52917814", "0.5280216", "0.5213973", "0.516227", "0.5125711", "0.5105448", "0.5087038", "0.5028018", "0.50257343", "0.49738595", "0.49733123", "0.49472165", "0.4919585", "0.4901498...
0.6035335
0
POST /organization_contacts POST /organization_contacts.json
def create @organization_contact = OrganizationContact.new(params[:organization_contact]) if params[:id][:org_id].empty? @organization_contact.organization_id = params[:organization_contact][:organization_id] else @organization_contact.organization_id = params[:id][:org_id] end respond...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @contact = @current_user.contacts.new(contact_params)\n if @contact.save\n render json: {status: 201, contact: @contact}\n else\n render json: {status: 400}\n end\n end", "def create_contact(options = {})\n post(:contacts, contacts: [options]).pop\n end", "def cr...
[ "0.70148814", "0.6978043", "0.68544346", "0.68139714", "0.6790472", "0.6746869", "0.6730257", "0.67105407", "0.6706745", "0.6636133", "0.6622512", "0.661313", "0.657801", "0.6544441", "0.65436363", "0.6539426", "0.65168494", "0.6427256", "0.64032644", "0.6387553", "0.63725895...
0.7015095
0
PUT /organization_contacts/1 PUT /organization_contacts/1.json
def update @organization_contact = OrganizationContact.find(params[:id]) org_id = Organization.find_by_company_name(params[:organization_contact][:organization_id]).id respond_to do |format| params[:organization_contact][:organization_id] = org_id if @organization_contact.update_attributes(param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_contacts(contacts)\n b = Builder::XmlMarkup.new\n request_xml = b.Contacts {\n contacts.each do | contact |\n contact.to_xml(b)\n end\n }\n\n response_xml = http_post(@client, \"#{@xero_url}/Contacts\", request_xml, {})\n\n response = parse_response(respon...
[ "0.68794465", "0.68764114", "0.6659082", "0.664357", "0.6634039", "0.66311294", "0.65473694", "0.6544432", "0.6540247", "0.65237737", "0.65087163", "0.6501151", "0.647436", "0.64389944", "0.6415391", "0.64046264", "0.64005375", "0.63825643", "0.6378881", "0.6361877", "0.63569...
0.76239353
0
POST /custom_workouts POST /custom_workouts.json
def create @custom_workout = @user.custom_workouts.new(params[:custom_workout]) respond_to do |format| if @custom_workout.save # TODO need to get a specific month in there . . . format.html { redirect_to my_fit_wit_fit_wit_workout_progress_path(month: params[:month]), notice: 'Custom work...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @myworkout = Myworkout.new(params[:myworkout])\n\n respond_to do |format|\n if @myworkout.save\n format.html { redirect_to @myworkout, :notice => 'Myworkout was successfully created.' }\n format.json { render :json => @myworkout, :status => :created, :location => @myworkout }\...
[ "0.72388965", "0.71684486", "0.71378744", "0.7121771", "0.6923282", "0.687507", "0.6815009", "0.66730154", "0.66602457", "0.66234684", "0.64854676", "0.64649713", "0.6462331", "0.6438944", "0.6381386", "0.6379294", "0.6376214", "0.63250685", "0.6314911", "0.62957966", "0.6261...
0.7617296
0
PUT /custom_workouts/1 PUT /custom_workouts/1.json
def update @custom_workout = @user.custom_workouts.find(params[:id]) respond_to do |format| if @custom_workout.update_attributes(params[:custom_workout]) format.html { redirect_to my_fit_wit_fit_wit_workout_progress_path(month: params[:month]), notice: 'Custom workout was successfully updated.' }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @myworkout = Myworkout.find(params[:id])\n\n respond_to do |format|\n if @myworkout.update_attributes(params[:myworkout])\n format.html { redirect_to @myworkout, :notice => 'Myworkout was successfully updated.' }\n format.json { head :no_content }\n else\n format.h...
[ "0.7118535", "0.70601964", "0.69140595", "0.6900946", "0.6875889", "0.6851672", "0.68229103", "0.6794696", "0.6784685", "0.6775333", "0.6775333", "0.6763716", "0.6688509", "0.6657758", "0.6657758", "0.6657758", "0.6657434", "0.656314", "0.65571964", "0.6500776", "0.6500776", ...
0.77989906
0
removing all odd numbers from an array
def remove_odd_numbers_from_array(a) a.each do |x| if x%2!=0 a.delete x end end return a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_odd_numbers_from_array(a)\n a.reject {|n| n.odd?}\nend", "def remove_odd_numbers_from_array(a)\n a.each do |x|\n if x%2!=0\n a.delete x\n end\n end\n return a\nend", "def remove_odd array\n no_odds_array = []\n array.each do |number|\n if number % 2 == 0\n no_odds_ar...
[ "0.8649637", "0.8510921", "0.84928346", "0.8418858", "0.83774436", "0.8366879", "0.83448106", "0.803952", "0.802341", "0.79663587", "0.7959718", "0.7952741", "0.7950148", "0.7938811", "0.79222083", "0.7919922", "0.79122835", "0.78768367", "0.77158695", "0.7655689", "0.7617314...
0.8573983
1
GET /evaluators GET /evaluators.xml
def index respond_to do |format| format.html # index.html.erb format.xml { render :xml => @evaluators } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluations(id)\n connection.get do |req|\n req.url \"job/#{id}/evaluations\"\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @evaluator }\n end\n end", "def index\n @evaluates = Evaluate.all\n ...
[ "0.6577595", "0.6472638", "0.6447232", "0.6365749", "0.63173395", "0.6290402", "0.62816536", "0.6276755", "0.6276755", "0.6276755", "0.6276755", "0.6276755", "0.626674", "0.6263589", "0.62486714", "0.62147796", "0.6130541", "0.6118378", "0.607262", "0.6069896", "0.6024948", ...
0.75014734
0
DELETE /evaluators/1 DELETE /evaluators/1.xml
def destroy @evaluator.destroy respond_to do |format| format.html { redirect_to(evaluators_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @evaluacione = Evaluacione.find(params[:id])\n @evaluacione.destroy\n\n respond_to do |format|\n format.html { redirect_to(evaluaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @evaluation = Evaluation.find(params[:id])\n @evaluation.destroy\n\n ...
[ "0.6882842", "0.681412", "0.681412", "0.6778896", "0.6495405", "0.6476748", "0.639871", "0.63172853", "0.629123", "0.62126756", "0.61966735", "0.6186981", "0.6186981", "0.6178857", "0.6157606", "0.6153738", "0.61197335", "0.6116494", "0.6100623", "0.60852253", "0.6043209", ...
0.7202966
0
Ensures that storeconfigs is present before calling AbstractCollector's evaluate method
def evaluate if Puppet[:storeconfigs] != true return false end super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_exists?; collect_data_exists? || collect_module_exists?; end", "def store_instances(enabled_stores, store_configs)\n fail \"No stores have been enabled, see configuration file\" if enabled_stores.blank?\n fail \"No store configuration present, see configuration file\" if store_configs.blank?\n\...
[ "0.59760356", "0.5726866", "0.55157197", "0.5411421", "0.5312494", "0.5292913", "0.52025586", "0.5150112", "0.5115923", "0.488663", "0.48714945", "0.48470297", "0.484389", "0.48265576", "0.47959197", "0.47775227", "0.47582924", "0.47565797", "0.47546118", "0.47405994", "0.473...
0.7297491
0
Collect exported resources as defined by an exported collection. Used with PuppetDB
def collect resources = [] time = Puppet::Util.thinmark do t = @type q = @cquery resources = scope.compiler.resources.find_all do |resource| resource.type == t && resource.exported? && (q.nil? || q.call(resource)) end found = Puppet::Resource.indirection. search(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end", "def catalog_resources\n # This method exists to supply a common interface to the puppet catalog\n # for different versions of puppet.\n @catalog.resources.map do...
[ "0.6269942", "0.62085956", "0.60153866", "0.59598154", "0.58800614", "0.5878395", "0.58030134", "0.57985556", "0.5784362", "0.57606655", "0.57126385", "0.5712488", "0.5709556", "0.5693825", "0.5692376", "0.56261975", "0.5625326", "0.5608248", "0.56036484", "0.559852", "0.5581...
0.75565386
0
Set an inclusion proc for this mixin. This block is evaluated in the tool class immediately after the mixin is included, and is passed any arguments provided to the `include` directive.
def on_include(&block) self.inclusion = block self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def when_included(&block)\n @cautious_included_block = block\n end", "def before_inclusion(&block)\n if block && block.respond_to?(:call)\n before_inclusion_procs << block\n else\n raise 'Anything added to be called before_inclusion must be callable (respond to #call).'\n end\n ...
[ "0.6221959", "0.6211982", "0.61903054", "0.61840326", "0.6139432", "0.609612", "0.606477", "0.6002307", "0.5992969", "0.5987443", "0.5961427", "0.59278387", "0.59278387", "0.59278387", "0.59224725", "0.58986557", "0.58627254", "0.5860639", "0.58554924", "0.5831537", "0.583062...
0.7361768
0
Makes sure a user cant access the given action Example: assert_user_cant_access(:quentin, "destroy", :listing_id => 1)
def assert_user_cant_access(user, actions, params = {}) assert_user_access_check(false, user, actions, params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_denied\n request.env[\"HTTP_REFERER\"] = journals_path\n yield\n assert_redirected_to root_path\n assert_equal \"You are not authorized to access this page.\", flash[:alert]\n end", "def assert_forbidden\n get :index\n\n assert_redirected_to login_path\n assert_equal evaluations_...
[ "0.71123266", "0.69788283", "0.6522834", "0.64373386", "0.64342105", "0.6428972", "0.6410233", "0.6398427", "0.63782954", "0.6375055", "0.63680017", "0.6304291", "0.6302578", "0.62869495", "0.62827134", "0.6269447", "0.62516826", "0.6247354", "0.6228233", "0.6224001", "0.6208...
0.8491018
0
upload_file(remote_filepath, remote_filename, local_filedata) remote_filepath: Remote filepath where the file will be uploaded remote_filename: Remote name of the file to be executed ie. boot.ini local_file: File containing the read data for the local file to be uploaded, actual open/read/close done in exploit()
def upload_file(remote_filepath, remote_filename, local_filedata = null) magic_code = "\xdd\xdd" opcode = [6].pack('L') # We create the filepath for the upload, for execution it should be \windows\system32\wbem\mof\<file with extension mof! file = "..\\..\\" << remote_filepath << remote_filename <...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(remote, local)\n write_file(remote, ::File.read(local))\n end", "def upload(remote_path, contents)\n end", "def upload_file local_source, remote_dest, options = {}\n add [local_source, remote_dest], check_file(remote_dest)\n chmod options[:perms], remote_dest if options[:perms]...
[ "0.7708411", "0.74333805", "0.7370586", "0.7252144", "0.70272493", "0.69999075", "0.6986755", "0.6977685", "0.6925003", "0.69215", "0.6871475", "0.686814", "0.6854381", "0.6843439", "0.6840953", "0.67960453", "0.67590165", "0.67536944", "0.6699718", "0.6699118", "0.66800934",...
0.85107166
0
Return True if the workflow is completed If the workflow is completed, then we can return the results via rest api
def workflow_complete? return status == WORKFLOW_COMPLETE || status == UPLOADING_RESULTS_SCORE_RUNNING || status == UPLOADING_RESULTS_SCORE_COMPLETE || status == UPLOADING_RESULTS_VCF_RUNNING || status == UPLOADING_RESULTS_VCF_COMPLETE || status == COMPLETE e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def completed?\n completed\n end", "def completed? # Is task completed? method\n completed_status # True or false\n end", "def complete()\n if @status.status == 'running'\n @logger.info \"Workflow #{self.class.name} has completed successfully\"\n @status.finished\n end\n end...
[ "0.69871557", "0.68729615", "0.68460083", "0.6821065", "0.6821065", "0.6776346", "0.67746854", "0.67564654", "0.670055", "0.66626245", "0.66512233", "0.6635171", "0.6626636", "0.66002434", "0.6598844", "0.6595642", "0.6595642", "0.6580231", "0.6569916", "0.6567461", "0.654173...
0.7996282
0
Check if the whole pedia service is complete
def pedia_complete? return status == COMPLETE end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete?\n status_code == 'OK'\n end", "def complete?\n !pending?\n end", "def complete?\n true\n end", "def complete?\n completed_at && response\n end", "def check_for_completeness\n mark_complete(Time.now) if paid? && received?\n end", "def compl...
[ "0.6847561", "0.68245554", "0.6812771", "0.681015", "0.6793678", "0.6774665", "0.6720847", "0.670837", "0.66802007", "0.6670647", "0.66577137", "0.6652871", "0.66319555", "0.6612134", "0.66067743", "0.65827566", "0.65827566", "0.6579573", "0.65789956", "0.6576879", "0.6539317...
0.7960537
0
POST /candidates POST /candidates.json
def create @candidate = current_user.candidates.new(candidate_params) respond_to do |format| if @candidate.save format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' } format.json { render :show, status: :created, location: @candidate } else form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @candidate = Candidate.new(params[:candidate])\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render json: @candidate, status: :created, location: @candidate }\n else\...
[ "0.6904368", "0.6874747", "0.6840404", "0.6840404", "0.6840404", "0.6840404", "0.6836909", "0.681982", "0.67530876", "0.67346483", "0.6661026", "0.66238564", "0.6538402", "0.64989924", "0.64921826", "0.6466355", "0.6316517", "0.63106084", "0.6291944", "0.627492", "0.62635297"...
0.7399355
0
Create empty database file (for new actions)
def create File.open(@db_file, "w" ) do |file| end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_default_databases()\n # Create subfolder for databases if needed.\n dir = \"./databases\"\n Dir.mkdir(dir) unless Dir.exist?(dir)\n # TODO: sanity check: if db-file exist, create copy first, make sure the\n # name of the copy makes it highly unlikely to match an already existing\n # file, e.g. cur...
[ "0.70180553", "0.70034385", "0.6916622", "0.67767686", "0.6750496", "0.6745915", "0.67454153", "0.6736713", "0.66946566", "0.65877306", "0.65702873", "0.6518181", "0.64506614", "0.641259", "0.6378093", "0.6374572", "0.63407344", "0.6326909", "0.6324662", "0.63072497", "0.6294...
0.8056952
0
Add new resonance to database (if not exists) body_number: number of new body resonance: array of resonance values type: type of resonance
def add(body_number, resonance, type = 1) if !self.check?(body_number) File.open(@db_file, 'a+') do |db| db.puts(body_number.to_s+';'+type.to_s+';'+resonance.inspect) end true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveReceipt\n\t\tcurrent_time = DateTime.now\n\t\tReceipt.create!(:concept => params[:tipofactura],\n\t\t\t\t\t\t\t:subtotal => params[:subtotal],\n\t\t\t\t\t\t\t:total => params[:pagototal],\n\t\t\t\t\t\t\t:iva => params[:iva],\n\t\t\t\t\t\t\t:xml => params[:rawxml],\n\t\t\t\t\t\t\t:users_id => current_user.i...
[ "0.55727786", "0.5414552", "0.54082865", "0.5372017", "0.5306836", "0.52967393", "0.5277086", "0.5268584", "0.52550507", "0.5231991", "0.51906204", "0.5178119", "0.51626855", "0.5160992", "0.51592076", "0.51131296", "0.51053286", "0.5103857", "0.509744", "0.5084057", "0.50640...
0.72508407
0
Find all asteroids in resonances for given interval [start, stop] in body numbers start: start of the interval stop: stop of the interval
def find_between(start, stop) asteroids = Array.new File.open(@db_file, 'r').each do |line| arr = line.split(';') tmp = arr[0].to_i if ((tmp >= start) && (tmp <= stop) ) resonance = arr[1].delete('[').delete(']').split(',').map{|x| x.to_f} asteroids.push(Asteroid.new(arr[0], re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_squares(range)\n\tresult= []\n\ti= 1\n\twhile( i*i < range.end)\n\t\tresult << i*i\n\t\ti+= 1\n\tend\n\treturn result\nend", "def ranges\n x_start, y_start = absolute(0, 0)\n x_end, y_end = absolute(@diameter - 1, @diameter - 1)\n\n [x_start..x_end, y_start..y_end]\n end", "def front_rear_and...
[ "0.57230544", "0.54768497", "0.5457582", "0.54111487", "0.5384382", "0.53677857", "0.5340084", "0.53324497", "0.5291634", "0.52822244", "0.52500904", "0.5245245", "0.5233917", "0.5157799", "0.51520157", "0.5142144", "0.5095644", "0.50856274", "0.5076656", "0.5047769", "0.5044...
0.66536564
0
Find all asteroids in given resonance resonance: resonance array
def find_asteroids_in_resonance(c_resonance) asteroids = Array.new File.open(CONFIG['resonance']['db_file'], 'r').each do |line| arr = line.split(';') resonance = arr[1].gsub!('[', '').gsub!(']', '').split(', ').map{|elem| elem.to_f} if ((resonance[0] == c_resonance[0]) && (resonance[1] == c_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asteroid_collision(asteroids)\n puts '-' * 43\n puts \"asteroid_collision: #{asteroids}\"\n\n return [] if asteroids.empty?\n\n res = []\n\n asteroids.each do |ast|\n puts res.to_s\n\n if res.empty?\n res.push(ast)\n next\n end\n\n temp = res.pop\n\n if (temp < 0) && (ast < 0)\n ...
[ "0.57883084", "0.55295974", "0.54605013", "0.5421821", "0.54022443", "0.5327467", "0.5319856", "0.5249486", "0.517589", "0.5160459", "0.5139191", "0.5129507", "0.5119351", "0.5116142", "0.510882", "0.51056117", "0.50999314", "0.5088872", "0.50880206", "0.5084541", "0.5074132"...
0.73080885
0
define the binary tree data by reading the contents of an array. Overwrites exisitng data if called on an existing tree. Considers an empty tree (root = nil) to not contain 'nil' Assumes all items in the data array are of similar, or compatible, data type.
def build_tree(data_array) @root = nil # overwrites tree, even if array is empty data_array.each_with_index do |data, index| if index == 0 @root = Node.new(data) else set_next_node(data) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_tree_2(data_array)\n root = nil\n \n data_array.each do |elem|\n node = insert_node(root, nil, elem) \n\troot ||= node\n end\n \n root\nend", "def build_tree(arr)\n @root = Node.new(arr.shift)\n arr.each { |data| insert_data(data, @root) }\n end", "def build_tree(array)\n\t\t@root_nod...
[ "0.7098929", "0.70791733", "0.6836663", "0.68199146", "0.67296803", "0.66995484", "0.6675161", "0.65784395", "0.6575065", "0.6522355", "0.64704555", "0.6445603", "0.6444982", "0.6413812", "0.6316787", "0.63120574", "0.63006896", "0.627045", "0.6244209", "0.62240076", "0.62186...
0.76057476
0
Same method as breadth_first_search, but with debugging output that lists the number nodes visited, and the actual order visited. Note: Handles case where data searched for and tree are not the same type
def breadth_first_search_with_debug(data) search_order = [] # For Debug output queue = [@root] node_match = nil match_found = false until queue.empty? || match_found || @root.nil? cur_node = queue.first next_node_value = cur_node.nil? ? "nil" : cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth_first_search_pre_order_with_debug(data)\n search_order = [] # For Debug output\n stack = [@root]\n node_match = nil\n match_found = false\n until stack.empty? || match_found || @root.nil?\n cur_node = stack.pop\n next_node_value = cur_node.n...
[ "0.7347308", "0.6729006", "0.662765", "0.65168625", "0.6457625", "0.6426889", "0.64240444", "0.6405202", "0.6271761", "0.626424", "0.62619036", "0.6259853", "0.6248911", "0.62266546", "0.62127036", "0.6198458", "0.6155168", "0.61439085", "0.6132902", "0.61186343", "0.6074785"...
0.7838283
0
Iterative PreOrder depthfirst search (Parent > Left Child > Right Child) Returns, from the binary tree, the node which contains 'data' Returns 'nil' if no match is found, or if tree is empty (Root = nil). Note: Handles case where data searched for and tree are not the same type
def depth_first_search_pre_order(data) stack = [@root] node_match = nil match_found = false until stack.empty? || match_found || @root.nil? cur_node = stack.pop if cur_node.value == data match_found = true node_match = cur_node end right = cur_node.right_child ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth_first_search(data)\n node = nil\n @list << @root if @root\n\n until @list.empty?\n # Get next node from the stack\n node = @list.pop\n puts \"Visiting node #{node.value}\" if @debug\n break if node.value == data\n # Push each child on the stack, making sure the left chil...
[ "0.8119697", "0.7890585", "0.7884613", "0.78070575", "0.7770379", "0.7769602", "0.77549934", "0.7731764", "0.77259016", "0.77247083", "0.7719595", "0.77187645", "0.76705396", "0.7649889", "0.7642115", "0.7638175", "0.76211554", "0.7618138", "0.75921905", "0.7591433", "0.75731...
0.84809583
0
Same method as depth_first_search_pre_order (iterative), but with debugging output that lists the number nodes visited, and the actual order visited. Note: Handles case where data searched for and tree are not the same type
def depth_first_search_pre_order_with_debug(data) search_order = [] # For Debug output stack = [@root] node_match = nil match_found = false until stack.empty? || match_found || @root.nil? cur_node = stack.pop next_node_value = cur_node.nil? ? "nil" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def breadth_first_search_with_debug(data)\n search_order = [] # For Debug output\n queue = [@root]\n node_match = nil\n match_found = false\n until queue.empty? || match_found || @root.nil?\n cur_node = queue.first\n next_node_value = cur_node.nil? ?...
[ "0.7068602", "0.6529732", "0.6499556", "0.6468799", "0.64642525", "0.64460623", "0.6432414", "0.6365465", "0.63020855", "0.62877464", "0.62871575", "0.6270008", "0.6225689", "0.6198207", "0.6187993", "0.6116962", "0.6110345", "0.6089103", "0.60853326", "0.6075992", "0.6073185...
0.8022904
0
Builds an array of text to print binary tree. Each array position is a row of text that represents one level of the tree. Position 0 is level 0 (toplevel, or Root), Position 1 is level 1, etc... (Uses fact that there are 2^n nodes in each level "n", level 0 = root level) This really only works well for smaller trees. T...
def tree_levels_text_array text_rows = [] num_levels = num_tree_levels # set string size for spacing and "nil" nodes (with default if tree too big) max_length = (num_levels > 4) ? 2 : max_node_value_length blank_node = "_" * max_length # text for nil nodes cell_pad = " " * max_length # text ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_binary_tree\n text = tree_levels_text_array\n puts \"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\"\n puts \"\\nBinary Tree Display:\\n \"\n text.each { |row| puts \"\\n\" + row }\n puts \"\\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\"\n end", "def draw_t...
[ "0.7588622", "0.6982911", "0.64528465", "0.63787144", "0.63711566", "0.6337727", "0.6287795", "0.62840784", "0.62748057", "0.6244077", "0.62364006", "0.6231077", "0.6226879", "0.61911505", "0.61880326", "0.6178838", "0.6178838", "0.6136494", "0.6130256", "0.60903126", "0.6088...
0.83797944
0
Returns an array of all node values in breadthfirst search order. Includes 'nil' nodes, such that the array is a representation of the tree as a complete binary tree (even if the actual binary tree is NOT complete)
def all_node_values_with_nil tree_nodes = [] queue = [@root] queue_all_nil = false # continue adding all child nodes to queue until it contains only nil nodes until queue_all_nil cur_node = queue.first next_value = cur_node.nil? ? nil : cur_node.value tree_nodes << next_value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def breadth_first\n queue = []\n values = []\n queue << @root\n\n while queue.size > 0\n node = queue.shift\n queue << node.left unless node.left.nil?\n queue << node.right unless node.right.nil?\n\n values << node.value\n end\n\n values\n end", "def breadth_first\n ...
[ "0.7739973", "0.7470075", "0.7301787", "0.7235261", "0.7193675", "0.715518", "0.7110694", "0.70759076", "0.7072268", "0.6938686", "0.69078094", "0.6819643", "0.67454106", "0.6710788", "0.66445833", "0.66087765", "0.65865344", "0.6582494", "0.6518734", "0.6475558", "0.6470963"...
0.7706944
1
Returns the number of levels in the binary tree
def num_tree_levels level = 0 num_nodes= all_node_values_with_nil.length # considers tree as 'complete num_nodes_in_full_tree = 2**level until num_nodes_in_full_tree >= num_nodes level += 1 num_nodes_in_full_tree += 2**level end num_tree_levels = level + 1 # (started count at 0)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length\n @tree.length\n end", "def level\n root? ? 0 : ancestors.count\n end", "def leaf_count\n @leaf_count\n end", "def level\n case\n when root? then 0\n when depth_column_could_be_used? then depth\n when parent_association_loaded? then parent.le...
[ "0.7820029", "0.75637954", "0.73583835", "0.73572165", "0.73358834", "0.7318168", "0.7289695", "0.72789776", "0.7276516", "0.72135735", "0.713046", "0.7125948", "0.7125948", "0.7102207", "0.70956147", "0.70953685", "0.7085641", "0.70844376", "0.7083465", "0.70783395", "0.7041...
0.8804443
0
sums the series: basem, base(m+1)...base(n1), base(n) Assumes exponents are positive integers, and first_exp 2^0 + 2^1 + 2^2 + 2^3 Returns base^exp, if first_exp = second_exp (trivial case) Returns 'nil' if first_exp > second_exp, or exponents not positivbe integers
def sum_base_to_exponent_series(base, first_exp, second_exp) sum = 0 if (first_exp.is_a?(Integer) && second_exp.is_a?(Integer) && first_exp <= second_exp && first_exp >= 0 && second_exp >= 0) if first_exp == second_exp sum = base**first_exp else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_base_2_number(pow = 1)\n (2**pow).to_s.split('').map(&:to_i).inject(:+)\nend", "def rec_exp_1(base, power)\nend", "def rec_exp_2(base, power)\nend", "def power_digit_sum(base, exponent)\n\t(2 ** 1000).to_s.split(\"\").inject(0) {|sum, n| sum + n.to_i}\nend", "def exp1(base, n)\n return 1 if n =...
[ "0.6745065", "0.6632199", "0.66135454", "0.6524792", "0.6473241", "0.64234036", "0.63033384", "0.62924904", "0.6276634", "0.62561995", "0.6239749", "0.6203269", "0.6167198", "0.6165442", "0.6144075", "0.61336285", "0.61278594", "0.6127639", "0.61219263", "0.6108432", "0.61023...
0.8149083
0
returns the array of letters, which are left to guess
def letters_to_guess @letters.map do |letter| if @user_guesses.include?(normalize_letter(letter)) letter else nil end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_letters\n guess_array = []\n @current_word.each do\n guess_array << \"_\"\n end\n return guess_array\n end", "def guessed_letters()\n guessed = $bucket.join(\" \") # return a string of guessed letters\nend", "def check_guess(letter)\n\t\tret = []\n\t\tif(@secret_word.include?(lett...
[ "0.83717734", "0.76092356", "0.7403644", "0.73906", "0.7341107", "0.7259141", "0.7250252", "0.71186", "0.7107187", "0.69222337", "0.6911611", "0.6904964", "0.6879654", "0.68753994", "0.6873055", "0.68552655", "0.6841495", "0.6822786", "0.68145984", "0.68145984", "0.67986995",...
0.79954636
1
method plays the letter, chosen by user it puts the letter into the array of user guesses
def play!(letter) if !over? && !@user_guesses.include?(letter) @user_guesses << normalize_letter(letter) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_players_letter()\n letter= @player1.give_letter()\n if @hiddenword1.determine_if_correct_letter_given(letter)\n p @hiddenword1.obscured_word\n @guessed_letters.push(letter)\n else\n @player1.lives-=1\n p \"Please try again\"\n p @guessed_letters\n p @hiddenword1....
[ "0.7819657", "0.74802244", "0.74758935", "0.7473382", "0.7470513", "0.7463379", "0.7428028", "0.74274343", "0.742174", "0.7416329", "0.7352845", "0.73427355", "0.7332662", "0.73032117", "0.7283592", "0.72802657", "0.72511613", "0.7247099", "0.72414386", "0.7233034", "0.722753...
0.81299454
0
the method merges the letters to the word
def word @letters.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertions\n new_words = []\n @words.each do |word|\n @word = word || '' \n (length + 1).times do |i|\n ('a'..'z').each { |c| new_words << \"#{@word[0...i]}#{c}#{@word[i..-1]}\" }\n end\n end\n new_words\n end", "def ordered_letters\n @word.chars.s...
[ "0.6957881", "0.6812398", "0.6796432", "0.6794042", "0.6770985", "0.67527235", "0.67447853", "0.6704794", "0.66879094", "0.6662192", "0.65762955", "0.6547677", "0.65325296", "0.648715", "0.64836806", "0.6450129", "0.6446887", "0.64426637", "0.64330477", "0.643056", "0.6428144...
0.72019935
0
Task body for the :docs_debug task
def do_docs_debug( task, args ) self.prompt.say( "Docs are published to:", color: :bright_green ) if ( publish_url = self.publish_to ) self.prompt.say( self.indent(publish_url, 4) ) else self.prompt.say( self.indent("n/a"), color: :bright_yellow ) end self.prompt.say( "\n" ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc_task; end", "def define_debug_tasks\n\t\ttask( :base_debug ) do\n\t\t\tself.output_documentation_debugging\n\t\t\tself.output_project_files_debugging\n\t\t\tself.output_dependency_debugging\n\t\tend\n\n\t\ttask :debug => :base_debug\n\tend", "def rdoc_task_description\n 'Build RDoc HTML files'\n en...
[ "0.70848274", "0.65630335", "0.6512884", "0.640787", "0.6406908", "0.6014486", "0.59714633", "0.59714633", "0.5910287", "0.5891495", "0.5885187", "0.5845575", "0.58450913", "0.5750026", "0.57377464", "0.571465", "0.57077557", "0.5703094", "0.5573421", "0.5564845", "0.55494595...
0.6979061
1
Sets Socket options to allow for multicasting. If ENV["RUBY_TESTING_ENV"] is equal to "testing", then it doesn't turn off multicast looping.
def setup_multicast_socket set_membership(IPAddr.new(MULTICAST_IP).hton + IPAddr.new('0.0.0.0').hton) set_multicast_ttl(@ttl) set_ttl(@ttl) unless ENV["RUBY_TESTING_ENV"] == "testing" switch_multicast_loop :off end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def socket\n @socket ||= UDPSocket.new.tap do |socket|\n socket.setsockopt Socket::IPPROTO_IP,\n Socket::IP_ADD_MEMBERSHIP,\n multicast_group\n socket.setsockopt Socket::IPPROTO_IP,\n Socket::IP_MULTICAST_TTL,\n ...
[ "0.6720747", "0.6434258", "0.6337197", "0.6265162", "0.61841965", "0.5984235", "0.5704508", "0.5697548", "0.566056", "0.5625054", "0.5582187", "0.55817896", "0.55669034", "0.54880464", "0.5358894", "0.5306145", "0.5298759", "0.5297812", "0.5286206", "0.5280641", "0.5195248", ...
0.75971866
0
The MD5 digest of the response body
def md5 headers['Content-MD5'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def md5\n return self.body_data.md5\n end", "def md5_of_body\n data[:md5_of_body]\n end", "def digest\n Digest::MD5.digest(blob)\n end", "def md5\n render :json => { :hash => Digest::MD5.hexdigest(md5_query.to_s) }\n end", "def md5\n @gapi[\"md5Hash\"]\n end"...
[ "0.84057665", "0.8236111", "0.74144596", "0.72782755", "0.7249975", "0.71416867", "0.70871454", "0.70627", "0.7057871", "0.6931921", "0.6869169", "0.6869169", "0.6836221", "0.6742051", "0.67413205", "0.6737911", "0.6641898", "0.6584662", "0.65782964", "0.6554568", "0.6496937"...
0.83577657
1
Find all existing volumes that belong to this cluster and cram their metadata into the existing logical volume
def adopt_existing_volumes! Volume.all.each do |ec2_vol| next if ec2_vol.deleted? || ec2_vol.deleting? instance = Instance.find(ec2_vol.attached_instance_id) ; p instance ; next unless instance cluster_node_id = instance.get_cluster_node_id(self.name) ; next unless cluster_node_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_volumes\n volumes = get(\"cloud-instances/#{guid}/volumes\")[\"volumes\"] || []\n\n volumes.map do |volume|\n get_volume(volume[\"volumeID\"])\n end\n end", "def retrieve_volumes\n dbg { \"retrieving #{pool_info}, #{hv_info}\" }\n\n volumes = pool.list_a...
[ "0.6234512", "0.61205035", "0.59852165", "0.5910362", "0.58662003", "0.58459437", "0.5731675", "0.57041305", "0.5700364", "0.5600427", "0.5520195", "0.5516698", "0.5514974", "0.54641396", "0.54414856", "0.544014", "0.5434479", "0.54320407", "0.5425922", "0.5424895", "0.541379...
0.73872954
0
Automatically embeds the RPXNow Javascript once.
def has_rpxnow return if defined?(@has_rpxnow) && @has_rpxnow rpxnow_js = "#{request.ssl? ? 'https://' : 'http://static.'}rpxnow.com/js/lib/rpx.js" has_js rpxnow_js @has_rpxnow = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def js_reload\n riak_admin 'js_reload'\n end", "def inject_js; end", "def google_ajax_slideshow_scripts\n return '' if defined?(@google_ajax_slideshow_scripts_included)\n @google_ajax_slideshow_scripts_included = true\n '<script src=\"http://www.google.com/uds/solutions/slideshow/gfslideshow.j...
[ "0.63585854", "0.6316609", "0.62955207", "0.6079166", "0.6002843", "0.59913486", "0.58566576", "0.58550465", "0.5832863", "0.5830729", "0.58221483", "0.5816108", "0.575655", "0.57521373", "0.57018924", "0.56737095", "0.5645401", "0.56193215", "0.5561888", "0.55011255", "0.549...
0.6403021
0
Verifies that product is a common multiple of every number up to num
def check_number(num, product) result = true (1..num).each do |number| if product % number != 0 result = false break end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_perfect(num)\n multiples_sum = 0\n\n (1..num / 2).each do |i|\n multiples_sum += i if (num % i).zero?\n break false if multiples_sum > num # for performance issues\n end\n\n multiples_sum == num\nend", "def multiple_of(n, x)\n x.modulo(n).zero?\n end", "def multiple?(num, bas...
[ "0.7245897", "0.7108705", "0.6874142", "0.68720376", "0.6817972", "0.6805568", "0.6805244", "0.67951924", "0.67475176", "0.6743969", "0.67405343", "0.67225254", "0.6716327", "0.67162025", "0.67034566", "0.6678607", "0.66688037", "0.6667505", "0.6648071", "0.6639418", "0.66376...
0.7446986
0
Returns the smallest common multiple of all numbers 1num
def find_smallest_common_multiple(num) primes = find_primes_under(num) product = factorial(num) counter = 0 while counter < primes.size while check_number(num, product) product = product / primes[counter] end product = product * primes[counter] counter += 1 end product end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smallest_multiple(num)\n\t(2..num).inject(1) do |mul, i|\n\t\tif mul%i == 0\n\t\t\tmul\n\t\telse\n\t\t\t(i-1).downto(2) do |j| \n\t\t\t\tif i%j == 0\n\t\t\t\t\ti /= j\n\t\t\t\t\tbreak \n\t\t\t\tend\n\t\t\tend\n\t\t\tmul *= i\n\t\tend\n\tend\nend", "def smallest_common_multiple(n)\n\n\treturn 0\nend", "def ...
[ "0.8038764", "0.8010712", "0.79202425", "0.7871839", "0.7845951", "0.77993315", "0.77966326", "0.7774211", "0.77692664", "0.7746873", "0.77313554", "0.77013797", "0.7685281", "0.7672937", "0.76618665", "0.7654444", "0.76053", "0.7604434", "0.7579523", "0.75754476", "0.7559644...
0.8328037
0
Open the TDB file. Accepts a URI and list of open modes: db = TokyoModel::Adapters::File.new("file:///tmp/database.tdb", :read, :write, :create, :trunc)
def initialize(uri, *args) @db = TokyoCabinet::TDB::new @db.open(uri.path, args.empty? ? File.default_open_mode : File.open_mode(*args)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open\n close\n @db = SQLite3::Database.new(@options[:filename])\n self\n end", "def open(options)\n @db ||= options[:connection]\n return @db if @db\n\n if options[:path] && !File.exist?(options[:path])\n @db = SQLite3::Database.new(options[:path])\n setup\n ...
[ "0.6886159", "0.6755556", "0.66981125", "0.6550848", "0.6532551", "0.6516999", "0.64219695", "0.6117631", "0.6093412", "0.6080202", "0.60689014", "0.60628444", "0.60472375", "0.6038953", "0.6009289", "0.5993715", "0.5974676", "0.59687597", "0.5957488", "0.5949796", "0.5936086...
0.76090646
0
Takes an array of open mode symbols and returns the mode number: open_mode(:read, :write, :sync) 3 open_mode(:read, :write, :sync) 67
def open_mode(*modes) modes.inject(0) { |memo, obj| memo | OPEN_MODES[obj.to_sym].to_i } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modes\n mode_codes.keys\n end", "def modes\n fix_mode.modes\n end", "def get_modes\n @_modes\n end", "def mode\n \"%o\" % (self.stat(:mode) & 007777)\n end", "def mode(io) \n readable, writable = try_handle(io, \"mode\")\n\n case\n when readable && writabl...
[ "0.7007333", "0.63937294", "0.63889694", "0.62738407", "0.62436235", "0.61912835", "0.61912835", "0.6170272", "0.60947335", "0.6063899", "0.605558", "0.6018973", "0.59452987", "0.59145707", "0.58938867", "0.58720183", "0.58720183", "0.58720183", "0.58720183", "0.5861154", "0....
0.81249195
0
send a pdu, receives a pdu
def send(pdu) log { "sending request..." } log(level: 2) { pdu.to_hex } encoded_request = pdu.to_der log { Hexdump.dump(encoded_request) } encoded_response = @transport.send(encoded_request) log { "received response" } log { Hexdump.dump(encoded_response) } response_pdu =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_pdu(pdu)\n case pdu\n when Pdu::DeliverSm\n write_pdu(Pdu::DeliverSmResponse.new(pdu.sequence_number))\n logger.debug \"ESM CLASS #{pdu.esm_class}\"\n if pdu.esm_class != 4\n # MO message; invoke MO proc\n @mo_proc.call(pdu.source_addr, pdu.destination_addr, pdu.short...
[ "0.62173456", "0.5727398", "0.5652252", "0.556148", "0.55610675", "0.5502294", "0.5496475", "0.54655826", "0.5443902", "0.54054236", "0.53878194", "0.5355966", "0.53243285", "0.5301934", "0.52953327", "0.5294901", "0.52764934", "0.52762645", "0.5273468", "0.5272399", "0.52670...
0.65175533
0
Deploys the given app_id on the given instance_id in the given stack_id Blocks until AWS confirms that the deploy was successful Returns a Aws::OpsWorks::Types::CreateDeploymentResult
def deploy(stack_id:, app_id:, instance_id:, revision:, deploy_timeout: 1800) # App IDs can be passed as a CSV to deploy multiple apps in the same stack app_ids = app_id.split(",") deploy_id = [] app_ids.each do |id| # Update the branch/revision to the given parameter, if any. unless revisi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_application(app_id, options = {:comment => nil, :migrate => false})\n json_command = JSON.dump(:command => 'deploy', \n :comment => options[:comment], \n :migrate => options[:migrate])\n http_post_request(Scalarium.applications_url+\"...
[ "0.6109779", "0.60810125", "0.60790414", "0.5944442", "0.5917404", "0.57502055", "0.56585085", "0.56419224", "0.5638102", "0.56327844", "0.5585359", "0.55598646", "0.5558177", "0.5551345", "0.549737", "0.5492338", "0.5491895", "0.54425794", "0.5421702", "0.54156965", "0.53469...
0.7538104
0
Polls Opsworks for timeout seconds until deployment_id has completed
def wait_until_deploy_completion(deployment_id, timeout) started_at = Time.now Timeout::timeout(timeout) do @opsworks_client.wait_until( :deployment_successful, deployment_ids: [deployment_id] ) do |w| # disable max attempts w.max_attempts = nil end end en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wait_until_deployed(deployment_id, timeout)\n opsworks_client.wait_until(:deployment_successful, deployment_ids: [deployment_id]) do |w|\n w.before_attempt do |attempt|\n puts \"Attempt #{attempt} to check deployment status\".light_black\n end\n w.interval = 10\n w.ma...
[ "0.74300927", "0.69848865", "0.6737966", "0.6208974", "0.612199", "0.60591793", "0.5990514", "0.58479667", "0.58325887", "0.57840073", "0.57760847", "0.5765682", "0.57396877", "0.57095104", "0.5659073", "0.56037563", "0.55957127", "0.55913246", "0.5573044", "0.5542815", "0.55...
0.7276278
1
Takes a Aws::OpsWorks::Types::Instance Detaches the provided instance from all of its load balancers Returns the detached load balancers as an array of Aws::ElasticLoadBalancing::Types::LoadBalancerDescription Blocks until AWS confirms that all instances successfully detached before returning Does not wait and instead ...
def detach_from_elbs(instance:) unless instance.is_a?(Aws::OpsWorks::Types::Instance) fail(ArgumentError, "instance must be a Aws::OpsWorks::Types::Instance struct") end all_load_balancers = @elb_client.describe_load_balancers .load_balancer_descriptions load_balancers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detach_from(load_balancers, instance)\n check_arguments(instance: instance, load_balancers: load_balancers)\n\n load_balancers.select do |lb|\n matched_instance = lb.instances.any? do |lb_instance|\n instance.ec2_instance_id == lb_instance.instance_id\n end\n\n if matched_instance &...
[ "0.7349848", "0.64322937", "0.5938487", "0.55990577", "0.55990577", "0.55371326", "0.5396752", "0.5392787", "0.5200122", "0.5149061", "0.51062137", "0.50860155", "0.50319856", "0.5029228", "0.5029228", "0.5000057", "0.4997184", "0.49925008", "0.4931991", "0.48914087", "0.4886...
0.8192437
0
Accepts load_balancers as array of Aws::ElasticLoadBalancing::Types::LoadBalancerDescription and instances as a Aws::OpsWorks::Types::Instance Returns only the LoadBalancerDescription objects that have the instance attached and should be detached from Will not include a load balancer in the returned collection if the s...
def detach_from(load_balancers, instance) check_arguments(instance: instance, load_balancers: load_balancers) load_balancers.select do |lb| matched_instance = lb.instances.any? do |lb_instance| instance.ec2_instance_id == lb_instance.instance_id end if matched_instance && lb.instance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detach_from_elbs(instance:)\n unless instance.is_a?(Aws::OpsWorks::Types::Instance)\n fail(ArgumentError, \"instance must be a Aws::OpsWorks::Types::Instance struct\")\n end\n\n all_load_balancers = @elb_client.describe_load_balancers\n .load_balancer_descriptions\n\n ...
[ "0.7493718", "0.6402033", "0.6297438", "0.60137606", "0.57810754", "0.56451625", "0.5547521", "0.5476744", "0.54553556", "0.54553556", "0.5338663", "0.53209645", "0.5208643", "0.50709707", "0.50377965", "0.502718", "0.4977642", "0.49732804", "0.4951387", "0.49166682", "0.4907...
0.7582588
0
Takes an instance as a Aws::OpsWorks::Types::Instance and load balancers as an array of Aws::ElasticLoadBalancing::Types::LoadBalancerDescription Attaches the provided instance to the supplied load balancers and blocks until AWS confirms that the instance is attached to all load balancers before returning Does nothing ...
def attach_to_elbs(instance:, load_balancers:) check_arguments(instance: instance, load_balancers: load_balancers) if load_balancers.empty? log("No load balancers to attach to") return {} end @lb_wait_params = [] registered_instances = {} # return this load_balancers.each do |lb| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach_to_elb(instance, elb_name, subnet = nil)\n begin\n @log.info \"\"\n @log.info \"Adding to ELB: #{elb_name}\"\n elb = AWS::ELB.new\n AWS.memoize do\n unless subnet\n # Build list of availability zones for any existing instances\n zones = { }...
[ "0.66799253", "0.6596726", "0.6403054", "0.6080672", "0.59530383", "0.59022284", "0.5899842", "0.5899842", "0.5851962", "0.5830692", "0.5830109", "0.5732898", "0.56988794", "0.5676722", "0.5660909", "0.56561345", "0.5622698", "0.5528505", "0.5520164", "0.5405592", "0.53571993...
0.82129145
0
The value of the next element in the Sequence. The sequence goes back to the first element if there are no more elements.
def next if @elements and not @elements.empty? @index = (@index + 1) % @elements.length element = @elements[@index] value = value_of(element) @element, @value = element, value end @value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next\r\n next_values[0]\r\n end", "def next\n next? ? @current + 1 : nil\n end", "def next\n @next && @next.value\n end", "def next()\n result = current\n @index += 1\n @got_next_element = false\n @next_element = nil\n result\n end", "def ...
[ "0.78649074", "0.7677277", "0.7610153", "0.7523153", "0.74460936", "0.74261945", "0.7173325", "0.7046524", "0.7042904", "0.70228416", "0.6932574", "0.6907588", "0.690667", "0.6889075", "0.68485904", "0.6822495", "0.6812803", "0.680058", "0.6792862", "0.67672247", "0.67133975"...
0.8077969
0
def set_variant return unless params[:variant].in?(%w(phone tablet desktop)) request.variant = params[:variant].to_sym end o tambien se puede por medio del user_agent:
def set_variant # request.variant = :phone if request.user_agent.include?('iPhone') # o con la gema browser request.variant = :phone if browser.device.mobile? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_request_variant\n request.variant = :mobile if request.user_agent =~ /android|Android|blackberry|iphone|ipod|iemobile|mobile|webos/\n request.variant = :android_app if request.user_agent =~ /AndroidApp/\n puts \"--------------\"+request.variant.to_s+\"--------------\"\n end", "def set_variant\n...
[ "0.8481653", "0.83958817", "0.7845817", "0.6666438", "0.645645", "0.645645", "0.645645", "0.645645", "0.6431474", "0.6211851", "0.6140318", "0.6060406", "0.6022627", "0.59794176", "0.5893816", "0.58839273", "0.58839273", "0.5853466", "0.58247656", "0.5782216", "0.5780708", ...
0.8770161
0
Add a new Recipe options Params for creating the recipe label label for the recipe description description for the recipe compatible_with recipe compatiblity (windows or unix) script_type specify script type for windows compatible (bat, vps, powershell) Returns a hash
def create(options = {}) optional = [:description, :compatible_with, :script_type ] params.required(:label).accepts(optional).validate!(options) response = request(:post, "/recipes.json", default_params(options)) response['recipe'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_params\n params.require(:script).permit(:id, :name, :description, :definition, :long_text, :platform, :industry, :solution_type_id, :script_file, :pdf_file, :complexity, :status_id, requirements_attributes: [:id, :script_id, :requirement])\n end", "def script_type\n case @script.type\n ...
[ "0.5260635", "0.5225325", "0.5150821", "0.5094689", "0.49993294", "0.49987155", "0.49897885", "0.49472606", "0.4925912", "0.4893017", "0.4848319", "0.48476556", "0.48109058", "0.47579283", "0.47567686", "0.4753889", "0.4753889", "0.47527644", "0.47507527", "0.4748219", "0.473...
0.54346275
0
Edit a Recipe id ID of the recipe options Params for creating recipe, see 'create' method Returns a Hash.
def edit(id, options = {}) optional = [:label, :description, :compatible_with, :script_type ] params.accepts(optional).validate! options request(:put, "/recipes/#{id}.json", default_params(options)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\t@recipe = Recipe.find(params[:id])\n\tend", "def set_recipe\n @recipe = Recipe.find params[:id]\n end", "def edit\n #@recipe = Recipe.find(params[:id])\n \n \n end", "def edit\n @recipe = Recipe.find(params[:id])\n end", "def edit\n @page_title = \"Edit Recipe\"\n ...
[ "0.6942881", "0.6904631", "0.69043124", "0.687355", "0.67433167", "0.67433167", "0.67359465", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", ...
0.8046158
0
Delete a Recipe id ID of the recipe Returns a Hash.
def delete(id) request(:delete, "/recipes/#{id}.json") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end", "def destroy\n\t\t\t\trecipe = get_recipe_by_id(params[:id])\n\t\t\t\trecipe.destroy\n\t\t\t\trender json: {status: 'SUCCESS', message: 'Deleted recipe', data: recipe}, statu...
[ "0.7345936", "0.7117749", "0.70913756", "0.7004412", "0.69768625", "0.6968033", "0.6870223", "0.6793253", "0.66248935", "0.6618518", "0.6546741", "0.6417568", "0.63943815", "0.63507", "0.63507", "0.63507", "0.63507", "0.63507", "0.6343963", "0.6295678", "0.62717605", "0.626...
0.78809714
0
Gets all rules that respond to a char in a given state.
def rules_for(state, char) rules.select { |rule| rule.applies_to?(state, char) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule_for(state, character)\n self.rules.detect{ |rule| rule.applies_to?(state, character) } #detect == find\n end", "def follow_rules_for(state, char)\n rules_for(state, char).map(&:follow)\n end", "def rules_for(configuration, character)\n # note that it is select (filter), not detect (fi...
[ "0.7075871", "0.6970317", "0.6756823", "0.6713443", "0.59350425", "0.57529193", "0.55863184", "0.55824673", "0.5424139", "0.5417562", "0.5357804", "0.53440744", "0.5255588", "0.52198327", "0.51960623", "0.51960623", "0.5167096", "0.51596755", "0.5098893", "0.5073545", "0.5064...
0.8715351
0
Support functions Run the jekyll command, with arguments (symbols are long options, hashes are long options with arguments)
def jekyll(*directives) directives.map! do |x| case x when Symbol "--#{x}" when Hash x.map { |k, v| "--#{k}=#{v}" }.join(' ') else x end end sh "jekyll #{directives.join(' ')}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jekyll(options = '')\n system(\"bin/jekyll #{options}\")\nend", "def jekyll(opts = '')\n if ENV['dev']=='on'\n dev = ' --plugins=_plugins,_plugins-dev'\n else\n dev = ''\n end\n sh \"bundle exec jekyll #{opts}#{dev} --trace\"\nend", "def build_site\n sh \"bundle exec jekyll bu...
[ "0.80927277", "0.7410157", "0.6836247", "0.6233287", "0.6165086", "0.6102838", "0.60718995", "0.5725411", "0.566027", "0.55965084", "0.55664337", "0.55242765", "0.5434422", "0.5385596", "0.53424096", "0.53060234", "0.52977204", "0.5263145", "0.5238425", "0.52285326", "0.52063...
0.7589127
1
GET /passwordrecovery/recover/:token The page where the user lands coming from the password recovery email
def recover @user = User.find_by password_reset_digest: params[:token] if !@user flash[:alert] = 'Invalid link' redirect_to '/password-recovery/remind-password' return end @token = params[:token] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_recover\n redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission\n if user = LatoCore::Superuser.find_by(email: params[:email].downcase)\n # genero il codice da salvare come session code\n code = \"RECPSW-#{SecureRandom.urlsafe_base64}\"\n # ...
[ "0.7462621", "0.7343085", "0.7154333", "0.7150844", "0.70899653", "0.6937087", "0.69230616", "0.6896216", "0.6651413", "0.6637898", "0.66059184", "0.6569683", "0.6552999", "0.65236306", "0.6519975", "0.6487537", "0.6470082", "0.6465917", "0.6448562", "0.64428467", "0.6429536"...
0.792576
0
Checks if current recipient able to receive freeform text
def able_to_send_freeform_text? last_inbound_message = messages.inbound.last return false unless last_inbound_message last_inbound_message.created_at + 24.hours >= Time.zone.now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipient_available?(current_recipient)\n if current_recipient.nil?\n puts \"No current recipient selected.\"\n else\n puts \"What message would you like to send?\"\n current_recipient.send_message(gets.chomp)\n end\nend", "def receive_recipient rcpt\n true\n end", "def receive_reci...
[ "0.67116827", "0.6551628", "0.6551628", "0.6551628", "0.639441", "0.6319106", "0.6124252", "0.61182696", "0.60949963", "0.6088107", "0.60835266", "0.6025747", "0.5957783", "0.59218585", "0.5919245", "0.59189445", "0.5888836", "0.58698213", "0.58676255", "0.5857659", "0.585522...
0.66995835
1
Checks for messaging platform based on their `number` column whatsapp 'whatsapp:+60123456789' sms '+60123456789' messenger 'messenger:123456789'
def platform case number when /whatsapp/ 'whatsapp' when /messenger/ 'messenger' else 'sms' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_extension_phone_number_detect_sms_feature()\n begin\n endpoint = \"/restapi/v1.0/account/~/extension/~/phone-number\"\n resp = $platform.get(endpoint)\n for record in resp.body['records'] do\n for feature in record['features'] do\n if feature == \"SmsSender\"\n # If user has...
[ "0.6133845", "0.58666766", "0.5720551", "0.56871295", "0.5615994", "0.5611103", "0.5572347", "0.55648994", "0.55512226", "0.5486782", "0.5485437", "0.5461072", "0.54113466", "0.53517085", "0.53516674", "0.53315014", "0.52528274", "0.5250304", "0.52291155", "0.5209644", "0.519...
0.68543506
0
POST /stuk_todo_tasks POST /stuk_todo_tasks.json
def create @stuk_todo_task = current_user.stuk_todo_tasks.new(stuk_todo_task_params) respond_to do |format| if @stuk_todo_task.save format.html { redirect_to @stuk_todo_task, notice: 'Stuk todo task was successfully created.' } format.json { render :show, status: :created, location: @stuk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end", "def create\n @todo_task = TodoTask.new(params[:todo_task])\n\n respond_to do |format|\n if @todo_task.save\n format.html { redirect_to @todo_task, notice: 'Todo task...
[ "0.72900796", "0.71089965", "0.70728654", "0.7051348", "0.70033", "0.6977859", "0.6906729", "0.6902627", "0.6896549", "0.68596447", "0.68373394", "0.6836748", "0.6828704", "0.68118685", "0.680485", "0.6779569", "0.67759764", "0.67681193", "0.6761551", "0.6726276", "0.67132014...
0.7319497
0
Checks the passedin password against the saved admin salt and hash.
def admin_authenticate?(password) salt = get_setting(:admin_pass_salt, "") hash = get_setting(:admin_pass_hash, "") hash == BCrypt::Engine.hash_secret(password, salt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_password_hash\n\n evaluated_password_e = Admin.get_encrypted_password(@password, @login_salt_d)\n return incorrect_login_error('am_l_pa_5') unless (evaluated_password_e == @admin.password)\n\n success\n end", "def password_match?(password=\"\")\n hashed_password == AdminUse...
[ "0.769719", "0.7437058", "0.7437058", "0.741785", "0.7398052", "0.72857696", "0.7268918", "0.7190211", "0.71522725", "0.7132809", "0.7114226", "0.70729923", "0.70544493", "0.7022992", "0.69982386", "0.6994294", "0.69464236", "0.6921369", "0.6857899", "0.6852244", "0.6849744",...
0.7565166
1
Saves all of the settings using the passedin params.
def save(params) save_admin_pass(params[:admin_pass]) save_setting(:site_name, params[:site_name]) save_setting(:navbar_bg_color, params[:navbar_bg_color]) save_setting(:navbar_font_color, params[:navbar_font_color]) save_setting(:navbar_border_color, params[:navbar_border_color]) save_set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_settings\n (params[:setting] || []).each do |key, val|\n setting = Setting.find_by_key(key)\n setting = Setting.create!(key: key) unless setting\n if val.is_a?(ActionDispatch::Http::UploadedFile) # image setting value\n setting.update(image: val)\n else # text set...
[ "0.7590652", "0.73559767", "0.6841639", "0.6654382", "0.65896815", "0.65478325", "0.6514156", "0.6493019", "0.64362705", "0.6330308", "0.63055104", "0.6266877", "0.6252989", "0.6231826", "0.61786515", "0.6168354", "0.6162905", "0.6148051", "0.6091877", "0.60746914", "0.606607...
0.7825897
0
Gets the value of the setting with the passedin key, otherwise, default.
def get_setting(key, default) setting = Setting.where(key: key).first setting && !setting.value.blank? ? setting.value : default end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_setting_value(key, hash_setting = nil)\n hash_setting ||= get_setting\n \n hash_setting[key] || self.class.default_value(key)\n end", "def get(key)\n settings.find_by_key(key).try(:value)\n end", "def [](key)\n setting_obj = setting(key)\n setting_obj ? setting_obj.value : n...
[ "0.82567984", "0.779489", "0.77867734", "0.7385333", "0.7326429", "0.73019946", "0.72514933", "0.72428375", "0.7231807", "0.7206626", "0.72030574", "0.7148321", "0.7117809", "0.7058934", "0.7033194", "0.70088047", "0.7007596", "0.69341326", "0.69001806", "0.6856759", "0.68560...
0.82835025
0
Saves the settings with the passedin key and val.
def save_setting(key, val) # Check for nil, since unchecked checkboxes don't send a value. # Check for whether a boolean, since .blank? returns true for false. # Check for a blank string. if val == nil || !!val == val || !val.blank? setting = Setting.where(key: key).first_or_create set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_settings\n (params[:setting] || []).each do |key, val|\n setting = Setting.find_by_key(key)\n setting = Setting.create!(key: key) unless setting\n if val.is_a?(ActionDispatch::Http::UploadedFile) # image setting value\n setting.update(image: val)\n else # text set...
[ "0.65049446", "0.64630955", "0.6442019", "0.6379647", "0.6346737", "0.6198693", "0.6194307", "0.6174642", "0.6109541", "0.6098306", "0.6091826", "0.6089523", "0.60892266", "0.6073278", "0.6063142", "0.6054539", "0.6030947", "0.5986636", "0.59849757", "0.5968679", "0.5918444",...
0.7639786
0
Saves the admin password salt, hash, and whether the password exists.
def save_admin_pass(val) if val != ADMIN_PASS pass_salt = BCrypt::Engine.generate_salt pass_hash = BCrypt::Engine.hash_secret(val, pass_salt) save_setting(:admin_pass_salt, pass_salt) save_setting(:admin_pass_hash, pass_hash) save_setting(:is_admin_pass, true) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_password\n @admin.password = Admin.get_encrypted_password(@new_password, @login_salt_d)\n @admin.save!\n end", "def create_hashed_password\n\t\t#if :password has a value\n\t\t#\t-indicates we want to update the passowrd\n\t\t#\t-before_save: encrypt value with salt\n\t\t#\t-Save has...
[ "0.69242066", "0.6907935", "0.6779018", "0.6631843", "0.651768", "0.65106", "0.648056", "0.6426778", "0.6382841", "0.6331234", "0.6310939", "0.63054407", "0.6302917", "0.63028574", "0.62918323", "0.62731266", "0.62249255", "0.6209997", "0.61880714", "0.6187574", "0.6185089", ...
0.7605614
0
the recommendations made by some user
def user recommendations 'user' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recommendations\n check_preference_setup \n check_last_played_time\n add_personality_recommendations\n\n @recommendations\n end", "def recommended_by_current_user\n if current_user\n extract = Csvarchive.find(params[:id])\n e_rec = extract.recommendations\n u_rec = current_user...
[ "0.781104", "0.764283", "0.7367639", "0.7309262", "0.7185015", "0.71237814", "0.70941293", "0.7024433", "0.69872284", "0.6975372", "0.6952374", "0.6946477", "0.69447094", "0.69369817", "0.68893766", "0.6883884", "0.6842288", "0.68398297", "0.68184286", "0.6811445", "0.6805568...
0.7848443
0
the recommendations made about some location
def location recommendations 'location' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recommendations\n check_preference_setup \n check_last_played_time\n add_personality_recommendations\n\n @recommendations\n end", "def recommendation\n return @recommendation\n end", "def recommendations\n @recommendations = []\n @connection.response_data.map do...
[ "0.6895317", "0.64271694", "0.61626726", "0.61371845", "0.6095805", "0.6088224", "0.6049037", "0.60365665", "0.6002279", "0.5947189", "0.59232193", "0.5922127", "0.5903396", "0.5897451", "0.5890264", "0.58837897", "0.58737075", "0.5868922", "0.5841194", "0.5817728", "0.579175...
0.7703625
0
The cached formatter instance. If there's none, one will be created.
def formatter @formatter ||= Formatters::Default.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @formatter = method(:default_formatter)\n end", "def formatter\n @formatter.formatter\n end", "def formatter()\n @formatter\n end", "def formatter=(formatter)\n @formatter =\n if formatter.nil?\n respond_to?(:call) ? self : default_formatter\n ...
[ "0.6976056", "0.66532505", "0.6622581", "0.65775734", "0.6514169", "0.6495601", "0.64901483", "0.64893776", "0.64805293", "0.6469977", "0.63685036", "0.6346911", "0.6346911", "0.6291584", "0.62146187", "0.6171398", "0.6147943", "0.61447847", "0.6122132", "0.6077509", "0.60711...
0.7393584
0
GET /gigapans GET /gigapans.json
def index @gigapans = Gigapan.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end", "def index\n @gakkas = Gakka.all\n end", "def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"...
[ "0.7172506", "0.6659971", "0.6642913", "0.6595735", "0.65871245", "0.65791607", "0.6527109", "0.64854366", "0.64815277", "0.64590824", "0.6453193", "0.63492286", "0.63449687", "0.6342909", "0.6331624", "0.62757236", "0.6259193", "0.62442195", "0.62335265", "0.6215515", "0.620...
0.74949664
0
POST /gigapans POST /gigapans.json
def create @gigapan = Gigapan.new(gigapan_params) respond_to do |format| if @gigapan.save format.html { redirect_to @gigapan, notice: 'Gigapan was successfully created.' } format.json { render :show, status: :created, location: @gigapan } else format.html { render :new } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @gang = Gang.new(gang_params)\n\n respond_to do |format|\n if @gang.save\n format.html { redirect_to @gang, notice: 'Gang was successfully created.' }\n format.json { render :show, status: :created, location: @gang }\n else\n format.html { render :new }\n fo...
[ "0.6331206", "0.6269475", "0.60883754", "0.60736394", "0.6058379", "0.6015301", "0.60093653", "0.5913532", "0.5912147", "0.5908234", "0.5886577", "0.5848796", "0.58117175", "0.58074707", "0.57898474", "0.5749476", "0.5709044", "0.57076526", "0.5680967", "0.56791526", "0.56687...
0.64743775
0
Checks if the value of the resource placeholder has been set yet.
def set_yet? !!@resource_lock.synchronize { defined? @resource } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_defined_resource?\n nil\n end", "def is_placeholder?(fieldname)\n self.class.placeholders.include?(fieldname.to_sym)\n end", "def resource_exists?\n reload!\n @exists = true\n rescue Google::Cloud::NotFoundError\n @exists = false\n end", "def valida...
[ "0.6281598", "0.59835535", "0.5972937", "0.59416115", "0.58103603", "0.5802725", "0.57957435", "0.5691157", "0.56776327", "0.56732917", "0.5642177", "0.5588255", "0.5586867", "0.552094", "0.5505273", "0.5489662", "0.5489662", "0.5480142", "0.5452378", "0.5446339", "0.5435332"...
0.6769206
0
Checks if the attempt to read the resource has been terminated.
def terminated? !!@resource_lock.synchronize { @terminated } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closed_read?() end", "def ready_for_read?\n begin\n connected? && IO.select([socket], nil, nil, 0.1)\n rescue Exception\n triggered_close $!.message, :terminated\n raise\n end\n end", "def closed_read?\n end", "def terminated?\n terminated\n end", "def closed_read?()\n...
[ "0.69412136", "0.683393", "0.6718201", "0.66746604", "0.6557179", "0.64754516", "0.645448", "0.6434888", "0.64260674", "0.6363099", "0.6356087", "0.6356087", "0.6356087", "0.6344195", "0.6330458", "0.6299704", "0.62796926", "0.6244833", "0.6233195", "0.6221297", "0.621574", ...
0.7574514
0
A peak is an array element which is larger than its neighbours. More precisely, it is an index P such that 0 A[P + 1]. For example, the following array A: ``` A[0] = 1 A[1] = 5 A[2] = 3 A[3] = 4 A[4] = 3 A[5] = 4 A[6] = 1 A[7] = 2 A[8] = 3 A[9] = 4 A[10] = 6 A[11] = 2 ``` has exactly four peaks: elements 1, 3, 5 and 10...
def solution(a) peaks = find_peaks(a) return 0 if peaks.empty? min_flags = 1 max_flags = Math.sqrt(a.length).ceil + 1 while min_flags != max_flags mid_flags = min_flags + ((max_flags-min_flags)/2.0).ceil if check(peaks, mid_flags) min_flags = mid_flags else max_flags = mid_flags-1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a)\n nexxt = next_peak(a)\n f = 1 # can we set f flags?\n max_flags = 0\n # (f-1) * f = max distance between first and last flags\n while (f - 1) * f <= a.size\n pos = 0\n flags_so_far = 0\n while pos < a.size && flags_so_far < f\n pos = nexxt[pos]\n break if pos == -1\n f...
[ "0.72533923", "0.66104174", "0.6574849", "0.63505656", "0.62534386", "0.6224907", "0.6141785", "0.6076366", "0.59294224", "0.58392936", "0.58202827", "0.57658553", "0.5696571", "0.5521911", "0.5462099", "0.540951", "0.5368209", "0.5274806", "0.52329034", "0.5222797", "0.52077...
0.7654614
0
callseq: File.mime( string ) > string or array See also: File::magic and File::type
def mime(path) magic(path, Magic::MIME) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mime_type file\n FileMagic.new(FileMagic::MAGIC_MIME).file(file).split(';').first\n end", "def mimetype; @mimetype ||= `file -b --mime-type '#@fname'`.strip; end", "def magic_mime_type\n return if new_record?\n return unless File.exists? io_stream.path\n FileMagic.mime.file(io_st...
[ "0.7542645", "0.74431837", "0.74249846", "0.7394399", "0.73165077", "0.72394323", "0.72394323", "0.72394323", "0.72394323", "0.72184753", "0.7176577", "0.7176577", "0.7176577", "0.71424216", "0.71355206", "0.7130608", "0.7127985", "0.7120794", "0.7098829", "0.70859224", "0.70...
0.77118236
0
Determine if two points are equal with some degree of variance
def bbpFuzzyEqual(first_point, second_point, variance) if first_point.x - variance <= second_point.x and second_point.x <= first_point.x + variance if first_point.y - variance <= second_point.y and second_point.y <= first_point.y + variance return true end end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eql?(other)\n if ! other.is_a?(self.class)\n false\n else\n [@mean, @variance] == [other.mean, other.variance]\n end\n end", "def eql?(other)\n return false unless other.respond_to?(:coords)\n equal = true\n self.coords.each_with_index do |c, i|\n ...
[ "0.6776845", "0.6417084", "0.6343171", "0.58008915", "0.57410693", "0.5729826", "0.5673462", "0.56618375", "0.5639518", "0.5631125", "0.56209457", "0.55441827", "0.5516703", "0.55106246", "0.5506014", "0.54897404", "0.54426676", "0.54279107", "0.53732026", "0.53457093", "0.53...
0.6507642
1
Rotates a point counterclockwise by the angle around the pivot
def bbpRotateByAngle(first_point, pivot_point, angle) rotation_point = bbpSub(first_point, pivot_point) cosine = Math.cos(angle) sine = Math.sin(angle) rotation_point.x = rotation_point.x * cosine - rotation_point.y * sine + pivot_point.x rotation_point.y = rotation_point.y * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_around_point(angle, point)\n Point.new(x - point.x, y - point.y).rotate_around_origin(angle) + point\n end", "def rotate_around!(degrees, origin=Point.empty)\n result = self.to_point.rotate_around(degrees, origin)\n self.x = result.x\n self.y = result.y\n return result\n end",...
[ "0.7248794", "0.67271066", "0.6599568", "0.65638596", "0.65050906", "0.6434806", "0.63303524", "0.62884986", "0.6158123", "0.6145699", "0.61132485", "0.6047556", "0.6029288", "0.5985884", "0.5983372", "0.5962268", "0.5916851", "0.5892418", "0.5876767", "0.58615625", "0.585663...
0.68556434
1