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
display all stock info
def full_info(db) info = db.execute("SELECT stocks2.company_name,stocks2.stock_ticker,stocks2.stock_price,stocks2.stock_exchange,stocks1.recommendation FROM stocks2 JOIN stocks1 ON stocks2.recommendation_id = stocks1.id;") puts "" info.each do |category| puts " Company Name : #{category['company_name']} Stock Ticker : #{category['stock_ticker']} Stock Price : #{category['stock_price']} Stock Exchange: #{category['stock_exchange']} Rating : #{category['recommendation']}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @stock = Stock.find(params[:id])\n @items = @stock.item\n @stock_audits = @stock.stock_audit\n end", "def stocks\n\n end", "def index\n render :layout => \"user\"\n #Stock.test 'SK6U.SI'\n #Stock.searchSymbol 'starhub'\n #Stock.historicalData 'CC3.SI','2013-07-21','2013-07-25'...
[ "0.7258694", "0.7220351", "0.72107476", "0.7159445", "0.70638436", "0.70638436", "0.70638436", "0.70638436", "0.69971085", "0.695509", "0.6935364", "0.693432", "0.69110006", "0.68549937", "0.68522435", "0.68075544", "0.68004185", "0.6786964", "0.67383635", "0.67300165", "0.67...
0.0
-1
View stock rating by stock ticker.
def stock_rating_by_ticker(db,stock_ticker) info =db.execute(<<-SQL SELECT stocks1.recommendation FROM stocks2 JOIN stocks1 ON stocks2.recommendation_id = stocks1.id Where stock_ticker="#{stock_ticker}"; SQL ) puts "===========================================" info.each do |category| puts " Rating : #{category['recommendation']}" end puts "===========================================" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @stock = Stock.find(params[:id])\n @quote = YahooFinance::get_standard_quotes(@stock.ticker)[@stock.ticker]\n @tweets = Twitter.search('$' + @stock.ticker).results\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "de...
[ "0.631439", "0.6221746", "0.61881375", "0.60670185", "0.6023123", "0.6011484", "0.6006157", "0.59581685", "0.5951628", "0.5937563", "0.59231937", "0.5920202", "0.5919826", "0.5901018", "0.5854697", "0.5853447", "0.5838837", "0.5830437", "0.58225834", "0.58210045", "0.58164966...
0.60575294
4
view stocks by certain price
def stock_by_price(db,price) info =db.execute(<<-SQL SELECT stocks2.stock_ticker, stocks2.stock_price FROM stocks2 Where stock_price >"#{price}"; SQL ) puts "These follwing stocks are above $#{price}." puts "===========================================" info.each do |category| puts " Stock Ticker : #{category['stock_ticker']} Stock Price : #{category['stock_price']}" end puts "===========================================" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @stock_prices = StockPrice.all\n end", "def index\n @prices = Price.all\n end", "def index\n @prices = Price.all\n end", "def show\n @portfolio = Portfolio.find(params[:id])\n\n \n # @stocks = YahooFinance.quotes([@portfolio.stocks.group_by(&:stock_symbol)], [:ask, :bid], { r...
[ "0.69174224", "0.66827065", "0.66827065", "0.6642413", "0.6596903", "0.65562946", "0.6541607", "0.6524333", "0.6453875", "0.6356635", "0.6355919", "0.63423777", "0.6339856", "0.633441", "0.63135374", "0.631001", "0.62855583", "0.6277117", "0.62562686", "0.6248119", "0.6212147...
0.6524777
7
method to display less info about each stock.
def less_info(db) info = db.execute("SELECT stocks2.stock_ticker,stocks1.recommendation FROM stocks2 JOIN stocks1 ON stocks2.recommendation_id = stocks1.id;") info.each do |category| puts " Stock Ticker : #{category['stock_ticker']} Rating : #{category['recommendation']}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @stock = Stock.find(params[:id])\n @items = @stock.item\n @stock_audits = @stock.stock_audit\n end", "def stocks\n\n end", "def show\n\t\t\n\t\t#Show total items and prices\n\t\tputs \"\\nShopping list: \"\n @list_products.each {|key, val| print val, \" \", key, \" \",productsMarke...
[ "0.65670115", "0.6542134", "0.648184", "0.63011235", "0.6294176", "0.60961866", "0.60911953", "0.60625654", "0.60086185", "0.6000794", "0.59954786", "0.59662706", "0.59593064", "0.59510046", "0.5950865", "0.59379345", "0.5937267", "0.59259033", "0.5919316", "0.5911653", "0.59...
0.57326883
45
Return a string suitable for a Link header for the given asset types/groups.
def preload_assets_link_header(*args) _preload_assets_array(args).map{|path, as| "<#{path}>;rel=preload;as=#{as}"}.join(",") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_to_group(group, options={})\n if group.is_a?(Group)\n name = h(group.name)\n name\n else\n h(group.to_s)\n end\n end", "def link_headers\n yield if block_given?\n return '' unless response.include? 'Link'\n\n response['Link'].split(\",\\n\").map do |line|\n ...
[ "0.57666767", "0.5554674", "0.55449826", "0.5508934", "0.5475637", "0.5463846", "0.5373173", "0.53267276", "0.53070956", "0.5268659", "0.52500427", "0.52480745", "0.5217396", "0.52102214", "0.5206908", "0.5185243", "0.5180088", "0.5177367", "0.5164608", "0.5155887", "0.515330...
0.0
-1
Return an array of paths/as pairs for the given asset types and/or groups.
def _preload_assets_array(assets) assets.map do |type| paths = assets_paths(type) type = type[0] if type.is_a?(Array) as = TYPE_AS[type] paths.map{|path| [path, as]} end.flatten(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups_by_asset_type(type)\n arr = []\n groups.each do |group|\n arr << group if !@bundles[group.to_s].assets(type.to_sym).empty?\n end\n return arr\n end", "def get_assets(type, options = {})\n type = type.to_sym\n\n filtered_assets = []\n\n parents.e...
[ "0.6720017", "0.66494125", "0.6104565", "0.610242", "0.5847597", "0.57444996", "0.5533651", "0.5492172", "0.5486772", "0.54427785", "0.5433832", "0.5421612", "0.540857", "0.54022443", "0.54022443", "0.53719497", "0.52690303", "0.52605104", "0.5236442", "0.5216548", "0.5192718...
0.607574
4
before_filter :check, :only=>[:create] crudify :'refinery/ships/ship', :xhr_paging => true before_filter :all_collections, :only=>[:new, :edit]
def index if client_signed_in? @ships = Refinery::Ships::Ship.includes(:translations, :page_status).where(:client_id=>current_client.id).order('updated_at DESC') @all = @ships @moderate = @ships.select{|ship| ship.page_status.id == 1} @published = @ships.select{|ship| ship.page_status.id == 2} if (params[:status]=='1' or params[:status]=='2') params[:status]=='1' ? @ships = @moderate : @ships = @published end else redirect_to(root_path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:company_id] == nil\n render status: 422, json: {errors: ['company_id is required']}\n else\n @shipments = filter(params)\n @shipments = sort_accordingly_to_params(params, @shipments)\n @shipments = make_pagination(params, @shipments)\n ...
[ "0.594476", "0.59187573", "0.58799136", "0.5827994", "0.5777794", "0.5753862", "0.5714483", "0.5603547", "0.55215657", "0.55150557", "0.55035037", "0.54972976", "0.54972976", "0.5497178", "0.5485776", "0.5481498", "0.54684716", "0.54476863", "0.5432035", "0.54228103", "0.5413...
0.6284054
0
TODO: Should this method be here? The responsability of initialize preferences shouldn't be of other module?
def test_should_init_mail_settings assert Preference.init_mail_settings end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_static_preferences!\n @preference_store = default_preferences\n end", "def load_all\n parse_json(get(PREFERENCE_URL))['prefs'].each do |p|\n @@greader_preferences[p['id']] = p['value']\n end\n end", "def set_preferences\n unless current_user.pref...
[ "0.68646574", "0.6762229", "0.67269933", "0.67051286", "0.6561225", "0.6489059", "0.64557296", "0.64415497", "0.64272344", "0.6423151", "0.64202106", "0.6395984", "0.6195999", "0.6173371", "0.6166012", "0.6166012", "0.61643034", "0.6160293", "0.61566055", "0.61537826", "0.613...
0.54639274
65
TODO: Should this method be here? The responsability of saving preferences isn't of the controller? A preference should just represent one instance of preferences?
def test_should_save_settings prefs = { "store_name" => "Substruct", "store_handling_fee" => "0.00", "store_use_inventory_control"=>"1" } assert Preference.save_settings(prefs) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remember_preference settings\n self.preference = Preference.find_or_create_by user_id: self\n self.preference.update settings\n end", "def preferences_field\n :preferences\n end", "def store(prefs)\n prefs.each do |key, value|\n self[key] = value\n end if prefs.respond_to?(:...
[ "0.71047384", "0.6982862", "0.69240975", "0.68625", "0.67936575", "0.67744124", "0.6701743", "0.6616281", "0.6584082", "0.6558399", "0.6545109", "0.6542056", "0.65122724", "0.6495747", "0.6444124", "0.6442849", "0.64281374", "0.63773936", "0.6375911", "0.63714576", "0.6358978...
0.57040185
100
Here we verify if a preference is true.
def test_should_verify_if_is_true a_preference = preferences(:store_use_inventory_control) assert a_preference.is_true? a_preference = preferences(:store_require_login) assert !a_preference.is_true? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_pref?(preference)\n !prefs[preference].to_s.empty?\nend", "def pref?\n type? 'PREF'\n end", "def prescriptively_ok?\n acceptance & PRESCRIPTIVE == PRESCRIPTIVE\n end", "def has_dietary_preferences?\n return self.dietary_preference.present?\n end", "def display_checked?(_prefere...
[ "0.7398408", "0.7188429", "0.694314", "0.6846657", "0.6842776", "0.64817506", "0.6453544", "0.6366312", "0.63659054", "0.62658584", "0.6238055", "0.61952966", "0.6189725", "0.6163909", "0.6163411", "0.61403745", "0.61381257", "0.6134576", "0.61083555", "0.6105409", "0.610343"...
0.7983518
0
if RAILS_ENV == 'production' define_index do indexes :name indexes description indexes sections.name indexes sections.text indexes street indexes city indexes url indexes location_type.name indexes comments.title indexes comments.text indexes user.username end end
def address_empty? if !self.street.blank? or !self.city.blank? or !self.state.blank? or !self.postal_code.blank? return false else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_index_existence\n index_every_directory(:remove_first) unless index_exists? or RAILS_ENV==\"production\"\n end", "def ensure_index_existence\n index_every_directory(:remove_first) unless index_exists? or RAILS_ENV==\"production\"\n end", "def indexes\n raise 'not implemented'\n ...
[ "0.64384854", "0.64384854", "0.62137336", "0.61372256", "0.60987246", "0.60636115", "0.60047305", "0.60047305", "0.5986503", "0.5949258", "0.59465885", "0.59400415", "0.59310704", "0.59061843", "0.590034", "0.58992034", "0.5898599", "0.5882596", "0.58533615", "0.5828817", "0....
0.0
-1
GET /orders/1 GET /orders/1.json
def show @order = Order.where(id: params[:id], user: current_user).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def index\n @orders = Order.order(\"id\").all\n\n resp...
[ "0.7554187", "0.7488565", "0.7475228", "0.73777765", "0.73714006", "0.7341344", "0.73384553", "0.73168725", "0.73018956", "0.7291244", "0.7291244", "0.7291244", "0.7291244", "0.72911215", "0.7281374", "0.7266143", "0.72498786", "0.7228276", "0.7213504", "0.71842283", "0.71261...
0.0
-1
POST /orders POST /orders.json
def create @products = Product.all order_products = [] @products.each do |p| sym = "product_#{p.id}".to_sym if params[sym].present? count = params[sym].to_i if count > 0 order_product = OrderProduct.new(product: p, count: count) order_products << order_product end end end if order_products.size > 0 order = Order.new(user: current_user) order.save! order_products.each do |i| i.order = order i.save! end redirect_to order_path(order.id) else redirect_to new_order_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders\n authenticated_post(\"orders\").body\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def create\n order = Order.create(order_params)\n render json: order\nend", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = ...
[ "0.75886714", "0.7490972", "0.7488501", "0.74664384", "0.72739846", "0.7195349", "0.7063682", "0.69745994", "0.6910657", "0.68880194", "0.68747663", "0.685004", "0.6840204", "0.6838178", "0.6838178", "0.6838178", "0.6838178", "0.682244", "0.6790037", "0.67793274", "0.6779247"...
0.0
-1
DELETE /orders/1 DELETE /orders/1.json
def destroy Order.where(id: params[:id], user: current_user).first.destroy! redirect_to action: 'index' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end", "def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\...
[ "0.75915873", "0.7474085", "0.7430466", "0.73727256", "0.73726606", "0.73718613", "0.73583674", "0.73583674", "0.73583674", "0.73583674", "0.73583674", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0.734848", "0...
0.0
-1
GET /articles or /articles.json
def index @article = Article.includes(:user).order('created_at DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end", "def article(id, params = {})\n get \"articles/#{id}\", {query: params}\n end", "def GetArticles params = {}\n\...
[ "0.7225488", "0.72081155", "0.70706594", "0.70543015", "0.70543015", "0.70543015", "0.70543015", "0.70543015", "0.70543015", "0.7025084", "0.7021429", "0.6986294", "0.6986294", "0.6986294", "0.6986294", "0.6986294", "0.6986294", "0.6986294", "0.6986294", "0.6986294", "0.69862...
0.0
-1
GET /articles/1 or /articles/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end", "def article(id, params = {})\n get \"articles/#{id}\", {query: params}\n end", "def article(id, *args)\n ...
[ "0.72986925", "0.72947234", "0.7097804", "0.704951", "0.704951", "0.704951", "0.704951", "0.704951", "0.704951", "0.704951", "0.704951", "0.704951", "0.704951", "0.704951", "0.704951", "0.704951", "0.704951", "0.7026049", "0.70235556", "0.70208627", "0.7020236", "0.7013127"...
0.0
-1
POST /articles or /articles.json
def create @article = Article.new(article_params) respond_to do |format| if @article.save format.html { redirect_to root_path, notice: 'Article was successfully created.' } format.json { render :index, status: :created, location: @article } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @article.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n ...
[ "0.69139385", "0.69022036", "0.6837345", "0.6837345", "0.6837345", "0.6837345", "0.6837345", "0.6837345", "0.6837345", "0.6837345", "0.6790484", "0.6773438", "0.67692786", "0.6758303", "0.6749435", "0.6733409", "0.6721679", "0.6721679", "0.6715562", "0.6715562", "0.6715562", ...
0.6786828
11
PATCH/PUT /articles/1 or /articles/1.json
def update if @article.user != current_user redirect_to root_path else respond_to do |format| if @article.update(article_params) format.html { redirect_to @article, notice: 'Article was successfully updated.' } format.json { render :show, status: :ok, location: @article } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @article.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @article = article_get(params[:id])\n @article.update(params[:article])\n respond_with(@article)\n end", "def update_article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"articles/#{id}\",options)\n if response['success']\n re...
[ "0.70243174", "0.6928369", "0.69101673", "0.68680274", "0.6860129", "0.6860129", "0.6860129", "0.6860129", "0.6860129", "0.6860129", "0.6860129", "0.6860129", "0.6860129", "0.6860129", "0.68567026", "0.68324685", "0.682033", "0.6802904", "0.6786608", "0.6786608", "0.6786608",...
0.0
-1
DELETE /articles/1 or /articles/1.json
def destroy if @article.user != current_user redirect_to root_path else @article.destroy respond_to do |format| format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' } format.json { head :no_content } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @article = Article.where(id: params[:id]).last\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id]) \n @article.destroy\n\n respo...
[ "0.7802082", "0.77808625", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", "0.7762953", ...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_article @article = Article.find(params[:id]) @article_bodies=ArticleBody.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 article_params params.require(:article).permit(:title,:image,:buyer_id,:item_id, tags_attributes: [:id, :text, :_destroy], article_bodies_attributes: [:id, :order, :body,{images: []},:_destroy]).merge(user_id: current_user.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
GET /draft_lists/new GET /draft_lists/new.xml
def new @draft_list = DraftList.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @draft_list } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @draft = SmsOnRails::Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end", "def new\n @draft = @compare.drafts.build \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml...
[ "0.69568026", "0.6762843", "0.67102605", "0.670306", "0.66820025", "0.6679832", "0.66745394", "0.6630775", "0.65615577", "0.65440714", "0.6540415", "0.6540345", "0.6521184", "0.6509956", "0.6496252", "0.6495337", "0.6472967", "0.6470149", "0.6447194", "0.64383936", "0.6425332...
0.80648017
0
POST /draft_lists POST /draft_lists.xml
def create params[:draft_list].store(:user_id, current_user.id) params[:draft_list].store(:year, Time.now.year) @draft_list = DraftList.new(params[:draft_list]) respond_to do |format| if @draft_list.save # Populate this list with all of the available cars rankedCars = PreseasonRanking.find_all_by_year( @draft_list.year, :order => "position DESC").collect{|pr| pr.car} rankedCars.each do |car| @draft_list.add_car(car) end # Car.find_all_by_year(@draft_list.year, :order => "number").each do |car| # @draft_list.add_car(car) # end flash[:notice] = 'Draft list was successfully created.' format.html { redirect_to(draft_lists_path) } format.xml { render :xml => @draft_list, :status => :created, :location => @draft_list } else format.html { render :action => "new" } format.xml { render :xml => @draft_list.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @draft_list = DraftList.find(params[:id])\n\n respond_to do |format|\n if @draft_list.update_attributes(params[:draft_list])\n flash[:notice] = 'Draft list was successfully updated.'\n format.html { redirect_to(draft_lists_path) }\n format.xml { head :ok }\n else\...
[ "0.63938475", "0.6388358", "0.6145281", "0.5994053", "0.5969233", "0.5941389", "0.58176166", "0.5741093", "0.5715119", "0.5673285", "0.5673227", "0.56605244", "0.56574726", "0.5634852", "0.5632401", "0.56087613", "0.5605864", "0.55926204", "0.55814457", "0.5562096", "0.552869...
0.6137105
3
PUT /draft_lists/1 PUT /draft_lists/1.xml
def update @draft_list = DraftList.find(params[:id]) respond_to do |format| if @draft_list.update_attributes(params[:draft_list]) flash[:notice] = 'Draft list was successfully updated.' format.html { redirect_to(draft_lists_path) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @draft_list.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end", "def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end", "def update\n @list = List.find(params[:id])\n @show_list =...
[ "0.63704234", "0.6353446", "0.6287557", "0.6285754", "0.6237817", "0.6230982", "0.6184482", "0.6094058", "0.6075279", "0.6065166", "0.6065166", "0.60512656", "0.6043054", "0.6038768", "0.6019874", "0.6018788", "0.60174894", "0.6013198", "0.59993565", "0.59912586", "0.5988361"...
0.765184
0
DELETE /draft_lists/1 DELETE /draft_lists/1.xml
def destroy @draft_list = DraftList.find(params[:id]) errorMessage = "" if !@draft_list.league_memberships.empty? errorMessage += 'Cannot delete the list named ' + @draft_list.name + ' because it is being used by the following memberships: ' + @draft_list.league_memberships.collect{|m| m.toString}.join(", "); end if errorMessage.length == 0 @draft_list.destroy_preferences @draft_list.destroy end respond_to do |format| if errorMessage.length != 0 flash[:error] = errorMessage end format.html { redirect_to(draft_lists_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end", "def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to(checklists_url) }\n format.xml { head :ok }\n end\n end", ...
[ "0.6686314", "0.663948", "0.66389483", "0.65358526", "0.6514827", "0.6477018", "0.6456549", "0.64453", "0.6440348", "0.64037955", "0.63965863", "0.6386861", "0.63488877", "0.634262", "0.6325674", "0.6303573", "0.6302348", "0.630143", "0.6289629", "0.62745905", "0.6265695", ...
0.6921329
0
There is a problem with test_removes_hyphens, still need to identify.
def test_removes_spaces assert_equal(true,check_isbn_length("123 123 123 4")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_result(str)\n str.gsub(/- /, '-')\n end", "def test_tablenames_with_hyphens\n end", "def unhyphenate(string)\n string.to_s.gsub(/(pre|post)xfer/, '\\1-xfer')\nend", "def fix_dash_dash(text); end", "def __hyphen_\n while true # kleene\n\n begin # choice\n _tmp = apply(...
[ "0.643038", "0.6262071", "0.6161886", "0.61124504", "0.6020855", "0.5934467", "0.58910143", "0.5854226", "0.58385634", "0.58158493", "0.579575", "0.57797027", "0.5774522", "0.57717985", "0.5751172", "0.57336986", "0.5732711", "0.57112056", "0.5694054", "0.56866884", "0.568570...
0.0
-1
if target is _, returns false if we've guessed the word's char already if target is az, returns false if our word has a different char
def char_valid?(char, guesses, target) if target == '_' return !guesses.include?(char) end char == target end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_a_letter?(guess)\n return true if @word.include?(guess)\n return false\n end", "def check_winner\n @word.downcase.chars == @guess\n end", "def guessed?\n \t(word.split('') - selected_letters).empty?\n\tend", "def win?\n if word_guessed.select{|x| x!=\"_ \"}.count == @word.length\n \t\t...
[ "0.7235492", "0.71536624", "0.70810634", "0.70719945", "0.6917247", "0.6909202", "0.68957025", "0.6866008", "0.6855387", "0.6817434", "0.68087834", "0.68041897", "0.67244977", "0.6707401", "0.666795", "0.6667471", "0.666238", "0.6646481", "0.66432536", "0.66403455", "0.662629...
0.7721092
0
Sending request using OAuth2 + Faraday connection. All credentials are automatically added.
def request(word, path, params, repeat=1) if BeaconClient.config.debug? BeaconClient.logger.debug("Path: #{path.inspect}") BeaconClient.logger.debug("Params: #{params.inspect}") end response = connection.send(word, path, params: params) if BeaconClient.config.debug? BeaconClient.logger.debug("Params: #{response.inspect}") end response rescue OAuth2::Error => error BeaconClient.logger.error(error.message) error.response rescue refresh! repeat-=1 retry if repeat >= 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client\n Faraday.new(url: URL) do |c|\n c.token_auth self.auth_token\n c.request :url_encoded # form-encode POST params\n c.adapter Faraday.default_adapter # Net::HTTP\n end\n end", "def send_auth_request \n request = AuthorizeRequest.new(:get, actio...
[ "0.6997332", "0.68359137", "0.6742062", "0.6471984", "0.6444603", "0.6423", "0.63679844", "0.62900496", "0.62185377", "0.61797994", "0.61231816", "0.60815585", "0.60598445", "0.6046625", "0.603964", "0.6033901", "0.60203284", "0.60081655", "0.59914744", "0.59409106", "0.59332...
0.0
-1
Create new connection between BeaconCtrl and BeaconClient New oauth token should be returned by server.
def connect! @connection = user ? connection_for_user : connection_for_application @auth_token = @connection.token BeaconClient.logger.debug("Client token: #{@auth_token}") if BeaconClient.config.debug? @auth_token rescue OAuth2::Error => error BeaconClient.logger.error(error.message) BeaconClient.logger.error(error.backtrace.join("\n")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oauth2_client(token, params = {})\n @oauth2_client = RubyLokaliseApi::OAuth2Client.new token, params\n end", "def init\n\t\tuser_credentials = {\n\t\t\t:access_token => access_token,\n\t\t\t:refresh_token => refresh_token,\n\t\t\t:expires_at => Time.now + expires_in\n\t\t}\n\n client_id = '694fc2f...
[ "0.6380972", "0.62495327", "0.6106842", "0.6075413", "0.6040838", "0.594724", "0.5946612", "0.59366834", "0.5933798", "0.58959275", "0.58607024", "0.583236", "0.58179176", "0.5784521", "0.5774283", "0.5768779", "0.5752608", "0.57318664", "0.5723591", "0.5723143", "0.57165766"...
0.7369405
0
Connect as an application No user credentials are required Not recommended and poorly supported Require ApplicationID and ApplicationSecret
def connection_for_application oauth_client.client_credentials.get_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_application(application_name)\n if application_name.nil? || application_name == ''\n throw 'Bad application name'\n end\n res = nil\n applicaiton_init_uri = URI(@url + \"sys/auth/#{application_name}\")\n req = Net::HTTP::Post.new(applicaiton_init_uri)\n ...
[ "0.67706966", "0.6617992", "0.6561239", "0.655139", "0.6305887", "0.6224214", "0.6176887", "0.615896", "0.60993266", "0.6063759", "0.6046726", "0.60441613", "0.6016811", "0.5971014", "0.59639347", "0.5855553", "0.5813227", "0.57922775", "0.5791998", "0.57514274", "0.5742783",...
0.6250392
5
Connect as an User Require ApplicationID, ApplicationSecret, UserEmail, UserPassword
def connection_for_user BeaconClient.logger.debug([user.email.inspect, user.password.inspect].join(' : ')) oauth_client.password.get_token( user.email, user.password, email: user.email ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n client.login(\n params[:user],\n params[:password],\n authParams: {\n scope: 'openid name email'\n },\n connection: 'Username-Password-Authentication'\n )\n end", "def connect\n @user = User.where(:email => params[:user][:email]).first\n # If there is no u...
[ "0.64241004", "0.6331916", "0.62217134", "0.6183177", "0.61571425", "0.6136779", "0.61230576", "0.6118697", "0.611587", "0.61028427", "0.6061592", "0.5996285", "0.59956163", "0.59897864", "0.5960525", "0.59489065", "0.5941224", "0.59311044", "0.59311044", "0.59311044", "0.593...
0.6625705
0
GET /products GET /products.xml
def index # @products = Product.all #pagination: @products = Product.all.paginate :per_page => 5, :page => params[:page] respond_to do |format| format.html # index.html.erb format.xml { render :xml => @products } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def index\n @products = Product.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end", "def show\n...
[ "0.7690255", "0.7466418", "0.7425016", "0.74209785", "0.73869234", "0.7353577", "0.7106357", "0.7065102", "0.70622796", "0.7044841", "0.6991611", "0.6951951", "0.69358504", "0.69277465", "0.69277465", "0.69277465", "0.69277465", "0.69277465", "0.69277465", "0.69277465", "0.69...
0.65631115
55
GET /products/1 GET /products/1.xml
def show @product = Product.all # respond_to do |format| # format.html # show.html.erb # format.xml { render :xml => @product } # end prawnto :filename => 'Report-Products.pdf', :inline => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @products = Product.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end", "def show\n @products = CatalogMebeli.find(params[:id]).products\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.7179435", "0.7173421", "0.71549183", "0.71045", "0.70836425", "0.69191265", "0.6913727", "0.6910618", "0.68953973", "0.6880187", "0.68616176", "0.68402064", "0.68402064", "0.68402064", "0.68402064", "0.68402064", "0.68402064", "0.68402064", "0.68402064", "0.68402064", "0.6...
0.0
-1
GET /products/1 GET /products/1.xml
def view @product = Product.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @product } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @products = Product.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end", "def show\n @products = CatalogMebeli.find(params[:id]).products\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.7179336", "0.7171388", "0.7154841", "0.710436", "0.7082973", "0.69185144", "0.6908935", "0.68934613", "0.68782115", "0.68597215", "0.68382996", "0.68382996", "0.68382996", "0.68382996", "0.68382996", "0.68382996", "0.68382996", "0.68382996", "0.68382996", "0.68382996", "0....
0.69124043
6
GET /products/new GET /products/new.xml
def new @product = Product.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @product } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product }\n end\n end", "def new\n @product = Product.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product }\n end\n end...
[ "0.76482433", "0.7579773", "0.7519316", "0.7502765", "0.74657583", "0.7434349", "0.74215573", "0.7396897", "0.7360391", "0.7310408", "0.7238188", "0.72329867", "0.7184186", "0.71429384", "0.71082217", "0.7098051", "0.7098051", "0.70815927", "0.70775115", "0.7044904", "0.70373...
0.75921214
10
POST /products POST /products.xml
def create @product = Product.new(params[:product]) respond_to do |format| if @product.save format.html { redirect_to(products_path, :notice => 'Product was successfully created.') } format.xml { render :xml => @product, :status => :created, :location => @product } else @category = Category.all @subcategory = Subcategory.all format.html { render :action => "new" } format.xml { render :xml => @product.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_product(product)\n request(product, \"product\", :post, {method: \"add\"})\n end", "def post_to_newgistics\n document = Spree::Newgistics::DocumentBuilder.build_product([self])\n response = Spree::Newgistics::HTTPManager.post('/post_products.aspx', document)\n\n if response.status == 20...
[ "0.6789319", "0.6542377", "0.6446984", "0.6443423", "0.6434772", "0.6432644", "0.6425894", "0.64010847", "0.63864654", "0.63746935", "0.63500327", "0.6335439", "0.63341945", "0.6292344", "0.62861097", "0.6277138", "0.62646955", "0.6240773", "0.6239165", "0.6231106", "0.619260...
0.0
-1
PUT /products/1 PUT /products/1.xml
def update @product = Product.find(params[:id]) respond_to do |format| if @product.update_attributes(params[:product]) format.html { redirect_to(products_path, :notice => 'Product was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @product.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 update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({err...
[ "0.6657229", "0.6596969", "0.6552781", "0.6262558", "0.6182844", "0.6148961", "0.61441714", "0.6139365", "0.61223286", "0.61182135", "0.60683304", "0.60678256", "0.60616505", "0.6059548", "0.6045304", "0.60420585", "0.6039043", "0.6035258", "0.60067576", "0.59999204", "0.5983...
0.6130307
8
DELETE /products/1 DELETE /products/1.xml
def destroy @product = Product.find(params[:id]) @product.destroy respond_to do |format| format.html { redirect_to(products_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end", "def destroy\n #@product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to(products_url) }\n format.xml { head :ok }\n end\n end", "def delete_product(id)\...
[ "0.714076", "0.6952734", "0.6938255", "0.6938226", "0.69245267", "0.69100815", "0.69078654", "0.68602526", "0.68597865", "0.6848749", "0.678357", "0.67752033", "0.6767523", "0.6767523", "0.67373854", "0.67333865", "0.6726935", "0.66829884", "0.66734195", "0.66715693", "0.6623...
0.69181097
16
End: Search method for load subcategories
def load_subcategries #puts "#### Country Id - #{params[:id]}" @subcategories = Subcategory.where(:category_id => params[:id]) respond_to do |format| format.js{ render :update do |page| page[:product_subcategory_id].replace collection_select(:product,:subcategory_id, @subcategories, :id, :name) end } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subcategories\n @subcategories ||= Category.find_all_subcategories(category_name)\n end", "def index\n @subcategories = @category.subcategories\n end", "def sub_category\n @sub_category = SubCategory.new\n @sub_categories = SubCategory.find_all\n end", "def get_subcategories\r\n sub...
[ "0.7385731", "0.7033718", "0.69372934", "0.6935654", "0.6793213", "0.67677534", "0.66941816", "0.6618365", "0.6618365", "0.66144574", "0.6581398", "0.65587914", "0.65270436", "0.6523657", "0.6515557", "0.6510016", "0.6492263", "0.6490421", "0.6481871", "0.6479391", "0.6459524...
0.65954953
10
array to store the possible options for the interactive menu
def interactive_menu loop do #print the menu and ask the user what to do print_menu #read the input and save it into a variable selection = STDIN.gets.chomp #do what the user has asked process(selection) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_menu\n input_options_array = [\"1\",\"2\",\"3\",\"4\",\"5\"]\nend", "def menu_options\n @menu_options ||= {}\n end", "def options\n self.items\n itemsArr = @items.keys\n @options = []\n for i in 1..(items.length) do\n @options = @options + itemsArr.combination(i).to_a\n...
[ "0.7256117", "0.6851709", "0.67834306", "0.6751165", "0.6739841", "0.66743743", "0.66743743", "0.66641486", "0.6620726", "0.6618428", "0.6618428", "0.65678024", "0.6492404", "0.6422482", "0.6341518", "0.6328099", "0.62321687", "0.621441", "0.6190853", "0.61892235", "0.6187551...
0.0
-1
WRITE NEW METHODS HERE:
def save_wizards #open the file for writing file = File.open("wizards.csv", "w") # iterate over the array of save_wizards @wizards.each do |wizard| wizard_data = [wizard[:name], wizard[:house]] csv_line = wizard_data.join(",") file.puts csv_line end file.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def custom; end", "def custom; end", "def implementation; end", "def implementation; end", "def methods() end", "def method; end", "def method; end", "def method; end", "def method; end", ...
[ "0.765835", "0.72703606", "0.72703606", "0.72703606", "0.72703606", "0.7158053", "0.7158053", "0.71483564", "0.71483564", "0.712561", "0.6905086", "0.6905086", "0.6905086", "0.6905086", "0.6905086", "0.6905086", "0.6905086", "0.6905086", "0.6905086", "0.6905086", "0.6905086",...
0.0
-1
Quantity because transactions are in BTC
def update_value(quantity) if quantity > 0 # First If statement is for buying (if there are funds) self.total_value = self.total_value + quantity else # Else statement is for selling because quantity would be negative value self.total_value = self.total_value + quantity end save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_quantity\n cached_qty_bank.to_f + cached_qty_consigned.to_f\n end", "def deposit_quantity\n money.to_d.divmod(market.settle_price(currency)).first\n end", "def get_btc_profit\n quantity - close_positions.sum(:quantity)\n end", "def get_btc_profit\n close_positions.sum(:quan...
[ "0.74126107", "0.7122835", "0.7038064", "0.6998828", "0.6977632", "0.6943274", "0.6789709", "0.6749792", "0.667268", "0.66495126", "0.66365737", "0.66282135", "0.662325", "0.6605231", "0.65895015", "0.6584995", "0.65725833", "0.65725833", "0.6539682", "0.652451", "0.6523343",...
0.0
-1
Overriding the default json method so that the data returned can be used for plotting fullcalendar
def as_json(options = {}) { :title => "#{self.user_id}", # :desctiption => "#{self.rank}" :start => self.exam_date.rfc822, :end => self.exam_date.rfc822, :recurring => false, :allDay => true, :rank => self.rank, :total => self.total_users_attended, :l1_attended => self.l1_attended, :l2_attended => self.l2_attended, :l3_attended => self.l3_attended, :l1_total => self.l1_total, :l2_total => self.l2_total, :l3_total => self.l3_total, :accuracy => self.accuracy, :mark_ratio => self.mark_ratio, :least_mark_ratio => self.least_mark_ratio, :day_parameter => self.day_parameter, :backgroundColor => color_pick } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_json(options = {})\n {\n :id => self.id,\n :title => self.title,\n :description => self.description || \"\",\n :start => starts_at.rfc822,\n :end => ends_at.rfc822,\n :allDay => self.all_day,\n :recurring => false,\n :url => Rails.application.routes.url_helpers.eve...
[ "0.7324992", "0.7303312", "0.72471964", "0.72265244", "0.7214426", "0.71634436", "0.7146891", "0.7124845", "0.7124406", "0.70961374", "0.70811063", "0.70280695", "0.7009959", "0.69732386", "0.6949632", "0.6936495", "0.691719", "0.6679622", "0.6658336", "0.65865195", "0.655620...
0.0
-1
this method will be called for each events in the full calendar
def color_pick if mark_ratio < (day_parameter + least_mark_ratio) color = "#C7E6F2" #light color below average performance elsif mark_ratio >= ((2*day_parameter) + least_mark_ratio) color = "#44bbdf" #dark color excellent perfomance else color = "#70c9e5" #meduim color average performance end return color end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync\n @events = nil\n each do |event|\n matching_event_page = @event_pages.find do |event_page|\n event_page.ical_url == event.url.to_s\n end\n\n if matching_event_page\n event.url = Icalendar::Values::Uri.new(matching_event_page.url)\n\n ...
[ "0.68089354", "0.66351753", "0.6625511", "0.6571208", "0.6562682", "0.65499276", "0.6546111", "0.65309846", "0.64745647", "0.6468685", "0.63850963", "0.6361785", "0.63551205", "0.63305944", "0.63158315", "0.62972516", "0.6290232", "0.6279823", "0.62779874", "0.6269341", "0.62...
0.0
-1
GET /time/time_reports GET /time/time_reports.json
def index @time_time_reports = Time::TimeReport.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_report }\n end\n end", "def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.h...
[ "0.7129789", "0.6651742", "0.6524392", "0.6520537", "0.64876735", "0.6469547", "0.64045674", "0.6402486", "0.63891643", "0.637867", "0.6360271", "0.6352883", "0.6333305", "0.6322239", "0.6311603", "0.6298278", "0.6296576", "0.6294042", "0.62818474", "0.6249144", "0.6238625", ...
0.76245445
0
GET /time/time_reports/1 GET /time/time_reports/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_report }\n end\n end", "def index\n @time_time_reports = Time::TimeReport.all\n end", "def new\n @time_report = TimeReport.new\n\n res...
[ "0.7323457", "0.72856814", "0.66904587", "0.6596875", "0.6527952", "0.646537", "0.6450064", "0.6444921", "0.64392394", "0.64335614", "0.6381917", "0.6379952", "0.63682824", "0.6333002", "0.63050634", "0.6292514", "0.6255531", "0.6248565", "0.61916894", "0.6185597", "0.6175564...
0.0
-1
POST /time/time_reports POST /time/time_reports.json
def create @time_time_report = Time::TimeReport.new(time_time_report_params) respond_to do |format| if @time_time_report.save format.html { redirect_to @time_time_report, notice: 'Time report was successfully created.' } format.json { render :show, status: :created, location: @time_time_report } else format.html { render :new } format.json { render json: @time_time_report.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @time_report = TimeReport.new(params[:time_report])\n\n respond_to do |format|\n if @time_report.save\n format.html { redirect_to @time_report, notice: 'Time report was successfully created.' }\n format.json { render json: @time_report, status: :created, location: @time_report...
[ "0.70921266", "0.6761054", "0.64973444", "0.6496163", "0.62217873", "0.62083626", "0.61755913", "0.6170444", "0.61321265", "0.59996265", "0.59521925", "0.5950501", "0.591422", "0.59066695", "0.5901786", "0.58856946", "0.5881303", "0.5850961", "0.5844043", "0.58260477", "0.582...
0.7346389
0
PATCH/PUT /time/time_reports/1 PATCH/PUT /time/time_reports/1.json
def update respond_to do |format| if @time_time_report.update(time_time_report_params) format.html { redirect_to @time_time_report, notice: 'Time report was successfully updated.' } format.json { render :show, status: :ok, location: @time_time_report } else format.html { render :edit } format.json { render json: @time_time_report.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n if @time_report.update_attributes(params[:time_report])\n format.html { redirect_to @time_report, notice: 'Time report was successfully updated.' }\n format.json { head :no_content }\n else\n ...
[ "0.7290955", "0.6576943", "0.64213574", "0.6377546", "0.63269603", "0.62979215", "0.628985", "0.6274075", "0.62733537", "0.6249891", "0.6246424", "0.6219413", "0.62069434", "0.62032944", "0.6199899", "0.6196775", "0.61851215", "0.6164271", "0.61478305", "0.61432433", "0.61336...
0.7261616
1
DELETE /time/time_reports/1 DELETE /time/time_reports/1.json
def destroy @time_time_report.destroy respond_to do |format| format.html { redirect_to time_time_reports_url, notice: 'Time report was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @time_report = TimeReport.find(params[:id])\n @time_report.destroy\n\n respond_to do |format|\n format.html { redirect_to time_reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy!\n render json: {status: :ok}\n end", "def des...
[ "0.772896", "0.7103305", "0.7072272", "0.695569", "0.6955369", "0.69498515", "0.6926362", "0.6880567", "0.68741995", "0.6863329", "0.6863329", "0.68536603", "0.68531406", "0.68531406", "0.68531406", "0.67923605", "0.6771732", "0.67691076", "0.67691076", "0.67691076", "0.67691...
0.7533543
1
Use callbacks to share common setup or constraints between actions.
def set_time_time_report @time_time_report = Time::TimeReport.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.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def time_time_report_params params.require(:time_report).permit(:repdate, :hours, :note,:user_id,:time_reason_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
overrides the session role key from Cul::Omniauth::RemoteIpAbility
def current_ability @current_ability ||= Ability.new(current_user, roles: session["cul.roles"], remote_ip:request.remote_ip) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_session_role!\n unless params[:r].blank?\n if params[:r]== 'clear'\n session[:role] = nil\n session[:role_id] = nil\n else\n session[:role] = params[:r]\n session[:role_id] = params[:r_id]\n end\n end\n end", "def session_key\n\t\tretu...
[ "0.57071483", "0.55735743", "0.5524688", "0.5394851", "0.5394851", "0.5393864", "0.53375196", "0.5287679", "0.5287679", "0.5272336", "0.5268222", "0.5217467", "0.5199451", "0.5199451", "0.5177186", "0.5172258", "0.5172258", "0.5126305", "0.510549", "0.5102342", "0.50966513", ...
0.46817338
80
translate a label into a rfc5987 encoded header value see also
def label_to_content_disposition(label,attachment=false) value = attachment ? 'attachment; ' : 'inline' value << "; filename*=utf-8''#{label.gsub(' ','%20').gsub(',','%2C')}" value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate_header(header, value)\n value\n end", "def encode_header(s); s; end", "def download_label(value)\n value.tr(\"-\", \" \").capitalize\n end", "def label=(label)\n @label = label.to_s.gsub(\" \",\"_\").without_superscript_characters.to_sym\n end", "def markup_header(...
[ "0.6996217", "0.6041654", "0.5584373", "0.55744535", "0.5564824", "0.5467604", "0.54429823", "0.5427848", "0.54235256", "0.541773", "0.53974086", "0.5383139", "0.5373882", "0.53735423", "0.5372769", "0.53723717", "0.5364748", "0.5357917", "0.53317016", "0.5314928", "0.5265331...
0.5250433
21
shims from Blacklight 6 controller fetch to BL 7 search service
def search_service Blacklight::SearchService.new(config: blacklight_config, user_params: {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_custom_search_params; end", "def service\n :search\n end", "def search(builder)\n send_and_receive connection_config[:url], builder.blacklight_params\n end", "def search_implementation(args)\n\n # 'args' should be a normalized search arguments hash including the following eleme...
[ "0.6300988", "0.6218276", "0.616826", "0.60939366", "0.5896516", "0.5875381", "0.585296", "0.5824424", "0.57832783", "0.5767981", "0.5749384", "0.5748537", "0.5744475", "0.570369", "0.56970006", "0.569167", "0.56652063", "0.5658615", "0.5651207", "0.56440043", "0.56440043", ...
0.68247706
0
:only=>[:edit, :index, :new, :show] GET /user_device_configurations GET /user_device_configurations.json
def index @user_device_configurations = UserDeviceConfiguration.all respond_to do |format| format.html # index.html.erb format.json { render json: @user_device_configurations } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_device_configuration }\n end\n end", "def new\n @user_device_configuration = UserDeviceConfiguration.new\n\n resp...
[ "0.77152336", "0.68687224", "0.6436471", "0.64328855", "0.625644", "0.62446505", "0.6229039", "0.6210126", "0.62084097", "0.6168424", "0.6168424", "0.6134404", "0.6129831", "0.6116969", "0.6111193", "0.6098484", "0.6050534", "0.6049359", "0.6025359", "0.6021061", "0.60040593"...
0.7609758
1
GET /user_device_configurations/1 GET /user_device_configurations/1.json
def show @user_device_configuration = UserDeviceConfiguration.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @user_device_configuration } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_device_configurations = UserDeviceConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_device_configurations }\n end\n end", "def new\n @user_device_configuration = UserDeviceConfiguration.new\n\n respond_to do ...
[ "0.7492147", "0.6698003", "0.64019376", "0.636954", "0.6290901", "0.62316716", "0.6173154", "0.60930663", "0.6080835", "0.60617256", "0.6031278", "0.5986048", "0.59786606", "0.5911146", "0.58746797", "0.58695865", "0.5857259", "0.5846473", "0.5846473", "0.5844806", "0.5790104...
0.7543941
0
GET /user_device_configurations/new GET /user_device_configurations/new.json
def new @user_device_configuration = UserDeviceConfiguration.new respond_to do |format| format.html # new.html.erb format.json { render json: @user_device_configuration } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @user_device_configuration = UserDeviceConfiguration.new(params[:user_device_configuration])\n\n respond_to do |format|\n if @user_device_configuration.save\n format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully created.' }\n ...
[ "0.7416002", "0.6693734", "0.6640873", "0.66044855", "0.6557954", "0.6548632", "0.648198", "0.642695", "0.64139533", "0.64139533", "0.64139533", "0.6399564", "0.63916725", "0.639119", "0.6353396", "0.63454413", "0.63220626", "0.6315711", "0.62958187", "0.6291078", "0.62852484...
0.7832908
0
POST /user_device_configurations POST /user_device_configurations.json
def create @user_device_configuration = UserDeviceConfiguration.new(params[:user_device_configuration]) respond_to do |format| if @user_device_configuration.save format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully created.' } format.json { render json: @user_device_configuration, status: :created, location: @user_device_configuration } else format.html { render action: "new" } format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @user_device_configuration = UserDeviceConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_device_configuration }\n end\n end", "def index\n @user_device_configurations = UserDeviceConfiguration.all\n\n respond_to do |fo...
[ "0.6286393", "0.6214254", "0.6205987", "0.6070616", "0.60648894", "0.60373116", "0.59652203", "0.5938822", "0.59274423", "0.5905517", "0.58977926", "0.5889703", "0.588639", "0.58825624", "0.5842152", "0.5767097", "0.576701", "0.5760106", "0.5741859", "0.57213974", "0.5700535"...
0.72387016
0
PUT /user_device_configurations/1 PUT /user_device_configurations/1.json
def update @user_device_configuration = UserDeviceConfiguration.find(params[:id]) respond_to do |format| if @user_device_configuration.update_attributes(params[:user_device_configuration]) format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @user_device_configuration.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def create\n @user_device_configuration = UserDeviceConfiguration.new(para...
[ "0.65472317", "0.65472317", "0.64532495", "0.62633395", "0.62229526", "0.616681", "0.6139146", "0.61142075", "0.60482115", "0.6007381", "0.5962633", "0.59482735", "0.5906064", "0.5891318", "0.5853674", "0.5834662", "0.58281314", "0.58265907", "0.5818131", "0.57997096", "0.579...
0.70914483
0
DELETE /user_device_configurations/1 DELETE /user_device_configurations/1.json
def destroy @user_device_configuration = UserDeviceConfiguration.find(params[:id]) @user_device_configuration.destroy respond_to do |format| format.html { redirect_to user_device_configurations_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @device.user_id = nil\n @device.save\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @graphium_configuration.destroy\n respond_to do |format|\n format.html { redirect_to graphium_configurations_url, notice: 'Configuration was suc...
[ "0.6859505", "0.6803306", "0.66347903", "0.66031045", "0.6595982", "0.6521107", "0.64514136", "0.64363354", "0.63970107", "0.6394089", "0.63729304", "0.6359964", "0.63501835", "0.63125575", "0.62923324", "0.6290117", "0.62786174", "0.6268358", "0.6236461", "0.62357044", "0.62...
0.7800072
0
optimized using a flag
def bubble_sort(items) # assume 10 items n = items.size iterations = 0 loops = 0 loop do swapped = false for a in (1..(n - 1)) do # 1 to (number of items - 1) if items[a] < items[a - 1] tmp = items[a - 1] items[a - 1] = items[a] items[a] = tmp swapped = true end iterations += 1 # debug: loop counter end n -= 1 # optimization, halfs the time by doing one less inner loop for each addtinal outer loop loops += 1 # debug: loop counter break unless swapped end p "Total iterations: #{iterations}" p "loops: #{loops}" items end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flag; end", "def optimize_every=(_arg0); end", "def optimize_every; end", "def optimize(_optimized, _layer)\n raise 'TODO'\n end", "def switch_flag\n\t\t@flag = !@flag\n\tend", "def gp_flags=(_arg0); end", "def flag _args\n \"flag _args;\" \n end", "def optimize(**options)\n op...
[ "0.6576738", "0.654601", "0.6461099", "0.58961284", "0.5814387", "0.5799709", "0.5784561", "0.5738412", "0.5699105", "0.5663129", "0.5621774", "0.5608972", "0.5556748", "0.5556748", "0.5556748", "0.5528855", "0.5528855", "0.5520852", "0.5513031", "0.5513003", "0.5452477", "...
0.0
-1
always 45 iterations on 10 items without swapped flag
def bubble_sort_2(items) n = items.size iterations = 0 for a in (0...n) do # same as (0...n).each do |a| ..... end swapped = false for b in (0...(n - a - 1)) do if items[b] > items[b + 1] tmp = items[b + 1] items[b + 1] = items[b] items[b] = tmp swapped = true end iterations += 1 end break unless swapped end p "Total iterations: #{iterations}" items end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end", "def bubble_sort(items) # assume 10 items\n n = items.size\n iterations = 0\n loops = 0\n loop do\n swapped = false\n for a in (1..(n - 1)) do # 1 to (number of items - 1)\n if items[a] < items[...
[ "0.63773704", "0.63520086", "0.6240631", "0.6206211", "0.61759394", "0.6061025", "0.6061025", "0.6044446", "0.5860032", "0.585789", "0.5850233", "0.5808923", "0.5807631", "0.5792638", "0.5783578", "0.57741535", "0.5749921", "0.5685318", "0.5680298", "0.56587034", "0.564353", ...
0.6282058
2
ClothMark will generate a default filename if user don't want to save output to a specific file and will use Markdown as a default markup language.
def initialize(file, markup = "markdown", additional_html = false, output = nil) @file = file # ClothMark will raise an error if unknown markup language was sent if %w(markdown textile bbcode).include? markup @markup = markup else raise ArgumentError, "Unknown markup language (#{markup})" end if (!output || output.empty?) @output = "#{file.gsub(/(\.[a-z]{3,4})/, '')}_clothmark.html" else @output = output end @data_for_output = [] @additional_html = additional_html # If true, then ClothMark will generate additional CSS and HTML end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filename\n \"#{Parchemin::Config.articles_path}/#{@id}.markdown\"\n end", "def make_me_some_markdown\n\tputs \"write the name of the markdown file\"\n\tfile = gets.chomp.downcase\n\tputs `touch #{file}.md`\nend", "def default_file_content_for file_name\n \"#{file_name} content\"\nend", "def mark...
[ "0.6529348", "0.6146489", "0.6010292", "0.5887668", "0.5875801", "0.582014", "0.57950526", "0.57086563", "0.5665793", "0.5588449", "0.5588449", "0.55547607", "0.5531979", "0.5527283", "0.5523892", "0.5519306", "0.55154103", "0.5507361", "0.54875225", "0.5472601", "0.5448487",...
0.5479206
19
Read lines from input file and put them to array
def read_from_file begin File.open(@file) do |file| file.each_line {|line| @data_for_output << line} end rescue Errno::ENOENT => e puts e exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_to_array file\n lines = []\n File.open(file, \"r\") do |infile|\n while (line = infile.gets)\n lines.push(line.gsub(\"\\n\", \"\").rstrip)\n end\n end\n lines\n end", "def load\n arr = []\n begin\n while(!@file.eof?)\n line = @file....
[ "0.80196583", "0.7749824", "0.77011627", "0.72063196", "0.7174054", "0.7150337", "0.71363366", "0.70905995", "0.7030608", "0.6968798", "0.6930889", "0.6930889", "0.6908619", "0.69043326", "0.68708426", "0.6870337", "0.68451256", "0.6843648", "0.6832475", "0.6819522", "0.67275...
0.6262738
55
Convert input to HTML with predefined markup language.
def to_html case @markup when 'markdown' @data_for_output.collect! {|line| BlueCloth.new(line).to_html} when 'textile' @data_for_output.collect! {|line| RedCloth.new(line).to_html} when 'bbcode' @data_for_output.collect! {|line| line.bbcode_to_html} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_to_html( content )\r\n content = case @markup_type\r\n when :markdown\r\n markdown_to_html( content )\r\n when :textile\r\n textile_to_html( content )\r\n when :rest\r\n rest_to_html( content )\r\n end\r\n content\r\n end", "def text_to_html( content )\n ...
[ "0.70379156", "0.69220823", "0.68515563", "0.66325426", "0.65912336", "0.6540873", "0.65322465", "0.6487623", "0.6483732", "0.6466318", "0.64222157", "0.64067423", "0.6392053", "0.63866705", "0.63852215", "0.62836677", "0.6237739", "0.61745656", "0.6155622", "0.6147576", "0.6...
0.6401807
12
Save output to the output file (one paragraph per line). Include additional HTML and CSS if attr additional_html = true
def save_to_file File.open(@output, 'w+') do |file| file.puts HEADER if @additional_html file.puts @data_for_output.join("\n") file.puts FOOTER if @additional_html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_file\n\t\tFile.open(@output, \"w+\") do |file|\n\t\t\tfile.puts \"[b][align=center]\"\n\t\t\trandomize if @random\n\t\t\t@output_data.each_line { |line| line.delete('\\n') }\n\t\t\tfile.puts @output_data\n\t\t\tfile.puts \"[/align][/b][align=center][sup]Made with [user]kryszanek[/user]'s [url=http://gi...
[ "0.69958144", "0.6527814", "0.651571", "0.64858437", "0.6472231", "0.6387234", "0.6373998", "0.6227278", "0.6227233", "0.6194358", "0.61680895", "0.61304563", "0.61276233", "0.6038381", "0.6024614", "0.6015311", "0.59880507", "0.5960089", "0.59393054", "0.5933858", "0.5930584...
0.7856954
0
GET /participants GET /participants.xml
def index scan_procedure_array = (current_user.view_low_scan_procedure_array).split(' ').map(&:to_i) hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i) @hide_page_flag = 'N' if hide_date_flag_array.count > 0 @hide_page_flag = 'Y' end # @search = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id from enrollment_visit_memberships where enrollment_visit_memberships.visit_id in # (select visit_id from scan_procedures_visits where scan_procedure_id in (?)))) ", scan_procedure_array).search(params[:search]) # @search = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id # from enrollment_visit_memberships, scan_procedures_visits # where enrollment_visit_memberships.visit_id = scan_procedures_visits.visit_id and scan_procedures_visits.scan_procedure_id in (?))) ", scan_procedure_array).search(params[:search]) @search = Participant.where(" participants.id in ( select participant_id from enrollments,enrollment_vgroup_memberships, scan_procedures_vgroups where enrollments.id = enrollment_vgroup_memberships.enrollment_id and enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?)) ", scan_procedure_array).search(params[:search]) @participants = @search.relation.page(params[:page]) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @participants } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end", "def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.h...
[ "0.75301546", "0.75301546", "0.75301546", "0.7211292", "0.71730536", "0.69233406", "0.68727845", "0.67522633", "0.6745673", "0.67305", "0.6725285", "0.667992", "0.667992", "0.667992", "0.667992", "0.667992", "0.667992", "0.6631142", "0.65574384", "0.652753", "0.6451678", "0...
0.0
-1
GET /participants/1 GET /participants/1.xml
def show scan_procedure_array = (current_user.view_low_scan_procedure_array).split(' ').map(&:to_i) hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i) @hide_page_flag = 'N' if hide_date_flag_array.count > 0 @hide_page_flag = 'Y' end # @participant = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id from enrollment_visit_memberships where enrollment_visit_memberships.visit_id in # (select visit_id from scan_procedures_visits where scan_procedure_id in (?)))) ", scan_procedure_array).find(params[:id]) @participants = Participant.where("participants.id in ( select vgroups.participant_id from vgroups, scan_procedures_vgroups where vgroups.id = scan_procedures_vgroups.vgroup_id and vgroups.participant_id in (?) and scan_procedures_vgroups.scan_procedure_id in (?)) ", params[:id],scan_procedure_array) if(@participants.blank?) @participants = Participant.where("participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_vgroup_memberships.enrollment_id from enrollment_vgroup_memberships, scan_procedures_vgroups where enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?)))",scan_procedure_array) end # problems if no vgroup or enumber -- no way to link to scan procedure and access control @participant = @participants.find(params[:id]) @vgroups = Vgroup.where("participant_id in ( select participant_id from enrollments where participant_id = ? and enrollments.id in (select enrollment_vgroup_memberships.enrollment_id from enrollment_vgroup_memberships, scan_procedures_vgroups where enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?))) ", params[:id],scan_procedure_array) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @participant } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end", "def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.h...
[ "0.7610412", "0.7610412", "0.7610412", "0.7206566", "0.7199847", "0.71683496", "0.6933899", "0.6729997", "0.660732", "0.66044706", "0.65247947", "0.64980125", "0.64980125", "0.64980125", "0.64980125", "0.64980125", "0.64980125", "0.6490464", "0.6490464", "0.6490464", "0.64904...
0.0
-1
GET /participants/new GET /participants/new.xml
def new @participant = Participant.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @participant } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { ...
[ "0.7934836", "0.78061885", "0.77111936", "0.73798215", "0.73798215", "0.73798215", "0.7350297", "0.70026046", "0.70026046", "0.69834095", "0.68899137", "0.68822193", "0.68822193", "0.68822193", "0.68822193", "0.68822193", "0.68822193", "0.68822193", "0.68822193", "0.68822193", ...
0.7878028
3
POST /participants POST /participants.xml
def create @participant = Participant.new(participant_params)#params[:participant]) if @participant.dob > 365.days.ago.to_date # form is setting a default date of today sometimes @participant.dob = nil end connection = ActiveRecord::Base.connection(); if !params[:enumber].blank? @enrollment = Enrollment.where("participant_id is not NULL and enumber = ?",params[:enumber] ) if !@enrollment.blank? flash[:notice] = 'There is a participant with enumber '+params[:enumber] else @enrollment = Enrollment.where(" enumber = ?",params[:enumber] ) end end if !params[:participant][:wrapnum].blank? @participant2 = Participant.where("wrapnum in (?)",params[:participant][:wrapnum] ) if !@participant2.blank? flash[:notice] = 'There is a participant with wrapnumber '+params[:participant][:wrapnum] end end if !params[:participant][:reggieid].blank? @participant3 = Participant.where("reggieid = ?",params[:participant][:reggieid] ) if !@participant3.blank? flash[:notice] = 'There is a participant with reggieid '+params[:participant][:reggieid] end end respond_to do |format| if (!@enrollment.blank? and !(@enrollment[0].participant_id).blank? ) or !@participant2.blank? or !@participant3.blank? format.html { render :action => "new" } format.xml { render :xml => @participant.errors, :status => :unprocessable_entity } elsif @participant.save sql = "update participants set apoe_e1 = NULL where apoe_e1 = '0' " results = connection.execute(sql) sql = "update participants set apoe_e2 = NULL where apoe_e2 = '0' " results = connection.execute(sql) sql = "update participants set wrapnum = NULL where trim(wrapnum) = '' " results = connection.execute(sql) sql = "update participants set reggieid = NULL where trim(reggieid) = '' " results = connection.execute(sql) if !params[:enumber].blank? and @enrollment.blank? sql = " insert into enrollments(enumber,participant_id)values('"+params[:enumber].gsub(/[;:'"()=<>]/, '')+"',"+@participant.id.to_s+")" results = connection.execute(sql) elsif !params[:enumber].blank? and !@enrollment.blank? sql = " update enrollments set participant_id = "+@participant.id.to_s+" where enumber ='"+params[:enumber].gsub(/[;:'"()=<>]/, '')+"' " results = connection.execute(sql) end flash[:notice] = 'Participant was successfully created.' format.html { redirect_to(participant_search_path) } format.xml { render :xml => @participant, :status => :created, :location => @participant } else format.html { render :action => "new" } format.xml { render :xml => @participant.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @participant = Participant.new(participant_create_params)\n @participant.save\n respond_with(@participant)\n end", "def create\n @participant = Participant.new(participant_create_params)\n @participant.save\n respond_with(@participant)\n end", "def create\n @participant = Pa...
[ "0.6477641", "0.6477641", "0.64547783", "0.6425662", "0.64193356", "0.6417889", "0.6339285", "0.6265307", "0.62553793", "0.6244246", "0.62189275", "0.61577004", "0.61544013", "0.61544013", "0.6124953", "0.61127096", "0.60809004", "0.6026621", "0.60184425", "0.5984262", "0.593...
0.0
-1
PUT /participants/1 PUT /participants/1.xml
def update scan_procedure_array = (current_user.edit_low_scan_procedure_array).split(' ').map(&:to_i) hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i) @hide_page_flag = 'N' if hide_date_flag_array.count > 0 @hide_page_flag = 'Y' end # @participant = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id from enrollment_visit_memberships where enrollment_visit_memberships.visit_id in # (select visit_id from scan_procedures_visits where scan_procedure_id in (?)))) ", scan_procedure_array).find(params[:id]) if current_user.role == 'Admin_High' @participant = Participant.where(" participants.id in ( select vgroups.participant_id from vgroups where vgroups.id in (select scan_procedures_vgroups.vgroup_id from scan_procedures_vgroups where scan_procedures_vgroups.scan_procedure_id in (?))) ", scan_procedure_array).find(params[:id]) else @participant = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_vgroup_memberships.enrollment_id from enrollment_vgroup_memberships, scan_procedures_vgroups where enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?))) ", scan_procedure_array).find(params[:id]) end respond_to do |format| if @participant.update(participant_params)#params[:participant], :without_protection => true) connection = ActiveRecord::Base.connection(); sql = "update participants set apoe_e1 = NULL where apoe_e1 = '0' " results = connection.execute(sql) sql = "update participants set apoe_e2 = NULL where apoe_e2 = '0' " results = connection.execute(sql) sql = "update participants set wrapnum = NULL where trim(wrapnum) = '' " results = connection.execute(sql) sql = "update participants set reggieid = NULL where trim(reggieid) = '' " results = connection.execute(sql) if @participant.dob > 365.days.ago.to_date # form is setting a default date of today sometimes @participant.dob = nil @participant.save end if !@participant.dob.blank? @appointments = Appointment.where("appointments.vgroup_id in (select vgroups.id from vgroups where participant_id is not null and participant_id in (?))", params[:id]) @appointments.each do |appt| appt.age_at_appointment = ((appt.appointment_date - @participant.dob)/365.25).round(2) if appt.age_at_appointment > 0 appt.save end end end flash[:notice] = 'Participant was successfully updated.' format.html { redirect_to(@participant) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @participant.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n debugger\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n if @participants.update_attributes(params[:participant])\n AuditTrail.audit(\"Participant #{@participants.fullname} updated by #{current_user.login}\", edit_participant_url(@participants))\n ...
[ "0.70595413", "0.67215466", "0.65886676", "0.6568778", "0.649423", "0.6486298", "0.6454561", "0.6453501", "0.640855", "0.63106656", "0.6295969", "0.62650514", "0.6241024", "0.61904854", "0.6134768", "0.6086217", "0.6079291", "0.6013151", "0.6009334", "0.6009334", "0.5967649",...
0.0
-1
DELETE /participants/1 DELETE /participants/1.xml
def destroy scan_procedure_array = (current_user.edit_low_scan_procedure_array).split(' ').map(&:to_i) hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i) @hide_page_flag = 'N' if hide_date_flag_array.count > 0 @hide_page_flag = 'Y' end # @participant = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id from enrollment_visit_memberships where enrollment_visit_memberships.visit_id in # (select visit_id from scan_procedures_visits where scan_procedure_id in (?)))) ", scan_procedure_array).find(params[:id]) @participant = Participant.where(" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_vgroup_memberships.enrollment_id from enrollment_vgroup_memberships, scan_procedures_vgroups where enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?))) ", scan_procedure_array).find(params[:id]) @participant.destroy respond_to do |format| format.html { redirect_to(participants_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\r\n @participant.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(participants_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n fo...
[ "0.73595655", "0.7291958", "0.72203684", "0.719783", "0.7180345", "0.7086956", "0.7086956", "0.7050125", "0.6904703", "0.6904703", "0.6884381", "0.6838106", "0.6752201", "0.6752201", "0.6716238", "0.66887695", "0.6665926", "0.6664324", "0.6657975", "0.6657975", "0.6630124", ...
0.0
-1
returns an error string if it exists, otherwise just the error code
def get_error(error) string = '' if @@errors[error] string = @@errors[error] else string = sprintf('0x%.8x',error) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_error_code\n codes = get_error_codes\n return '' if codes.empty?\n codes[0]\n end", "def geterrorcode()\r\n return getvalue(@@ERROR_CODE)\r\n end", "def error_code\n @data[\"code\"] || 0\n end", "def code\n @errorcode\n end", "def error_text(error_code)\n ERRO...
[ "0.83683896", "0.759948", "0.74977714", "0.7461778", "0.740444", "0.7294125", "0.7203687", "0.7194286", "0.71031255", "0.70884675", "0.70692676", "0.7053955", "0.7029813", "0.7019458", "0.6984064", "0.6968237", "0.6968237", "0.6951904", "0.69264865", "0.6924769", "0.6835028",...
0.7057953
11
Actions for User Rights subform
def add_user_rights_row @organization = Organization.find(params[:organization_id]) @new_ur_identity = Identity.find_or_create(params[:new_ur_identity_id]) @user_rights = user_rights(@organization.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end", "def edit\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n ...
[ "0.6229843", "0.6174926", "0.6099008", "0.6061552", "0.6059249", "0.6041759", "0.6030051", "0.5976333", "0.595651", "0.5939111", "0.59238595", "0.5840466", "0.5813331", "0.57810396", "0.5767399", "0.57612205", "0.57542527", "0.5752309", "0.57359934", "0.5732222", "0.57210875"...
0.0
-1
Actions for Fulfillment Rights subform
def add_fulfillment_rights_row @organization = Organization.find(params[:organization_id]) @new_fr_identity = Identity.find_or_create(params[:new_fr_identity_id]) @fulfillment_rights = fulfillment_rights(@organization_id) set_registrar_enabled(@organization) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_item_action_form_fields(form, document, action)\n render '/collections/single_item_action_fields', form: form, document: document, action: action\n end", "def reseller_allow_edit(permission)\n return reseller_right(permission) == 2\n end", "def update\n # this action is not provided f...
[ "0.5582562", "0.55035233", "0.5486686", "0.53779143", "0.5373652", "0.53297323", "0.53215307", "0.5253843", "0.52380574", "0.5212609", "0.5211989", "0.509528", "0.50839174", "0.5064582", "0.50536174", "0.5030007", "0.5000622", "0.5000622", "0.5000622", "0.5000622", "0.5000622...
0.562831
0
Actions for status subform
def toggle_default_statuses @organization = Organization.find(status_params[:organization_id]) if @organization.update_attributes(use_default_statuses: status_params[:checked]) flash[:success] = "Organization updated successfully." else flash[:alert] = "Error updating organization." end set_status_variables end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_params\n end", "def status_update(_event)\n @submitted = false\n @filed = false\n end", "def statuses; end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def index\n restrict('allow only admins') or begin\n if params[:form_status].nil...
[ "0.6408864", "0.63910174", "0.61050975", "0.60360134", "0.60360134", "0.60360134", "0.60360134", "0.5962925", "0.58869207", "0.5884131", "0.58666223", "0.58666223", "0.58665544", "0.58340216", "0.5833556", "0.5832985", "0.5777124", "0.57629204", "0.5761881", "0.5752113", "0.5...
0.0
-1
Actions for the pricing subform
def increase_decrease_modal @organization = Organization.find(params[:organization_id]) @can_edit_historical = current_user.can_edit_historical_data_for?(@organization) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def price\n \n end", "def pricing_params\n params.require(:pricing).permit(:price, :price_cents, :item_id, :menu_id)\n end", "def price\n \n end", "def set_pricing\n @pricing = Pricing.find(params[:id])\n end", "def set_pricing\n @pricing = Pricing.find(params[:id])\n ...
[ "0.64287066", "0.6364972", "0.62145567", "0.6124128", "0.6124128", "0.6124128", "0.59390074", "0.5935499", "0.58450955", "0.5844143", "0.57943785", "0.5794063", "0.5791016", "0.5770293", "0.5770293", "0.571319", "0.57033384", "0.57024044", "0.5701781", "0.5700988", "0.5682341...
0.0
-1
Actions for Surveys subform
def add_associated_survey @organization = Organization.find(params[:surveyable_id]) @associated_survey = @organization.associated_surveys.new :survey_id => params[:survey_id] if @associated_survey.save flash[:success] = "Survey added successfully." else @organization.reload @associated_survey.errors.messages.each do |field, message| flash[:alert] = "Error adding survey: #{message.first}." end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goto_surveys\n goto_controller('Assignment Survey')\n end", "def sub_view\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).sub_handler\n page(Submissi...
[ "0.63650465", "0.6119467", "0.5991499", "0.59267044", "0.59055215", "0.58541095", "0.58460486", "0.5837655", "0.5742948", "0.5680584", "0.5595867", "0.5590169", "0.5590169", "0.5581101", "0.55748653", "0.5567919", "0.5535796", "0.5532905", "0.5514446", "0.5508905", "0.5503894...
0.5500721
21
================ Imported from OrganizationUpdater ========================
def update_organization @attributes = organization_params[:organization] @attributes.delete(:id) #detects if incoming name/abbreviation is different from the old name/abbreviation name_change = @attributes[:name] != @organization.name || @attributes[:abbreviation] != @organization.abbreviation if @organization.update_attributes(@attributes) @organization.update_ssr_org_name if (@organization.type != "Institution" && name_change) update_services true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organization; end", "def organization; end", "def organization; end", "def autonomous_system_organization; end", "def autonomous_system_organization; end", "def autonomous_system_organization; end", "def requestor; organization; end", "def after_update_org\n\n controller = PublicActivity.get_c...
[ "0.69556916", "0.69556916", "0.69556916", "0.6740694", "0.6740694", "0.6740694", "0.63896847", "0.63867813", "0.6342161", "0.62235695", "0.612015", "0.6067204", "0.6037979", "0.6037979", "0.57789713", "0.5770368", "0.5762854", "0.5703052", "0.56691426", "0.56605864", "0.56389...
0.5838612
14
end dog name setter
def name @name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name=(dog_name)\n @name = dog_name\n end", "def name= (name_of_dog)\n # @name = name_of_dog\n @name = name_of_dog\n end", "def name=(str); dirty!; super; end", "def name=(value); end", "def name_setter\n @name\n end", "def name=(name)\n end", "def name_setter(new_name)\n ...
[ "0.814059", "0.7974424", "0.73772466", "0.73696977", "0.7326985", "0.7315736", "0.71199644", "0.71181464", "0.71181464", "0.71181464", "0.71181464", "0.71181464", "0.71181464", "0.71181464", "0.71181464", "0.71181464", "0.7104481", "0.7093211", "0.7081058", "0.70381874", "0.7...
0.0
-1
end dog name getter
def bark puts "woof!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n @named_dog\n end", "def name # this 'gets' a property\n @this_dogs_name\n end", "def name\n @this_dog_name\n end", "def name\n @this_dogs_name\n end", "def name\n @this_dogs_name\n end", "def name\n @this_dogs_name\n end", "def name\n @this_dogs_name\n end",...
[ "0.8342136", "0.82844603", "0.8168558", "0.81575644", "0.81575644", "0.81575644", "0.81575644", "0.81468236", "0.8138214", "0.81082535", "0.7914222", "0.7863684", "0.7740348", "0.7728464", "0.7728464", "0.7635208", "0.75268835", "0.74387866", "0.74323446", "0.74323446", "0.74...
0.0
-1
positive number, return the negative of that number. If the number is 0 or negative, return the original number.
def negative(num) if num > 0 p (-num) else p num end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def negative(number)\n if number > 0\n -number\n else\n return number\n end\nend", "def negative(number)\n return number if number.negative? || number.zero?\n -number\nend", "def negative(num)\n if num.positive?\n -num\n else\n num\n end\nend", "def negative(num)\n return num if num.nega...
[ "0.8684646", "0.85498834", "0.85438204", "0.8435659", "0.84351003", "0.83852386", "0.83852386", "0.8368064", "0.8339414", "0.8294396", "0.8290071", "0.8290071", "0.82831675", "0.82831675", "0.82831675", "0.82831675", "0.82612395", "0.82522976", "0.82400227", "0.823075", "0.82...
0.7719785
49
Temporarily merges the migration files by copying them over and then deletes them. Sequel's migration class cannot work with migrations in different directories even if sequelrails can. This is the simplest solution that works until ::Sequel::Migrator supports merging of multiple migration directories.
def temporarily_merge_migration_files(explanation=nil) copy_files = [] Rails.application.config.paths["db/migrate"].expanded.each do |specified_migration_dir| if migrations_dir.to_s != specified_migration_dir Dir[File.join(specified_migration_dir, '*')].each do |file_name| copy_files.push([file_name, migrations_dir.join(File.basename(file_name)).to_s]) end end end if explanation && copy_files.any? puts "SequelRails: Detected migration files outside of the main db/migrate directory. Copying them to db/migrate temporarily to #{explanation}:" copy_files.each { |o, _| puts " - #{o}"} end copy_files.each { |original, destination| FileUtils.cp(original, destination) } yield ensure copy_files.each { |_, destination| FileUtils.rm_f(destination) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_migration_files\n migration_templates = Dir.children(File.join(TEMPLATES, 'migrations')).sort\n migration_templates.each do |template_file|\n destination_file = template_file.match(/^\\d*_(.*\\.rb)/)[1] # 01_create_good_jobs.rb.erb => create_good_jobs.rb\n migration_template \"mi...
[ "0.64950824", "0.6446832", "0.6330297", "0.61446697", "0.61125183", "0.6087638", "0.60875565", "0.6055927", "0.5956392", "0.58962667", "0.58298993", "0.5826711", "0.579875", "0.566398", "0.566398", "0.5635069", "0.56145006", "0.5608341", "0.5579934", "0.55681324", "0.55277866...
0.72574717
0
adds the string to the front of the array
def using_unshift(array, string) array.unshift(string) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def using_unshift(array, str)\n array.unshift(str)\nend", "def using_unshift (array, string)\n return array.unshift(string)\nend", "def using_unshift(array, string)\n array.unshift(string)\nend", "def using_unshift(array,string)\n array.unshift(string)\nend", "def using_unshift(array, string)\n arra...
[ "0.78610003", "0.77769566", "0.7769001", "0.77567065", "0.77551603", "0.77423966", "0.77090186", "0.744187", "0.7167576", "0.7150526", "0.7146718", "0.71345437", "0.71130425", "0.7058408", "0.6957623", "0.6903203", "0.67701745", "0.6651832", "0.6614276", "0.6561021", "0.65559...
0.77790976
8
removes the last element from the array and return that element
def using_pop(array) array.pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_retrieve_last\n # @array.pop\n @array.slice!(0)\n end", "def remove_element_from_end_of_array(array)\n return array.pop\nend", "def remove_element_from_end_of_array(array)\n array.pop\nend", "def remove_element_from_end_of_array(array)\n array.pop\nend", "def exclude_last(arr)\n a...
[ "0.8562115", "0.8191691", "0.80318755", "0.80318755", "0.79777193", "0.7865328", "0.78050315", "0.7760841", "0.77211654", "0.77048576", "0.7652601", "0.76393324", "0.7639147", "0.7621482", "0.761272", "0.7592618", "0.75801075", "0.7578333", "0.75608534", "0.75558513", "0.7555...
0.68624735
80
removes the last two array items and return them
def pop_with_args(array) array.pop(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude_last (array)\n array[0..-2]\nend", "def exclude_last(arr)\n arr[0..-2]\n end", "def exclude_last(arr)\n arr.slice!(arr.length-1,1)\n return arr\n end", "def remove_retrieve_last\n # @array.pop\n @array.slice!(0)\n end", "def exclude_last list\n list[0..-2]\nend", "def excl...
[ "0.782528", "0.78186804", "0.7776563", "0.7538111", "0.7505128", "0.72887135", "0.72868603", "0.71094716", "0.7030802", "0.70049906", "0.69502646", "0.6929446", "0.6928151", "0.68812907", "0.68551385", "0.6817437", "0.6754313", "0.6754313", "0.674815", "0.66994137", "0.668234...
0.6503454
33
removes the first item and return it
def using_shift(array) array.shift end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_first(item)\n return self.dup.tap { |s| s.remove_first!(item) }\n end", "def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end", "def delete_first(items)\n items = [items] unless items.respond_to?(:each)\n items.each do |item|\n delete_at(index(item))\n e...
[ "0.7904336", "0.73692536", "0.7068829", "0.7046681", "0.70312953", "0.69558793", "0.6931585", "0.6927071", "0.69099426", "0.68258584", "0.68151677", "0.6684873", "0.6618262", "0.6612974", "0.66108006", "0.6552066", "0.65513194", "0.65508413", "0.65314543", "0.65307456", "0.65...
0.0
-1
removes and return the first 2 items
def shift_with_args(array) array.shift(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_cards\n\t\t@cards.slice!(0,2)\n\tend", "def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end", "def drop!(n)\n dropped_elements = @list.values.first(n)\n @list = Hash[@list.drop(n)]\n return dropped_elements\n end", "def remove_fish_river()\n @fish.slice(inde...
[ "0.70008415", "0.6667068", "0.65538055", "0.6525892", "0.6421527", "0.6408714", "0.63991064", "0.63599104", "0.6309316", "0.6301006", "0.6238068", "0.6222119", "0.6216789", "0.61941886", "0.61658305", "0.60964936", "0.6084031", "0.6084031", "0.6084031", "0.60806143", "0.60686...
0.0
-1
adds the contents of the 2nd array to the first
def using_concat(array, array2) array.concat(array2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat(array,array2)\n array << array2\n return array\nend", "def array_concat(array_1, array_2)\n\tarray_1 += array_2\nend", "def using_concat(array1, array2)\n array1 = array1.push(*array2)\n\nend", "def array_concat(array_1, array_2)\n array_2.each do |x|\n array_1[array_1.length] = x\n en...
[ "0.76912", "0.7652779", "0.75134814", "0.7469689", "0.74564713", "0.7365452", "0.73516685", "0.73151153", "0.7289406", "0.7261168", "0.7248163", "0.72362316", "0.72358894", "0.7233923", "0.72325504", "0.7226388", "0.72243124", "0.71952444", "0.71671575", "0.7158433", "0.71567...
0.70858574
27
adds the item to the 4th index of the array
def using_insert(array, element) array.insert(4, element) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def using_insert(array, item)\n array.insert(4, item)\nend", "def add_item(array, item)\n\tarray << item\nend", "def index_arr_add(arr, index, element)\n # Add `element` at position `index` to the Array variable `arr` and return `arr`\n return arr.insert(index, element)\nend", "def update_element_from...
[ "0.69418097", "0.6788948", "0.6742472", "0.67088306", "0.6707434", "0.66805154", "0.66803867", "0.66455716", "0.663238", "0.65624106", "0.6540289", "0.65217257", "0.65185714", "0.6514281", "0.6502582", "0.65024966", "0.64935154", "0.6487453", "0.6467238", "0.6467036", "0.6456...
0.6486821
21
removes any duplicate items
def using_uniq(array) array.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_duplicates\n return @remove_duplicates if @set_remove_duplicates\n @remove_duplicates ||= true\n end", "def remove_duplicates()\n self.duplicate_transactions_by_actor().each do |a, txns|\n # Spaceship operator, if my actor is of greater value than theirs, skip beca...
[ "0.73704195", "0.7098819", "0.6927093", "0.6903166", "0.6793666", "0.67628163", "0.6742184", "0.6724654", "0.6691295", "0.6676369", "0.6668123", "0.66613764", "0.66546863", "0.66425705", "0.65930635", "0.6578563", "0.6549495", "0.64949054", "0.6493671", "0.64762974", "0.64699...
0.0
-1
returns a new array that is a onedimensional flattening of self
def using_flatten(array) array.flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten\n\t\tmake_flat(@array)\n\tend", "def my_flatten\n arr = []\n i = 0\n while i < self.length\n if self[i].is_a? Array\n arr += self[i].my_flatten\n else\n arr << self[i]\n end\n i += 1\n end\n return arr\n end", "def my_flatten\n flattened = []...
[ "0.77120745", "0.770132", "0.7382087", "0.7377283", "0.73431385", "0.7294778", "0.72917634", "0.72794485", "0.7258651", "0.7115506", "0.70637363", "0.6971108", "0.6960108", "0.6960108", "0.684128", "0.67989725", "0.6789756", "0.67784405", "0.67644423", "0.6729483", "0.6729297...
0.6511354
39
removes any items from the array that are equal to the string
def using_delete(array, string) array.delete(string) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_non_strings(array)\n array.delete_if {|word| word.to_s != word}\n end", "def remove_non_strings(arr)\n arr.select do |element|\n element == element.to_s\n end\nend", "def remove_non_strings (array)\n\tarray.delete_if {|element| element.class != String }\nend", "def remove_non_strings(ar...
[ "0.7720109", "0.7636316", "0.762875", "0.7627442", "0.7552872", "0.73815334", "0.736349", "0.7361404", "0.73528564", "0.7334624", "0.730869", "0.7206498", "0.7197225", "0.7157979", "0.7139616", "0.71244895", "0.71010286", "0.7077331", "0.7067973", "0.7058944", "0.70495105", ...
0.0
-1
delete using the index
def using_delete_at(array, integer) array.delete_at(integer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_at_index(index)\n \n end", "def delete(index_value)\n index.delete(index_value)\n end", "def delete_at index\n idx = named_index_for index\n @data.delete_at @index[idx]\n\n if @index.index_class == Integer\n @index = Daru::Index.new @size-1\n ...
[ "0.869793", "0.8263856", "0.8255343", "0.81012404", "0.7901392", "0.7879432", "0.7879432", "0.7705953", "0.77014935", "0.767028", "0.76054955", "0.75758374", "0.7519988", "0.7492276", "0.74708027", "0.74678814", "0.7444457", "0.7436622", "0.739986", "0.73541504", "0.7307726",...
0.0
-1
Split the full name into individual characters and run each character against a conditional logic checking to see if it falls under a lower and upper case vowel or lower and upper case consonant or neither. If the vowel or consonant is found return the next character of it's kind and if it's not found under either one just return it. Combine the split characters back into a full name. Return the modified full name.
def alias_modifier(full_name) low_vowels = ["a", "e", "i", "o", "u"] up_vowels = ["A", "E", "I", "O", "U"] low_consonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"] up_consonants = ["B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "X", "Y", "Z"] full_name = full_name.split('') updated_name = full_name.map do |char| if low_vowels.include?(char) low_vowels.rotate[low_vowels.index(char)] elsif up_vowels.include?(char) up_vowels.rotate[up_vowels.index(char)] elsif low_consonants.include?(char) low_consonants.rotate[low_consonants.index(char)] elsif up_consonants.include?(char) up_consonants.rotate[up_consonants.index(char)] else char end end updated_name.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fake_name (full_name)\n words_array = full_name.split (\" \")\n swap_name_array = words_array.reverse\n swap_name = swap_name_array.join(\" \")\n letters = swap_name.chars\n fake_letters = []\n letters.each do |letter|\n vowel = %w[a A e E i I o O u U]\n if vowel.include?(letter)\n fake_lett...
[ "0.73680586", "0.72787887", "0.71903306", "0.7187212", "0.7153722", "0.7009704", "0.6930415", "0.6819983", "0.6816364", "0.67795926", "0.6713809", "0.66752636", "0.6661062", "0.66135", "0.6591218", "0.65676045", "0.65536165", "0.6545161", "0.65293187", "0.6485878", "0.6483958...
0.6117013
50
Adds a new comment.
def <<(new_comment) @config.ffi_delegate.set_comment('%s', :string, new_comment) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_comment(comment)\n @comments << comment\n end", "def add_comment(comment)\n @comments << comment\n end", "def add_comment(comment)\n comments << comment\n end", "def add_comment(comment)\n @comments << comment\n end", "def add_comment\n return client.add_comment(repository,...
[ "0.8414552", "0.8414552", "0.8409626", "0.84052885", "0.8386455", "0.8340048", "0.8251898", "0.8193716", "0.81295615", "0.7969205", "0.7946953", "0.7877461", "0.7877461", "0.7856832", "0.7722643", "0.77115965", "0.7672535", "0.75468194", "0.7528655", "0.7467862", "0.74043787"...
0.0
-1
Returns the Zlist to the list of comments for this config item.
def _zlist @config.ffi_delegate.comments end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n get_ticket_property_list(\"comments\" , Unfuddled::Comment)\n end", "def comments\n @comments\n end", "def comments\n @comments\n end", "def comments\n pull_comments\n @comments_list\n end", "def getComments\r\n\t\t\t\t\treturn @comments\r\n\t\t\t\tend", ...
[ "0.6938066", "0.6897551", "0.688011", "0.6876297", "0.684835", "0.6825231", "0.6788851", "0.67877203", "0.67877203", "0.67596716", "0.67596716", "0.67596716", "0.6717209", "0.67012393", "0.6682884", "0.66785896", "0.6668563", "0.6597387", "0.6597387", "0.65674895", "0.6529552...
0.75143844
0
all the listings that belongs to current_user
def index if params[:tag] @listings = current_user.listings.tagged_with(params[:tag]) else @listings = current_user.listings.all end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listings\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\t\t@listings = Listing.find_all_by_user_id(@current_user)\n\tend", "def user_listings\n @listings =current_user.listings\n end", "def index\n @listings = Listing.all\n @personal_listings = current_user.listings\n ...
[ "0.884166", "0.86853826", "0.8165919", "0.78842926", "0.77413684", "0.76383317", "0.7507519", "0.73346674", "0.7302317", "0.7245117", "0.72264403", "0.7220218", "0.7213203", "0.71016943", "0.7086736", "0.70820016", "0.70707357", "0.70707357", "0.70707357", "0.70372427", "0.69...
0.6812662
29
just one specific listing
def show @reservation = Reservation.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def given_listing(attributes = {})\n given_listings(attributes).first\n end", "def listing\n @listing\n end", "def show\n # this gets the todo items listing params :id\n @listing = Listing.find(params[:id])\n end", "def show\n impressionist(@listing)\n \n @listing = Listing.fr...
[ "0.65429056", "0.6476397", "0.6350077", "0.63299024", "0.61577284", "0.6090166", "0.6090166", "0.6090166", "0.6090166", "0.6080957", "0.6035764", "0.5994395", "0.5980632", "0.59770596", "0.59299946", "0.59226084", "0.5914771", "0.59146106", "0.59105045", "0.589528", "0.589506...
0.0
-1
get the page that lets you create a new post
def new @listing = Listing.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @page_title = \"New Blog\"\n @blogpost = Blogpost.new\n end", "def new\n # responsbile for creating a new instance of a post\n @post = Post.new\n end", "def create\n @post = Post.new(post_params)\n if @post.save\n redirect_to find_redirect(@post.page)\n else\n ...
[ "0.7164712", "0.7093431", "0.7008371", "0.6987437", "0.69851446", "0.69717884", "0.6901042", "0.68375283", "0.683118", "0.6823701", "0.68218505", "0.6798911", "0.6795959", "0.6795959", "0.6795959", "0.6795959", "0.6795959", "0.6795959", "0.6795959", "0.6795959", "0.6795959", ...
0.0
-1