query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
POST /services POST /services.xml | def create
submenu_item 'services-new'
@service = Service.new(params[:service])
@service_type = @service.type
service_param
@service.tenant_id = current_user.tenant_id
# service_params = Service.extract_params(params[:service])
# service_params = Service.extract_thresholds(service_params)
# @service = Service.new(service_params)
respond_to do |format|
if @service.save
flash[:notice] = "#{@service.name}创建成功"
format.html { redirect_to(@service) }
else
dictionary
format.html { render :action => "new" }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_service(service={})\n request :post, '/services', service\n end",
"def create\n\n @service = Service.new(params[:service])\n respond_to do |format|\n if @service.save\n\n format.html { }\n format.xml { render :xml => @service }\n else\n format.html { render :act... | [
"0.7019069",
"0.62797195",
"0.6158375",
"0.6121117",
"0.6106566",
"0.60866106",
"0.6082971",
"0.59980494",
"0.5980973",
"0.5943503",
"0.593012",
"0.5919196",
"0.5866695",
"0.585808",
"0.5831464",
"0.58228064",
"0.5817531",
"0.58162165",
"0.5796376",
"0.5792843",
"0.5781072",
... | 0.54802674 | 58 |
PUT /services/1 PUT /services/1.xml | def update
@service = Service.find(params[:id], :conditions => conditions)
params[:service].delete :serviceable_id
params[:service].delete :ctrl_state
params[:service].delete :type_id
respond_to do |format|
if @service.update_attributes(params[:service])
flash[:notice] = "#{@service.name}更新成功"
format.html { redirect_to(@service) }
format.xml { head :ok }
else
@service_type = @service.type
dictionary
format.html { render :action => "edit" }
format.xml { render :xml => @service.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def reset_services(services=[])\n request :put, '/services', services\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[... | [
"0.66295433",
"0.6348835",
"0.61497",
"0.6116656",
"0.6116537",
"0.60769606",
"0.6001242",
"0.60008645",
"0.59863025",
"0.59718204",
"0.5936275",
"0.588877",
"0.588877",
"0.5883784",
"0.5804322",
"0.5723139",
"0.56858826",
"0.56711096",
"0.56468433",
"0.56043905",
"0.56043905... | 0.0 | -1 |
DELETE /services/1 DELETE /services/1.xml | def destroy
@service = Service.find(params[:id], :conditions => conditions)
#不能删除主控服务
if @service.is_ctrl?
flash[:error] = "#{@service.name}删除失败,不能删除主控服务。"
else
@service.destroy
flash[:notice] = "#{@service.name}删除成功。"
end
respond_to do |format|
format.html { redirect_to(services_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_services_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |for... | [
"0.71936023",
"0.7171704",
"0.7171704",
"0.7171704",
"0.67564905",
"0.6729424",
"0.6722399",
"0.665567",
"0.66411704",
"0.6615554",
"0.6574227",
"0.65718734",
"0.65649456",
"0.65440506",
"0.65440506",
"0.65440506",
"0.65421736",
"0.6507189",
"0.650532",
"0.650532",
"0.650532"... | 0.6275244 | 41 |
index to hold the visions | def index
@visions = Vision.all.order("created_at DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visibilities; end",
"def variants_idx; end",
"def index\r\n @index ||= 0\r\n end",
"def image idx=0\n @images[idx]\n end",
"def index\n @images = get_approved\n @left_images = []\n @right_images = []\n @center_images = []\n counter = 0\n @images.each do |image|\n ... | [
"0.66058105",
"0.6506336",
"0.6158692",
"0.6155393",
"0.60802233",
"0.60663015",
"0.60533136",
"0.6051944",
"0.6050882",
"0.6050882",
"0.6038882",
"0.59581167",
"0.59581167",
"0.59258085",
"0.5872099",
"0.5845627",
"0.5836286",
"0.5789152",
"0.5751594",
"0.57469535",
"0.57435... | 0.55403805 | 48 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.friendships_mailer.accepted.subject | def accepted user_id, accepter_id
@user = User.find user_id
@accepter = User.find accepter_id
mail to: @user.email, subject: I18n.t('friendships_mailer.accepted.subject')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def subject\n self['subject'] || ms... | [
"0.6812615",
"0.67983675",
"0.6794393",
"0.65702283",
"0.6542836",
"0.65288997",
"0.6282071",
"0.6217708",
"0.61898345",
"0.6167793",
"0.6153471",
"0.6104842",
"0.60931265",
"0.60761005",
"0.6069549",
"0.6041583",
"0.6017945",
"0.5994741",
"0.59892327",
"0.59889954",
"0.59629... | 0.0 | -1 |
GET /apps/1 GET /apps/1.xml GET /apps/1.json | def show
@app = App.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @app }
format.json { render :json => @app }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end",
"def app data={}\n get '/app', data\n end",
"def index\n @app = App.new\n @apps = App.all\n\n respond_to do |format|\n form... | [
"0.7394064",
"0.7196788",
"0.70889664",
"0.70800966",
"0.7041119",
"0.7013052",
"0.69590694",
"0.6893688",
"0.68551886",
"0.68551886",
"0.68551886",
"0.68122727",
"0.6778694",
"0.6753676",
"0.6717287",
"0.66659266",
"0.6584758",
"0.6565096",
"0.6560866",
"0.6526091",
"0.65023... | 0.67858326 | 12 |
POST /apps POST /apps.xml POST /apps.json | def create
@app = App.new(params[:app])
@app.rating = Rating.new(params[:rating])
respond_to do |format|
if @app.save
format.xml { render :xml => @app, :status => :created, :location => @app, :only => [:id]}
format.json { render :json => @app, :status => :created, :location => @app, :only => [:id]}
else
format.xml { render :xml => @app.errors, :status => :unprocessable_entity }
format.json { render :json => @app.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end",
"def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_... | [
"0.7001234",
"0.6684904",
"0.66720366",
"0.6669351",
"0.6620774",
"0.65990245",
"0.65990245",
"0.65046954",
"0.647889",
"0.6468927",
"0.6442003",
"0.642065",
"0.6420005",
"0.6420005",
"0.6415673",
"0.6389441",
"0.63139117",
"0.6275622",
"0.6253363",
"0.623006",
"0.62077874",
... | 0.5995883 | 29 |
PUT /apps/1 PUT /apps/1.xml PUT /apps/1.json | def update
@app = App.find(params[:id])
respond_to do |format|
if @app.update_attributes(params[:app]) and @app.rating.update_attributes(params[:rating])
format.xml { head :ok }
format.json { head :ok }
else
format.xml { render :xml => @app.errors, :status => :unprocessable_entity }
format.json { render :json => @app.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_app data={}\n put '/app', data\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n put(\"/apps/#{name}\", :app => attribu... | [
"0.7055544",
"0.69823295",
"0.69823295",
"0.6745103",
"0.6531843",
"0.651689",
"0.6496434",
"0.63878524",
"0.637245",
"0.6318991",
"0.6318991",
"0.6299086",
"0.6299086",
"0.6299086",
"0.6297548",
"0.6297548",
"0.628797",
"0.6164732",
"0.6164732",
"0.6164732",
"0.6164732",
"... | 0.5985732 | 26 |
DELETE /apps/1 DELETE /apps/1.xml DELETE /apps/1.json | def destroy
@app = App.find(params[:id])
@app.destroy
respond_to do |format|
format.html { redirect_to(apps_url) }
format.xml { head :ok }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"def dest... | [
"0.73132116",
"0.73132116",
"0.71195567",
"0.71092236",
"0.70344305",
"0.70344305",
"0.70344305",
"0.6928899",
"0.6928899",
"0.6919953",
"0.6919953",
"0.6919953",
"0.6907732",
"0.6769033",
"0.67417604",
"0.67132974",
"0.67062855",
"0.67062855",
"0.67062855",
"0.67062855",
"0.... | 0.70474726 | 4 |
POST /apps/exists.xml POST /apps/exists.json | def exists
@record = Record.new
app = App.find_by_packageName(params[:packageName], :select => :id)
if app.nil?
@record.exists = false
else
@record.id = app.id
@record.exists = true
end
respond_to do |format|
format.xml {render :xml => @record}
format.json {render :json => @record}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists?\n json['exists']\n end",
"def has_app_action\n validate :uuid, /^[a-zA-Z0-9]+$/\n validate :application, /^[a-zA-Z0-9]+$/\n uuid = request[:uuid]\n app_name = request[:application]\n if File.exist?(\"/var/lib/openshift/#{uuid}/#{app_name}\")\n reply[:ou... | [
"0.6413426",
"0.6083834",
"0.57530457",
"0.5716068",
"0.55992895",
"0.5566655",
"0.5526369",
"0.55217683",
"0.5510037",
"0.549786",
"0.5477157",
"0.5470329",
"0.5452816",
"0.544372",
"0.54398584",
"0.543484",
"0.5399404",
"0.5377472",
"0.53333384",
"0.5328893",
"0.53184444",
... | 0.68885815 | 0 |
URI representing the type of packaging used for the original deposit represented by this record, such as CDR METS or BagIt. | def deposit_package_type
'https://sagepub.com'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deposit_package_subtype\n 'https://jats.nlm.nih.gov/publishing/'\n end",
"def deposit_package_type\n 'http://proquest.com'\n end",
"def location_string(type, id, version=nil)\n link = Conf.base_uri\n case type.downcase\n when \"workflow\"; link += \"/workflows/\"\n when \"bl... | [
"0.70184714",
"0.68661696",
"0.6044681",
"0.59459037",
"0.58869135",
"0.5851393",
"0.57971567",
"0.577034",
"0.5739009",
"0.56879425",
"0.5609115",
"0.55804163",
"0.55690694",
"0.5559279",
"0.55484146",
"0.5535899",
"0.55323404",
"0.5527149",
"0.5514766",
"0.5514766",
"0.5514... | 0.67867374 | 2 |
Subclassification of the packaging type for this deposit, such as a METS profile. | def deposit_package_subtype
'https://jats.nlm.nih.gov/publishing/'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deposit_package_subtype\n 'ProQuest'\n end",
"def writeup_classification\n classification_label().split(\"-\").first\n end",
"def sub_type\n @sub_type || parse_and_return(:@sub_type)\n end",
"def writeup_classification\n classification_label.split(\"-\").first\n en... | [
"0.7367067",
"0.59793675",
"0.5879135",
"0.58740616",
"0.5836648",
"0.5623186",
"0.5592812",
"0.5577389",
"0.5480861",
"0.541264",
"0.541264",
"0.54093224",
"0.5404062",
"0.53890365",
"0.5334105",
"0.5334105",
"0.5327387",
"0.5320731",
"0.531167",
"0.5271905",
"0.5266696",
... | 0.6812239 | 1 |
TODO: Make more assertions about what a completed ingest looks like and test here | def package_ingest_complete?(dir, file_names)
return true if File.exist?(File.join(dir, file_names.first)) && File.exist?(File.join(dir, file_names.last))
logger.error("Package ingest not complete for #{file_names.first} and #{file_names.last}")
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ingest_new_content( depositor, dirname, wsname, current, total )\n\n filename = File.join( dirname, wsname )\n _, asset_filenames = IngestHelpers.load_workset( filename )\n\n puts \"Ingesting #{current} of #{total}: #{filename} ...\"\n\n work_id = IngestHelpers.get_ingest_id( filename )\n i... | [
"0.63798815",
"0.6270631",
"0.6208013",
"0.5848671",
"0.577947",
"0.5632209",
"0.562226",
"0.54872626",
"0.5420143",
"0.5402963",
"0.53982854",
"0.53874266",
"0.53650314",
"0.5339857",
"0.53220147",
"0.529509",
"0.5269367",
"0.5266903",
"0.52645147",
"0.52600604",
"0.52368826... | 0.0 | -1 |
an empty variable for all methods | def print_menu
puts "\n1. Input the students"
puts "2. Show the students"
puts "3. Save the list to file"
puts "4. Load the list from file"
puts "9. Exit" # '9' beacuse we'll be adding more.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nothing; end",
"def empty()\n \n end",
"def nothing\nend",
"def methods() end",
"def empty!; end",
"def methods=(_arg0); end",
"def empty_function\nend",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def m... | [
"0.69905114",
"0.6975272",
"0.67242306",
"0.6712875",
"0.670391",
"0.6679789",
"0.6642516",
"0.65114075",
"0.65114075",
"0.65114075",
"0.65114075",
"0.65114075",
"0.65114075",
"0.65114075",
"0.65114075",
"0.65114075",
"0.65114075",
"0.65114075",
"0.65114075",
"0.6484146",
"0.... | 0.0 | -1 |
Locates a record according to the current scope. Returns the record if found. If not found, creates a new record with the attributes of the current scope and the provided attributes. | def find_or_create(*args, &block)
find_or_initialize_and_do :save, *args, &block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_existing_record\n @record = record_class.find(@locator)\n end",
"def find_existing_record\n @record = record_class.find(@locator)\n end",
"def replicate_find_existing_record(attributes)\n return if replicate_natural_key.empty?\n conditions = {}\n replicate_... | [
"0.66697276",
"0.66697276",
"0.61919004",
"0.6107912",
"0.6105047",
"0.6052528",
"0.6003502",
"0.59510815",
"0.5907279",
"0.58934265",
"0.58772117",
"0.5833222",
"0.5774199",
"0.5683193",
"0.5659311",
"0.56541806",
"0.5625775",
"0.55967027",
"0.5586025",
"0.55542266",
"0.5519... | 0.48612761 | 78 |
Locates a record according to the current scope. Updates the record with the provided attributes if found. If not found, creates a new record with the current scope's attributes and the provided attributes. | def create_or_update(*args, &block)
create_or_update_and_do :save, *args, &block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_update_by_some( attrs={} )\n attrs = extract_ar_object_ids( attrs )\n conditions = attrs.delete( :find_by )\n raise 'You must provide a :find_by hash of attributes to search with, ie. :find_by => {:id => 1}' unless conditions\n attrs.merge!( conditions )\n record = ... | [
"0.65203243",
"0.62778926",
"0.6178753",
"0.60669404",
"0.60669404",
"0.5907997",
"0.58912694",
"0.58410513",
"0.58184624",
"0.57878697",
"0.5764894",
"0.5757926",
"0.57100385",
"0.56683683",
"0.56166995",
"0.55867493",
"0.5567204",
"0.556713",
"0.55598974",
"0.55597705",
"0.... | 0.0 | -1 |
Create a new server connection FluidDB::Connection.new(:test) will use the sandbox Params: __username__ __password__ __server__ __schema__ Could be 'http' or 'https' __port__ Change default port (443 for https and 80 for http) | def initialize(args)
@params = args == :test ? SANDBOX : DEFAULT.merge(args)
@params[:port] ||= @params[:scheme] == 'https' ? 443 : 80
connect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_server\n {\n 'name' => 'test_db',\n 'address' => '172.19.108.5',\n 'database' => 'MigrationTest',\n 'username' => 'jenkins',\n 'password' => 'QDfVkyVn8tk6'\n }\nend",
"def initialize(host, port, password, type=HLDS)\n @host = host\n @port = port\n @password = password\... | [
"0.6575973",
"0.63804036",
"0.62315804",
"0.61822844",
"0.6164898",
"0.6145027",
"0.61370987",
"0.6126241",
"0.6084073",
"0.60745937",
"0.6043617",
"0.60184824",
"0.59785104",
"0.5972319",
"0.59659743",
"0.5921441",
"0.5912027",
"0.5903905",
"0.58972245",
"0.5890872",
"0.5845... | 0.69465876 | 0 |
Reconnect to the server FluidDB::Connection use http 1.1. If you don't use the connection for a while, probably the server will disconnect | def connect
@connection = Net::HTTP.new(@params[:server], @params[:port])
@connection.use_ssl = true if @params[:scheme] == 'https'
@connection.start
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconnect\n end",
"def reconnect!\n end",
"def reconnect!\n @connection.reset_connection\n end",
"def reconnect\n @mutex.synchronize do\n if @db.opts[:conn]\n @jdbc_loaded = true\n @conn = @db.opts.fetch(:conn)\n else\n com.mysql.cj.jdbc.Driver\n ... | [
"0.70318574",
"0.6847359",
"0.68375975",
"0.6749706",
"0.67421275",
"0.67421275",
"0.6638965",
"0.6516056",
"0.6495502",
"0.64952815",
"0.6471527",
"0.6380864",
"0.63248515",
"0.62904626",
"0.6206614",
"0.6206614",
"0.6204935",
"0.61641645",
"0.61454904",
"0.60938793",
"0.608... | 0.0 | -1 |
Query to the server Options: headers => Special headers payload => Data query => Query arguments | def query(method, path, options = {})
headers = DEFAULT_HEADERS.merge(options[:headers] || {})
uri = URI.parse(path)
uri.query = URI.encode((options[:query] || {}).map {|k,v| "#{k}=#{v}"}.join('&'))
payload = [:post,:put].include?(method) ? Yajl::Encoder.encode(options[:payload].nil? ? {} : options[:payload]) : nil
$stderr << "#{method.to_s.upcase}: #{uri.to_s} (#{payload.inspect}, #{headers.inspect})\n" if $debug
req = Net::HTTP.const_get(method.to_s.capitalize).new(uri.to_s, headers)
req.basic_auth(@params[:username],@params[:password])
res = @connection.request(req,payload)
data = res.body || ""
data = Yajl::Parser.parse(data) if MIME::Type.simplified(res['content-type']) == 'application/json'
data = symbolize_keys(data) if data.is_a?(Hash)
$stderr << "#{res.code}: #{data.inspect}\n" if $debug
raise FluidDB::Error.new(data) unless [200,201,204].include?(res.code.to_i)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query\n start do |connection|\n request = HTTP::Get.new \"#{ @uri.path }?#{ @uri.query }\"\n @headers.each { |header, value| request[header] = value }\n connection.request request\n end\n end",
"def custom_query(options)\n form_data = {}\n options.each {|k,v| form_... | [
"0.7025024",
"0.69391894",
"0.67741704",
"0.6513036",
"0.63895476",
"0.6340665",
"0.6310358",
"0.62826514",
"0.62426656",
"0.6236473",
"0.6227796",
"0.6180938",
"0.6177872",
"0.61531353",
"0.6143883",
"0.61168987",
"0.6097822",
"0.60848093",
"0.6076635",
"0.6069289",
"0.60510... | 0.58953935 | 42 |
Alternative to the instance variable Use a method. The implicit return immediately spits out the hash you create You can read this within methods. | def nucleotide_score
{
A: 0,
C: 0,
G: 0,
T: 0
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash()\n #This is a stub, used for indexing\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n @hash || calculate_hash!\n end",
"def hash; end",
"def hash; end",
"def hash; end",
... | [
"0.80561984",
"0.7926657",
"0.7926657",
"0.7926657",
"0.7926657",
"0.7926657",
"0.7926657",
"0.7926657",
"0.7892501",
"0.78740686",
"0.78740686",
"0.78740686",
"0.78740686",
"0.78740686",
"0.78740686",
"0.78740686",
"0.78740686",
"0.78740686",
"0.78740686",
"0.7807299",
"0.77... | 0.0 | -1 |
def stringy num test_arr = [] counter = 0 loop do test_arr << "1" break if num == test_arr.size test_arr << "0" break if num == test_arr.size counter += 1 end test_arr.join('') end p stringy 11 puts stringy(6) == '101010' puts stringy(9) == '101010101' puts stringy(4) == '1010' puts stringy(7) == '1010101' Further Exploration | def stringy(int, int1 = 1)
if int && int1 != 0
Array.new(int) { |i| i.even? ? '1' : '0' }.join
elsif int1 == 0
Array.new(int) { |i| i.even? ? '0' : '1' }.join
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringy(num)\n arr = []\n\n num.times do |idx|\n digit = idx.odd? ? '0' : '1'\n arr << digit\n end\n\n arr.join\nend",
"def stringy2(int, *zero)\n str = ''\n if zero == [0] then str += '0' else str += '1' end\n int.times do |n|\n if n > 0\n array = str.chars\n if array[n - 1] == '0'... | [
"0.83429146",
"0.82513034",
"0.82389313",
"0.8171739",
"0.8153618",
"0.81305486",
"0.8121433",
"0.81042135",
"0.808339",
"0.8071928",
"0.80312777",
"0.80308896",
"0.8008519",
"0.7981671",
"0.79604447",
"0.7953095",
"0.7929839",
"0.79243046",
"0.7923863",
"0.79161626",
"0.7906... | 0.75884503 | 32 |
GET /uang_masuks GET /uang_masuks.json | def index
@cari_uang_masuk = UangMasuk.where(["keterangan iLIKE ?","%#{params[:keterangan]}%"]).order(id: :desc)
@a_masuk = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_uang_masuk\n @uang_masuk = UangMasuk.find(params[:id])\n end",
"def index\n @makanans = Makanan.all\n end",
"def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n ... | [
"0.6560736",
"0.6529683",
"0.6488961",
"0.6302812",
"0.6289363",
"0.6280052",
"0.6269392",
"0.62378204",
"0.6229503",
"0.62005544",
"0.61642164",
"0.61461586",
"0.61443377",
"0.6141813",
"0.6141049",
"0.6125693",
"0.61210275",
"0.6082039",
"0.60736835",
"0.6059679",
"0.605018... | 0.58548 | 44 |
GET /uang_masuks/1 GET /uang_masuks/1.json GET /uang_masuks/new | def new
@uang_masuk = UangMasuk.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end",
"def new\n @jamaat = Jamaat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jamaat }\n end\n e... | [
"0.74359715",
"0.72972745",
"0.72335505",
"0.71722674",
"0.7165662",
"0.715485",
"0.71110934",
"0.70961934",
"0.7043198",
"0.7035463",
"0.6986085",
"0.69837177",
"0.6966193",
"0.69611734",
"0.6947536",
"0.6927173",
"0.6924353",
"0.69206536",
"0.69088465",
"0.68979883",
"0.686... | 0.73136866 | 1 |
POST /uang_masuks POST /uang_masuks.json | def create
@uang_masuk = UangMasuk.new(uang_masuk_params)
respond_to do |format|
if @uang_masuk.save
format.html { redirect_to uang_masuks_path, notice: 'Uang masuk was successfully created.' }
else
format.html { render :new }
format.json { render json: @uang_masuk.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uang_masuk_params\n params.require(:uang_masuk).permit(:jumlah, :tanggal, :keterangan)\n end",
"def create\n @mata_matum = MataMatum.new(mata_matum_params)\n\n respond_to do |format|\n if @mata_matum.save\n format.html { redirect_to @mata_matum, notice: 'Mata matum was successfully ... | [
"0.6765135",
"0.6558367",
"0.64361453",
"0.64069957",
"0.6372077",
"0.63490796",
"0.6300831",
"0.62534034",
"0.6252394",
"0.6232137",
"0.62242776",
"0.6219938",
"0.61723536",
"0.61279565",
"0.61261934",
"0.6087251",
"0.607512",
"0.6014324",
"0.5990471",
"0.5990286",
"0.597366... | 0.74192625 | 0 |
PATCH/PUT /uang_masuks/1 PATCH/PUT /uang_masuks/1.json | def update
respond_to do |format|
if @uang_masuk.update(uang_masuk_params)
format.html { redirect_to @uang_masuk, notice: 'Uang masuk was successfully updated.' }
format.json { render :show, status: :ok, location: @uang_masuk }
else
format.html { render :edit }
format.json { render json: @uang_masuk.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @municao.update(municao_params)\n format.html { redirect_to @municao, notice: 'A Munição foi editada com sucesso!' }\n format.json { render :show, status: :ok, location: @municao }\n else\n format.html { render :edit }\n format.json ... | [
"0.6621979",
"0.66182715",
"0.6617474",
"0.6602954",
"0.6565074",
"0.6554986",
"0.65191126",
"0.6513416",
"0.65086436",
"0.65006024",
"0.6457103",
"0.6387565",
"0.63814646",
"0.63745594",
"0.6361265",
"0.6346211",
"0.6342107",
"0.63342166",
"0.6324423",
"0.6323482",
"0.630938... | 0.6941636 | 0 |
DELETE /uang_masuks/1 DELETE /uang_masuks/1.json | def destroy
@uang_masuk.destroy
respond_to do |format|
format.html { redirect_to uang_masuks_url, notice: 'Uang masuk was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @jamaat = Jamaat.find(params[:id])\n @jamaat.destroy\n\n respond_to do |format|\n format.html { redirect_to jamaats_url }\n format.json { head :ok }\n en... | [
"0.7298238",
"0.72319317",
"0.72173846",
"0.7208355",
"0.71664023",
"0.7165098",
"0.71593475",
"0.71474856",
"0.71457386",
"0.7130274",
"0.71219695",
"0.7111745",
"0.7110901",
"0.7098837",
"0.70826423",
"0.7076899",
"0.7068214",
"0.70646155",
"0.7061949",
"0.7060429",
"0.7059... | 0.74981093 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_uang_masuk
@uang_masuk = UangMasuk.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def uang_masuk_params
params.require(:uang_masuk).permit(:jumlah, :tanggal, :keterangan)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Return lowercase 'untitled', to comply with HIG | def displayName
fileURL ? super : super.sub(/^[[:upper:]]/) {|s| s.downcase}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title\n name.gsub(/_/, ' ')\n end",
"def wikified_name\n self.name.slice(0,1).capitalize + self.name.slice(1..-1).gsub(/ /, '_')\n end",
"def wikiname(title)\n title.gsub(\" \",\"_\").downcase\nend",
"def quick_title(song)\n File.basename(song, File.extname(song)).gsub(/^[^A-Za-z]+\\s+(\\w)/... | [
"0.7231389",
"0.7142952",
"0.7133862",
"0.7060653",
"0.70403767",
"0.7037739",
"0.6999924",
"0.6961202",
"0.6958249",
"0.6884209",
"0.6880593",
"0.6877515",
"0.68573695",
"0.68573695",
"0.6833635",
"0.6829837",
"0.6824174",
"0.6819142",
"0.67633533",
"0.67549527",
"0.6732342"... | 0.0 | -1 |
Returns whole file name and without extension. | def name()
unless @repo_addr
fn = @@fname
bn = @@bname
return [fn, bn]
else
return ['', '']
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end",
"def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end",
"def get_file_name_without_ext(full_name)\n return File.basename(full_name, File.extname(full_name))\n rescue Exception => exc\n puts exc\n re... | [
"0.827731",
"0.827731",
"0.8152603",
"0.8113025",
"0.80447334",
"0.8028507",
"0.79462236",
"0.78709334",
"0.78709334",
"0.7857307",
"0.78541654",
"0.78443754",
"0.78128636",
"0.78098804",
"0.7794699",
"0.7776142",
"0.7771309",
"0.7770821",
"0.7714301",
"0.7704968",
"0.7699916... | 0.0 | -1 |
Ruby, S. and Thomas, D., 2009. Agile web development with rails. Raleigh, NC: Pragmatic Bookshelf. | def add_chocolate_bar(chocolate_bar)
current_item = line_items.find_by(chocolate_bar_id: chocolate_bar.id)
if current_item
current_item.quantity += 1
else
current_item = line_items.build(chocolate_bar_id: chocolate_bar.id)
end
current_item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_rails\n puts \"created Rails biblebook\"\n p = Biblebook.new\n p.title = \"Ruby on Rails\"\n p.author = \"Rails Community\"\n p.published_at = Date.new 2012, 12, 31\n p.intro = \"Rails is a super *web application* framework\"\n load_rails_md p\n p.save!\nend",
"def main\n puts 'Ruby bootstrap..... | [
"0.64919496",
"0.56565297",
"0.563342",
"0.56238055",
"0.56238055",
"0.56238055",
"0.56238055",
"0.56238055",
"0.56238055",
"0.56238055",
"0.56238055",
"0.56238055",
"0.56238055",
"0.55928266",
"0.5405755",
"0.5395589",
"0.53235054",
"0.52686423",
"0.5246219",
"0.5204262",
"0... | 0.0 | -1 |
Google related helper methods | def google_email(connection)
email_array = connection["gd$email"]
unless email_array.nil? or email_array.blank?
return email_array[0]["address"]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def google\n process_oauth_callback\n end",
"def google(query)\n # API key, engine id, and uri to make API call\n key = CSE_API_KEY\n # \"AIzaSyDpp4azZVRsBYgmjAqSI-Z-PIZG8FI-hfw\"\n engine_id = CSE_ENGINE_ID\n # \"011724650152002634172:r-e9bq2ubda\"\n uri = URI(\"https://www.googleapis.... | [
"0.64734644",
"0.64286184",
"0.6354036",
"0.6351691",
"0.6303969",
"0.6262413",
"0.6156889",
"0.6153725",
"0.6062569",
"0.59816915",
"0.59383726",
"0.5905375",
"0.5890451",
"0.582224",
"0.5819071",
"0.5770797",
"0.5765101",
"0.5764558",
"0.57627064",
"0.57448214",
"0.5733116"... | 0.0 | -1 |
Facebook related helper methods | def connection_facebook_id(connection)
return connection["id"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook\n\n end",
"def facebook\n end",
"def facebook\n handle_oauth\n end",
"def facebook\n callback\n end",
"def facebook\n handle_auth \"facebook\"\n end",
"def facebook_url\n facebook_id.blank? ? \"\" : \"http://facebook.com/\" + facebook_id\n end",
"def facebook_url; \"h... | [
"0.8020095",
"0.8002339",
"0.7271388",
"0.71464",
"0.7018307",
"0.70034075",
"0.6959742",
"0.694319",
"0.68869185",
"0.6844395",
"0.6771748",
"0.6763959",
"0.6689031",
"0.6674703",
"0.6593799",
"0.65672195",
"0.65485245",
"0.652231",
"0.651489",
"0.64977574",
"0.6492827",
"... | 0.0 | -1 |
Ensure that every criterion that is supposed to be in this level is selectable, and that every criterion that is not supposed to be in this level is not selectable. rubocop:disable Metrics/MethodLength | def only_correct_criteria_selectable(level)
Criteria.keys do |query_level|
Criteria[query_level].each do |criterion|
if query_level == level
assert_select '#' + criterion.to_s
assert_select "#project_#{criterion}_status_met"
elsif !Criteria[level].key?(criterion)
# This is criterion in another level, *not* this one
assert_select '#' + criterion.to_s, false
assert_select "#project_#{criterion}_status_met", false
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_conditions level\n (get_level <= level and !@turn_off)\n end",
"def actual_level_of_effort_only_on_completion\n if actual_level_of_effort.nil? && status == \"completed\"\n errors.add(:status, \"must have actual level of effort if complete\")\n elsif !actual_level_of_effort.nil?\n ... | [
"0.6053208",
"0.56069434",
"0.54321605",
"0.5352756",
"0.52428716",
"0.5224901",
"0.5192965",
"0.5175696",
"0.5145365",
"0.5132913",
"0.51296735",
"0.5120049",
"0.5120049",
"0.5113218",
"0.5041589",
"0.5032248",
"0.50028133",
"0.4991241",
"0.49846005",
"0.4965926",
"0.4957848... | 0.7640995 | 1 |
the above commands make sure that the specified fields is not blank | def total_votes
self.votes.where(vote: true).size - self.votes.where(vote: false).size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end",
"def not_blank\n if (name.blank? and email.blank? and phone.blank?)\n errors.add(\"name, email, and phone cannot ... | [
"0.76139396",
"0.7068433",
"0.6778111",
"0.67348576",
"0.67177594",
"0.6701642",
"0.6691128",
"0.66364396",
"0.6602282",
"0.6596749",
"0.658611",
"0.65655494",
"0.6564474",
"0.6512758",
"0.6502888",
"0.6499729",
"0.6473405",
"0.6472589",
"0.647067",
"0.644545",
"0.64326346",
... | 0.0 | -1 |
global varible so that each recursion can use same one | def fibo_rec(target_number)
if target_number<1
$series[0]=0
return 0
elsif target_number=1
$series[1]=1
fibo_rec 0
return 1
else
ans=fibo_rec(target_number-1)+(fibo_rec(target_number-2))
$series[target_number]=ans
return ans
end
return $series
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive => nil",
"def recursive_solution\n\n end",
"def global; return root end",
"def depth=(_arg0); end",
"def nesting() end",
"def one_singleton_ancestors_cache; end",
"def my_depth\n 1\n end",
"def global; end",
"def recurse_local\n result = perform_recursion(self[:path])\n ... | [
"0.6926839",
"0.63375765",
"0.59233725",
"0.5814848",
"0.5782792",
"0.5763344",
"0.57407284",
"0.56935567",
"0.5641538",
"0.56200415",
"0.5612161",
"0.5598958",
"0.5568708",
"0.55281496",
"0.55179334",
"0.5499403",
"0.5471157",
"0.5402655",
"0.5388618",
"0.53799194",
"0.53384... | 0.0 | -1 |
:section: Basics Some commands sometimes cause side effects. When evaluating arguments, if you discover that undoing doesn't make sense, and will be confusing to the user, call dont_undo, and the interpreter will ignore the call for purposes of undoing | def dont_undo
@should_undo = false
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undo\n\t\t\n\tend",
"def undo\n\t\t\n\tend",
"def test_undo_quick_start\n job 'jobbist'\n\n start 'jobbist'\n pause\n start\n message = undo\n assert_message(lines(undid_prefix('quick_start'),\n undid_restart_quickly('jobbi... | [
"0.64404494",
"0.64404494",
"0.626697",
"0.6181161",
"0.6152248",
"0.61470264",
"0.60993606",
"0.60690165",
"0.59408873",
"0.59353113",
"0.5875205",
"0.5849912",
"0.5845147",
"0.5778812",
"0.5750887",
"0.57296675",
"0.5691882",
"0.5619012",
"0.5612826",
"0.55998266",
"0.55998... | 0.68540466 | 0 |
This is how you'll access the Vizier::Subject object that's the interface of every command to the program state. | def subject
@subject
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def sub... | [
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.643268",
"0.635685",
"0.6337496",
"0.61610323",
"0.61610323",
"0.... | 0.62788373 | 20 |
:section: Pause and Resume Stop here. Return control to the user. If several commands are chained (c.f. chain) and the pause is subsequently resumed (StandardCommands::Resume) the whole chain will be resumed. | def pause(deck = nil)
raise ResumeFrom, deck
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_pause\n raw_stop\n end",
"def raw_pause\n raw_stop\n end",
"def resume\n @halt = false\n end",
"def resume; end",
"def resume; end",
"def resume!\n raise InvalidActionError, \"Cannot resume a Output that is not paused.\" unless paused?\n resume_action.tap do |act... | [
"0.6763182",
"0.6763182",
"0.6719082",
"0.65291953",
"0.65291953",
"0.64089096",
"0.6381771",
"0.6381771",
"0.63779324",
"0.63572705",
"0.6347065",
"0.6307767",
"0.6295562",
"0.6261589",
"0.6237658",
"0.61858994",
"0.61754566",
"0.6127437",
"0.6123034",
"0.610057",
"0.6075805... | 0.59623754 | 28 |
Stop here and return control to the user. If several commands are chained (c.f. chain) and the pause is subsequently resumed (StandardCommands::Resume) the rest of the chain (not this command) will be dropped. | def defer(deck = nil)
raise ResumeFromOnlyThis, deck
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_pause\n raw_stop\n end",
"def raw_pause\n raw_stop\n end",
"def resume\n @halt = false\n end",
"def pause\n $stderr.write('Press CTRL+j or ENTER to continue') && $stdin.gets\n end",
"def _pause_if_needed\n return unless Nenv.cuke_step?\n\n STDOUT.puts \"\\n\\nPress enter t... | [
"0.6680757",
"0.6680757",
"0.6440828",
"0.6343416",
"0.61830145",
"0.6043394",
"0.59855115",
"0.5966923",
"0.59566194",
"0.59408",
"0.5923926",
"0.58985835",
"0.5883969",
"0.5872774",
"0.5844364",
"0.5834944",
"0.58259034",
"0.5788786",
"0.5788114",
"0.5783912",
"0.57826936",... | 0.0 | -1 |
Allows for a command to be broken into pieces so that a resume can pick up within a command. The block will be executed normally, but if the command is resumed with a task id, all task blocks until that id will be skipped. | def task(id) #:yield:
if not @resume_from.nil?
if @resume_from == id
@resume_from = nil
end
return
end
yield if block_given?
@last_completed_task = id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_command_waiting\r\n self.class.send :alias_method, :command, :command_and_wait\r\n yield\r\n self.class.send :alias_method, :command, :command_verbatim \r\n end",
"def process_command\n @fiber.resume get_result\n end",
"def prepare_idle_continuation(command)\n when_not_awa... | [
"0.58563584",
"0.5820798",
"0.57175434",
"0.5440751",
"0.53977746",
"0.5369646",
"0.5253311",
"0.51831436",
"0.51503336",
"0.51449543",
"0.51425433",
"0.5089442",
"0.50614905",
"0.5060039",
"0.5044992",
"0.5001407",
"0.49813578",
"0.49724594",
"0.4968552",
"0.49647057",
"0.49... | 0.47904146 | 31 |
For big jobs splitting them into subthreads and such. But they need to be debugged, and IIRC there's a deadlock condition | def action_thread(&block)
collector = sub_collector
return Thread.new do
$stdout.set_thread_collector(collector)
block.call
$stdout.remove_thread_collector(collector)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_job() \n number_of_real_process = @cores * 2\n number_of_columns_to_render = @job.ending_column - @job.starting_column\n\n number_of_jobs_that_we_want_to_create = number_of_real_process\n if((number_of_columns_to_render/number_of_real_process) < 1) \n number_of_jobs_t... | [
"0.6585305",
"0.65603745",
"0.6557719",
"0.6557719",
"0.64358795",
"0.642723",
"0.6340268",
"0.624239",
"0.62395394",
"0.62395394",
"0.6229476",
"0.62185264",
"0.6170829",
"0.611027",
"0.61078054",
"0.60195905",
"0.59924245",
"0.59820765",
"0.5974776",
"0.5974776",
"0.5974776... | 0.0 | -1 |
STRONG PARAMS / whitelist what the user can give us | def task_params
params.require(:task).permit(:title, :details, :completed)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_params; true; end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :... | [
"0.69359034",
"0.6866467",
"0.6745993",
"0.6593917",
"0.657007",
"0.65202683",
"0.65155405",
"0.6446152",
"0.64390135",
"0.6430172",
"0.6336102",
"0.63286304",
"0.6321278",
"0.6321278",
"0.6301794",
"0.6276191",
"0.62626964",
"0.62154263",
"0.6214585",
"0.61983865",
"0.619114... | 0.0 | -1 |
GET /user_biographies/1 GET /user_biographies/1.json | def show
@user_biography = UserBiography.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user_biography }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end",
"def new\n @user_biography = UserBiography.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json... | [
"0.644018",
"0.6396032",
"0.6361036",
"0.63073796",
"0.62759113",
"0.62329787",
"0.61055005",
"0.60451716",
"0.59533983",
"0.58362174",
"0.58237267",
"0.58040273",
"0.57759655",
"0.5772738",
"0.57715225",
"0.57408094",
"0.56855345",
"0.56695676",
"0.5669275",
"0.56559336",
"0... | 0.70377785 | 0 |
GET /user_biographies/new GET /user_biographies/new.json | def new
@user_biography = UserBiography.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user_biography }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n ... | [
"0.6884423",
"0.688118",
"0.6829219",
"0.68197525",
"0.67852134",
"0.67106146",
"0.6710588",
"0.6694529",
"0.66929626",
"0.667535",
"0.66709125",
"0.66633976",
"0.66573405",
"0.66573405",
"0.66573405",
"0.66444045",
"0.66369414",
"0.6634766",
"0.6634766",
"0.6618654",
"0.6609... | 0.75278735 | 0 |
POST /user_biographies POST /user_biographies.json | def create
@user_biography = UserBiography.new(params[:user_biography])
respond_to do |format|
unless params[:nosave]
if @user_biography.save
if @user_biography.tour
format.html { redirect_to controller: 'tours', action: 'setup', id: @user_biography.tour.id, bio_id: @user_biography.id, notice: 'User biography was successfully created.' }
format.json { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography }
else
format.html { redirect_to @user_biography, notice: 'User biography was successfully created.' }
format.json { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography }
end
else
format.html { render action: "new" }
format.json { render json: @user_biography.errors, status: :unprocessable_entity }
end
else
format.html { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography }
format.json { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @biography = Biography.new(biography_params)\n respond_to do |format|\n if @biography.save\n current_admin_user.biographies << @biography\n format.html { redirect_to [:admin, @biography], notice: 'Biography was successfully created.' }\n format.json { render action: 'sh... | [
"0.6635438",
"0.6198474",
"0.61068356",
"0.60496575",
"0.5917843",
"0.5771784",
"0.56593245",
"0.5633631",
"0.5619063",
"0.56128657",
"0.56062555",
"0.5566145",
"0.5563016",
"0.5516866",
"0.5489686",
"0.5484335",
"0.54818875",
"0.54562587",
"0.5415347",
"0.5408733",
"0.540066... | 0.5598525 | 11 |
PUT /user_biographies/1 PUT /user_biographies/1.json | def update
@user_biography = UserBiography.find(params[:id])
respond_to do |format|
if @user_biography.update_attributes(params[:user_biography])
format.html { redirect_to @user_biography, notice: 'User biography was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @user_biography.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n if @bio.update_attributes(params[:bio])\n format.html { redirect_to @bio.user.profile, notice: 'Bio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edi... | [
"0.6728715",
"0.61430943",
"0.6076785",
"0.6006197",
"0.5944847",
"0.5944847",
"0.59333885",
"0.59219307",
"0.59190124",
"0.5903632",
"0.58626586",
"0.5792056",
"0.5694102",
"0.56844187",
"0.5684088",
"0.5627282",
"0.5609686",
"0.55957776",
"0.5563816",
"0.5562741",
"0.555432... | 0.69388103 | 0 |
DELETE /user_biographies/1 DELETE /user_biographies/1.json | def destroy
@user_biography = UserBiography.find(params[:id])
@user_biography.destroy
respond_to do |format|
format.html { redirect_to user_biographies_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @biography.destroy\n respond_to do |format|\n format.html { redirect_to admin_biographies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bio = Bio.find(params[:id])\n @bio.destroy\n\n respond_to do |format|\n format.html { redirect_to bios_u... | [
"0.7078497",
"0.684274",
"0.6570586",
"0.6549361",
"0.6459091",
"0.6452129",
"0.6434868",
"0.6414489",
"0.6368596",
"0.63259935",
"0.6324762",
"0.6265212",
"0.62557817",
"0.62532383",
"0.6248457",
"0.6214569",
"0.6174089",
"0.61298287",
"0.6116617",
"0.61144644",
"0.61012375"... | 0.7754777 | 0 |
GET /instructors GET /instructors.json | def index
@instructors = Instructor.all(:order => :name)
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @instructors }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @instructors = Instructor.all\n end",
"def index\n @section_instructors = SectionInstructor.all\n end",
"def show\n render json: @instructor\n end",
"def show\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format... | [
"0.7474448",
"0.72173893",
"0.7175054",
"0.70918465",
"0.70283026",
"0.6961625",
"0.69567657",
"0.69409734",
"0.69235194",
"0.69104546",
"0.68709964",
"0.684239",
"0.68309546",
"0.67133147",
"0.67078835",
"0.66748357",
"0.6630658",
"0.6601479",
"0.65697086",
"0.65195835",
"0.... | 0.7403752 | 1 |
GET /instructors/1 GET /instructors/1.json | def show
@instructor = Instructor.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @instructor }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instructor }\n end\n end",
"def index\n @instructors = Instructor.all(:order => :name)\n respond_to do |format|\n format.html # index.html.er... | [
"0.7551621",
"0.75332004",
"0.745846",
"0.7375946",
"0.73743033",
"0.71484536",
"0.7090503",
"0.7067631",
"0.70597637",
"0.7032259",
"0.70185703",
"0.6976074",
"0.69606",
"0.6956809",
"0.6795209",
"0.6745011",
"0.6743703",
"0.6740313",
"0.66673917",
"0.6654393",
"0.662805",
... | 0.7491764 | 2 |
GET /instructors/new GET /instructors/new.json | def new
@instructor = Instructor.new
@aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]}
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @instructor }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instructor }\n end\n end",
"def new\n @manage_instructor = Instructor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render... | [
"0.79211736",
"0.7722816",
"0.7513944",
"0.7511639",
"0.7312013",
"0.7312013",
"0.71173847",
"0.7111925",
"0.70473874",
"0.70473874",
"0.7037403",
"0.70316744",
"0.695933",
"0.68866456",
"0.68866456",
"0.68866456",
"0.68828076",
"0.68552125",
"0.68540186",
"0.6851731",
"0.685... | 0.6792313 | 33 |
POST /instructors POST /instructors.json | def create
@instructor = Instructor.new(params[:instructor])
respond_to do |format|
if @instructor.save
format.html { redirect_to @instructor, :notice => 'Instructor was successfully created.' }
format.json { render :json => @instructor, :status => :created, :location => @instructor }
else
@aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]}
format.html { render :action => "new" }
format.json { render :json => @instructor.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @instructor = Instructor.new(trainer_params)\n if @instructor.save\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end",
"def create\n @instructor = Instructor.new(params[:instructor])\n\n respond_to do |format|\n if @instructor... | [
"0.7211147",
"0.7157347",
"0.7080013",
"0.7080013",
"0.7080013",
"0.7005359",
"0.6938629",
"0.6901605",
"0.6890581",
"0.6829674",
"0.6803561",
"0.6802934",
"0.67715555",
"0.6598164",
"0.65361786",
"0.651337",
"0.64388067",
"0.64371824",
"0.6317453",
"0.6299684",
"0.6266201",
... | 0.6376019 | 18 |
PUT /instructors/1 PUT /instructors/1.json | def update
@instructor = Instructor.find(params[:id])
respond_to do |format|
if @instructor.update_attributes(params[:instructor])
format.html { redirect_to @instructor, :notice => 'Instructor was successfully updated.' }
format.json { head :ok }
else
@aircraft_types = AircraftType.by_name.collect{|at| [at.name, at.id]}
format.html { render :action => "edit" }
format.json { render :json => @instructor.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @instructor.update(instructor_params)\n render json: @instructor\n else\n render json: @instructor.errors\n end\n end",
"def update\n @instructor = Instructor.find(params[:id])\n\n respond_to do |format|\n if @instructor.update_attributes(params[:instructor])\n ... | [
"0.7247789",
"0.71572495",
"0.69670326",
"0.69597566",
"0.6910412",
"0.6750971",
"0.6750971",
"0.6750971",
"0.6750971",
"0.6750971",
"0.6750971",
"0.6750971",
"0.6750971",
"0.65655047",
"0.65613306",
"0.65545636",
"0.6540953",
"0.652795",
"0.65277505",
"0.6497438",
"0.6445801... | 0.6376264 | 23 |
DELETE /instructors/1 DELETE /instructors/1.json | def destroy
@instructor = Instructor.find(params[:id])
@instructor.destroy
respond_to do |format|
format.html { redirect_to instructors_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to instructores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_instructor = Instructor.find(params[:id])\n @manage_instruc... | [
"0.7996455",
"0.79741395",
"0.79579455",
"0.7898916",
"0.7898916",
"0.77079374",
"0.76391745",
"0.75418645",
"0.7397706",
"0.7370281",
"0.7235165",
"0.7205407",
"0.7058448",
"0.6970631",
"0.6963942",
"0.6914965",
"0.6912169",
"0.6902971",
"0.6870069",
"0.6862512",
"0.684864",... | 0.8137119 | 0 |
dscl . read /Groups/ladmins | def group_get_info(attribs, dir_info)
attribs = group_record_name_alternatives(attribs)
check_critical_attribute( attribs, :record_name )
command = {action: 'read', scope: 'Groups', value: nil}
user_attrs = attribs.merge(command)
dscl( user_attrs, dir_info )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_list\n execute('dscacheutil -q group') do |result|\n groups = []\n result.stdout.each_line do |line|\n groups << line.split(': ')[1].strip if /^name:/.match?(line)\n end\n\n yield result if block_given?\n\n groups\n end\n end",
"def get_nodegroups()\n nodemgr_res... | [
"0.5869755",
"0.5858927",
"0.58041286",
"0.57643944",
"0.5731714",
"0.5700018",
"0.56217474",
"0.55706805",
"0.55501926",
"0.54923594",
"0.54857326",
"0.54787624",
"0.5444364",
"0.5424681",
"0.54155844",
"0.53593093",
"0.53563887",
"0.5346893",
"0.53294224",
"0.53145015",
"0.... | 0.61652225 | 0 |
dscl . read /Groups/ladmins TODO: switch to dseditgroup o checkmember m username groupname dseditgroup o checkmember m btihen employee yes btihen is a member of employee dseditgroup o checkmember m btihen student no btihen is NOT a member of student | def user_in_group?(attribs, dir_info)
temp = user_record_name_alternatives(attribs)
username = temp[:record_name]
# pp username
# pp attribs
attribs = group_record_name_alternatives(attribs)
# groupname = attribs[:record_name]
attribs[:value] = username
# pp attribs
check_critical_attribute( attribs, :value, :username )
check_critical_attribute( attribs, :record_name, :groupname )
attribs = tidy_attribs(attribs)
command = {action: 'read', scope: 'Groups', attribute: nil, value: nil}
cmd_attribs = attribs.merge(command)
dscl( cmd_attribs, dir_info )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def priv_groups(domain,username,password,dc_ip)\n groupArr = [\"Domain Admins\",\"Enterprise Admins\",\"Administrators\"]\n groupArr.each {|group| enum_group_membership(domain,username,password,dc_ip,group)}\n\n priv_groups = Array.new\n\n groupArr.each do |group|\n groupFormatted = group.gsub(' '... | [
"0.63096815",
"0.6192209",
"0.6168978",
"0.5735705",
"0.57065",
"0.566582",
"0.55977696",
"0.555057",
"0.5533047",
"0.55120414",
"0.54727644",
"0.5412138",
"0.5398606",
"0.538851",
"0.5374278",
"0.53711075",
"0.5338259",
"0.5334743",
"0.5280515",
"0.5279155",
"0.5274533",
"... | 0.6092619 | 3 |
dscl . delete /Groups/yourGroupName | def group_delete(attribs, dir_info)
attribs = group_record_name_alternatives(attribs)
check_critical_attribute( attribs, :record_name )
command = {action: 'delete', scope: 'Groups', attribute: nil, value: nil}
user_attrs = attribs.merge(command)
dscl( user_attrs, dir_info )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n Group.delete_groups_and_acls([id])\n end",
"def delete_group(client, options)\n if options[:directory].nil? or options[:group].nil?\n puts \"Missing arguments\"\n return\n end\n\n groups = client.groups\n group = groups.get options[:group]\n group.delete\n puts \"Group deleted.\"\n ... | [
"0.7440654",
"0.7241825",
"0.7211262",
"0.7123508",
"0.7112543",
"0.7112543",
"0.71104467",
"0.70682937",
"0.7066243",
"0.7046521",
"0.7028241",
"0.701744",
"0.70083165",
"0.6990598",
"0.69859797",
"0.6957801",
"0.69464016",
"0.69464016",
"0.6940704",
"0.6863574",
"0.68242246... | 0.7430047 | 1 |
Runs one game loop | def game_loop(game, word)
game.update_screen(word)
until game.correct_positions.all? { |position| position == true }
special_result = game.read_and_validate_input(word)
break if special_result == 'QUIT'
if special_result == 'SAVE'
game.save_game(word)
break
end
if special_result == 'WORD'
correct = game.guess_word(word)
if correct
puts "\n\nCongratulations! You won!"
game.update_screen(word, true)
break
else
puts "\nYou were wrong :("
game.update_screen(word)
next
end
end
if special_result == 'GAMEOVER'
puts "\n\nYour man has fallen to his doom :("
puts "The Word was #{word}\n"
puts 'Game over..'.red
break
end
system('clear')
game.update_screen(word)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n start_game\n game_loop\n end_game\n end",
"def game_loop\n end",
"def game_loop\n end",
"def play\n\t\tgame_loop\n\tend",
"def run_game\n if !@board.game_over? and @running\n @timer.stop\n @timer.start(@board.delay, (lambda {|x| @board.run; run_game}))\n end\n end",... | [
"0.87649673",
"0.8544371",
"0.8425255",
"0.80018187",
"0.76502776",
"0.76035655",
"0.758828",
"0.7516517",
"0.74487525",
"0.74096924",
"0.729788",
"0.72965634",
"0.7294417",
"0.72561574",
"0.7174715",
"0.715",
"0.71041787",
"0.71010053",
"0.7091696",
"0.7075392",
"0.706808",
... | 0.6599419 | 99 |
for position 4 (count < position1) at line no. 33 count position curr == nil? 1 4 2 (no) 2 4 3 (no) 3 4 yes = raise for position 5 (count < position1) at line no. 29 count position curr == nil? 1 5 2 (no) 2 5 3 (no) 3 5 nil (yes) it goes further because still counter is remaining till go to position1 4 5 nil (yes) it raise here at line number 29 | def delete(head, val)
current = head
prev = nil
while (current != nil)
if current.value == val
# if it's a first element
if prev == nil
return head.next
# else any element which is not first but 2nd, 3rd and so forth
else
prev.next = prev.next.next
break
end
else
prev = current
current = current.next
end
end
return head
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startcheck(pos) #position\n set = [pos,pos] #initialized so ruby recognizes type\n numfound = 0\n\n numfound = check(set,pos,numfound)\n\n #cleanup => \n #unmark those we marked, they don't-need-to/shouldn't be condensed\n if(numfound<3)\n if numfound == 1 #we found only this node\... | [
"0.6377514",
"0.6026735",
"0.59947467",
"0.595899",
"0.59440255",
"0.5885027",
"0.58431447",
"0.5826273",
"0.58142495",
"0.5809331",
"0.580567",
"0.5799473",
"0.57869035",
"0.57806444",
"0.5780224",
"0.5753324",
"0.5748126",
"0.5726143",
"0.5673042",
"0.5654381",
"0.564202",
... | 0.0 | -1 |
GET /charts/1 GET /charts/1.xml | def show
@chart = Chart.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @chart }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @charts = Chart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @charts }\n end\n end",
"def get_chart(options={})\n api_response = @api_client.make_api_request(:GET, \"artist/chart\", {}, options)\n @api_client.chart_item_diges... | [
"0.7527839",
"0.6795368",
"0.6685772",
"0.65405685",
"0.64616686",
"0.6404945",
"0.640389",
"0.640389",
"0.6384045",
"0.63516575",
"0.62155235",
"0.6200735",
"0.61004233",
"0.60807085",
"0.6080472",
"0.60790664",
"0.6067205",
"0.606101",
"0.60535896",
"0.60415655",
"0.6010505... | 0.7207917 | 2 |
GET /charts/new GET /charts/new.xml | def new
@chart = Chart.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @chart }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @chart = Chart.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chart }\n end\n end",
"def new\n @chart = Chart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chart }\n end\n ... | [
"0.77033484",
"0.7309915",
"0.7306113",
"0.7275111",
"0.70852625",
"0.7053791",
"0.6977749",
"0.6737508",
"0.6737508",
"0.6737508",
"0.660809",
"0.66072446",
"0.6556984",
"0.6495462",
"0.6344661",
"0.6333267",
"0.63040686",
"0.63040686",
"0.6276543",
"0.625858",
"0.625858",
... | 0.77778155 | 1 |
POST /charts POST /charts.xml | def create
@chart = Chart.new(params[:chart])
respond_to do |format|
if @chart.save
format.html { redirect_to(@chart, :notice => 'Chart was successfully created.') }
format.xml { render :xml => @chart, :status => :created, :location => @chart }
else
format.html { render :action => "new" }
format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @chart = Chart.new(params[:chart])\n flash[:notice] = 'Chart was successfully created.' if @chart.save\n respond_with(@chart)\n end",
"def create\n @chart = Chart.new(params[:chart])\n\n respond_to do |format|\n if @chart.save\n format.html { redirect_to @chart, notice: '... | [
"0.65970594",
"0.65693563",
"0.63704085",
"0.6119202",
"0.61002785",
"0.6066215",
"0.6066215",
"0.60581326",
"0.602852",
"0.602785",
"0.58818173",
"0.585007",
"0.5821043",
"0.58203584",
"0.5788525",
"0.5693146",
"0.56842303",
"0.5673135",
"0.5672992",
"0.56695896",
"0.5654621... | 0.6785044 | 2 |
PUT /charts/1 PUT /charts/1.xml | def update
@chart = Chart.find(params[:id])
respond_to do |format|
if @chart.update_attributes(params[:chart])
format.html { redirect_to(@chart, :notice => 'Chart was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @chart.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @chart = Chart.find(params[:id])\n\n respond_to do |format|\n if @chart.update_attributes(params[:chart])\n format.html { redirect_to @chart, notice: 'Chart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.6449991",
"0.6297368",
"0.6296782",
"0.62869847",
"0.62565005",
"0.60187995",
"0.5938625",
"0.58949643",
"0.58259284",
"0.5767014",
"0.5705839",
"0.5652434",
"0.5622406",
"0.55728036",
"0.55679613",
"0.55430096",
"0.5536842",
"0.55357033",
"0.55357033",
"0.55357033",
"0.55... | 0.6627718 | 2 |
DELETE /charts/1 DELETE /charts/1.xml | def destroy
@chart = Chart.find(params[:id])
@chart.destroy
respond_to do |format|
format.html { redirect_to(:controller => "charts", :action => "area_chart") }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @chart = Chart.find(params[:id])\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to(charts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @chart = Chart.find(params[:id])\n @chart.chartnodes.destroy_all\n @chart.destroy\n\n res... | [
"0.7517604",
"0.7406817",
"0.70356894",
"0.70292705",
"0.70213526",
"0.7007386",
"0.6971715",
"0.67867607",
"0.67440975",
"0.6674559",
"0.66329294",
"0.6537913",
"0.6527878",
"0.6490176",
"0.6455502",
"0.6455502",
"0.64321643",
"0.64310485",
"0.6427718",
"0.6420352",
"0.64019... | 0.7183303 | 2 |
GET /welcome/home GET /welcome/home.xml | def home
@page_title = "Spendy! Home"
respond_to do |format|
format.html # home.html.erb
format.xml { head :ok }
format.iphone do # home.iphone.erb
@panel_title = @page_title
render :layout => false
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage\n get '/Pages/Default.aspx'\n end",
"def info\n get '/'\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @welcome_images }\n end\n end",
"def root\n get \"/\"\n end",
"def root\n get \"/\"\n ... | [
"0.65853876",
"0.6351047",
"0.6247749",
"0.61689335",
"0.61689335",
"0.6157365",
"0.614441",
"0.60804194",
"0.6058407",
"0.6058407",
"0.6019937",
"0.5999139",
"0.5997893",
"0.599277",
"0.59579474",
"0.59579474",
"0.5949235",
"0.5944733",
"0.5912214",
"0.5902114",
"0.5885626",... | 0.0 | -1 |
Creates a connection manager with an empty set of connections. This class is intended to be used as a singleton, so use the `instance` class method instead. | def initialize
# This hash stores the connections that have already been created. The keys of the hash will be the
# identifiers of the EMSs, and the values will be instances of the `Entry` class.
@registry = {}
# Load from the configuration the settings that control how often we purge connections that correspond to
# EMSs that no longer exist:
@purge_interval = settings.purge_interval.to_i_with_method
@purge_time = Time.current
# Make sure that all connections will be closed when the process finishes:
at_exit do
$rhevm_log.info("Closing all connections before exit.")
clear
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_connection_manager\n ThreadSafeClientConnManager.new( @mparams, @scheme_registry )\n end",
"def empty_connection_pools!; end",
"def initialize\n bootstrap_connections unless File.exist?(connections_file)\n load_connections\n end",
"def connections\n @connections ||= [... | [
"0.68826705",
"0.6653651",
"0.6432107",
"0.6380911",
"0.62814766",
"0.6249917",
"0.6229978",
"0.6208591",
"0.6195679",
"0.6056034",
"0.60286254",
"0.59706455",
"0.5960879",
"0.59563905",
"0.5942803",
"0.5937572",
"0.5929709",
"0.58996505",
"0.5872333",
"0.583394",
"0.5832141"... | 0.0 | -1 |
Returns the connection that corresponds to the given EMS identifier and options. The connection will be created if doesn't exist yet. If the connection already exists, but the given options are different to the options that were used to create it, then it will be closed and created again. This is intended to support updates to the credentials, for example changes of user names or passwords. | def get(id, opts)
# Purge connections if needed:
purge if purge?
# Find the entry for the given id and return it if the options are compatible:
entry = @registry[id]
return entry.connection if entry && entry.compatible?(opts)
# If there is an entry but it isn't compatible, then close and remove it:
if entry
$rhevm_log.info(
"Existing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}' isn't compatible " \
"with the requested options, will close it and create a new one."
)
close(id)
end
# At this point we know that either there was no connection or else it needs to be created again:
$rhevm_log.info("Creating new connection for EMS with identifier '#{id}' and URL '#{opts[:url]}'.")
connection = OvirtSDK4::Connection.new(opts)
entry = Entry.new(opts, connection)
@registry[id] = entry
# Return the new connection:
connection
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection(options={})\n raise NoToken if @token.to_s.empty?\n\n @connections ||= {}\n\n cached_connection? && !protocol_changed? ? cached_connection : new_connection\n end",
"def create_new_connection(options, &block)\n if @connection\n logger.debug(\"[WinRM] shutting previous conn... | [
"0.61312765",
"0.5736034",
"0.56035495",
"0.55937487",
"0.550592",
"0.549464",
"0.54722667",
"0.5441871",
"0.535668",
"0.52862924",
"0.52640533",
"0.52551687",
"0.5240386",
"0.5175389",
"0.5153329",
"0.5129178",
"0.5091268",
"0.50633556",
"0.5057974",
"0.5056725",
"0.5048977"... | 0.72336143 | 0 |
Closes the connection associated to the given EMS id. | def close(id)
entry = @registry.delete(id)
return unless entry
begin
$rhevm_log.info("Closing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}'.")
entry.connection.close
rescue OvirtSDK4::Error => error
$rhevm_log.warn(
"Error while closing connection for EMS with identifier '#{id}' and URL '#{entry.options[:url]}', " \
"backtrace follows."
)
$rhevm_log.warn(error.message)
error.backtrace.each do |line|
$rhevm_log.warn(line)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(id)\n wf_event_id?(id)\n api.post([id, 'close'].uri_concat)\n end",
"def close\n @connection.close # Close the active mailbox\n @connection.logout # Send the logout command\n @connection.disconnect # Close the actual connection\n end",
"def close_conne... | [
"0.64190793",
"0.6231773",
"0.6159994",
"0.6136389",
"0.6118631",
"0.6106486",
"0.60919684",
"0.60472023",
"0.60431606",
"0.6028157",
"0.5995724",
"0.59579116",
"0.59545505",
"0.5945803",
"0.5933718",
"0.59191465",
"0.58832866",
"0.5883167",
"0.58707285",
"0.58483255",
"0.584... | 0.8365954 | 0 |
Closes and forgets all the connections. Note that the manager can still be used, it will create the connections again when needed. | def clear
@registry.keys.each { |id| close(id) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n @connection_manager.close\n end",
"def close_all\n @connections.close_all\n end",
"def dispose\n return if @connection_pool.nil?\n\n until @connection_pool.empty?\n conn = @connection_pool.pop(true)\n conn&.close\n end\n\n @connection_pool = nil\n en... | [
"0.7668497",
"0.7450589",
"0.70779496",
"0.70193243",
"0.69711995",
"0.6834777",
"0.6828846",
"0.6814725",
"0.6800203",
"0.6688958",
"0.6661373",
"0.66588235",
"0.66120976",
"0.6569933",
"0.64764404",
"0.6437694",
"0.64314955",
"0.64314955",
"0.6409354",
"0.63321674",
"0.6313... | 0.0 | -1 |
Creates a new object describing a connection. | def initialize(options, connection)
@options = options
@connection = connection
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(connection_attributes)\n validate_mandatory_attributes(connection_attributes)\n HwfHmrcApi::Connection.new(connection_attributes)\n end",
"def connection\n Connection.new(conn_spec)\n end",
"def connection\n Connection.new(conn_spec)\n end",
"def new_connection; end",... | [
"0.7004096",
"0.6789055",
"0.677971",
"0.66304564",
"0.66045743",
"0.6581394",
"0.648485",
"0.6459519",
"0.64401376",
"0.6385079",
"0.6382361",
"0.63795316",
"0.6378691",
"0.63023454",
"0.6283964",
"0.6256638",
"0.6248066",
"0.6243992",
"0.6237161",
"0.6209522",
"0.62080103",... | 0.59946674 | 30 |
Checks if the this entry is compatible with the given options. A connection is compatible if it the options that were used to create it are exactly the same than the given options. | def compatible?(opts)
opts == @options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compatible?(other)\n false\n end",
"def check_options\n unless @options[:stub]\n STDERR.puts \"Please specify a host to connect to using --host\" unless @options[:host]\n STDERR.puts \"Please specify a model to check using --model\" unless @options[:model]\n return f... | [
"0.6074165",
"0.6045599",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.56833667",
"0.561666",
"0.5525309",
"0.5525309",
"0.5525309",
"0.5499034",
"0.544034",
"0.54343796",
"0.54343796",
"0.542... | 0.75475293 | 0 |
Checks if it is time to purge connections that correspond to EMSs that no longer exist in the database. | def purge?
Time.current - @purge_time > @purge_interval
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purge\n # Get the identifiers of the EMS from the database and from the registry, and calculate the difference:\n database_ids = ManageIQ::Providers::Ovirt::InfraManager.pluck(:id)\n registry_ids = @registry.keys\n purged_ids = registry_ids - database_ids\n\n # Close the connections:\n purged... | [
"0.70933026",
"0.61687094",
"0.6096776",
"0.590582",
"0.5902677",
"0.58976835",
"0.58303976",
"0.57569265",
"0.5739425",
"0.57245564",
"0.5702364",
"0.5696099",
"0.56932616",
"0.5691575",
"0.5691043",
"0.5627115",
"0.5594837",
"0.55646896",
"0.55571216",
"0.55569404",
"0.5541... | 0.63257563 | 1 |
Closes all the connections that correspond that EMSs that no longer exist in the database. | def purge
# Get the identifiers of the EMS from the database and from the registry, and calculate the difference:
database_ids = ManageIQ::Providers::Ovirt::InfraManager.pluck(:id)
registry_ids = @registry.keys
purged_ids = registry_ids - database_ids
# Close the connections:
purged_ids.each do |id|
$rhevm_log.info(
"The EMS with identifier '#{id}' no longer exists in the database, the connection will be closed."
)
close(id)
end
# Update the purge time:
@purge_time = Time.current
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_all\n @connections.close_all\n end",
"def close_connections\n @connections.values.each(&:close)\n end",
"def closeConnections\n #N Without this the cached connections won't get closed\n @contentHost.closeConnections()\n end",
"def closeConnections()\n #N Without this... | [
"0.7711901",
"0.73530525",
"0.6947571",
"0.69461405",
"0.69093853",
"0.6802882",
"0.67584205",
"0.6690401",
"0.66065574",
"0.6506693",
"0.6506693",
"0.6461829",
"0.6452855",
"0.64227253",
"0.64010775",
"0.6378468",
"0.6346231",
"0.6337507",
"0.6320681",
"0.6320681",
"0.631096... | 0.66014004 | 9 |
Returns the settings of the connection manager. | def settings
::Settings.ems.ems_ovirt.connection_manager
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings\n @settings_manager\n end",
"def get_settings\n settings.get\n end",
"def get_settings\n @bridge.get_settings\n end",
"def settings\n return @settings\n end",
"def settings\n return @settings\n end",
... | [
"0.7442025",
"0.6843902",
"0.6825964",
"0.6815452",
"0.6815452",
"0.6766492",
"0.67414266",
"0.6664022",
"0.66578126",
"0.6616409",
"0.6517596",
"0.6456353",
"0.6438402",
"0.64383745",
"0.63868517",
"0.63868517",
"0.638044",
"0.6369448",
"0.6369448",
"0.6365058",
"0.6349014",... | 0.71007746 | 1 |
gets distance between two cities | def cost(shake, cities)
distance = 0
shake.each_with_index do |c1, i|
c2 = (i == (shake.size - 1)) ? shake[0] : shake[i + 1]
# +++ get distance between two cities
distance += euc_2d cities[c1], cities[c2]
end
distance
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_between(city_1, city_2)\n Math.hypot(city_2.x - city_1.x, city_2.y - city_1.y)\nend",
"def distance(city1, city2) # haversine formula to compute great circle distances\n # nb need convert to radians\n lon1 = city1.lon * RAD_PER_DEG\n lat1 = city1.lat * RAD_PER_DEG\... | [
"0.8227443",
"0.7703495",
"0.7438826",
"0.74112356",
"0.71867234",
"0.71397513",
"0.7052167",
"0.69245255",
"0.69197166",
"0.68925357",
"0.68689406",
"0.6844648",
"0.6843373",
"0.6812917",
"0.68090725",
"0.6795379",
"0.67788523",
"0.6722451",
"0.6704945",
"0.66986805",
"0.668... | 0.6485588 | 43 |
gets reverse in range | def two_opt(shake)
perm = Array.new(shake)
c1, c2 = rand(perm.size), rand(perm.size)
collection = [c1]
collection << ((c1 == 0 ? perm.size - 1 : c1 - 1))
collection << ((c1 == perm.size - 1) ? 0 : c1 + 1)
c2 = rand(perm.size) while collection.include? (c2)
c1, c2 = c2, c1 if c2 < c1
# +++ reverses in range
perm[c1...c2] = perm[c1...c2].reverse
perm
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_range(min, max)\n reversed = [] \n \n index = max - 1 \n \n while index > min \n reversed << index \n index -= 1\n end \n \n return reversed \n \nend",
"def reverse_range(min, max)\n\ti = max\n \tarry = []\n \twhile i > min + 1\n i -=1\n arry << i\n e... | [
"0.7990748",
"0.7750124",
"0.77284634",
"0.7728301",
"0.77241874",
"0.7718352",
"0.7688151",
"0.7674692",
"0.7667949",
"0.76237965",
"0.7498455",
"0.7486348",
"0.7342698",
"0.7119615",
"0.7099041",
"0.7099041",
"0.69748014",
"0.68238634",
"0.6802179",
"0.6758775",
"0.6694144"... | 0.0 | -1 |
GET /construction_expenses GET /construction_expenses.json | def index
@construction_expenses = ConstructionExpense.all.order("created_at DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def create\n @construction_expense = ConstructionExpense.new(construction_expense_params)\n\n respond_to do |format|\n if @construction_expense.save\n format.html { redirect_to root_path, notice: 'Construction ex... | [
"0.6659299",
"0.6520159",
"0.65055424",
"0.64795685",
"0.6426143",
"0.6382438",
"0.63674146",
"0.63465184",
"0.62532586",
"0.6242231",
"0.62382334",
"0.6213262",
"0.6213234",
"0.6207032",
"0.6184197",
"0.61797196",
"0.61617935",
"0.61617935",
"0.61617935",
"0.61617935",
"0.61... | 0.6559654 | 1 |
GET /construction_expenses/1 GET /construction_expenses/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @expense = current_user.organization.expenses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def set_construction_expense\n @construction_expense = ConstructionExpense.find(params[:id])\n end... | [
"0.66751117",
"0.6669506",
"0.66435164",
"0.6616033",
"0.6598347",
"0.657494",
"0.6564787",
"0.65063477",
"0.65063477",
"0.65063477",
"0.65063477",
"0.65063477",
"0.6410001",
"0.6399676",
"0.6324974",
"0.63197803",
"0.6302435",
"0.6291151",
"0.6268371",
"0.62529576",
"0.62201... | 0.0 | -1 |
POST /construction_expenses POST /construction_expenses.json | def create
@construction_expense = ConstructionExpense.new(construction_expense_params)
respond_to do |format|
if @construction_expense.save
format.html { redirect_to root_path, notice: 'Construction expense was successfully created.' }
format.json { render :show, status: :created, location: @construction_expense }
else
format.html { render :new }
format.json { render json: @construction_expense.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n @expense = Expense.new(expense_params)\n\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n \n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n ... | [
"0.69896954",
"0.69765955",
"0.69157416",
"0.66434765",
"0.6574246",
"0.65408623",
"0.6496539",
"0.64624095",
"0.6363663",
"0.6356102",
"0.6346727",
"0.6338695",
"0.6337026",
"0.6293627",
"0.62786674",
"0.62495375",
"0.6247721",
"0.6238824",
"0.62264425",
"0.6225141",
"0.6202... | 0.7696556 | 0 |
PATCH/PUT /construction_expenses/1 PATCH/PUT /construction_expenses/1.json | def update
respond_to do |format|
if @construction_expense.update(construction_expense_params)
format.html { redirect_to @construction_expense, notice: 'Construction expense was successfully updated.' }
format.json { render :show, status: :ok, location: @construction_expense }
else
format.html { render :edit }
format.json { render json: @construction_expense.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { r... | [
"0.70114714",
"0.6817503",
"0.67659867",
"0.6595009",
"0.6591188",
"0.6582702",
"0.6581021",
"0.6554496",
"0.6515357",
"0.6515357",
"0.64758146",
"0.6439279",
"0.64058924",
"0.639098",
"0.6382717",
"0.6382717",
"0.6382717",
"0.6363434",
"0.63544077",
"0.6351631",
"0.63405055"... | 0.6809714 | 2 |
DELETE /construction_expenses/1 DELETE /construction_expenses/1.json | def destroy
@construction_expense.destroy
respond_to do |format|
format.html { redirect_to construction_expenses_url, notice: 'Construction expense was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html ... | [
"0.7375016",
"0.7301809",
"0.73000616",
"0.73000616",
"0.7262738",
"0.7252981",
"0.7248885",
"0.7248885",
"0.7145355",
"0.7112137",
"0.70849514",
"0.7055886",
"0.7045581",
"0.7045581",
"0.7045581",
"0.7045581",
"0.7045581",
"0.7045581",
"0.69821775",
"0.6977332",
"0.695557",
... | 0.7442039 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_construction_expense
@construction_expense = ConstructionExpense.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def construction_expense_params
params.require(:construction_expense).permit(:material_description, :amount, :owner)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
GET /everydays GET /everydays.json | def index
@everydays = Everyday.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def set_everyday\n @everyday = Everyday.find(params[:id])\n end",
"def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n ... | [
"0.66841364",
"0.65996456",
"0.6409283",
"0.6333991",
"0.62007236",
"0.61959934",
"0.6188859",
"0.61742467",
"0.61663413",
"0.6161771",
"0.61412436",
"0.6059106",
"0.60513824",
"0.5995897",
"0.5991781",
"0.59844416",
"0.59807616",
"0.59723216",
"0.59380704",
"0.5926723",
"0.5... | 0.7274144 | 0 |
GET /everydays/1 GET /everydays/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @everydays = Everyday.all\n end",
"def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n end",
"def set_everyday\n @everyday = Everyday.find(params[:id])\n end",
"def daily\n object # Initializing to mak... | [
"0.7072942",
"0.6704829",
"0.66739696",
"0.6578025",
"0.6522374",
"0.63656336",
"0.6358717",
"0.6280563",
"0.6162076",
"0.615712",
"0.6151431",
"0.6126535",
"0.60666364",
"0.60655785",
"0.60551673",
"0.6052626",
"0.60312504",
"0.6025219",
"0.60220593",
"0.5994382",
"0.5978404... | 0.0 | -1 |
POST /everydays POST /everydays.json | def create
@everyday = Everyday.new(everyday_params)
respond_to do |format|
if @everyday.save
format.html { redirect_to :back, notice: 'Everyday was successfully created.' }
format.json { render :show, status: :created, location: :back }
else
format.html { render :new }
format.json { render json: @everyday.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_everyday\n @everyday = Everyday.find(params[:id])\n end",
"def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params... | [
"0.60896844",
"0.59003717",
"0.58973724",
"0.57750404",
"0.57136077",
"0.5689553",
"0.56647605",
"0.5659476",
"0.5605483",
"0.54992175",
"0.5485113",
"0.5469261",
"0.54659045",
"0.54556376",
"0.5435531",
"0.54342586",
"0.5425583",
"0.54221326",
"0.5417237",
"0.540463",
"0.540... | 0.6630837 | 0 |
PATCH/PUT /everydays/1 PATCH/PUT /everydays/1.json | def update
respond_to do |format|
if @everyday.update(everyday_params)
format.html { redirect_to :back, notice: 'Everyday was successfully updated.' }
format.json { render :show, status: :ok, location: :back }
else
format.html { render :edit }
format.json { render json: @everyday.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @day.update(update_params)\n render json: @day, include: [:activities]\n else \n render json: @day.errors\n end\n end",
"def set_everyday\n @everyday = Everyday.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @tas... | [
"0.6328196",
"0.6328081",
"0.6133792",
"0.611257",
"0.5963384",
"0.5951463",
"0.5947674",
"0.5879265",
"0.5850053",
"0.58497775",
"0.58165795",
"0.580463",
"0.5785597",
"0.5773269",
"0.5760348",
"0.57367593",
"0.5730971",
"0.57227343",
"0.57154465",
"0.56800395",
"0.56774",
... | 0.6927426 | 0 |
DELETE /everydays/1 DELETE /everydays/1.json | def destroy
@everyday.destroy
respond_to do |format|
format.html { redirect_to everydays_url, notice: 'Everyday was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_all(date = Date.today)\n delete(date.strftime(@request_path))\n end",
"def destroy\n @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @day = Day.find(params[:id])\n @day.... | [
"0.69665116",
"0.67102396",
"0.66386753",
"0.6553476",
"0.65202314",
"0.6462715",
"0.646062",
"0.64455366",
"0.6442089",
"0.64065385",
"0.63933307",
"0.63892376",
"0.6362518",
"0.63495654",
"0.6343083",
"0.6332661",
"0.63257277",
"0.6316366",
"0.63014525",
"0.62983966",
"0.62... | 0.71945614 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_everyday
@everyday = Everyday.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def everyday_params
params.require(:everyday).permit(:read, :cardio, :exercise, :eat_to_plan, :make_money)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /resource_import_files GET /resource_import_files.json | def index
@resource_import_files = ResourceImportFile.page(params[:page])
respond_to do |format|
format.html # index.html.erb
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @resource_import_file = ResourceImportFile.find_by(id: params[:resource_import_file_id])\n if @resource_import_file\n if request.format.text?\n @resource_import_results = @resource_import_file.resource_import_results\n else\n @resource_import_results = @resource_import_fil... | [
"0.65673685",
"0.63847166",
"0.6238196",
"0.6160717",
"0.6133016",
"0.6123933",
"0.6122611",
"0.6096373",
"0.6085375",
"0.60096335",
"0.5826483",
"0.5823359",
"0.58093315",
"0.58054435",
"0.5777549",
"0.5763998",
"0.5763272",
"0.57436293",
"0.5695138",
"0.5695138",
"0.5695138... | 0.70251775 | 0 |
GET /resource_import_files/1 GET /resource_import_files/1.json | def show
@resource_import_results = @resource_import_file.resource_import_results.page(params[:page])
respond_to do |format|
format.html # show.html.erb
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @resource_import_files = ResourceImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n @resource_import_file = ResourceImportFile.find_by(id: params[:resource_import_file_id])\n if @resource_import_file\n if reque... | [
"0.6988211",
"0.68019485",
"0.628874",
"0.6260535",
"0.62352586",
"0.62322205",
"0.61994076",
"0.61859846",
"0.61519456",
"0.6042415",
"0.6017899",
"0.6017899",
"0.6017899",
"0.5998597",
"0.59978217",
"0.5868479",
"0.58679044",
"0.57720214",
"0.5749232",
"0.57485163",
"0.5740... | 0.6465003 | 2 |
POST /resource_import_files POST /resource_import_files.json | def create
@resource_import_file = ResourceImportFile.new(resource_import_file_params)
@resource_import_file.user = current_user
respond_to do |format|
if @resource_import_file.save
if @resource_import_file.mode == 'import'
ResourceImportFileJob.perform_later(@resource_import_file)
end
format.html { redirect_to @resource_import_file, notice: t('import.successfully_created', model: t('activerecord.models.resource_import_file')) }
format.json { render json: @resource_import_file, status: :created, location: @resource_import_file }
else
prepare_options
format.html { render action: "new" }
format.json { render json: @resource_import_file.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_import_params\n params.permit(:file)\n end",
"def import_resources\n # for each resource type, look for a file of measurement data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.unrestr... | [
"0.66359407",
"0.6210905",
"0.61485267",
"0.61209726",
"0.60407674",
"0.60240185",
"0.6018459",
"0.5925431",
"0.59234285",
"0.58760333",
"0.58420527",
"0.5828545",
"0.5824298",
"0.58238655",
"0.5813659",
"0.58081394",
"0.57994705",
"0.5795284",
"0.5773734",
"0.5766934",
"0.57... | 0.68423814 | 0 |
PUT /resource_import_files/1 PUT /resource_import_files/1.json | def update
respond_to do |format|
if @resource_import_file.update(resource_import_file_params)
if @resource_import_file.mode == 'import'
ResourceImportFileJob.perform_later(@resource_import_file)
end
format.html { redirect_to @resource_import_file, notice: t('controller.successfully_updated', model: t('activerecord.models.resource_import_file')) }
format.json { head :no_content }
else
prepare_options
format.html { render action: "edit" }
format.json { render json: @resource_import_file.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @resource_import_file = ResourceImportFile.new(resource_import_file_params)\n @resource_import_file.user = current_user\n\n respond_to do |format|\n if @resource_import_file.save\n if @resource_import_file.mode == 'import'\n ResourceImportFileJob.perform_later(@resource_i... | [
"0.6438908",
"0.6217954",
"0.6214161",
"0.6188599",
"0.60518265",
"0.60505116",
"0.60078007",
"0.59259033",
"0.589679",
"0.5834578",
"0.5829367",
"0.5814859",
"0.58146626",
"0.58146626",
"0.5807853",
"0.5791179",
"0.5754489",
"0.5743385",
"0.5727049",
"0.56840557",
"0.5667648... | 0.6792846 | 0 |
DELETE /resource_import_files/1 DELETE /resource_import_files/1.json | def destroy
@resource_import_file.destroy
respond_to do |format|
format.html { redirect_to resource_import_files_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.resource_import_file')) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @agent_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(agent_import_files_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource_file = ResourceFile.find(params[:id])\n @resource_file.destroy\n\n respond_to do |format... | [
"0.7266368",
"0.71524155",
"0.71393204",
"0.71231097",
"0.70842123",
"0.67905974",
"0.6733849",
"0.67136604",
"0.6695157",
"0.66710293",
"0.66710293",
"0.66710293",
"0.6636724",
"0.66088045",
"0.6603813",
"0.6593575",
"0.65913576",
"0.6543522",
"0.6518902",
"0.65058625",
"0.6... | 0.75656533 | 0 |
return the new version and the reasons | def new_version
%w(major minor patch).each do |level|
changes = git_changelog.select(&"#{level}?".to_sym)
return [ last_release.send("#{level}!"), changes ] if changes.size > 0
end
raise "No commit since last release (#{last_release})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_version; end",
"def get_version()\n\t\tend",
"def version_mismatch_detected\n end",
"def update_necessary?\n load_mixlib_versioning\n cur_version = Mixlib::Versioning.parse(current_version)\n des_version = Mixlib::Versioning.parse(desired_version)\n Chef::Log.debug(\"The current chef-client ... | [
"0.67777437",
"0.6207351",
"0.61994094",
"0.6154905",
"0.614534",
"0.6111828",
"0.61111784",
"0.6100825",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0.60958844",
"0... | 0.63348883 | 1 |
This show method displays the user's accout details | def show
@my_accounts=@current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @user_picture = @user.profile_image.expiring_url(3600, :square)\n @bookmarks = @user.bookmarks\n @enrollments = @user.courses\n @enrollments_visible = @user.course_enrollments_visible_for_user(current_user)\n @completions_visible = @user.course_results_visible_for_user(current_user)\n en... | [
"0.75487053",
"0.7194765",
"0.7172333",
"0.7027965",
"0.7009028",
"0.7008943",
"0.68949753",
"0.6892981",
"0.6883185",
"0.68554735",
"0.6837769",
"0.6820351",
"0.6820149",
"0.6819964",
"0.68073547",
"0.6804762",
"0.6798909",
"0.6776452",
"0.672516",
"0.6709773",
"0.6709125",
... | 0.7154594 | 3 |
This update method is used to update the user's account details like firstname, lastname, email id, password, contact details etc. | def update
#@my_accounts=@current_user.user_profile.update_attributes(params[:body])
@my_account=@current_user
#@my_account.before_update_account(params[:body][:user])
@my_account.update_attributes(params[:body][:user])
#@my_accounts.after_update_account(params[:body][:user])
file=params[:body][:file]
unless file[:encoded].empty?
if @my_account.attachment.nil?
Attachment.create_file(file[:encoded],@my_account,file[:file_name])
else
Attachment.update_file(file[:encoded],@my_account,file[:file_name])
end
end
unless @my_account.errors.empty?
render :json=>failure1(@my_account.errors)
else
render :json=>success1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n if @user.update(username: params[:username], email: params[:email], password: params[:password])\n render json: {status: 'SUCCESS', message: 'Account successfully updated', accessToken: @user.access_token}.to_json\n else\n render json: { errors: ['Update unsuccessful!'], stat... | [
"0.77663153",
"0.7693334",
"0.7693111",
"0.7604531",
"0.75612116",
"0.7513157",
"0.75130856",
"0.7504295",
"0.74569434",
"0.7436344",
"0.74172926",
"0.7413689",
"0.7364494",
"0.7331689",
"0.73256224",
"0.7323617",
"0.7321192",
"0.73104686",
"0.7297421",
"0.72915566",
"0.72797... | 0.0 | -1 |
This confirmation method saves user's accont details | def confirm
@profiles=@current_user.user_profile.update_attributes(params[:body])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show \n @user.confirmed = true\n @user.save!\n Session.create(@user)\n flash[:notice] = \"Thanks, your email address has been confirmed.\" \n redirect_to dashboard_url \n end",
"def confirm\n approval = Approval.find_by(id: params[:id])\n approval.approval = true\n approval.sa... | [
"0.6479514",
"0.6477246",
"0.639822",
"0.6364255",
"0.6328995",
"0.6306834",
"0.6261867",
"0.62605214",
"0.6229507",
"0.62193197",
"0.62167263",
"0.6208338",
"0.6168529",
"0.6163406",
"0.6126741",
"0.61217546",
"0.6110658",
"0.6105941",
"0.6090884",
"0.60697573",
"0.6065104",... | 0.6491109 | 0 |
UpdatePassword method updates the user's current password | def update_password
parameters=params[:body]
@my_accounts=@current_user
if @my_accounts.valid_password?(parameters[:current_password])
if @my_accounts.updatePassword(parameters)
render :json=>success1
else
render :json=>failure1(:current_password=>["Current password is wrong"])
end
else
render :json=>failure1(@my_accounts.errors)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_password\n if current_user.update_with_password(update_password_params)\n expose current_user\n else\n error! :invalid_resource, current_user.errors\n end\n end",
"def update_password\n @user = current_user\n\n # update_password assigns params to user ... | [
"0.8609968",
"0.835052",
"0.82832676",
"0.8243227",
"0.8206766",
"0.82027483",
"0.8143924",
"0.81153727",
"0.8032305",
"0.80255777",
"0.79965085",
"0.79620785",
"0.7953362",
"0.79267395",
"0.79267395",
"0.78944284",
"0.7860386",
"0.7860186",
"0.78431106",
"0.783977",
"0.78351... | 0.7828948 | 21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.