query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /item_alerts/1 GET /item_alerts/1.json
def show # authorize! :read, @item_alert # @item_alert = ItemAlert.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @item_alert } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n authorize! :read, ItemAlert\n @item_alerts = ItemAlert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_alerts }\n end\n end", "def index\n @alerts = Alert.all\n\n respond_to do |format|\n format.html # index.html.erb\n...
[ "0.75725156", "0.6692824", "0.6692824", "0.63853455", "0.63853455", "0.63853455", "0.63407147", "0.6333764", "0.6324947", "0.62646353", "0.6264148", "0.6264148", "0.61909854", "0.61897486", "0.6131482", "0.6069874", "0.60690945", "0.6061999", "0.6029045", "0.60230285", "0.599...
0.6896498
1
GET /item_alerts/new GET /item_alerts/new.json
def new @item_alert = ItemAlert.new(author: current_user) authorize! :create, @item_alert respond_to do |format| format.html # new.html.erb format.json { render json: @item_alert } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @alert = Alert.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def new\n @alert = Alert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", ...
[ "0.7386758", "0.7386439", "0.7263244", "0.7217224", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "0.7204508", "...
0.7478622
0
POST /item_alerts POST /item_alerts.json
def create @item_alert = ItemAlert.new(item_alert_params) authorize! :create, ItemAlert respond_to do |format| if @item_alert.save format.html do redirect_to @item_alert, notice: 'Item alert was successfully created.' end format.json do render json: @item_alert, status: :created, location: @item_alert end else format.html { render 'new' } format.json do render json: @item_alert.errors, status: :unprocessable_entity end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n authorize! :read, ItemAlert\n @item_alerts = ItemAlert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_alerts }\n end\n end", "def create\n @alert = Alert.new(params[:alert])\n notifiers = Hash.new\n User.find(params[:no...
[ "0.6206999", "0.6036369", "0.6022345", "0.5936935", "0.5878697", "0.5853556", "0.58084035", "0.5782575", "0.57697564", "0.57670176", "0.5693192", "0.5668247", "0.56330496", "0.5615316", "0.56021184", "0.559469", "0.55924493", "0.55824566", "0.55732167", "0.55604225", "0.55577...
0.69677263
0
PUT /item_alerts/1 PUT /item_alerts/1.json
def update @item_alert = ItemAlert.find(params[:id]) authorize! :create, @item_alert respond_to do |format| # if @item_alert.update_attributes(params[:item_alert]) if @item_alert.update_attributes(item_alert_params) format.html do redirect_to @item_alert, notice: 'Item alert was successfully updated.' end format.json { head :no_content } else format.html { render 'edit' } format.json do render json: @item_alert.errors, status: :unprocessable_entity end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n\n if @api_v1_item.update(api_v1_i...
[ "0.6448728", "0.6427076", "0.6404043", "0.6318351", "0.6289061", "0.62789416", "0.6225659", "0.62192327", "0.61859727", "0.61685854", "0.6133771", "0.6128254", "0.6102616", "0.6091629", "0.6080883", "0.60655695", "0.6048288", "0.6044828", "0.6044785", "0.60419357", "0.603559"...
0.7063758
0
DELETE /item_alerts/1 DELETE /item_alerts/1.json
def destroy @item_alert = ItemAlert.find(params[:id]) @item_alert.destroy authorize! :delete, @item_alert respond_to do |format| format.html { redirect_to item_alerts_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body...
[ "0.70364356", "0.6982611", "0.69521034", "0.691859", "0.6917775", "0.68811953", "0.68722075", "0.6864879", "0.6854338", "0.68435425", "0.6801066", "0.6799383", "0.6771074", "0.6751779", "0.6750032", "0.67378694", "0.6725671", "0.66899264", "0.6674385", "0.6665564", "0.6645596...
0.7485512
0
Get bookmarks without setting a user in data store
def test_get_bookmarks_nouser ds = BookmarkStore.new($conn_str) assert_raises(RuntimeError) { ds.get_bookmarks } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bookmarks(user)\n user = Access::Validate.user(user, false)\n Bookmark\n .where('(bookmarks.creator_id = ? OR bookmarks.updater_id = ?)', user.id, user.id)\n .order('bookmarks.updated_at DESC')\n end", "def index\n @bookmarks = Bookmark.user_bookmarks(current_user)\n ...
[ "0.72326785", "0.72011226", "0.70743287", "0.7037133", "0.6967528", "0.6930669", "0.6834692", "0.66484296", "0.6638327", "0.65910035", "0.65484047", "0.65316385", "0.65127164", "0.6463278", "0.64406705", "0.6440491", "0.6414593", "0.64123327", "0.64052445", "0.63684773", "0.6...
0.6338514
20
Get bookmarks for a valid user
def test_get_bookmarks exp_num_bms = count_bookmarks(1) act_num_bms = @bs.get_bookmarks.count assert_equal(exp_num_bms, act_num_bms) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_bookmarks(user_id)\n url = \"#{@@request_url}/User.listBookmarks?appid=#{@@appid}&ID=#{user_id}\"\n end", "def bookmarks(user)\n user = Access::Validate.user(user, false)\n Bookmark\n .where('(bookmarks.creator_id = ? OR bookmarks.updater_id = ?)', user.id, user.id)\n ...
[ "0.7724672", "0.7675483", "0.75782675", "0.71765727", "0.7074246", "0.7014627", "0.6934293", "0.6886563", "0.6840565", "0.680035", "0.67672414", "0.67662024", "0.6689592", "0.6545206", "0.6523133", "0.6447586", "0.6404685", "0.63477755", "0.6292949", "0.62805396", "0.62382364...
0.0
-1
Add a bookmark that the user already has No new bookmarks should be created
def test_get_existing_bookmark test_url = 'http://www.ml-class.com/' num0 = count_bookmarks(@bs.user_id) tot0 = count_bookmarks assert(get_bookmark(@bs.user_id, test_url) === @bs.add_or_get_bookmark(test_url)) assert_equal(num0, count_bookmarks(@bs.user_id)) assert_equal(tot0, count_bookmarks) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if session[:user_id]\n user = User.find(session[:user_id])\n params[:bookmark][:user] = user\n @bookmark = Bookmark.new(params[:bookmark])\n if params[:tag]\n @tags = params[:tag]\n @tags.each do |tag|\n objTag = Tag.find(tag)\n @bookmark.tags << ...
[ "0.7668615", "0.756963", "0.75449663", "0.7304702", "0.72948056", "0.727888", "0.7272424", "0.72638637", "0.7204328", "0.71956146", "0.7166677", "0.7122617", "0.71022606", "0.69950825", "0.6966107", "0.69440436", "0.69351745", "0.69175786", "0.6868568", "0.6866908", "0.684398...
0.61983454
97
Add a new bookmark that is in the system but not for this user A new bookmark should be created, but no new links The new bookmark will have the same name as the title of the link
def test_add_bookmark test_url = 'http://www.gridgain.com/' num_lns0 = count_links num_bms0 = count_bookmarks act_bm = @bs.add_or_get_bookmark(test_url) exp_bm = get_bookmark(@bs.user_id, test_url) assert(exp_bm === act_bm) assert_equal(num_bms0 + 1, count_bookmarks) assert_equal(num_lns0, count_links) assert(get_link_title(test_url), exp_bm.name) delete_bookmark(@bs.user_id, test_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if session[:user_id]\n user = User.find(session[:user_id])\n params[:bookmark][:user] = user\n @bookmark = Bookmark.new(params[:bookmark])\n if params[:tag]\n @tags = params[:tag]\n @tags.each do |tag|\n objTag = Tag.find(tag)\n @bookmark.tags << ...
[ "0.7378412", "0.73379254", "0.7270012", "0.7123105", "0.70684594", "0.7002804", "0.69816124", "0.6975062", "0.6803726", "0.6779687", "0.6770813", "0.67296064", "0.6688902", "0.66777533", "0.66677034", "0.66621345", "0.66582173", "0.660443", "0.6565674", "0.6533371", "0.652954...
0.6351619
29
Add a new bookmark that is not in the system A new link should be created along with a new bookmark The bookmark name and link title should be the page title
def test_add_new_bookmark test_url = 'http://gigaom.com' title = 'GigaOM' num_lns0 = count_links tot_bms0 = count_bookmarks num_bms0 = count_bookmarks(@bs.user_id) act_bm = @bs.add_or_get_bookmark(test_url) exp_bm = get_bookmark(@bs.user_id, test_url) assert(exp_bm === act_bm) assert_equal(num_lns0 + 1, count_links) assert_equal(tot_bms0 + 1, count_bookmarks) assert_equal(num_bms0 + 1, count_bookmarks(@bs.user_id)) assert_equal(get_link_title(test_url), exp_bm.name) delete_link(test_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bookmark(url, name = \"\")\n Item.create(:bookmark, {:name => name, :redirect_url => url})\n end", "def bookmark(title = \"My Default Sitewide Bookmark Title\", url=\"#{request.request_uri}\")\n url = 'http://' + request.host_with_port + url\n\n \"javascript:bookmarksite('#{title}=>#{request.re...
[ "0.78617215", "0.73552716", "0.71774745", "0.71621644", "0.7050708", "0.69208086", "0.69071114", "0.69058055", "0.6878341", "0.6870793", "0.67546004", "0.6648521", "0.6635095", "0.66106963", "0.6594734", "0.659241", "0.65716654", "0.65650654", "0.6560024", "0.6520975", "0.647...
0.68595207
10
Add a new bookmark that is not a valid URI No new bookmarks or links should be created
def test_add_invalid_bookmark num_lns0 = count_links act_bm = @bs.add_or_get_bookmark('ha ha ha') assert(act_bm.errors.count > 0) assert_equal(num_lns0, count_links) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bookmark(url, name = \"\")\n Item.create(:bookmark, {:name => name, :redirect_url => url})\n end", "def add_bookmark(url, options = {})\n perform_post_with_object('/api/1.1/bookmarks/add', options.merge(url: url), Instapaper::Bookmark)\n end", "def bookmarklet\n url_str = params[:url...
[ "0.7100404", "0.68750364", "0.68282086", "0.65775937", "0.65098935", "0.6509209", "0.64910096", "0.6419508", "0.6368577", "0.6304404", "0.62898225", "0.6288837", "0.6288614", "0.6219053", "0.62123704", "0.61552143", "0.6128389", "0.60410184", "0.601832", "0.60015666", "0.5996...
0.65869874
3
Add a new bookmark that is a valid URI but is not reachable over the Internet A new link should be created along with a new bookmark Both the link title and the bookmark name should be an empty string
def test_add_pvt_bookmark test_url = 'http://www.avilayparekh.com/' num_lns0 = count_links num_bms0 = count_bookmarks act_bm = @bs.add_or_get_bookmark(test_url) exp_bm = get_bookmark(@bs.user_id, test_url) assert(exp_bm === act_bm) assert_equal(num_lns0 + 1, count_links) assert_equal(num_bms0 + 1, count_bookmarks) assert_empty(get_link_title(test_url)) assert_empty(exp_bm.name) delete_link(test_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bookmark(url, name = \"\")\n Item.create(:bookmark, {:name => name, :redirect_url => url})\n end", "def bookmarklet\n url_str = params[:url]\n url_str.insert(0, 'http://') if url_str.match('^http').nil?\n \n url = Url.find_by_url(url_str)\n if url.nil?\n url = Url.new({:url => par...
[ "0.74731624", "0.7078461", "0.6896734", "0.6865405", "0.6600093", "0.6555521", "0.64713037", "0.6403258", "0.6363484", "0.6330094", "0.6321621", "0.6316843", "0.6294058", "0.62899977", "0.6284061", "0.62758213", "0.6262909", "0.6253047", "0.6228213", "0.6190284", "0.6133268",...
0.59816444
24
Update a valid bookmark name, notes, is_pinned
def test_update_bookmark bm0 = get_bookmark(@bs.user_id, 'http://www.ml-class.com/') new_name = SecureRandom.uuid.to_s bm0.name = new_name bm0.is_pinned = true new_notes = SecureRandom.uuid.to_s bm0.notes = new_notes new_bm = @bs.update_bookmark(bm0) assert(bm0 === new_bm, 'Updated bookmark does not match prototype') bm1 = get_bookmark(@bs.user_id, 'http://www.ml-class.com/') assert(bm1 === bm0, 'Before and after db dookmarks do not match') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n bookmark = Bookmark.find_by(id: params[:id])\n bookmark.update(\n name: bookmark.name,\n path: bookmark.path,\n note_id: params[:note_id],\n user_id: current_user.id,\n screenshot_data: bookmark.screenshot_data\n )\n if bookmark.save\n render json: { message...
[ "0.7195438", "0.6478249", "0.63931626", "0.6347408", "0.6278724", "0.6229141", "0.61931026", "0.6155853", "0.6155853", "0.6148525", "0.6129744", "0.6129744", "0.6122792", "0.6122792", "0.61062384", "0.60448325", "0.5964274", "0.58810306", "0.5838535", "0.5834831", "0.5829671"...
0.69014424
1
Try to update a bookmark that does not exist
def test_update_nonexisting_bookmark bm0 = Bookmark.new('id' => 1000, 'url' => '/some/url', 'title' => 'some title') new_bm = @bs.update_bookmark(bm0) assert(new_bm.errors.count > 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updatebookmark\n\t\t\t\turl_str = update_bookmark_params[:url]\n\t\t\t\tannotations = get_annotations(url_str)\n\t\t\t\turl = Url.find_by_url(url_str)\t\t\n\n\t\t\t url = Url.find_by_url(update_bookmark_params[:url])\n\t\t\t if url.nil?\n\t\t\t url = Url.new({:url => update_bookmark_params[:url], :i...
[ "0.66662264", "0.6618943", "0.65052134", "0.6453506", "0.64423984", "0.6309225", "0.6295251", "0.62498504", "0.6236375", "0.6178784", "0.617064", "0.617064", "0.61605555", "0.61459845", "0.61459845", "0.609051", "0.609051", "0.6084615", "0.6082597", "0.60710514", "0.60611504"...
0.7117027
0
Try to update a bookmark that exists but the user does not own
def test_update_unauth_bookmark bm0 = get_bookmark(2, 'http://www.gridgain.com/') bm0.name = 'hahaha' new_bm = @bs.update_bookmark(bm0) assert(new_bm.errors.count > 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n \n @bookmark = Bookmark.find(params[:id])\n \n respond_to do |format|\n if @bookmark.UserMade == current_user.username && @bookmark.update_attributes(params[:bookmark])\n format.html { redirect_to(@bookmark, :notice => 'Bookmark was successfully updated.') }\n format.xml...
[ "0.70674276", "0.6817994", "0.66311955", "0.6623495", "0.6586793", "0.6402623", "0.63414985", "0.6296957", "0.6281445", "0.6278867", "0.6271077", "0.62125784", "0.61521643", "0.61344993", "0.6134425", "0.6131768", "0.61140794", "0.60910213", "0.6083825", "0.6068625", "0.60422...
0.62318027
11
Get a valid bookmark that this user owns
def test_get_bookmark exp_bm = get_bookmark(@bs.user_id, 'http://www.ml-class.com/') act_bm = @bs.get_bookmark(4) assert(exp_bm === act_bm) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bookmark_for_user(user_id, bookmark_id)\n query = <<-EOS\n SELECT b.id, b.name, b.notes, b.added_on, w.url \n FROM bookmarks b, users u, web_pages w\n WHERE b.user_id = u.id\n AND b.web_page_id = w.id\n AND b.user_id = $1\n AND b.id = $2\n EOS\n bm = @conn.exec(query,...
[ "0.68905103", "0.67919695", "0.67752415", "0.67430377", "0.6659034", "0.637722", "0.62930834", "0.6239914", "0.6209224", "0.5993878", "0.5962502", "0.58072126", "0.57282805", "0.57282805", "0.5720498", "0.57180333", "0.5710632", "0.5710113", "0.5691769", "0.5658541", "0.56357...
0.5834022
11
Get a valid bookmark that this user does not own
def test_get_unauth_bookmark bm = @bs.get_bookmark(15) assert(bm.errors.count > 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_bookmarked user\n Bookmark.find_by(user_id: user_id, post_id: id)\n end", "def bookmark_by(u)\r\n Bookmark.bookmark_by(u, self)\r\n end", "def remember_bookmark\n @ole.RememberBookmark\n end", "def get_bookmark_for_user(user_id, bookmark_id)\n query = <<-EOS\n SELECT b.id, b.na...
[ "0.6234465", "0.618554", "0.6163488", "0.61443484", "0.60697204", "0.60685587", "0.60646415", "0.60524184", "0.59471", "0.58050704", "0.5762584", "0.57196563", "0.5506633", "0.5476419", "0.54485637", "0.54469395", "0.54293144", "0.54293144", "0.5415089", "0.5393074", "0.53837...
0.5890509
9
Get a bookmark that does not exist
def test_get_nonexisting_bookmark bm = @bs.get_bookmark(15000) assert(bm.errors.count > 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def existing_bookmark_for(document_id)\n # to_a, we don't want to go to the database, we want to use cached\n # copy. \n self.bookmarks.to_a.find {|b| b.document_id == document_id}\n end", "def bookmark_exists?(bm_name)\n raise_if_no_document\n @doc.Bookmarks.Exists(bm_name)\n end", "d...
[ "0.6512553", "0.64234", "0.61317307", "0.6131231", "0.6131231", "0.6053968", "0.59458023", "0.5931119", "0.5865685", "0.5798133", "0.5788846", "0.5774081", "0.5768561", "0.5694397", "0.56336737", "0.5632745", "0.5632575", "0.5603299", "0.5556167", "0.55304044", "0.5520814", ...
0.67313635
0
Use callbacks to share common setup or constraints between actions.
def set_tipo_usuario @tipo_usuario = TipoUsuario.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.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Only allow a trusted parameter "white list" through.
def tipo_usuario_params params.require(:tipo_usuario).permit(:nombre) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
GET /releases GET /releases.json
def index #@releases = Release.all @releases = Release.where(cashier_id: current_user.cashier.id, view: true) # respond_to do |format| # format.html # index.html.erb # format.json { render json: @releases } # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end", "def get(*args)\n arguments(args, required: [:owner, :repo, :id]).params\n\n get_request(\"/repos/#{arguments.owner}/#{a...
[ "0.782001", "0.757797", "0.73581696", "0.73581696", "0.72281694", "0.720763", "0.7137632", "0.7023981", "0.7014643", "0.6992209", "0.69265324", "0.6885234", "0.6854652", "0.67636126", "0.67317486", "0.6728395", "0.67004687", "0.66961014", "0.66916806", "0.66916806", "0.653991...
0.6401996
27
GET /releases/1 GET /releases/1.json
def show @release = Release.find(params[:id]) # respond_to do |format| # format.html show.html.erb # format.json { render json: @release } # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end", "def show\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb...
[ "0.7655217", "0.76069975", "0.7481829", "0.7175601", "0.7175601", "0.71647197", "0.70292014", "0.69231915", "0.6885941", "0.6856688", "0.6786493", "0.674057", "0.66668063", "0.65923876", "0.65679425", "0.6559784", "0.65479684", "0.6530027", "0.64978784", "0.648174", "0.647604...
0.63804334
25
GET /releases/new GET /releases/new.json
def new @release = Release.new @cashier = Cashier.find(params[:cashier_id]) #@cashier = current_user.cashier # @release.type_release = params[:type_release] respond_to do |format| format.html # new.html.erb format.json { render json: @release } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_releases\n api_call(\"https://api.spotify.com/\",\"/v1/browse/new-releases\")\n end", "def new\n @release = Release.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release }\n end\n end", "def new\n @commit = params[:commit]\n @rel...
[ "0.7606564", "0.73726594", "0.7259423", "0.7206175", "0.7025918", "0.69621646", "0.695169", "0.665543", "0.6646088", "0.6618149", "0.6618149", "0.6528592", "0.6528592", "0.652044", "0.6508119", "0.6506925", "0.6483403", "0.6403102", "0.63954437", "0.6389003", "0.6384176", "...
0.0
-1
POST /releases POST /releases.json
def create @cashier = Cashier.find(params[:cashier_id]) @release = @cashier.releases.build(params[:release]) #@release.date_release = post_date Date.today respond_to do |format| if @release.save format.html { redirect_to cashier_path(@cashier), notice: 'Release was successfully created.' } #format.html { redirect_to cashier_release_path(@release.cashier, @release), notice: 'Release was successfully created.' } format.json { render json: @release, status: :created, location: @release } else format.html { render action: "new" } format.json { render json: @release.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @release = @environment.releases.new(params[:release])\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n ...
[ "0.7505364", "0.69592404", "0.68975914", "0.6603602", "0.6592334", "0.65453446", "0.65143144", "0.65005416", "0.64981085", "0.6413345", "0.63938975", "0.6342077", "0.6297878", "0.62877405", "0.61712164", "0.6131038", "0.61087114", "0.6082761", "0.6064941", "0.6031521", "0.597...
0.6215092
14
PUT /releases/1 PUT /releases/1.json
def update @release = Release.find(params[:id]) respond_to do |format| if @release.update_attributes(params[:release]) format.html { redirect_to cashier_release_path(current_user), notice: 'Release was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @release.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n if @release.update_attributes(params[:release])\n format.html { redirect_to @release, notice: 'Release was successfully updated.' }\n format.json { head :no_content }\n else\n format.ht...
[ "0.69961613", "0.66472304", "0.6548969", "0.6501719", "0.6237336", "0.6217063", "0.61924106", "0.61672974", "0.61118084", "0.610501", "0.6090956", "0.6084025", "0.59731543", "0.58848184", "0.5874233", "0.5872731", "0.5849618", "0.5817447", "0.5811649", "0.58088154", "0.580619...
0.6278123
4
DELETE /releases/1 DELETE /releases/1.json
def destroy @release = Release.find(params[:id]) #update_cashier(@release.value * -1) @release.view = false @release.save respond_to do |format| format.html { redirect_to cashier_path(params[:cashier_id]) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @release = @environment.releases.find(params[:id])\n @release.destroy\n\n respond_to do |format|\n format.html { redirect_to releases_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}...
[ "0.7703194", "0.75675386", "0.75182945", "0.741915", "0.7365901", "0.7125806", "0.7025917", "0.7010802", "0.693972", "0.68947285", "0.6815497", "0.67653763", "0.6761665", "0.6739756", "0.6728975", "0.671844", "0.6710564", "0.6691936", "0.6666579", "0.66623235", "0.6655915", ...
0.0
-1
E.g. converts "attachments,asdf" to [:attachments], assuming permitted: [:attachments]
def parse_include_param(permitted:, default: nil) include_param = params[:include] permitted = permitted.map(&:to_sym) includes = include_param.to_s.split(',').map { |param| param.strip.to_sym } filtered_includes = includes.select { |key, value| permitted.include?(key) } filtered_includes.present? ? filtered_includes : default end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mail_to_parts(mail)\n mail.parts.empty? ? [mail.to_s] : mail.parts.map { |part| part.to_s } \n end", "def adapt_user_ids!(p)\n p[:user_ids] = p[:user_ids].split(',') if p[:user_ids].is_a?(String)\n end", "def permitted_attachments_params\n params.permit(attachments: [])\n end", "def conve...
[ "0.55583644", "0.55507296", "0.5538301", "0.5465207", "0.5336404", "0.52054614", "0.50935775", "0.5093071", "0.508477", "0.504126", "0.49753997", "0.49150094", "0.4882767", "0.48761272", "0.48559403", "0.4840297", "0.481487", "0.4811684", "0.4786563", "0.4786563", "0.475682",...
0.0
-1
Basically just a wrapper around ActionController::Parameterspermit for now
def parse_filter_params(permitted:) # Symbolize the keys so the values can be used with keyword arguments in the filter scopes. filter_params = params[:filter].try(:permit, permitted).try(:to_h) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered_parameters; end", "def filter_parameters; end", "def filter_parameters; end", "def parameterize(value); end", "def params() request.params end", "def get_parameters; end", "def get_parameters; end", "def params\n @_params ||= ActionController::ManagebleParameters.new(request.paramet...
[ "0.65939003", "0.6592689", "0.6592689", "0.6531635", "0.6356746", "0.6329746", "0.6329746", "0.6328263", "0.6321279", "0.63092273", "0.63031286", "0.63031286", "0.63031286", "0.63031286", "0.63031286", "0.63031286", "0.63031286", "0.63031286", "0.63031286", "0.63031286", "0.6...
0.0
-1
Changes on which page this rendering manager should act
def page=(page) return if @page == page @page = page @available_renderers = available_renderers.map_value do |key, (value, render_options)| new_render = value.class.new(page) disconnect(value, SIGNAL('updated()')) connect(new_render, SIGNAL('updated()'), self, SIGNAL('updated()')) [new_render, render_options] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_page\n end", "def selected_page\n end", "def set_page\n @articlespage = 'active'\n end", "def page; self end", "def page()\n session[:edit_mode] ||= 0\n# Initialize parts\n @parts = nil\n @js, @css = '', ''\n# find domain name in sites\n @site = dc_get_site\n# site is not defined. re...
[ "0.7223673", "0.67566884", "0.65365523", "0.64494294", "0.6282483", "0.6277074", "0.6276437", "0.6276437", "0.6276437", "0.6276437", "0.6276437", "0.6276437", "0.6276437", "0.6276437", "0.6276437", "0.6276437", "0.6276437", "0.6276437", "0.6227069", "0.6227069", "0.61880505",...
0.60078204
29
before_create :send_message def initialize
def send_message response = RestClient::Request.new( :method => :post, :url => "https://api.twilio.com/2010-04-01/Accounts/#{ENV['TWILIO_ACCOUNT_SID']}/Messages.json", :user => ENV['TWILIO_ACCOUNT_SID'], :password => ENV['TWILIO_AUTH_TOKEN'], :payload => { :Body => body, :To => Contact.find(self.contact_id).number, :From => ENV['USER_NUMBER'] } ).execute end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n create_message(params)\n end", "def before_create()\n end", "def send_message\n create_sender_communication\n create_receiver_communication\n update_sent_at\n self.save\n end", "def create_message(data); end", "def create_message(data); end", "def new_message\n end", ...
[ "0.70992315", "0.6909764", "0.68819165", "0.6819651", "0.6819651", "0.67327917", "0.6639944", "0.66332066", "0.662693", "0.6606717", "0.66044635", "0.6579854", "0.65401685", "0.6531621", "0.6524528", "0.65060323", "0.650392", "0.6464165", "0.6455669", "0.6433637", "0.64270896...
0.0
-1
Builds an array of prime numbers
def find_prime x = 2 while @prime_numbers.count < @total @prime_numbers << x if prime?(x) x += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primeArray(number)\n @sieve = Array.new(number)\n \n for count in 2..Math.sqrt(number)\n next if @sieve[count]\n \n for inner_count in 2..number/count\n @sieve[count * inner_count] = true\n end\n end\n @sieve\nend", "def primes(num)\n\twhole_array = (2..num).to_a\n\tprime_array = [whole...
[ "0.79540586", "0.7770899", "0.754233", "0.7466241", "0.7425772", "0.7425547", "0.736337", "0.73616844", "0.73515874", "0.73021734", "0.7285649", "0.7274986", "0.72748196", "0.7231341", "0.72228384", "0.72217613", "0.7218809", "0.7192315", "0.7143178", "0.7131588", "0.7122674"...
0.0
-1
Shows the array of prime numbers as a string
def show_prime @prime_numbers.uniq.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_prime_notation(n)\n prime_notation = prime_notation(n)\n #puts prime_notation\n #print out the prime_notation array on one line\n print \"[\"\n (0...prime_notation.size - 1).each do |i|\n print \"#{prime_notation[i]}, \"\n end\n print \"#{prime_notation[prime_notation.size-1]}]\...
[ "0.7420053", "0.7110243", "0.6985472", "0.69466054", "0.69260967", "0.68931305", "0.6855024", "0.65815675", "0.6474151", "0.6442655", "0.64392066", "0.6290671", "0.62807584", "0.62599164", "0.6188199", "0.6181722", "0.6179354", "0.61237085", "0.6063521", "0.60254395", "0.6012...
0.7736279
0
Determines if the provided number is prime
def prime?(number) (2...number).each do |x| return false if (number % x).zero? end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime?(number)\n if number < 1\n return false\n end\n divisor = 2\n while number % divisor != 0\n divisor += 1\n if number == divisor\n return true \n end\n end\n return false\n end", "def prime?(number)\n\tx = Math.sqrt(number).ceil\n\tfor num in 2..x\n\t\tif...
[ "0.82608944", "0.8258196", "0.8242386", "0.81716", "0.8110411", "0.81054336", "0.81008714", "0.8098817", "0.80936307", "0.8086946", "0.8081761", "0.8079496", "0.80773157", "0.80503285", "0.80313873", "0.8027763", "0.8014631", "0.7991314", "0.7973856", "0.7973856", "0.7973856"...
0.8460171
0
Defualt stopping point if none provided
def default_stop @total ||= 1_000 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_0\n @stop = 1\n end", "def stopped_at=(_arg0); end", "def stopped_at=(_arg0); end", "def stopped_at=(_arg0); end", "def stopsig(*) end", "def stop?(*) end", "def stopped_at; end", "def stopped_at; end", "def stopped_at; end", "def stop_for_testing?(stop_point)\n if sto...
[ "0.6677213", "0.6391272", "0.6391272", "0.6391272", "0.62266386", "0.6191582", "0.61374426", "0.61374426", "0.61374426", "0.6008185", "0.59539366", "0.5834314", "0.5834218", "0.5834218", "0.5834218", "0.5834218", "0.5756148", "0.57359487", "0.57232577", "0.5706348", "0.566875...
0.6447211
1
Returns the currently logged in user or nil if there isn't one
def current_user if @current_user return @current_user end if session[:person_id] @current_user ||= Person.find(session[:person_id]) else authenticate_with_http_basic do |email, password| @current_user = Person.authenticate(email, password) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end", "def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end", "def current_user\n ...
[ "0.873353", "0.8696872", "0.8696666", "0.85968804", "0.858103", "0.8528413", "0.8528413", "0.8528413", "0.8528413", "0.8510657", "0.8416158", "0.8415876", "0.8392121", "0.83712745", "0.83696145", "0.835804", "0.835804", "0.835804", "0.83247185", "0.83241534", "0.8321151", "...
0.0
-1
Filter method to enforce a login requirement Apply as a before_filter on any controller you want to protect
def authenticate logged_in? ? true : access_denied end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_required\n # Skip this filter if the requested action is not protected\n return true unless protect?(action_name)\n\n # Check if user is logged in and authorized\n return true if logged_in? and authorized?(current_user)\n\n # Store current location so that we can redirect back after login\...
[ "0.80613875", "0.8022933", "0.7410015", "0.73734117", "0.71964866", "0.7189605", "0.71817356", "0.71453536", "0.71453536", "0.71453536", "0.71453536", "0.71453536", "0.71453536", "0.71453536", "0.71453536", "0.7138094", "0.71061844", "0.7104487", "0.7101725", "0.7094153", "0....
0.0
-1
Predicate method to test for a logged in user
def logged_in? current_user.is_a? Person end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logged_in_normal_user?\n normal_user.present?\n end", "def current_user?(user)\n logged_in? and user == current_user\n end", "def authorized?(tmp_user)\n user == tmp_user\n end", "def logged_in_user?(&block)\n if @user\n concat(capture(&block))\n end\n end", "def authorized?(use...
[ "0.747978", "0.7396226", "0.7389217", "0.7363599", "0.72975105", "0.72852147", "0.72606385", "0.72524583", "0.7237893", "0.72176665", "0.71965015", "0.7189546", "0.718382", "0.71730316", "0.71595126", "0.71503377", "0.71503377", "0.71487397", "0.7146684", "0.71454656", "0.714...
0.0
-1
You may assume that both input Arrays are nonempty and that they have the same number of elements INPUT two arrays OUTPUT single array RULES return single array containing all elements from both input arrays take an element from each array in alternation ALGORITHM create new array add element from arr1 into new array add element from arr2 into new array repeat until all elements from input arrays are present in new array START SET inter_arr = [] SET idx = 0 UNTIL idx == length of second input array inter_arr << element from arr1 at idx position inter_arr << element from arr2 at idx position increment idx by 1 RETURN inter_arr
def interleave(arr1, arr2) inter_arr = [] idx = 0 loop do inter_arr << arr1[idx] inter_arr << arr2[idx] idx += 1 break if idx >= arr2.length end inter_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interleave(arr_1, arr_2)\n current_index = 0\n combined_arr = []\n while current_index < arr_1.size\n combined_arr.push(arr_1[current_index])\n combined_arr.push(arr_2[current_index])\n current_index += 1\n end\n \n combined_arr\nend", "def interleave(arr1, arr2)\n\tnew_arr = []\n\tcounter = 0...
[ "0.7675738", "0.76539326", "0.76421326", "0.76369315", "0.7629027", "0.75723356", "0.75221044", "0.7520065", "0.75028795", "0.7494494", "0.7492797", "0.7488164", "0.7457966", "0.744886", "0.74477226", "0.74350184", "0.74272233", "0.7403209", "0.7375804", "0.7373888", "0.73645...
0.75527716
6
GET /quartiers/1 GET /quartiers/1.json
def show @quartier = Quartier.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @quartier } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getQuartier\r\n \tarrondissement = params[:id]\r\n \trender json: Quartier.where(arrondissement_id: arrondissement)\r\n end", "def show\n @quiniela = Quiniela.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quiniela }\n end\n end...
[ "0.73378515", "0.68576986", "0.6804682", "0.65586597", "0.6534483", "0.64916813", "0.6395623", "0.6305016", "0.6302825", "0.6276499", "0.6238748", "0.6212511", "0.61977655", "0.6181055", "0.6166113", "0.6150287", "0.6114974", "0.61138463", "0.6113721", "0.6074688", "0.6059026...
0.7306567
1
GET /quartiers/new GET /quartiers/new.json
def new @quartier = Quartier.new respond_to do |format| format.html # new.html.erb format.json { render json: @quartier } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @qu = Qu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @qu }\n end\n end", "def new\n @qu = Qu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @qu }\n end\n end", "def new...
[ "0.7472352", "0.7472352", "0.74581677", "0.7214666", "0.71439546", "0.71135354", "0.7073486", "0.70176154", "0.70083934", "0.6997093", "0.69833636", "0.6966258", "0.69537586", "0.69427913", "0.69345564", "0.69345564", "0.6931064", "0.69270194", "0.69263315", "0.69263256", "0....
0.7629509
0
POST /quartiers POST /quartiers.json
def create @quartier = Quartier.new(params[:quartier]) respond_to do |format| if @quartier.save format.html { redirect_to @quartier, notice: 'Quartier was successfully created.' } format.json { render json: @quartier, status: :created, location: @quartier } else format.html { render action: "new" } format.json { render json: @quartier.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @quaderni = Quaderni.new(quaderni_params)\n\n respond_to do |format|\n if @quaderni.save\n format.html { redirect_to quaderni_url(@quaderni), notice: \"Quaderni was successfully created.\" }\n format.json { render :show, status: :created, location: @quaderni }\n else\n ...
[ "0.63357705", "0.6203391", "0.6184371", "0.605641", "0.605641", "0.60297656", "0.600455", "0.5882824", "0.58737", "0.58430725", "0.5741812", "0.56960183", "0.5665037", "0.56619453", "0.56455624", "0.56213903", "0.55918944", "0.5590717", "0.5585319", "0.55746824", "0.5566193",...
0.6929035
0
PUT /quartiers/1 PUT /quartiers/1.json
def update @quartier = Quartier.find(params[:id]) respond_to do |format| if @quartier.update_attributes(params[:quartier]) format.html { redirect_to @quartier, notice: 'Quartier was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @quartier.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @quartet = Quartet.find(params[:id])\n\n respond_to do |format|\n if @quartet.update_attributes(params[:quartet])\n format.html { redirect_to @quartet, notice: 'Quartet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"...
[ "0.62870973", "0.6216404", "0.6142401", "0.6108412", "0.6108412", "0.60980576", "0.5995492", "0.5926216", "0.59142363", "0.5902625", "0.5878378", "0.58767843", "0.5857434", "0.5810647", "0.5791117", "0.57909423", "0.57608956", "0.5723608", "0.5706876", "0.5699816", "0.5692743...
0.6713708
0
DELETE /quartiers/1 DELETE /quartiers/1.json
def destroy @quartier = Quartier.find(params[:id]) @quartier.destroy respond_to do |format| format.html { redirect_to quartiers_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @quiniela = Quiniela.find(params[:id])\n @quiniela.destroy\n\n respond_to do |format|\n format.html { redirect_to quinielas_url }\n format.json { head :ok }\n end\n end", "def destroy\n @quatum.destroy\n respond_to do |format|\n format.html { redirect_to quata_url ...
[ "0.7257976", "0.7106223", "0.70359844", "0.7032195", "0.7014962", "0.6994533", "0.69638085", "0.69634825", "0.69094443", "0.688485", "0.68433696", "0.67736524", "0.6756191", "0.6730024", "0.6697799", "0.6689893", "0.6688174", "0.6665252", "0.6647299", "0.66252637", "0.6624329...
0.747771
0
need to override the json view to return what full_calendar is expecting.
def as_json(options = {}) { :id => self.id, :title => self.title, :description => self.description || "", :start => (starts_at).to_datetime.iso8601, :end => (ends_at).to_datetime.iso8601, :allDay => self.all_day, :recurring => false, :url => Rails.application.routes.url_helpers.main_event_event_path(self.main_event.id, id) } 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 => unless starts_at.blank? then starts_at.rfc822 else \"\" end,\n :end => unless ends_at.blank? then ends_at.rfc822 else \"\" end,\n :allDay => self.all_da...
[ "0.74432015", "0.7395977", "0.73539627", "0.7333909", "0.7332232", "0.72645205", "0.7234801", "0.7228743", "0.7222693", "0.71649045", "0.71444577", "0.71275014", "0.70618075", "0.7060224", "0.7038122", "0.7007454", "0.6857755", "0.67946815", "0.67614126", "0.6721101", "0.6721...
0.7032366
15
This software may be used and distributed solely under the terms of the MIT license (License). You should find a copy of the License in LICENSE.TXT or at By downloading or using this software you accept the terms and the liability disclaimer in the License.
def affiliations_xml <<-NODE <iq type='result' from='pubsub.shakespeare.lit' to='francisco@denmark.lit' id='affil1'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <affiliations> <affiliation node='node1' affiliation='owner'/> <affiliation node='node2' affiliation='owner'/> <affiliation node='node3' affiliation='publisher'/> <affiliation node='node4' affiliation='outcast'/> <affiliation node='node5' affiliation='member'/> <affiliation node='node6' affiliation='none'/> </affiliations> </pubsub> </iq> NODE end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def check_license()\n return true\n end", "def terms_of_use\n end", "def northern_irish_driving_licence; end", "def library; end", "def library; end", "def license\n File.read file_path('LICENSE') if license?\n end", "def standalone; end", "def vendor; end", "def lice...
[ "0.6296303", "0.6276106", "0.61861044", "0.6066651", "0.6016199", "0.6016199", "0.5958701", "0.5822583", "0.58213276", "0.5749377", "0.5737651", "0.5737651", "0.5737651", "0.5737651", "0.5737651", "0.5737651", "0.5737651", "0.5737651", "0.5737651", "0.5737651", "0.5737651", ...
0.0
-1
p my_hash_finding_method(my_family_pets_ages, 3) Identify and describe the Ruby method(s) you implemented. Person 2
def my_array_modification_method!(source, thing_to_modify) source.collect! do |x| if x.is_a?(Integer) x+=thing_to_modify else x end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_hash_finding_method(my_family_pets_ages, thing_to_find)\n my_family_pets_ages.select{|name, age| age == thing_to_find}.keys #for each name/age pair in the my_family_pets_ages hash, see if age is equal to the thing_to_find. If it is, add the name/age pair to a new hash. Then, .keys returns a new array of al...
[ "0.70698136", "0.6199392", "0.6199392", "0.61049", "0.61013764", "0.6021777", "0.6015965", "0.6010945", "0.59921443", "0.59800994", "0.5974329", "0.5917655", "0.5882972", "0.57855433", "0.5768528", "0.5748793", "0.57204425", "0.5671409", "0.562974", "0.56264347", "0.56046534"...
0.0
-1
Identify and describe the Ruby method(s) you implemented. I used collect! to iterate through the array to alter its contents. Since the method has to be destructuve, I added the "!" at the end of "collect". I used is_a? to check if each element in the array is an integer. This method returns true if the element is an integer, in which case "thing_to_modify" will be added to it. I used each to iterate through the hash to modify the values. The values can be changed by accessing the key through "source[key] =". Person 3
def my_array_sorting_method(source) source.sort_by { |x| x.to_s } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_array_modification_method!(source, thing_to_modify)\n source.each_index do |x|\n if (source[x].is_a?(Integer))\n source[x]+=thing_to_modify\n end\n end\n source\nend", "def my_array_modification_method(source, thing_to_modify)\n source.map! do |x|\n \t\tif x.is_a?(Integer) \n ...
[ "0.7336543", "0.71791273", "0.7174057", "0.7174057", "0.7116724", "0.69928366", "0.6990382", "0.69749117", "0.69692445", "0.69631255", "0.69597197", "0.69597197", "0.6958297", "0.6936574", "0.6921604", "0.6916574", "0.68876874", "0.6859251", "0.6838147", "0.68364656", "0.6808...
0.0
-1
p my_array_deletion_method!(["cat", "dog", "iguana", "shoe"], "o") Identify and describe the Ruby method(s) you implemented. Person 4
def my_array_deletion_method!(source, thing_to_delete) source.delete_if {|item| item.to_s.include?(thing_to_delete)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_array_deletion_method!(source, thing_to_delete)\nend", "def my_array_deletion_method(source, thing_to_delete)\n\t\nend", "def my_array_deletion_method(source, thing_to_delete)\n #Your code here!\nend", "def my_array_deletion_method(source, thing_to_delete)\n #Your code here!\nend", "def my_array_d...
[ "0.8403863", "0.81641227", "0.8079928", "0.8079928", "0.8079928", "0.8079928", "0.8079928", "0.8079928", "0.75605303", "0.7547214", "0.7547214", "0.7547214", "0.7547214", "0.7547214", "0.7547214", "0.7547214", "0.7547214", "0.7547214", "0.7547214", "0.7547214", "0.7547214", ...
0.73251194
48
Identify and describe the Ruby method(s) you implemented. Person 5
def my_array_splitting_method(source) new_array=[[], []] source.each do |x| if x.is_a?(Integer) new_array[0]<<x else new_array[1]<<x end end new_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methods() end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def me...
[ "0.7144192", "0.7030672", "0.7030672", "0.7030672", "0.7030672", "0.7030672", "0.7030672", "0.7030672", "0.7030672", "0.7030672", "0.7030672", "0.7030672", "0.7030672", "0.6951385", "0.68914163", "0.68914163", "0.68914163", "0.68914163", "0.6845223", "0.6793544", "0.6793544",...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_profile @profile = current_user.profile end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def profile_params params.require(:profile).permit(:first_name, :last_name, :phone, :emergency_contact_name, :emergency_contact_no) 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.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
To use relative find option it could be called as follows targetUiElement = FindChildOf(:class, 'SettingsView', :name, 'BtnBack')
def FindChildOf(parentByStrat, parentIdentifier, childByStrat, childIdentifier) parent = find_element(parentByStrat, parentIdentifier) return nil if parent==nil return parent.find_element(childByStrat, childIdentifier) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lp_back_button\n find_element(:xpath, \"//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]\")\n end", "def go_back\n back\n wait { find_ele_by_predicate_include(class_name: ui_ios.navbar, value: 'UICatalog') }\n end", "def btn_container\n\tbrowser.find_element(class: 'button-conta...
[ "0.68438077", "0.6045786", "0.56996936", "0.5551243", "0.5551243", "0.54766047", "0.5469208", "0.5453421", "0.52884436", "0.52884436", "0.5264842", "0.5255649", "0.5235375", "0.52099055", "0.51614887", "0.5152129", "0.5139528", "0.5128947", "0.5113548", "0.5113548", "0.511354...
0.0
-1
To use relative find option it could be called as follows targetUiElement = FindChildOf(:class, 'SettingsView', :name, 'BtnBack')
def ClickDropDownButton(buttonName) dropdown = findElementNamed("Filter-Drop-Down") buttons = dropdown.find_elements(:name, "Placeholder-Text") return false if buttons == nil for button in buttons puts "trying button named #{button.text}" if button.text == buttonName button.click puts "Clicked #{button.text}" return true end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lp_back_button\n find_element(:xpath, \"//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]\")\n end", "def go_back\n back\n wait { find_ele_by_predicate_include(class_name: ui_ios.navbar, value: 'UICatalog') }\n end", "def btn_container\n\tbrowser.find_element(class: 'button-conta...
[ "0.68443733", "0.6045651", "0.56981456", "0.55520684", "0.55520684", "0.54762036", "0.54685616", "0.545441", "0.52879673", "0.52879673", "0.5264524", "0.52568436", "0.52361417", "0.52107376", "0.51617014", "0.5152375", "0.5139827", "0.5128613", "0.5113316", "0.5113316", "0.51...
0.5003179
26
Convenience method to peform a swipe. Note that iOS 7 simulators have broken swipe.
def swipe(opts) start_x = opts.fetch :start_x, 0 start_y = opts.fetch :start_y, 0 end_x = opts.fetch :end_x, 0 end_y = opts.fetch :end_y, 0 duration = opts.fetch :duration, 2 action = Appium::TouchAction.new.press(x: start_x, y: start_y).move_to(x: end_x, y: end_y).release action.perform end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swipe(direction, duration=700)\n # @option opts [int] :start_x Where to start swiping, on the x axis. Default 0.\n # @option opts [int] :start_y Where to start swiping, on the y axis. Default 0.\n # @option opts [int] :end_x Where to end swiping, on the x axis. Default 0.\n # @option opts [int] ...
[ "0.69509816", "0.6540213", "0.6073967", "0.6002281", "0.588508", "0.5718026", "0.5652447", "0.53592443", "0.53592443", "0.5313849", "0.5265659", "0.52088654", "0.5142895", "0.512369", "0.50739413", "0.49735633", "0.49143434", "0.481616", "0.47914976", "0.47774407", "0.4738076...
0.6769638
1
input 2 arguments => array of current people in line string of new person at back of the line output string of persons name with index+1 (place in line)
def take_a_number(array, name) length = array.length case length when 0 array.push(name) puts "Welcome, #{array[0]}. You are number 1 in line." else array.push(name) puts "Welcome, #{name}. You are number #{array.length} in line." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_a_number(katz_deli, person)\n katz_deli.push(person)\n new_person_in_line = \" \"\n katz_deli.each_with_index do |item,index|\n new_person_in_line = \"Welcome, #{item}. You are number #{index + 1} in line.\"\n end\n puts new_person_in_line\n end", "def line(katz_deli)\n\n #...
[ "0.6911081", "0.6592283", "0.64158297", "0.6247763", "0.62327456", "0.61858046", "0.6155296", "0.61350864", "0.6126264", "0.61102134", "0.60736257", "0.60499185", "0.60320425", "0.6014515", "0.6013078", "0.6007297", "0.5965102", "0.59359145", "0.5925291", "0.59165186", "0.590...
0.0
-1
input is an array position(element) of string and integer output is a string of persons name (use index and name) a string when there is no one in line (array is at 0) use length
def now_serving(array) case array.length when 0 puts "There is nobody waiting to be served!" else puts "Currently serving #{array[0]}." array.shift end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line(katz_deli)\n\nline_array = []\n if katz_deli != []\n katz_deli.each.with_index(1) do |person, index| \n line_array << (\"#{index}. #{person} \")\n end\n \n line_array_last = line_array.pop ## removes last element with extra space\n line_array_last[line_array_l...
[ "0.63600785", "0.6344948", "0.63084775", "0.62896425", "0.6201454", "0.61371", "0.6118455", "0.6090272", "0.60339344", "0.5994789", "0.599185", "0.59891075", "0.5953024", "0.59346443", "0.59270513", "0.58932877", "0.5891583", "0.5880233", "0.5838522", "0.58171344", "0.5791915...
0.0
-1
Given an array of prices add them all together and return the total
def total(prices) amount = 0 #From this: #index = 0 #while index < prices.length # amount+= prices[index] # index += 1 #end #To this: prices.each do |price| amount += price end amount end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total(prices)\n amount = 0\n prices.each do |price|\n amount += price\n end\n amount\nend", "def total(prices)\n amount = 0\n prices.each do |price|\n amount += price\n end\n amount\nend", "def total(prices)\n total = 0\n i = 0\n while i < prices.length\n total += prices[i]\...
[ "0.8137551", "0.80798495", "0.79904795", "0.764584", "0.76190805", "0.761145", "0.73859763", "0.7376361", "0.73627096", "0.73535717", "0.73500705", "0.73165846", "0.722756", "0.7223032", "0.7203295", "0.7194074", "0.7146743", "0.7108413", "0.7077179", "0.7075131", "0.7069444"...
0.7516752
6
Locks the middleware stack to ensure no further modifications are made.
def lock! @handlers.freeze end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock\n post :lock\n end", "def lock!\n freeze!\n @locked = true\n self\n end", "def lock!\n @locked = true\n end", "def lock!\n @locked = true\n end", "def lock\n @locked = true\n self\n end", "def lock\n end", "def lock!; end", "def lock\n s...
[ "0.6852519", "0.6586164", "0.63761896", "0.6314826", "0.6294935", "0.62870705", "0.6227263", "0.6158333", "0.6136505", "0.612237", "0.6074853", "0.60657173", "0.6043082", "0.60342884", "0.60031444", "0.59981024", "0.5975979", "0.5968261", "0.5968261", "0.5968261", "0.5936253"...
0.68016756
1
Processes a Request into a Response by passing it through this Builder's middleware stack.
def build_response(connection, request) app.call(build_env(connection, request)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process\n klass.new(request).process\n end", "def handler_request!\n response = Core::HandlerResponse.new(\n @req.body,\n @req.code,\n @req.header.to_hash.inspect\n )\n populate_properties! if response.request_successful? && check_request\n end", "def run(requ...
[ "0.63388455", "0.61693895", "0.5949508", "0.59195703", "0.5902849", "0.5900626", "0.5857656", "0.5849027", "0.5819243", "0.57861006", "0.5753923", "0.57421637", "0.5715293", "0.5700912", "0.5685569", "0.56431687", "0.56385857", "0.56356794", "0.56223404", "0.562024", "0.55914...
0.6191159
1
The "rack app" wrapped in middleware. All requests are sent here. The builder is responsible for creating the app object. After this, the builder gets locked to ensure no further modifications are made to the middleware stack. Returns an object that responds to `call` and returns a Response.
def app @app ||= begin lock! to_app end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_app\n Rack::Builder.new do\n Scrapple.middleware_stack.middleware.each do |ware|\n use ware[0], *ware[1], &ware[2]\n end\n\n run Scrapple.middleware_stack.endpoint\n end \n end", "def build_rack_app\n app = base_rack_app_callable(use_new_dispatch_api?)\n...
[ "0.75081575", "0.7201688", "0.7051585", "0.68423927", "0.6821686", "0.6709449", "0.6691695", "0.6642308", "0.664097", "0.6609931", "0.6581618", "0.6562447", "0.64991105", "0.64991105", "0.6495539", "0.6442085", "0.6414543", "0.64062184", "0.6403297", "0.63671625", "0.63623613...
0.5639332
86
ENV Keys :http_method a symbolized request HTTP method (:get, :post) :body the request body that will eventually be converted to a string. :url URI instance for the current request. :status HTTP response status code :request_headers hash of HTTP Headers to be sent to the server :response_headers Hash of HTTP headers from the server :parallel_manager sent if the connection is in parallel mode :request Hash of options for configuring the request. :timeout open/read timeout Integer in seconds :open_timeout read timeout Integer in seconds :proxy Hash of proxy options :uri Proxy Server URI :user Proxy server username :password Proxy server password :ssl Hash of options for configuring SSL requests.
def build_env(connection, request) exclusive_url = connection.build_exclusive_url( request.path, request.params, request.options.params_encoder ) Env.new(request.http_method, request.body, exclusive_url, request.options, request.headers, connection.ssl, connection.parallel_manager) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(host, port = 80, context = {}, ssl = nil, ssl_version = nil, proxies = nil, username = '', password = '')\n self.hostname = host\n self.port = port.to_i\n self.context = context\n self.ssl = ssl\n self.ssl_version = ssl_version\n self.proxies = proxies\n self.username...
[ "0.708227", "0.6855678", "0.677044", "0.67122096", "0.66025454", "0.65804905", "0.6520179", "0.64744437", "0.6469615", "0.64537364", "0.64322484", "0.64288735", "0.64247936", "0.64215344", "0.64008856", "0.63978016", "0.63692707", "0.63568306", "0.63567543", "0.6353613", "0.6...
0.0
-1
param needs to be there to be arrity compatible with one we're overriding, even though we do nothing with it.
def export_as_openurl_ctx_kev(ignored_param = nil) unless defined? @_ctx_kev @_ctx_kev = to_openurl.kev end return @_ctx_kev end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param; end", "def param; end", "def overrides=(_arg0); end", "def PO114=(arg)", "def extra=(_arg0); end", "def params=(_); end", "def PO115=(arg)", "def special\n override\n end", "def base=(_arg0); end", "def PO109=(arg)", "def isolated=(_arg0); end", "def isolated=(_arg0); end", "...
[ "0.68352705", "0.68352705", "0.67828035", "0.64904994", "0.6456034", "0.6437997", "0.6401613", "0.63760763", "0.63744754", "0.6372114", "0.63044477", "0.63044477", "0.62971455", "0.6275492", "0.6264658", "0.625603", "0.62498426", "0.6240562", "0.623103", "0.62217796", "0.6206...
0.0
-1
GET /mycoins/1 GET /mycoins/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_coins\n get(\"/getcoins\")\n end", "def coins\n\t\tres = {}\n\t\tuser = User.find_by_token(params[:token])\n\t\tif user\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:coins] = user.coins\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend", "def show\n @mint_coin = @coin.min...
[ "0.84082484", "0.753926", "0.7383669", "0.7280798", "0.71560216", "0.7153468", "0.71490777", "0.7071821", "0.69310087", "0.68784136", "0.68784136", "0.67587876", "0.6739173", "0.6729109", "0.6688378", "0.668214", "0.66332483", "0.6594243", "0.65897954", "0.6559238", "0.653189...
0.0
-1
POST /mycoins POST /mycoins.json
def create @mycoin = Mycoin.new(mycoin_params) respond_to do |format| if @mycoin.save format.html { redirect_to @mycoin, notice: 'Mycoin was successfully created.' } format.json { render :show, status: :created, location: @mycoin } else format.html { render :new } format.json { render json: @mycoin.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @mint_coin = @coin.mint_coins.build(params[:mint_coin])\n \n respond_to do |format|\n if @mint_coin.save\n format.html { redirect_to coin_mint_coins_url([@coin]), :notice => 'Mint coin was successfully created.' }\n format.json { render :json => @mint_coin, :status => :create...
[ "0.67880285", "0.6718918", "0.6638327", "0.66376436", "0.6620706", "0.655323", "0.6550608", "0.64727485", "0.6425487", "0.6424369", "0.6400119", "0.6386561", "0.636734", "0.63596565", "0.629563", "0.6102046", "0.592336", "0.5900385", "0.5881751", "0.5863372", "0.5841663", "...
0.7042763
0
PATCH/PUT /mycoins/1 PATCH/PUT /mycoins/1.json
def update respond_to do |format| if @mycoin.update(mycoin_params) format.html { redirect_to @mycoin, notice: 'Mycoin was successfully updated.' } format.json { render :show, status: :ok, location: @mycoin } else format.html { render :edit } format.json { render json: @mycoin.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @mint_coin = @coin.mint_coins.find(params[:id])\n\n respond_to do |format|\n if @mint_coin.update_attributes(params[:mint_coin])\n format.html { redirect_to coin_mint_coins_url([@coin]), :notice => 'Mint coin was successfully updated.' }\n format.json { head :no_content }\n ...
[ "0.7056684", "0.66152626", "0.65133774", "0.6398108", "0.6364747", "0.6345327", "0.6341038", "0.62709826", "0.6223703", "0.60864305", "0.6062356", "0.6058811", "0.6048507", "0.6043911", "0.60191005", "0.60119724", "0.5994841", "0.5966423", "0.5960222", "0.5957424", "0.5894995...
0.6759136
1
DELETE /mycoins/1 DELETE /mycoins/1.json
def destroy @mycoin.destroy respond_to do |format| format.html { redirect_to mycoins_url, notice: 'Mycoin was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @mint_coin = @coin.mint_coins.find(params[:id])\n @mint_coin.destroy\n\n respond_to do |format|\n format.html { redirect_to coin_mint_coins_url([@coin]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @our_coin = OurCoin.find(params[:id])\n @our_coin.d...
[ "0.744106", "0.73111403", "0.7100537", "0.6864171", "0.68539053", "0.68439144", "0.6825783", "0.67375666", "0.6736706", "0.6608597", "0.6585013", "0.65613866", "0.65609366", "0.65452105", "0.65399355", "0.65252656", "0.64747334", "0.645256", "0.63808227", "0.63786685", "0.636...
0.7361596
1
Use callbacks to share common setup or constraints between actions.
def set_mycoin @mycoin = Mycoin.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.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def mycoin_params params.require(:mycoin).permit(:category, :coinname, :price, :user_id,:deposit) 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
Create a new filter. params[:filter] should contain JSON for a new filter.
def create Filter.create! :json_contents => params[:filter] render json: { success: true } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @filter = Filter.new(params[:filter])\n\n respond_to do |format|\n if @filter.save\n format.html { redirect_to @filter, notice: 'Filter was successfully created.' }\n format.json { render json: @filter, status: :created, location: @filter }\n else\n format.html { r...
[ "0.8008522", "0.8008522", "0.7968216", "0.76918185", "0.7645773", "0.76049215", "0.7578487", "0.74827754", "0.7482206", "0.7421159", "0.73157597", "0.72239846", "0.7207327", "0.71313983", "0.7102057", "0.7024703", "0.69755477", "0.6968274", "0.6899808", "0.6896703", "0.686502...
0.7960388
3
conditional is needed to check that title exists and not null, otherwise error will occur when trying to capitalize
def capitalize_title self.title.capitalize! if title end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_title_case\n if title.split.any?{|w|w[0].upcase != w[0]}\n errors.add(:title, \"Title must be in title case\")\n end\n end", "def capitalize_title\n self.title = title.capitalize if title.present?\n end", "def check_title\n if self.title.blank? && st = (url && Site.by_link(self.url))\n...
[ "0.79957825", "0.7451677", "0.7428102", "0.7410179", "0.73497176", "0.72852767", "0.72852767", "0.7264714", "0.7242843", "0.7217544", "0.7199664", "0.71892285", "0.71670467", "0.71654975", "0.7139259", "0.71011055", "0.7050629", "0.6987702", "0.6911543", "0.69110924", "0.6891...
0.76986045
1
TODO: implement sorting by related resources
def ja_sort [{ :created_at => :desc }] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ordered_resources\n resources_graph.topsort.to_a\n end", "def ordered(resource)\n\n children = resource.children\n dir = resource.url\n\n ordered_simple(children, dir)\n end", "def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize h...
[ "0.7103373", "0.6793567", "0.6656269", "0.644793", "0.6329379", "0.6042379", "0.6025476", "0.6016506", "0.6010833", "0.596091", "0.59522825", "0.5924344", "0.59237415", "0.5858654", "0.5856437", "0.58447605", "0.5841473", "0.58362025", "0.58116984", "0.5789317", "0.5746036", ...
0.0
-1
Return the physical path within the repository Takes care of symbolic links
def relative_path_to(path, relative_to = nil) if relative_to path = File.expand_path( # symlink, e.g. "../../../../grid5000/environments/etch-x64-base-1.0.json" path, # e.g. : File.join("/", File.dirname("grid5000/sites/rennes/environments/etch-x64-base-1.0")) File.join('/', File.dirname(relative_to)) ).gsub(%r{^/}, '') end path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repo_path\n @path\n end", "def abspath\n \"#{repo_base_path}/#{self.git_repo_path}\"\n end", "def absolute_repository_path\n File.join(\n OpenProject::Revisions::Git::GitoliteWrapper.gitolite_global_storage_path,\n git_path\n )\n end", "def r...
[ "0.76176834", "0.7288794", "0.7199333", "0.7054408", "0.70526856", "0.70484394", "0.7033288", "0.7008346", "0.6925168", "0.6921327", "0.6901449", "0.6885142", "0.68739384", "0.6863467", "0.68331283", "0.6827163", "0.67837936", "0.6766695", "0.67578685", "0.67453045", "0.67434...
0.6307605
61
Implementing git log behavior with Walker from libgit2 can results in slow responses. Filtering on path for each commit is time consuming. Adapted from:
def entry_changed?(commit, path) parent = commit.parents[0] entry = commit.tree.path(path) rescue nil # if at a root commit, consider it changed if we have this file; # i.e. if we added it in the initial commit if !parent return entry != nil end parent_entry = begin parent.tree.path(path) rescue Rugged::TreeError begin parent.tree.path(path + '.json') rescue Rugged::TreeError nil end end # does exist in either, no change if !entry && !parent_entry false # only in one of them, change elsif !entry || !parent_entry true # otherwise it's changed if their ids arent' the same else entry[:oid] != parent_entry[:oid] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_git_log(dir)\n\n name = `git config --global --get user.email`.strip\n git_cmd = \"git log --stat --since='1 day ago' --author='#{name}'\"\n\n out = []\n Dir.foreach(dir) do |d|\n next if d == \".\" or d == \"..\"\n t = dir + '/' + d\n next if not File.directory?(t)\n ...
[ "0.6871297", "0.66156656", "0.6473258", "0.63975114", "0.61808044", "0.61529064", "0.6081708", "0.60423076", "0.6013339", "0.60048395", "0.59839517", "0.5968312", "0.5918237", "0.59051895", "0.5895297", "0.5890388", "0.5822074", "0.58176994", "0.57792914", "0.5770118", "0.576...
0.0
-1
This will define the initialize method which will populate every instance of Grade with the same attributes. These are required inputs to create an instance.
def initialize(name, grade_number, num_of_pupils, teacher) @name = name @grade_number = grade_number @num_of_pupils = num_of_pupils @teacher = teacher if grade_number == "kindergarten" puts "Welcome to #{grade_number}, #{name}. You have #{num_of_pupils.to_i - 1} classmates this year, and your teacher is #{teacher}." else puts "Welcome to #{grade_number} grade, #{name}. You have #{num_of_pupils.to_i - 1} classmates this year, and your teacher is #{teacher}." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(student)\n @number_grade = set_number_grade(student)\n @letter_grade = set_letter_grade\n end", "def initialize(name, grade, id = nil) #the name attribute can be accessed, the grade attribute can be accessed\n @name = name \n @grade = grade\n @id = id\n end", "def initialize(nam...
[ "0.76288193", "0.74194777", "0.7232502", "0.7169807", "0.71658593", "0.71543574", "0.70550203", "0.7051208", "0.6970033", "0.6931684", "0.69181067", "0.6903284", "0.6891237", "0.6891237", "0.68507415", "0.68507415", "0.68507415", "0.6805139", "0.6805139", "0.67915344", "0.678...
0.582711
86
Every time a new instance of Grade is produced, the greeting will be printed out with a puts (put string)method. You can create new methods, or actions, to perform on each instance of Grade. Using dot notation to combine methods and objects, you can manipulate them. Here's another method definition:
def dismissal if @grade_number == "kindergarten" puts "Dismissal time for #{grade_number} is 1:00." else puts "Regular Grades are dismissed at 3:00." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greet\r\n self.yell_name + \" says hi.\" # self specifies method within the class\r\n end", "def letter_grade # getter\n self.class.letter_grade(grade)\n end", "def grade!\n # default method does nothing and leaves a score of 0\n end", "def greeting(name)\n \"Hello and welcome to Ruby metho...
[ "0.60621995", "0.57469565", "0.55793154", "0.5548945", "0.5541698", "0.54349023", "0.54314744", "0.5413042", "0.540696", "0.5378676", "0.53664005", "0.53643113", "0.5351526", "0.53321534", "0.53284186", "0.53153235", "0.5315051", "0.5313958", "0.53074193", "0.53047436", "0.53...
0.0
-1
csv_header spss_header csv_answer spss_answer load_csv_answer
def csv_header(header_prefix) @csv_header << header_prefix end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_csv_full\n \n end", "def import_csv_smart\n \n end", "def load_csv\n # read each line frmo csv and append to recipes collection\n CSV.foreach(@csv_file) do |row|\n # puts \"#{row[0]} | #{row[1]}\"\n @recipes << Recipe.new(name: row[0], description: row[1], cooking_time: row[2],...
[ "0.6545457", "0.64624006", "0.6358659", "0.6289967", "0.6254917", "0.6253156", "0.62218475", "0.6173473", "0.6159406", "0.6158068", "0.6135107", "0.6132076", "0.6083586", "0.60813946", "0.60739803", "0.6053666", "0.6043436", "0.6039961", "0.6022485", "0.6021724", "0.60078704"...
0.0
-1
def get_item_id(index) return nil if index.blank? index = index.to_i 1 self.issue["items"][index]["id"] end
def get_item_id(index) return nil if index.blank? raise "您填写的内容不像是个数字啊(#{index})!" unless only_num?(index) index = index.to_i - 1 raise "您确定有这个选项吗(#{index})?" unless (0..(self.issue["items"].count)).include? index self.issue["items"][index]["id"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_id\n return @item_id\n end", "def item_id\n return @item_id\n end", "def item_id\n return @item_id\n end", "def item_id\n id\n end", "def item_id\n params['item_number'] || params['custom']\n ...
[ "0.74608386", "0.74608386", "0.74608386", "0.7437478", "0.74029404", "0.74029404", "0.7320078", "0.7313053", "0.7313053", "0.7312211", "0.7140663", "0.7140663", "0.7100038", "0.7046582", "0.6988008", "0.6892233", "0.6892233", "0.6892233", "0.68241984", "0.6823998", "0.6808094...
0.87208825
0
POST /auth/ Authenticate, generate token and add header
def authenticate(username = nil, password = nil, options = {}, &block) if username.is_a?(Hash) or password.is_a?(Hash) options = username.is_a?(Hash) ? username : password end options["username"] = username if username and !username.is_a?Hash options["password"] = password if password and !password.is_a?Hash options = set_options(options, &block) #TODO: Raise error if doesn't find username and password key in options @response = post('auth', options) if @response.has_key?("success") and @response['success'] add_header("X-Auth-Token", @response['token']) end @response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth\n build_response(\"token\") do\n connection.post do |req|\n req.headers.delete(\"Authorization\")\n req.url \"auth/\"\n req.body = { username: username, password: password }.to_json\n end\n end\n end", "def create_set_and_add_token\n token = Sec...
[ "0.75020164", "0.7068762", "0.7028924", "0.69227207", "0.68898046", "0.68744516", "0.6855017", "0.6841688", "0.6833473", "0.6829393", "0.68290335", "0.6824104", "0.68062234", "0.6785159", "0.6760981", "0.67287433", "0.6723888", "0.6723038", "0.6722622", "0.67125356", "0.67023...
0.0
-1
DELETE /auth/:token Delete auth token
def logout auth_token = get_connection_object.headers['X-Auth-Token'] raise "Can't find any authorization token to logout." unless auth_token @response = delete("/auth/#{auth_token}") if @response.has_key?("success") and @response['success'] get_connection_object.headers.delete("X-Auth-Token") end @response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_token(token = nil)\n token = token || settings.token\n delete \"authToken/#{token.to_s}\"\n end", "def delete_apn_token\n if params[:id] == current_user.id.to_s\n # A user can delete tokens for themself\n @user = current_user\n return render_error(500, \"must speci...
[ "0.815367", "0.77766246", "0.7587209", "0.75869095", "0.75727856", "0.7473823", "0.74708533", "0.74280477", "0.73880243", "0.7295512", "0.7284652", "0.7212292", "0.71979445", "0.71979445", "0.7176711", "0.71505785", "0.71470386", "0.7061725", "0.70295316", "0.70237345", "0.70...
0.70132047
20
GET /photo_tag_references GET /photo_tag_references.json
def index @photo_tag_references = PhotoTagPhoto.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_photo_tag_reference\n @photo_tag_reference = PhotoTagPhoto.find(params[:id])\n end", "def index\n @tag_refs = TagRef.all\n end", "def photo_tag_reference_params\n params.require(:photo_tag_photo).permit(:photo_id, :photo_tag_id)\n end", "def show\n @tag = Tag.find(params[:id])\...
[ "0.68515515", "0.6600326", "0.6443113", "0.63678175", "0.6323055", "0.61629534", "0.6062828", "0.5960789", "0.59396493", "0.593711", "0.5936961", "0.5933352", "0.58903474", "0.5790465", "0.57846105", "0.57844365", "0.57674474", "0.57613236", "0.57411736", "0.5731385", "0.5708...
0.78492594
0
GET /photo_tag_references/1 GET /photo_tag_references/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @photo_tag_references = PhotoTagPhoto.all\n end", "def set_photo_tag_reference\n @photo_tag_reference = PhotoTagPhoto.find(params[:id])\n end", "def index\n @tag_refs = TagRef.all\n end", "def show\n @tag = Tag.find(params[:id])\n if current_admin\n if params[:pin]\n ...
[ "0.7644032", "0.69248235", "0.6507964", "0.6310063", "0.6292115", "0.6140941", "0.6124623", "0.60348076", "0.6002396", "0.59820753", "0.5949577", "0.5936829", "0.5898569", "0.58960676", "0.5880373", "0.57771295", "0.56927085", "0.56813", "0.56791455", "0.5653899", "0.56453687...
0.0
-1
POST /photo_tag_references POST /photo_tag_references.json
def create @photo_tag_reference = PhotoTagPhoto.new(photo_tag_reference_params) respond_to do |format| if @photo_tag_reference.save format.html { redirect_to @photo_tag_reference, notice: 'Photo tag reference was successfully created.' } format.json { render :show, status: :created, location: @photo_tag_reference } else format.html { render :new } format.json { render json: @photo_tag_reference.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photo_tag_reference_params\n params.require(:photo_tag_photo).permit(:photo_id, :photo_tag_id)\n end", "def set_photo_tag_reference\n @photo_tag_reference = PhotoTagPhoto.find(params[:id])\n end", "def index\n @photo_tag_references = PhotoTagPhoto.all\n end", "def create\n @tag_ref...
[ "0.69959605", "0.6750295", "0.6590501", "0.6211269", "0.6173671", "0.61552715", "0.6083645", "0.6070497", "0.6057032", "0.5977463", "0.583303", "0.5794752", "0.57838273", "0.57782066", "0.5652392", "0.56314397", "0.5596663", "0.55630195", "0.5559896", "0.5536033", "0.5486907"...
0.70961
0
PATCH/PUT /photo_tag_references/1 PATCH/PUT /photo_tag_references/1.json
def update respond_to do |format| if @photo_tag_photo.update(photo_tag_reference_params) format.html { redirect_to @photo_tag_reference, notice: 'Photo tag reference was successfully updated.' } format.json { render :show, status: :ok, location: @photo_tag_reference } else format.html { render :edit } format.json { render json: @photo_tag_reference.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_photo_tag_reference\n @photo_tag_reference = PhotoTagPhoto.find(params[:id])\n end", "def update\n # creates tag objects for photos\n tag_array = tag_params['tags'].split(',').each do |x|\n x.strip!\n end\n tag_array.each do |x| \n if Tag.find_by(name: x)\n @tag =...
[ "0.6825852", "0.6774827", "0.6622745", "0.64420795", "0.6418615", "0.62085545", "0.6106002", "0.6028779", "0.5949675", "0.5885303", "0.585909", "0.58474535", "0.5829722", "0.5811459", "0.5748328", "0.57446533", "0.5697312", "0.5687181", "0.5678905", "0.56371164", "0.5636402",...
0.72623074
0
DELETE /photo_tag_references/1 DELETE /photo_tag_references/1.json
def destroy @photo_tag_reference.destroy respond_to do |format| format.html { redirect_to photo_tag_references_url, notice: 'Photo tag reference was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @image_reference.destroy\n respond_to do |format|\n format.html { redirect_to image_references_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo_tag.destroy\n respond_to do |format|\n format.html { redirect_to photo_tags_url, notice: 'Photo ...
[ "0.72668993", "0.7183108", "0.7113497", "0.70694256", "0.69641674", "0.6859285", "0.6857697", "0.6793", "0.67763734", "0.67498916", "0.67401063", "0.6716383", "0.67146635", "0.67146635", "0.67146635", "0.67146635", "0.67146635", "0.67146635", "0.6712148", "0.6712148", "0.6712...
0.79156494
0
Use callbacks to share common setup or constraints between actions.
def set_photo_tag_reference @photo_tag_reference = PhotoTagPhoto.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def photo_tag_reference_params params.require(:photo_tag_photo).permit(:photo_id, :photo_tag_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
Try to focus on using correct technical vocabulary. Use the to create a new comment Build a Bear Declare function build_a_bear
def build_a_bear(name, age, fur, clothes, special_power) # Create variable greeting greeting = "Hey partner! My name is #{name} - will you be my friend?!" # Create variable demographics demographics = [name, age] # Create power_saying variable power_saying = "Did you know that I can #{special_power}?" # Create variable build_bear with values built_bear = { # give value to basic_info 'basic_info' => demographics, # Give value to clothes 'clothes' => clothes, # Give value to exterior 'exterior' => fur, # Give value to cost 'cost' => 49.99, # give value to sayings 'sayings' => [greeting, power_saying, "Goodnight my friend!"], # Give value to is_cuddly 'is_cuddly' => true, } # return variable return built_bear # end of function end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_a_bear(name, age, fur, clothes, special_power)\n# Interpulate the parameter name into a string for the variable greeting.\n greeting = \"Hey partner! My name is #{name} - will you be my friend?!\"\n# Assign an array of name and age for the demographics variable.\n demographics = [name, age]\n# Interpul...
[ "0.6031328", "0.5966727", "0.59379524", "0.5900155", "0.58082837", "0.575506", "0.5718518", "0.5684076", "0.56754506", "0.56603974", "0.5659542", "0.56561536", "0.5615543", "0.56151944", "0.56143266", "0.56134504", "0.56023705", "0.5572671", "0.5568915", "0.55657417", "0.5528...
0.58235306
4
Metodo para ordenar una array mediante each con ordenamiento por insercion
def ordenEachMenus (array) ordenado = [] array.each do |nodo| if ordenado.empty? ordenado.push(nodo) else indice = 0 while indice < ordenado.length aporteActual = (nodo.collect { |alimento| alimento.valorEnergeticoKcal}).reduce(:+) aporteSiguiente = (ordenado[indice].collect { |alimento| alimento.valorEnergeticoKcal}).reduce(:+) if aporteActual <= aporteSiguiente ordenado.insert(indice, nodo) break elsif indice == ordenado.length-1 ordenado.insert(indice+1, nodo) break end indice+=1 end end end return ordenado end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutliplied(array)\nend", "def double_array(array)\n array + array\nend", "def merge(array1, array2)\n # (array1 + array2).uniq\n array1 | array2\nend", "def my_array_modification_method!(i_want_pets, thing_to_modify)\n i_want_pets.map! {|element| element.is_a?(Integer)? (element + thing_to_modify) : ...
[ "0.6314202", "0.6136714", "0.59359163", "0.59351826", "0.593229", "0.59248644", "0.59098417", "0.58888525", "0.5882097", "0.58776957", "0.58757776", "0.58682984", "0.58642006", "0.5852364", "0.5833233", "0.5822562", "0.58202344", "0.58093995", "0.5798673", "0.5758143", "0.575...
0.5698999
36
Never trust parameters from the scary internet, only allow the white list through.
def grumble_params params.require(:grumble).permit(:authorName, :content, :title, :photoUrl) 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
def self.new_with_session(params, session) super.tap do |user| if data = session["devise.facebook_data"] && session["devise.facebook_data"]["extra"]["raw_info"] user.email = data["email"] if user.email.blank? end end end
def give_goals_to_user self.goals.create(category: "Use my own bags at the store", point_value: 12, frequency: 0, weekly_points_goal: 0, weekly_results: 0) self.goals.create(category: "Carpool instead of use my car", point_value: 100, frequency: 0, weekly_points_goal: 0, weekly_results: 0) self.goals.create(category: "Air dry a load of laundry", point_value: 70, frequency: 0, weekly_points_goal: 0, weekly_results: 0) self.goals.create(category: "Adjust the thermostat up 1 degree in summer", point_value: 40, frequency: 0, weekly_points_goal: 0, weekly_results: 0) self.goals.create(category: "Install a compact fluorescent light bulb", point_value: 60, frequency: 0, weekly_points_goal: 0, weekly_results: 0) self.goals.create(category: "Ride a bike instead of car 1 mile", point_value: 20, frequency: 0, weekly_points_goal: 0, weekly_results: 0) self.goals.create(category: "Take a shorter shower (5 min or less)", point_value: 4, frequency: 0, weekly_points_goal: 0, weekly_results: 0) self.goals.create(category: "Turn off my engine instead of idleing", point_value: 15, frequency: 0, weekly_points_goal: 0, weekly_results: 0) self.goals.create(category: "Buy or eat local", point_value: 15, frequency: 0, weekly_points_goal: 0, weekly_results: 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_with_session(params, session)\n super.tap do |user|\n if data = session[\"devise.facebook_data\"] && session[\"devise.facebook_data\"][\"extra\"][\"raw_info\"]\n user.email = data[\"email\"] if user.email.blank?\n end\n end\n end", "def new_with_session(params, session...
[ "0.97167295", "0.9157083", "0.90557295", "0.8633759", "0.7233643", "0.71774304", "0.7118631", "0.7025944", "0.6996177", "0.68110645", "0.6803577", "0.6784633", "0.6756826", "0.6713332", "0.6676178", "0.66739297", "0.66244805", "0.6558739", "0.6528538", "0.6500806", "0.6479499...
0.0
-1
Cat.all collections of all the cat objects get those cats that belong to owner
def cats Cat.all.select do |cat| cat.owner == self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cats\n Cat.all.select { |cats| cats.owner == self }\n end", "def cats \n Cat.all.select do |cat_instance|\n cat_instance.owner == self \n end\n end", "def cats\n Cat.all.select do |cat|\n cat.owner == self\n end\n end", "def cats \n Cat.all.select {|one_cat| one_cat.owner =...
[ "0.81496465", "0.80740863", "0.80354977", "0.80171543", "0.8001798", "0.7867059", "0.7041076", "0.69846386", "0.6716329", "0.6443365", "0.64384097", "0.6388401", "0.6378328", "0.62944335", "0.62826616", "0.62637126", "0.61636835", "0.6154231", "0.6140937", "0.6069419", "0.601...
0.7905704
5
Nikki.sell_pets get list of NIKKIS dogs and cats only (not all dod ) change dog mood to nervous, change cat mood to nervous remove their owner
def sell_pets all_owner_pets = self.dogs + self.cats all_owner_pets.each do |pet| pet.mood = "nervous" pet.owner = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sell_pets\n Cat.all.collect do |cats|\n cats.mood=\"nervous\"\n cats.owner=nil\n end\n Dog.all.collect do |dogs|\n dogs.mood=\"nervous\"\n dogs.owner=nil\n end\n end", "def sell_pets\n all_pets = []\n all_pets << self.cats \n all_pets << self.dogs \n all_pets.flat...
[ "0.7942787", "0.77901405", "0.77847093", "0.75183535", "0.74559134", "0.7317256", "0.7304654", "0.72911704", "0.72751087", "0.7241007", "0.71527725", "0.71185917", "0.69585556", "0.6837484", "0.65689373", "0.6440744", "0.64276016", "0.64176714", "0.63490415", "0.6338492", "0....
0.77688175
3
Laina.walk_dogs, then all dogs' moods == "happy"
def walk_dogs Dog.all.each do |dog| if dog.owner == self dog.mood = "happy" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk_dogs\n Dog.all.collect do |dogs|\n dogs.mood=\"happy\"\n end\n end", "def walk_dogs\n self.dogs.each {|dog| dog.mood = \"happy\"}\n end", "def walk_dogs\n\n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end\n end", "def walk_dogs \n self.dogs.each do |dog|\n do...
[ "0.7936932", "0.77647716", "0.7691516", "0.7673095", "0.76453155", "0.76043767", "0.7595616", "0.75860643", "0.75721794", "0.75654536", "0.75635475", "0.7462288", "0.737697", "0.70792484", "0.68411916", "0.6817402", "0.6563621", "0.642962", "0.617243", "0.61546737", "0.614458...
0.761721
5
ideal code: Dad.buy_cat("Captain") get Cat class makes new instance of that cat
def buy_cat(name) Cat.new(name, self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buy_cat(name)\n new_cat = Cat.new(name, self)\nend", "def buy_cat(name)\n Cat.new(name, self)\nend", "def buy_cat(name)\n Cat.new(name,self)\n end", "def buy_cat(cat)\n new_cat = Cat.all.find do |cat_instance|\n cat_instance.name == cat \n end\n if new_cat \n Cat.new(new_cat.name,...
[ "0.8603804", "0.844882", "0.8163699", "0.8059277", "0.7922411", "0.7922411", "0.7922411", "0.7922411", "0.7794786", "0.77737945", "0.7721542", "0.76968056", "0.7684081", "0.76199883", "0.7491412", "0.74529356", "0.7445323", "0.7405874", "0.73743445", "0.7327647", "0.72289234"...
0.7572495
14
Formulario General Para Cajones de Busquedad
def buscar(url,columnas) form_tag url, class: 'navbar-form navbar-right',method: 'get',role: "search" do content_tag :div , class: "form-group form-group-sm" do |div| array = [] array << text_field_tag(:search, params[:search], class:"form-control", style:"width:inherid",placeholder: "Buscar") array << select_tag(:sort ,options_for_select(columnas,params[:sort]), class: "form-control",style: "width:100px;") array << submit_tag("Buscar",class: 'btn btn-default btn-sm', :name => nil) array.join.html_safe end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiples_facturas_confirmar_parciales\n @width_layout=1180\n @form_title = I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Mensajes.orden_despacho_insumos') \n @form_title_record = I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Mensajes.orden_despacho_insumo') \n end", "def comida_params\n ...
[ "0.65286636", "0.62023795", "0.6152687", "0.61135095", "0.60902584", "0.6061958", "0.60468096", "0.6042072", "0.6020243", "0.600849", "0.59937924", "0.5984717", "0.5981439", "0.59610784", "0.59361017", "0.59222907", "0.5916482", "0.59100455", "0.58903545", "0.58865637", "0.58...
0.0
-1
Update parameters of a TIFF image. The image is saved in the cloud
def modify_tiff_from_storage puts('Update parameters of a TIFF image from cloud storage') upload_sample_image_to_cloud compression = 'adobedeflate' resolution_unit = 'inch' bit_depth = 1 horizontal_resolution = 150.0 vertical_resolution = 150.0 from_scratch = nil folder = ImagingBase::CLOUD_PATH # Input file is saved at the Examples folder in the storage storage = nil # We are using default Cloud Storage request = AsposeImagingCloud::ModifyTiffRequest.new( get_sample_image_file_name, bit_depth, compression, resolution_unit, horizontal_resolution, vertical_resolution, from_scratch, folder, storage) puts("Call ModifyTiff with params: compression: #{compression}, resolution unit: #{resolution_unit}, bit depth:" + " #{bit_depth}, horizontal resolution: #{horizontal_resolution}, vertical resolution: " + "#{vertical_resolution}") updated_image = imaging_api.modify_tiff(request) save_updated_sample_image_to_output(updated_image, false) puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_tiff_and_upload_to_storage\n puts('Update parameters of a TIFF image and upload to cloud storage')\n\n upload_sample_image_to_cloud\n\n compression = 'adobedeflate'\n resolution_unit = 'inch'\n bit_depth = 1\n horizontal_resolution = 150.0\n vertical_resolution = 150.0...
[ "0.75248754", "0.64094824", "0.63928926", "0.6162859", "0.59199685", "0.58921754", "0.5878425", "0.5715703", "0.5683739", "0.56832814", "0.5631916", "0.5582434", "0.5565626", "0.55581564", "0.555063", "0.5541528", "0.55397534", "0.5526326", "0.55211145", "0.5505909", "0.54976...
0.7163092
1
Update parameters of a TIFF image, and upload updated image to Cloud Storage
def modify_tiff_and_upload_to_storage puts('Update parameters of a TIFF image and upload to cloud storage') upload_sample_image_to_cloud compression = 'adobedeflate' resolution_unit = 'inch' bit_depth = 1 horizontal_resolution = 150.0 vertical_resolution = 150.0 from_scratch = nil folder = ImagingBase::CLOUD_PATH # Input file is saved at the Examples folder in the storage storage = nil # We are using default Cloud Storage request = AsposeImagingCloud::ModifyTiffRequest.new( get_sample_image_file_name, bit_depth, compression, resolution_unit, horizontal_resolution, vertical_resolution, from_scratch, folder, storage) puts("Call ModifyTiff with params: compression: #{compression}, resolution unit: #{resolution_unit}, " + "bit depth: #{bit_depth}, horizontal resolution: #{horizontal_resolution}, vertical resolution: " + "#{vertical_resolution}") updated_image = @imaging_api.modify_tiff(request) upload_image_to_cloud(get_modified_sample_image_file_name, updated_image) puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_tiff_from_storage\n puts('Update parameters of a TIFF image from cloud storage')\n\n upload_sample_image_to_cloud\n\n compression = 'adobedeflate'\n resolution_unit = 'inch'\n bit_depth = 1\n horizontal_resolution = 150.0\n vertical_resolution = 150.0\n from_scrat...
[ "0.7289607", "0.6953938", "0.6241735", "0.6236834", "0.6219689", "0.6117133", "0.6110932", "0.6075472", "0.60708135", "0.6052028", "0.6024746", "0.5989361", "0.59705985", "0.5968926", "0.59594244", "0.5911838", "0.59079736", "0.59057546", "0.5890637", "0.58853126", "0.5879327...
0.804041
0
Update parameters of a TIFF image. Image data is passed in a request stream
def create_modified_tiff_from_request_body puts('Update parameters of a TIFF image from request body') compression = 'adobedeflate' resolution_unit = 'inch' bit_depth = 1 horizontal_resolution = 150.0 vertical_resolution = 150.0 from_scratch = nil storage = nil # We are using default Cloud Storage out_path = nil # Path to updated file (if this is empty, response contains streamed image) input_stream = File.open(File.join(ImagingBase::EXAMPLE_IMAGES_FOLDER, get_sample_image_file_name), 'r') request = AsposeImagingCloud::CreateModifiedTiffRequest.new( input_stream, bit_depth, compression, resolution_unit, horizontal_resolution, vertical_resolution, from_scratch, out_path, storage) puts("Call CreateModifiedTiff with params: compression: #{compression}, resolution unit: #{resolution_unit}, " + "bit depth: #{bit_depth}, horizontal resolution: #{horizontal_resolution}, vertical resolution: " + "#{vertical_resolution}") updated_image = imaging_api.create_modified_tiff(request) save_updated_sample_image_to_output(updated_image, true) puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_tiff(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end", "def modify_tiff_and_upload_to_storage\n puts('Update parameters of a TIFF image and upload to cloud storage')\n\n upload_sample_image_to_cloud\n\n com...
[ "0.65617687", "0.6207883", "0.61605865", "0.597902", "0.5892953", "0.58489525", "0.57709026", "0.575025", "0.5632139", "0.56035566", "0.55919546", "0.55775326", "0.5544361", "0.5537182", "0.55243593", "0.5522123", "0.549101", "0.5489181", "0.54658824", "0.54581183", "0.544996...
0.6608118
0
Update parameters of TIFF image according to fax parameters
def update_tiff_to_fax_from_storage puts('Update parameters of TIFF image according to fax parameters') upload_sample_image_to_cloud # Update TIFF Image parameters according to fax parameters folder = ImagingBase::CLOUD_PATH # Input file is saved at the Examples folder in the storage storage = nil # We are using default Cloud Storage request = AsposeImagingCloud::ConvertTiffToFaxRequest.new(get_sample_image_file_name, storage, folder) puts('Call ConvertTiffToFax') updated_image = imaging_api.convert_tiff_to_fax(request) save_updated_image_to_output('ConvertTiffToFax.tiff', updated_image) puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_tiff_to_fax_from_request\n puts('Update parameters of TIFF image from request body according to fax parameters.')\n\n upload_sample_image_to_cloud\n\n # Update TIFF Image parameters according to fax parameters\n out_path = nil\n storage = nil # We are using default Cloud Storag...
[ "0.58253926", "0.57195073", "0.5651652", "0.54872596", "0.5463444", "0.52969515", "0.5196241", "0.5158733", "0.51491296", "0.5118988", "0.5118988", "0.50878406", "0.50488585", "0.5047299", "0.5042461", "0.5034973", "0.50137544", "0.49913076", "0.4975679", "0.49155724", "0.491...
0.63675535
0
Update parameters of TIFF image from request body according to fax parameters
def convert_tiff_to_fax_from_request puts('Update parameters of TIFF image from request body according to fax parameters.') upload_sample_image_to_cloud # Update TIFF Image parameters according to fax parameters out_path = nil storage = nil # We are using default Cloud Storage input_stream = File.open(File.join(ImagingBase::EXAMPLE_IMAGES_FOLDER, get_sample_image_file_name), 'r') request = AsposeImagingCloud::CreateFaxTiffRequest.new(input_stream, out_path, storage) puts('Call CreateFaxTiff') updated_image = imaging_api.create_fax_tiff(request) save_updated_sample_image_to_output(updated_image, updated_image) puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_modified_tiff_from_request_body\n puts('Update parameters of a TIFF image from request body')\n\n compression = 'adobedeflate'\n resolution_unit = 'inch'\n bit_depth = 1\n horizontal_resolution = 150.0\n vertical_resolution = 150.0\n from_scratch = nil\n storage =...
[ "0.69623035", "0.6587275", "0.63759434", "0.62554896", "0.6193293", "0.603095", "0.60180163", "0.5945903", "0.590611", "0.57979476", "0.57667667", "0.56971025", "0.5669187", "0.56582874", "0.5656709", "0.5604555", "0.55913335", "0.557831", "0.5572861", "0.55206877", "0.549371...
0.67815745
1