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
DELETE /people/1 DELETE /people/1.json
def destroy @person.destroy respond_to do |format| format.html { redirect_to people_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def destroy\n ## note use of method chaining to combine find & destroy into one line\n Person.find(params[:id]).destroy\n respond_t...
[ "0.756637", "0.75528497", "0.755258", "0.755258", "0.755258", "0.7542481", "0.75265175", "0.75265175", "0.75265175", "0.75265175", "0.7441367", "0.7421742", "0.7394193", "0.7350797", "0.72796255", "0.72706586", "0.7260598", "0.7246104", "0.72252226", "0.7197943", "0.7190502",...
0.7409622
16
Use callbacks to share common setup or constraints between actions
def get_genders @genders = [['Male', 'male'], ['Female', 'female']] 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 run_actions; end", "def action_hook; end", "def callbacks; end", "def callbacks; end", "def actions; end", "def add_actions; end", "def define_action_hook; end", "def define_action_helpers\n ...
[ "0.6285902", "0.618966", "0.61873674", "0.6065412", "0.6065412", "0.60507876", "0.5903431", "0.588588", "0.5793752", "0.5748446", "0.5626589", "0.56050205", "0.55814654", "0.55591184", "0.55174696", "0.5486214", "0.5463819", "0.54410374", "0.5435411", "0.5435411", "0.5435411"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def person_params params.require(:person).permit(:name, :lastname, :firstname, :gender, :age, :cabin_id, :role_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
Creates a representation of a subscription. options: :callback_url => The url that should be used to handle subscription handshakes. :topic_url => The url of the feed one wishes to subscribe to. :secret => A secret that will be passed to the callback to better verify that communication is not replayed. Default: A secure random hex. :hubs => A list of hubs to negotiate the subscription with. Default: attempts to discover the hubs when it subscribes for the first time. :hub => The hub we have a subscription with already.
def initialize(options = {}) @tokens = [] secret = options[:secret] || SecureRandom.hex(32) @secret = secret.to_s @callback_url = options[:callback_url] @topic_url = options[:topic_url] @tokens << options[:token] if options[:token] @hubs = options[:hubs] || [] @hub = options[:hub] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscription(options = {})\n Subscription.new(options.merge(:url => url)).to_hash\n end", "def do_subscribe(params)\n mode = params['hub.mode']\n callback = params['hub.callback']\n topic = params['hub.topic']\n verify = params['hub.verify']\n vtoken = params...
[ "0.71474326", "0.7015759", "0.6841458", "0.6808718", "0.68000674", "0.66442037", "0.6558682", "0.6536384", "0.6490218", "0.6484767", "0.6459495", "0.64432055", "0.6420155", "0.6410965", "0.6402001", "0.6390077", "0.63772875", "0.6364183", "0.63636607", "0.63478684", "0.629960...
0.5949587
44
Actively searches for hubs by talking to publisher directly
def discover_hubs_for_topic @hubs = Nelumba.feed_from_url(self.topic_url).hubs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(builder)\n send_and_receive connection_config[:url], builder.blacklight_params\n end", "def subscribe_to_channel; end", "def hub\n @@message_hub\n end", "def broadcast_presence\n services = CouchModels::Service.find_all\n users = services.map {|service| se...
[ "0.6113972", "0.59600884", "0.5850336", "0.5739712", "0.573358", "0.57098144", "0.5695787", "0.5596962", "0.55593485", "0.5538158", "0.55335677", "0.55157214", "0.5513801", "0.55004513", "0.54968965", "0.54825956", "0.54433197", "0.5424751", "0.5365758", "0.53638005", "0.5348...
0.70203334
0
Subscribe to the topic through the given hub.
def subscribe return unless self.hub.nil? # Discover hubs if none exist @hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty? @hub = self.hubs.first change_subscription(:subscribe, token) # TODO: Check response, if failed, try a different hub end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe(_topic, **)\n raise 'not implemented'\n end", "def subscribe!\n @repository.callback_url = pubsubhubbub_callback_url\n\n if @repository.valid?\n begin\n client.subscribe(\n topic,\n @repository.callback_url,\n ENV['PUBSUBHUBBUB_...
[ "0.74728787", "0.70307046", "0.6957174", "0.67062706", "0.6704016", "0.66576546", "0.6651502", "0.65908444", "0.65897375", "0.6423702", "0.64004534", "0.6368169", "0.63166356", "0.6305598", "0.6291053", "0.62853944", "0.6244622", "0.6231099", "0.6225057", "0.6201193", "0.6154...
0.82586724
0
Unsubscribe to the topic.
def unsubscribe return if self.hub.nil? change_subscription(:unsubscribe) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe_from(topic)\n subscriptions.find_by_topic_id(topic.id).try(:destroy)\n end", "def unsubscribe_from_topic(tokens, topic)\n make_topic_mgmt_request(tokens, topic, \"batchRemove\")\n end", "def unsubscribe(topic, callback)\n options = {\n :\"hub.mode\" => \"unsu...
[ "0.8266986", "0.78577626", "0.77358454", "0.77099276", "0.7670159", "0.7667653", "0.7498516", "0.7479801", "0.7474664", "0.7441543", "0.741957", "0.73319083", "0.732448", "0.73236096", "0.7317096", "0.7303973", "0.72524816", "0.72481936", "0.72364885", "0.713424", "0.7094634"...
0.70453525
21
Change our subscription to this topic at a hub. mode: Either :subscribe or :unsubscribe hub_url: The url of the hub to negotiate with token: A token to verify the response from the hub.
def change_subscription(mode) token ||= SecureRandom.hex(32) @tokens << token.to_s # TODO: Set up HTTPS foo res = Net::HTTP.post_form(URI.parse(self.hub), { 'hub.mode' => mode.to_s, 'hub.callback' => @callback_url, 'hub.verify' => 'async', 'hub.verify_token' => token, 'hub.lease_seconds' => '', 'hub.secret' => @secret, 'hub.topic' => @topic_url }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe\n return unless self.hub.nil?\n\n # Discover hubs if none exist\n @hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty?\n @hub = self.hubs.first\n change_subscription(:subscribe, token)\n\n # TODO: Check response, if failed, try a different hub\n end", ...
[ "0.7160374", "0.6106317", "0.57910156", "0.5741319", "0.55150294", "0.5457976", "0.5431595", "0.54250175", "0.53621566", "0.53432983", "0.5337536", "0.5233994", "0.5226833", "0.52050966", "0.5175315", "0.5174477", "0.51672274", "0.51595294", "0.5157737", "0.5157737", "0.51490...
0.823721
0
Verify that a subscription response is valid.
def verify_subscription(token) # Is there a token? result = @tokens.include?(token) # Ensure we cannot reuse the token @tokens.delete(token) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_subscription(subscriptions)\n # TODO: move out of vba documents\n schema_path = Pathname.new('modules/vba_documents/spec/fixtures/subscriptions/webhook_subscriptions_schema.json')\n schemer_formats = {\n 'valid_urls' => ->(urls, _schema_info) { validate_urls(urls) },\n 'va...
[ "0.70428723", "0.67207235", "0.6518188", "0.65162784", "0.64482665", "0.6391007", "0.6338562", "0.6279137", "0.62723386", "0.62565184", "0.617986", "0.615574", "0.61510926", "0.61398524", "0.6071308", "0.60654736", "0.6045898", "0.6039437", "0.5991898", "0.5961188", "0.593860...
0.5973699
19
Determines if the given body matches the signature.
def verify_content(body, signature) hmac = HMAC::SHA1.hexdigest(@secret, body) check = "sha1=" + hmac check == signature end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_post_body?(post_body, signature)\n hash = OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), @channel.line_channel_secret, post_body)\n Base64.strict_encode64(hash) == signature\n end", "def valid_integrity?(body, headers)\n request_signature = headers['X-Hub-Signature']\n signatu...
[ "0.7437906", "0.712865", "0.7121173", "0.692363", "0.6910715", "0.6827787", "0.6827674", "0.6740603", "0.6598621", "0.6550687", "0.64843714", "0.6434735", "0.6434735", "0.6426174", "0.64208806", "0.63046473", "0.6290229", "0.6231722", "0.6198167", "0.6130173", "0.60319704", ...
0.7715647
0
Gives the content of a challenge response given the challenge body.
def challenge_response(challenge_code) { :body => challenge_code, :status => 200 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def challenge\n @challenge = decode_challenge\n respond\n end", "def response\n get_header_and_body\n end", "def challenge(_request, _response)\n end", "def challenge!\n response_headers = { \"WWW-Authenticate\" => %(Basic realm=\"My Application\"), 'Content-Typ...
[ "0.67253035", "0.62437975", "0.60938525", "0.57907385", "0.5765408", "0.5646408", "0.56344783", "0.5613111", "0.56094533", "0.55950004", "0.55777925", "0.5523152", "0.5489182", "0.54876626", "0.54464895", "0.54340017", "0.54340017", "0.54257554", "0.54189813", "0.54122823", "...
0.6785793
0
Get the Middle Character You are going to be given a word. Your job is to return the middle character of the word. If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters. Examples: Kata.getMiddle("test") should return "es" Kata.getMiddle("testing") should return "t" Kata.getMiddle("middle") should return "dd" Kata.getMiddle("A") should return "A"
def get_middle(s) if s.length.even? == true else end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def middle_word(string)\n words = string.split\n case words.size.odd?\n when true\n index = (words.size/2) \n words[index]\n when false\n \"Unable to determine middle word. An odd number of words are necessary.\"\n end\nend", "def middle_word(string)\n words = string.split\n word_count = words.le...
[ "0.79567516", "0.7946197", "0.7852843", "0.78287125", "0.7798002", "0.77541465", "0.7729286", "0.7632451", "0.7557507", "0.7556252", "0.7507475", "0.7499818", "0.7486011", "0.7445402", "0.7408992", "0.73516864", "0.7320952", "0.7299202", "0.72701716", "0.72701716", "0.7250411...
0.6977287
37
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.sign_up_notification.subject
def sign_up_notification # @greeting = "Hi" # mail to: "to@example.org" # @admin = User.where(is_admin: true).last @user = params[:user] mail(to: @user.email, subject: 'Sign Up successfull') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subje...
[ "0.67989194", "0.67111087", "0.66632926", "0.666101", "0.65482634", "0.6421273", "0.6389339", "0.6372051", "0.637055", "0.63448995", "0.6310573", "0.6309523", "0.6307496", "0.6305691", "0.62805027", "0.62159854", "0.6200072", "0.6119486", "0.6116144", "0.6111704", "0.6083866"...
0.5682123
67
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.approved_notification.subject
def approved_notification @user = params[:user] mail(to: @user.email, subject: 'Library Card Request Approved') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end", "def message_subject=(value)\n @message_subject = value\n end", "def subject (recipient)\n subj...
[ "0.6953471", "0.6851552", "0.68108493", "0.66740793", "0.6556023", "0.65067506", "0.6479987", "0.64354974", "0.63558203", "0.63076705", "0.62724805", "0.6184268", "0.6167953", "0.6164907", "0.61641526", "0.6163602", "0.61215615", "0.6119967", "0.6119941", "0.6105301", "0.6101...
0.0
-1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.rejected_notification.subject
def rejected_notification @user = params[:user] mail(to: @user.email, subject: 'Library Card Request Rejected') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end", "def message_subject=(value)\n ...
[ "0.68627334", "0.67048913", "0.6604195", "0.65682906", "0.64851487", "0.6447959", "0.6248173", "0.62248915", "0.61789006", "0.6111783", "0.6110676", "0.60503715", "0.6018146", "0.59767115", "0.5970228", "0.59551007", "0.59481394", "0.58914465", "0.5798777", "0.5790437", "0.57...
0.546816
62
the profile, attack, reduce_hitpoint, isDead and deflect are called instance methods or behaviour implementation of encapsulation attribute writer method
def change_profile(new_name = @name, new_hitpoint = @hitpoint, new_attack_damage = @attack_damage) @name = new_name @hitpoint = new_hitpoint @attack_damage = new_attack_damage end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\...
[ "0.6494662", "0.6084706", "0.60470086", "0.5999071", "0.5985195", "0.5982514", "0.5951439", "0.5951439", "0.5951439", "0.58382714", "0.57350683", "0.56987786", "0.5691484", "0.56629795", "0.5614321", "0.55811626", "0.55712205", "0.5570128", "0.55580795", "0.5519975", "0.55023...
0.54402775
31
implementation of encapsulation attribute reader method
def profile() puts "#{@name} has #{@hitpoint} and #{@attack_damage} attack damage" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_attribute(key); end", "def set_attributes_to_reader\n if !@attributes.empty?\n @attributes.each { |ele|\n self.class.__send__(:attr_reader, ele.downcase)\n }\n end\n\nend", "def attr_reader(sym, *more) end", "def _read_attribute(attr)\n @attributes[attr]\n end", "def attr_reader(...
[ "0.7211231", "0.699463", "0.694054", "0.6804783", "0.6657404", "0.6654877", "0.65958893", "0.65935606", "0.65935606", "0.6572367", "0.657057", "0.6535748", "0.6505798", "0.6481784", "0.6450294", "0.6431738", "0.64302325", "0.63963467", "0.6390249", "0.6374584", "0.637208", ...
0.0
-1
implementation of encapsulation encapsulation is hide the internal represantion or state of an object
def reduce_hitpoint(damage) @hitpoint -= damage end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def internal; end", "def private=(_); end", "def delegate_object_reader_method; end", "def expose; end", "def isolated; end", "def isolated; end", "def accessibility; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "...
[ "0.6926775", "0.67813987", "0.67750967", "0.6600834", "0.6482705", "0.644682", "0.644682", "0.64030313", "0.62951356", "0.62951356", "0.62951356", "0.62951356", "0.62951356", "0.62951356", "0.62951356", "0.62951356", "0.62951356", "0.62951356", "0.62951356", "0.62951356", "0....
0.0
-1
creates a sorting link (used in table headers), swapping asc/desc
def sortable(column, title = nil) title ||= column.titleize direction = (column == sort_column && sort_direction == "asc") ? "desc" : "asc" link_to title, :sort => column, :direction => direction end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_sort_link(text, sort)\n link_to(text, :sort => sort, \n :order => params[:order] == 'desc' ? 'asc' : 'desc', \n :page => params[:page] ||= 1, \n :daysprune => params[:daysprune] ||= -1\n )\n end", "def sortable(column, title)\n direction = (column == sort_c...
[ "0.7743998", "0.7577518", "0.7532365", "0.7433285", "0.74016017", "0.73959976", "0.7323607", "0.73093885", "0.7263241", "0.7242758", "0.7191382", "0.71602434", "0.7129251", "0.71129787", "0.7095197", "0.7078148", "0.70740676", "0.70455366", "0.7044673", "0.69676214", "0.69675...
0.71461636
12
Returns the AC test method library
def ac_tml @ac_tml ||= AcTml.new(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lib\n TyrantLib\n end", "def lib\n TyrantLib\n end", "def library; end", "def library; end", "def test_frameworks; end", "def test_library\n\tputs \"Library Loaded!\"\nend", "def lib\n @obj['lib']\n end", "def library\n @library ||= Boson.library(@lib)\n end", ...
[ "0.624025", "0.62261623", "0.60597837", "0.60597837", "0.59456414", "0.5942837", "0.58562034", "0.5766432", "0.565484", "0.5615493", "0.55677295", "0.5529691", "0.549908", "0.549908", "0.5498513", "0.5491706", "0.5485096", "0.5485096", "0.5485096", "0.54760295", "0.5473333", ...
0.0
-1
Returns the DC test method library
def dc_tml @dc_tml ||= DcTml.new(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_frameworks; end", "def lib\n @data['lib']\n end", "def lib\n @obj['lib']\n end", "def library_name\n self.class.library_name\n end", "def library; end", "def library; end", "def library\n @library ||= Boson.library(@lib)\n end", "def getLibraryName()\n return @libr...
[ "0.608045", "0.6078954", "0.60627854", "0.6025612", "0.60234493", "0.60234493", "0.58579874", "0.57958966", "0.5788853", "0.57757235", "0.5756501", "0.57033247", "0.57033247", "0.5688265", "0.5645807", "0.5547105", "0.5547105", "0.5547105", "0.5506872", "0.5497956", "0.545312...
0.0
-1
Creates an accessor for custom test method libraries the first time they are called
def method_missing(method, *args, &block) custom_tmls = Origen.interface.send(:custom_tmls) if custom_tmls[method] tml = CustomTml.new(self, custom_tmls[method]) instance_variable_set "@#{method}", tml define_singleton_method method do instance_variable_get("@#{method}") end send(method) else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_methods_for_testing! #:nodoc:\n request.headers['mock_methods'].each do |method_name, return_value|\n (class << self; self; end).instance_eval do\n define_method(method_name) { |*not_used| return_value }\n end\n end\n end", "def tes...
[ "0.60914785", "0.6080619", "0.60542107", "0.5938238", "0.58953416", "0.5871357", "0.58641917", "0.5822107", "0.5773011", "0.57308537", "0.5684956", "0.5676139", "0.5669252", "0.5635569", "0.56068116", "0.56068116", "0.5605318", "0.5591912", "0.55851215", "0.55851215", "0.5584...
0.0
-1
GET /article_comments/1 GET /article_comments/1.xml
def show @article_comment = ArticleComment.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @article_comment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @article = Article.find(params[:id])\n @article_comment = @article.article_comments.new(params[:article_comment])\n @article_comments = @article.article_comments.page(params[:page]||1).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @a...
[ "0.7138699", "0.69637847", "0.68539035", "0.6730535", "0.6730535", "0.6726112", "0.67232865", "0.6709886", "0.6683312", "0.6682627", "0.66215074", "0.66215074", "0.66215074", "0.6614249", "0.6601951", "0.6593226", "0.6580574", "0.6566607", "0.6563338", "0.6559287", "0.6543599...
0.7225215
0
GET /article_comments/new GET /article_comments/new.xml
def new @article_comment = ArticleComment.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @article_comment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @comment = @story.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @co...
[ "0.7833341", "0.76509726", "0.76506793", "0.76506793", "0.76506793", "0.76506793", "0.76506793", "0.76506793", "0.76506793", "0.76506793", "0.76506793", "0.76506793", "0.76506793", "0.76506793", "0.763149", "0.749347", "0.72768426", "0.72593415", "0.7248823", "0.7105374", "0....
0.7926563
0
POST /article_comments POST /article_comments.xml
def create @article = Article.find(params[:article_id]) @article_comment = @article.article_comments.build() @article_comment.content = params[:replyContent] respond_to do |format| if @article_comment.save #format.html { redirect_to @article, :anchor => 'comment' } format.html { redirect_to(article_path(@article, :anchor => "comment", :page=>1)) } format.xml { render :xml => @article_comment, :status => :created, :location => @article_comment } else format.html { redirect_to(@article) } format.xml { render :xml => @article_comment.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n #@comment = Comment.new(params[:article_id])\n @comment = Article.find(params[:article_id]).comments.create(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to :back }\n f...
[ "0.6973863", "0.67758304", "0.67474", "0.6717696", "0.6668092", "0.66457486", "0.6593195", "0.647", "0.6407714", "0.6404982", "0.6362379", "0.6350214", "0.63283217", "0.62911814", "0.6280884", "0.627409", "0.62559813", "0.62031823", "0.6188769", "0.61598265", "0.611159", "0...
0.7053149
0
PUT /article_comments/1 PUT /article_comments/1.xml
def update @article_comment = ArticleComment.find(params[:id]) respond_to do |format| if @article_comment.update_attributes(params[:article_comment]) format.html { redirect_to(@article_comment, :notice => 'Article comment was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @article_comment.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity ...
[ "0.67775", "0.66272867", "0.6463805", "0.6380269", "0.63516814", "0.63516814", "0.6330247", "0.6270228", "0.62661874", "0.6241298", "0.62362623", "0.6210142", "0.6210142", "0.620209", "0.6201098", "0.6194806", "0.6194537", "0.619005", "0.6178299", "0.6148663", "0.6148663", ...
0.69861263
0
DELETE /article_comments/1 DELETE /article_comments/1.xml
def destroy @article_comment = ArticleComment.find(params[:id]) @article_comment.destroy respond_to do |format| format.html { redirect_to(article_comments_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n puts \">>>> Destroying a comment <<<<\"\n @comment = Comment.find(params[:id])\n puts \"found comment>>> #{@comment}\"\n @article = @comment.article\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(article_path(@article)) }\n format.xml { head :ok...
[ "0.72589505", "0.7096152", "0.7067763", "0.703446", "0.6966151", "0.68770635", "0.6868609", "0.68683994", "0.6865256", "0.68386793", "0.68386793", "0.6834373", "0.6748496", "0.67301726", "0.6726204", "0.67233056", "0.67233056", "0.67141426", "0.67141426", "0.67141426", "0.671...
0.73909175
0
GET /photos GET /photos.json
def index @photos = Photo.where(ip: request.remote_ip).all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BAS...
[ "0.8192671", "0.8084962", "0.7820687", "0.7662806", "0.76157993", "0.7597941", "0.7566764", "0.75608486", "0.7540451", "0.75032324", "0.7496815", "0.7360214", "0.7275886", "0.7223893", "0.72033954", "0.713234", "0.7127612", "0.7124163", "0.7120244", "0.7060392", "0.7055266", ...
0.0
-1
GET /photos/1 GET /photos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @ph...
[ "0.84863234", "0.7777037", "0.7566973", "0.7507857", "0.7482775", "0.742858", "0.73779064", "0.73423064", "0.73400605", "0.73322564", "0.73005956", "0.7280408", "0.725952", "0.7259299", "0.7214884", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0....
0.0
-1
POST /photos POST /photos.json
def create @photo = Photo.new(photo_params) params[:pictures].each do |s, i| #@photo[ip] = params[:ip] #@photo[avatar] = s @photo= Photo.new(ip: params[:photo][:ip],avatar: s) @photo.save end respond_to do |format| format.html { redirect_to photos_url, notice: 'Pictures was successfully added.' } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n if @...
[ "0.73626924", "0.71853614", "0.6947308", "0.69228035", "0.68975127", "0.68508923", "0.6683941", "0.66752636", "0.6614366", "0.660908", "0.660323", "0.6562045", "0.6548483", "0.6548483", "0.6548483", "0.6548483", "0.6548483", "0.6543545", "0.6476572", "0.6464061", "0.6464061",...
0.0
-1
PATCH/PUT /photos/1 PATCH/PUT /photos/1.json
def update respond_to do |format| if @photo.update(photo_params) format.html { redirect_to @photo, notice: 'Photo was successfully updated.' } format.json { render :show, status: :ok, location: @photo } else format.html { render :edit } format.json { render json: @photo.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successful...
[ "0.7049965", "0.6752749", "0.6740446", "0.67135185", "0.671254", "0.66867554", "0.66847605", "0.66847605", "0.66847605", "0.66847605", "0.66843224", "0.66707134", "0.66707134", "0.66707134", "0.66707134", "0.66707134", "0.66707134", "0.6667143", "0.6663248", "0.6657235", "0.6...
0.6384656
45
DELETE /photos/1 DELETE /photos/1.json
def destroy @photo.destroy respond_to do |format| format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.ht...
[ "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.77150726", "0.77150726", "0.77150726", "0.77150726", "0.77150726", "0.77036476", "0.7683938", "0.7666516", "0.7664305", "0.7664305", "0.7651935", "0.7651935", "0.76373297", "0.75912905", "0.75888...
0.7369001
55
Use callbacks to share common setup or constraints between actions.
def set_photo @photo = Photo.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_params params.require(:photo).permit(:ip, :avatar) 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.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
def define_index( name, unique = false )
def install( connection ) unless present?(connection) connection.execute(render_sql_create()) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(name, options = { :unique => false })\n collection.create_index(name, options[:unique])\n end", "def has_unique_index(name, *fields)\n indexes[name] = fields\n end", "def index(name, options = { :unique => false })\n collection.create_index(name, options)\n end", ...
[ "0.80841625", "0.79588526", "0.7905823", "0.77104324", "0.7225079", "0.7225079", "0.7085467", "0.70254433", "0.69911695", "0.69751793", "0.69751793", "0.6944564", "0.6942853", "0.6911964", "0.6911134", "0.67506224", "0.6749996", "0.6748517", "0.67222816", "0.66959053", "0.667...
0.0
-1
======================================================================================= Object Instantiation =======================================================================================
def create_field( name, type, *marks ) TableParts::Field.new(self, name, type, *marks) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def constructor; end", "def initialize\n end", "def i...
[ "0.80444825", "0.7907648", "0.7829564", "0.7829564", "0.7829564", "0.7829564", "0.7829564", "0.7829564", "0.7816187", "0.7742366", "0.7739882", "0.773351", "0.7690315", "0.7690315", "0.7690315", "0.7690315", "0.7690315", "0.7690315", "0.7690315", "0.7690315", "0.7690315", "...
0.0
-1
method to add a student
def add_student(database, name) database.execute("INSERT INTO students (name) VALUES (?)", [name]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_student(new_student)\n @students << new_student\n end", "def addStudent(studentId, fName, lName)\n @studentOne = Student.new(studentId, fName, lName)\n end", "def add_student(student)\n @student << student\n end", "def add_student(student)\n @students << student\n end", "def add_stu...
[ "0.83528656", "0.83310837", "0.8289876", "0.8281807", "0.8242785", "0.80043757", "0.7938122", "0.7918924", "0.79144514", "0.78676206", "0.7859744", "0.78085536", "0.76485455", "0.7648163", "0.7566657", "0.75616866", "0.7543123", "0.75255984", "0.7481705", "0.747584", "0.73632...
0.6870187
54
add_student(db, "Bob") methoad to add a subject
def add_subject(database, name) database.execute("INSERT INTO subjects (name) VALUES (?)", [name]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_student_to_course(student_id, name, email)\n if Student.find_by_email(email)\n student = Student.find_by_email(email)\n else\n student = Student.new\n student.email = email\n student.student_id = student_id\n student.name = name\n student.university = Faculty.find(faculty_id).university...
[ "0.74211407", "0.7257415", "0.7249954", "0.71419096", "0.7114764", "0.70805085", "0.7029817", "0.69931626", "0.693987", "0.69269323", "0.692504", "0.68591183", "0.67597145", "0.66752774", "0.6672282", "0.6646676", "0.6644185", "0.6618015", "0.6579783", "0.65795845", "0.656483...
0.79847014
0
add_subject(db, "Math") add_subject(db, "English") add_subject(db, "Physics") add_subject(db, "Art") add_subject(db, "Chemistry") method to add a grade
def add_grade(database, student_id, subject_id, grade) database.execute("INSERT INTO grades (grade, student_id, subject_id) VALUES (?, ?, ?)", [grade, student_id, subject_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_subject_grade(all_grades,cid)\n currentMark = mark_per(all_grades.sum(\"worth\"), all_grades.sum(\"courseMark\"))\n Subject.update(cid, :currentMark => currentMark)\n end", "def add_subject(database, name)\r\n\tdatabase.execute(\"INSERT INTO subjects (name) VALUES (?)\", [name])\r\nen...
[ "0.67687356", "0.65627533", "0.6485465", "0.6350736", "0.626064", "0.61422634", "0.613574", "0.60928875", "0.6089411", "0.6088551", "0.6086325", "0.60766816", "0.6043076", "0.60364455", "0.601754", "0.60110974", "0.6000983", "0.593063", "0.59266424", "0.58940816", "0.5888349"...
0.7312546
0
add_grade(db, 1, 1, 80) method to update a grade
def update_grade(database, student, subject, grade) student_id = get_student_id(database, student) subject_id = get_subject_id(database, subject) database.execute("UPDATE grades SET grade=? WHERE student_id=? AND subject_id=?",[grade, student_id, subject_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_grade(database, student_id, subject_id, grade)\r\n\tdatabase.execute(\"INSERT INTO grades (grade, student_id, subject_id) VALUES (?, ?, ?)\", [grade, student_id, subject_id])\r\nend", "def update_grade\n grade_entry_form = record\n grade_entry_student =\n grade_entry_form.grade_entry_students....
[ "0.7757418", "0.70768535", "0.70141536", "0.6971177", "0.6917739", "0.6823761", "0.6667837", "0.6667837", "0.6667837", "0.6667837", "0.6667837", "0.6667837", "0.6667837", "0.6667837", "0.6644402", "0.66316", "0.66285104", "0.66190195", "0.6585793", "0.6584383", "0.65841913", ...
0.7691302
1
update_grade(db, 1, 1, 75) method to get student id
def get_student_id(database, name) student = database.execute("SELECT * FROM students WHERE name=?",[name]) student_id = student[0][0].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_grade(database, student, subject, grade)\r\n\tstudent_id = get_student_id(database, student)\r\n\tsubject_id = get_subject_id(database, subject)\r\n\tdatabase.execute(\"UPDATE grades SET grade=? WHERE student_id=? AND subject_id=?\",[grade, student_id, subject_id])\r\nend", "def update_grade\n grad...
[ "0.7777008", "0.7150516", "0.7108687", "0.7021364", "0.7018361", "0.69828594", "0.6969169", "0.6856364", "0.6833396", "0.67951024", "0.6773907", "0.6773907", "0.6773907", "0.6773907", "0.6773907", "0.6773907", "0.6773907", "0.6773907", "0.67475665", "0.6730361", "0.6674328", ...
0.6109993
61
p get_student_id(db, "Bob") method to get subject id
def get_subject_id(database, name) subject = database.execute("SELECT * FROM subjects WHERE name=?",[name]) subject_id = subject[0][0].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end", "def student_id\r\n\t\t\treturn 51875531\r\n\t\tend", "def get_student_id(database, name)\r\n\tstudent = database.execute(\"SELECT * FROM students WHERE name=?\",[name])\r\n\tstudent_id = student[0][0].to_i\r\nend", "def subject_id\n ...
[ "0.72265273", "0.7163225", "0.70819074", "0.7021264", "0.6876979", "0.6489194", "0.64713913", "0.63267535", "0.6314024", "0.63004786", "0.62624776", "0.62099344", "0.6209032", "0.61056346", "0.61007106", "0.61007106", "0.6090539", "0.60806286", "0.60690045", "0.60500723", "0....
0.77052814
0
p get_subject_id(db, "Math") method to display all students
def display_students(database) students = database.execute("SELECT * FROM students") students.each do |student| puts "ID: #{student[0]} Name: #{student[1]}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_subjects\r\n #TODO only list subjects from my own schools \r\n #because then people can still it \r\n school = School.find(params[:nid]) rescue render_return\r\n render_return if !logged_in_user.see_course?(school)\r\n render_p 'course_display/course_selection',{'ca...
[ "0.6959218", "0.6828457", "0.6642038", "0.6640494", "0.6523877", "0.6490552", "0.6389986", "0.6362381", "0.6354497", "0.63431907", "0.63132465", "0.6304929", "0.6288541", "0.62871635", "0.62840205", "0.6244341", "0.62196714", "0.62151325", "0.6197774", "0.61873615", "0.618571...
0.58351296
76
display_students(db) method to display all subjects
def display_subjects(database) subjects = database.execute("SELECT * FROM subjects") subjects.each do |subject| puts "ID: #{subject[0]} Subject: #{subject[1]}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_subjects\r\n #TODO only list subjects from my own schools \r\n #because then people can still it \r\n school = School.find(params[:nid]) rescue render_return\r\n render_return if !logged_in_user.see_course?(school)\r\n render_p 'course_display/course_selection',{'ca...
[ "0.71916765", "0.70844215", "0.69682807", "0.6877798", "0.68359965", "0.68359965", "0.6818311", "0.6809174", "0.6809174", "0.6809174", "0.67688406", "0.67515945", "0.67114455", "0.66914874", "0.66760284", "0.66130507", "0.6603461", "0.6588587", "0.6587552", "0.65592146", "0.6...
0.74699634
0
method to display all grades
def display_grades(database, name) student_id = get_student_id(database, name) display_cmd= <<-SQL SELECT students.name, subjects.name, grades.grade FROM grades JOIN students ON grades.student_id=students.id JOIN subjects ON grades.subject_id=subjects.id WHERE student_id=? SQL display = database.execute(display_cmd,[student_id]) display.each do |grade| puts "#{grade[0]} scored a #{grade[2]} on #{grade[1]}." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_grades\n @learn_grades.each do |grade|\n puts grade.which_course?.foreground(:yellow) + \": \".foreground(:yellow)\n puts grade.summary\n end\n end", "def show_grades(grades, format)\n puts 'Assessment\\'s grades'\n puts AssessmentSerializer::serialize_grades(grades, format)\...
[ "0.7695495", "0.7247339", "0.68063635", "0.68063635", "0.68063635", "0.68063635", "0.6758233", "0.6643163", "0.66415995", "0.6596063", "0.6595783", "0.65084684", "0.64735466", "0.64129627", "0.6410633", "0.6373399", "0.63248175", "0.6307031", "0.6301125", "0.6288717", "0.6262...
0.6705752
7
display_grades(db, "Bob") Method to print out the commands
def help puts "-to add new student: add student" puts "-to display all students: display students" puts "-to display all subjects: display subjects" puts "-to update a grade: update grade" puts "-to display grades of a student: check grade" puts "-to quit: done, exit" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_grades(database, name)\r\n\tstudent_id = get_student_id(database, name)\r\n\tdisplay_cmd= <<-SQL\r\n\t\tSELECT students.name, subjects.name, grades.grade\r\n\t\tFROM grades\r\n\t\t\tJOIN students\r\n\t\t\t\tON grades.student_id=students.id\r\n\t\t\tJOIN subjects\r\n\t\t\t\tON grades.subject_id=subjects...
[ "0.78189224", "0.72039473", "0.67393196", "0.65408653", "0.6480849", "0.6253863", "0.6248736", "0.62272745", "0.62171775", "0.62033147", "0.61609966", "0.61529076", "0.61370504", "0.61213833", "0.6031915", "0.5981624", "0.5957633", "0.5948583", "0.59450686", "0.59396863", "0....
0.5833031
27
characters from the combined string. Each word will contain at least one letter. All words will be lower cased.
def count_unique(s1, s2) (s1 + s2).chars.uniq.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_me(string)\n string = string.split(\" \")\n collection = []\n string.each do |word|\n collection << word.gsub(/[^A-Za-z]/,\"\").chars.sort.join\n end\n collection.join(\" \")\nend", "def process_word word\n const_match = /^[BCDFGHIJKLMNPQRSTVWXYZbcdfhhtjklmnpqrstvwxyz]+/.match(word)\n ...
[ "0.6613564", "0.65555567", "0.6545711", "0.65066826", "0.64316565", "0.63898563", "0.6384395", "0.6379391", "0.6372362", "0.63480985", "0.63263416", "0.6314629", "0.6312543", "0.63082314", "0.62610877", "0.6256241", "0.62538505", "0.62426156", "0.6237041", "0.6230064", "0.621...
0.0
-1
predifiend categories in seeds file
def edit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addCategories(filename)\n\t# Open the file with categories\n\tcategoryTypes = File.open(Rails.root.join(\"db\", \"seed_data\", filename))\n\t# Each line of the file contains a category description. Iterate through the file and create a classification for each line.\n\tcategoryTypes.each do |curCategoryType|\n\...
[ "0.71271574", "0.6698336", "0.66660666", "0.6639025", "0.6382471", "0.61727256", "0.58482426", "0.58374375", "0.5787874", "0.5777432", "0.554145", "0.5506012", "0.5501003", "0.5486468", "0.547899", "0.54252803", "0.5384935", "0.537921", "0.5344382", "0.5343918", "0.5332457", ...
0.0
-1
=> "fiiiissshhhhhh" O(n log n)
def dominant_octopus(array) return array if array.length <= 1 midpoint = array.length / 2 sorted_left = dominant_octopus(array.take(midpoint)) sorted_right = dominant_octopus(array.drop(midpoint)) merge(sorted_left, sorted_right) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sluggish_octopus\n # O(N^2)\n longest_fish = \"\"\n Fishes.each do |fish1|\n Fishes.each do |fish2|\n longest_fish = fish2 if fish2.length > fish1.length\n end\n end\n longest_fish\nend", "def third_anagram?(str1, str2)\n beginning_time = Time.now\n str1.split(\"...
[ "0.6302133", "0.61150056", "0.6113979", "0.6094597", "0.60698813", "0.6040881", "0.6017755", "0.59926057", "0.59926057", "0.59700644", "0.59689933", "0.59623057", "0.59617096", "0.5959393", "0.5949651", "0.5927208", "0.5918272", "0.59065807", "0.58962685", "0.5892384", "0.589...
0.0
-1
wraps a span if inspector option is set to all
def wrap_span(translation, translation_key) # put the inspector class if inspector is all and the key doesn't belongs to translation_center if TranslationCenter::CONFIG['inspector'] == 'all' && translation_key.name.to_s.split('.').first != 'translation_center' "<span class='tc-inspector-key' data-locale='#{I18n.locale}' data-type='#{translation_key.status(I18n.locale)}' data-id='#{translation_key.id}'> #{translation} </span>".html_safe else translation end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def span?; end", "def format_as_span_html(name, attr, body); end", "def wrap_span(translation, translation_key)\n # put the inspector class if inspector is all and the key doesn't belongs to translation_center\n if TranslationCenter::CONFIG['inspector'] == 'all' && translation_key.name.to_s.split('.').fi...
[ "0.7098346", "0.6849896", "0.62820774", "0.6148056", "0.6100718", "0.6035346", "0.5988859", "0.5985079", "0.5972015", "0.5919117", "0.5876541", "0.57759917", "0.5760505", "0.568273", "0.5648857", "0.5648627", "0.5646561", "0.56354374", "0.5634116", "0.54959905", "0.548071", ...
0.6274524
3
make sure the complete key is build using the options such as scope and count
def prepare_key(key, options) complete_key = key # if a scope is passed in options then build the full key complete_key = options[:scope].present? ? "#{options[:scope].to_s}.#{complete_key}" : complete_key # add the correct count suffix if options[:count].present? && options[:count] == 1 complete_key = "#{complete_key}.one" elsif options[:count].present? && options[:count] != 1 complete_key = "#{complete_key}.other" end complete_key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_master_key=(_arg0); end", "def require_master_key=(_arg0); end", "def reserve_key(key); end", "def require_master_key; end", "def require_master_key; end", "def possible_keys(key); end", "def rekey_as_needed; end", "def flexible_key; end", "def rekey_limit=(_arg0); end", "def rekey_li...
[ "0.6185478", "0.6185478", "0.5928056", "0.5750648", "0.5750648", "0.5669566", "0.5653811", "0.5534185", "0.54608905", "0.53779304", "0.5377498", "0.53765714", "0.5315928", "0.5315928", "0.5315928", "0.53034055", "0.5301031", "0.52843225", "0.5276526", "0.5276526", "0.5276526"...
0.69126046
0
Returns +true+ if +self+ subtypes +other+. A UnionType subtypes another type if all the values in the union are subtypes of +other+. This has the effect of deferring dealing with unions on the rhs of a relation into the Type class. There may be better ways of doing this.
def <=(other) @types.all? do |t| t <= other end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kind_of?(other)\n super || object.kind_of?(other)\n end", "def evaluate_subtype?(other, type_bindings = nil, same_parameter_types = false)\n raise NotImplementedError\n end", "def contains?(other_type)\n if !(kind_of_class <= other_type.kind_of_class)\n return ...
[ "0.6656991", "0.6471581", "0.60800517", "0.60759646", "0.5913035", "0.58639884", "0.5717553", "0.56524837", "0.5639843", "0.55951434", "0.54245025", "0.5378488", "0.5363163", "0.5337256", "0.53275406", "0.5321028", "0.5317216", "0.53049093", "0.52971166", "0.52787286", "0.527...
0.53596807
13
You can't proxy nil or false, so remove those possibilities if they're in the type.
def proxy_simplify ts = @types.dup.delete_if do |t| t.is_a? NominalType and (t.klass == NilClass or t.klass == FalseClass) end if ts.length == @types.length then self else if ts.length == 1 then ts.to_a[0] else UnionType.new(ts) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proxy_types; end", "def typecast_value_boolean(opts={});true;end", "def skip_conversion?(obj, attr, value)\n value.nil? || !obj.class.attributes.key?(attr)\n end", "def nonregular_type; end", "def generic?; true; end", "def object_type?\n !value_type?\n end", "def proxy_type\n ...
[ "0.60454077", "0.60138047", "0.586154", "0.5804956", "0.58021206", "0.580121", "0.57736146", "0.57269555", "0.5706746", "0.5681425", "0.5674773", "0.56521684", "0.56374043", "0.56374043", "0.5634711", "0.56346625", "0.56327087", "0.5608932", "0.5591604", "0.55645496", "0.5531...
0.6163261
0
Creates a new UnionType that is the union of all the types in +type+. The initializer is private since UnionTypes should be created via the UnionTypeof method.
def initialize(types) @types = Set.new(types) super() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_union_tc(id, name, discriminator_type, *members)\n return CORBA::TypeCode::Union.new(id.to_s.freeze, name.to_s, nil, discriminator_type, members)\n end", "def union_memberships(type)\n rebuild_artifacts unless defined?(@union_memberships)\n @union_memberships.fetch(type.name, [])\n ...
[ "0.537518", "0.52013594", "0.52013594", "0.50309217", "0.49575335", "0.48586595", "0.4812013", "0.48092037", "0.48092037", "0.4775044", "0.46384695", "0.46366718", "0.4561177", "0.4559883", "0.45568106", "0.45401376", "0.4507513", "0.4429114", "0.44120076", "0.4387188", "0.43...
0.0
-1
DELETE /hookups/1 DELETE /hookups/1.xml
def destroy @hookup = Hookup.find(params[:id]) @hookup.destroy respond_to do |format| format.html { redirect_to(hookups_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_hook(id)\n delete(\"/hooks/#{id}\")\n end", "def delete(id)\n _params = {:id => id}\n return @master.call 'webhooks/delete', _params\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTT...
[ "0.66563874", "0.6259569", "0.6164094", "0.6144415", "0.6017475", "0.60122293", "0.59824574", "0.59824574", "0.5970387", "0.5937535", "0.58757156", "0.5859602", "0.5791331", "0.5747852", "0.5727907", "0.57187104", "0.5715497", "0.5710771", "0.56989694", "0.5691974", "0.568552...
0.7322159
0
method put def update unless user_signed_in? flash[:notice] = "You have to sign in first!" redirect_to new_user_registration_path else end end
def comment Hookup.where(:user_id => params[:user_id], :challenge_id => params[:challenge_id]).update_attribute(:u,:c) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @user.update_attributes(params[:user])\n flash[:success] = \"Profil mis à jour\"\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n @user=User.find(params[:id])\n if @user.update_attributes(params[:user])\n sign_in @use...
[ "0.79120916", "0.7705902", "0.7624987", "0.7619818", "0.7559416", "0.7453027", "0.74476624", "0.7401865", "0.7401865", "0.74005586", "0.73864746", "0.7342249", "0.7340904", "0.733215", "0.7280451", "0.726508", "0.7238233", "0.723091", "0.7184276", "0.71764535", "0.7165976", ...
0.0
-1
Must be done after all of the table definitions since `metrics_01` is dumped prior to `metrics_base`, etc.
def miq_metric_table_constraints(stream) inherited_metrics_tables.each do |(table, inherit_from)| child_table_num = table.match(METRIC_ROLLUP_TABLE_REGEXP)[:CHILD_TABLE_NUM].to_i child_table = remove_prefix_and_suffix(table).inspect primary_condition = if inherit_from.include?("rollup") "capture_interval_name != ? AND EXTRACT(MONTH FROM timestamp) = ?" else "capture_interval_name = ? AND EXTRACT(HOUR FROM timestamp) = ?" end conditions = [primary_condition, "realtime", child_table_num] stream.puts " add_miq_metric_table_inheritance #{child_table}, " \ "#{inherit_from.inspect}, " \ ":conditions => #{conditions.inspect}" end stream.puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def create_metrics_for_snapshot(snapshot)\n\n @eth0_rx_counter ||= 0\n @eth0_tx_counter ||= 0\n @uptime_counter ||= 0\n \n # Build a random value for the network counters.\n @eth0_rx_counter += rand(100000)\n @et...
[ "0.6586173", "0.6586173", "0.6586173", "0.61209255", "0.59465355", "0.58593833", "0.585492", "0.576403", "0.57523715", "0.5638309", "0.5612975", "0.5564316", "0.55219185", "0.5492186", "0.54915804", "0.5485196", "0.54703665", "0.54582983", "0.543948", "0.543948", "0.5437299",...
0.6014903
4
trying to set CORS response headers in controller actions
def cors_set_access_control_headers headers['Access-Control-Allow-Origin'] = '*' headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS' headers['Access-Control-Allow-Headers'] = 'Content-Type' headers['Access-Control-Max-Age'] = "1728000" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n end", "def cors_set_access_control_headers\n response.headers['Access-Control-Allow-Origin'] = '*'\n response.headers['Access-Control-Allow-Credentials'] = 'true'\n response.headers['Access-Control...
[ "0.76698726", "0.7661982", "0.7609696", "0.7580956", "0.7580956", "0.7580956", "0.7577397", "0.7558065", "0.75501055", "0.75398964", "0.75217545", "0.7520277", "0.7519073", "0.7519073", "0.7519073", "0.751607", "0.75038254", "0.75001", "0.7485436", "0.7483834", "0.7483834", ...
0.7560409
7
GET /events GET /events.json
def index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}...
[ "0.8337294", "0.82393", "0.7943906", "0.7928331", "0.77682066", "0.77408546", "0.76701826", "0.7665501", "0.76581633", "0.7642472", "0.76212007", "0.7615658", "0.7615658", "0.7612881", "0.75687", "0.7522498", "0.7488667", "0.74813455", "0.74698067", "0.7441679", "0.74408287",...
0.0
-1
POST /events POST /events.json
def create # app_owner = params['app_owner'] # puts "*** #{params[app_owner]}" # puts "*** #{params['app_owner']}" # user = User.find_by_email(app_owner) # user.events.create!(event_params) # blocmetrics.track("some event name", {property_1: "some value", property_2: "some other value"}) # {"name"=>"Page Views", "application"=>"Bloccit", "topic_name"=>"officiis enim laboriosam quibusdam aperiam qui voluptatum et iusto", "app_user"=>"4", "app_owner"=>"douglaswalter2@gmail.com", "event"=>{"name"=>"Page Views"}} Rails.logger.info(">>>>>>>>>This is in heroku") @event = Event.create(name: params[:name], property_1: params[:topic_name], property_2: params[:app_owner]) Rails.logger.info ">>>>>> #{@event.inspect}" Rails.logger.info ">>>>> #{params.inspect}" respond_to do |format| format.json { head :ok } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_event event, data={}\n data[:event] = event\n post '/event', data\n end", "def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end", "def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end", "def crea...
[ "0.7714071", "0.7611226", "0.76028967", "0.7541319", "0.7444731", "0.73206913", "0.73138195", "0.728203", "0.7251226", "0.7235907", "0.7235907", "0.7215051", "0.71682763", "0.7150409", "0.7126664", "0.7118896", "0.7117831", "0.71162695", "0.70964044", "0.70907074", "0.7083036...
0.0
-1
GET /product_groups/1 GET /product_groups/1.json
def show @product_group = ProductGroup.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @product_group } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @product_groups = ProductGroup.all\n end", "def index\n @product_product_groups = ProductProductGroup.all\n end", "def index\n render json: ProductAuth.where({group_id: params[:group_id]})\n end", "def index\n @groupsIds = GroupsProssumer.where(prossumer_id: params[:prossumer_id])....
[ "0.7469453", "0.7381799", "0.7266036", "0.7241326", "0.7148794", "0.7009119", "0.7007086", "0.69642437", "0.6889603", "0.6879488", "0.68774074", "0.68574584", "0.6847752", "0.68304884", "0.6828815", "0.6793829", "0.6793829", "0.67805314", "0.6775832", "0.676863", "0.6768066",...
0.7738448
0
GET /product_groups/new GET /product_groups/new.json
def new @product_group = ProductGroup.new respond_to do |format| format.html # new.html.erb format.json { render json: @product_group } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @group = Group.new\n render json: @group\n end", "def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n\n render json: @group\n end", "def new\n @gro...
[ "0.77525693", "0.77437204", "0.77248377", "0.7723919", "0.7723919", "0.7723919", "0.7723919", "0.7723919", "0.7723919", "0.7723919", "0.7723919", "0.7654325", "0.76500785", "0.76500785", "0.7637246", "0.7637246", "0.7630681", "0.76269585", "0.7613564", "0.76000494", "0.755431...
0.8207227
0
POST /product_groups POST /product_groups.json
def create @product_group = ProductGroup.new(params[:product_group]) respond_to do |format| if @product_group.save format.html { redirect_to @product_group, notice: 'Product group was successfully created.' } format.json { render json: @product_group, status: :created, location: @product_group } else format.html { render action: "new" } format.json { render json: @product_group.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @product_group = ProductGroup.new(product_group_params)\n\n respond_to do |format|\n if @product_group.save\n format.html { redirect_to @product_group, notice: \"Product group was successfully created.\" }\n format.json { render :show, status: :created, location: @product_grou...
[ "0.74873894", "0.7404065", "0.7276609", "0.72105795", "0.69572115", "0.6926051", "0.68251", "0.6778822", "0.67742246", "0.6755118", "0.67133766", "0.6642443", "0.6631938", "0.66003615", "0.6566832", "0.6520253", "0.64784855", "0.64757067", "0.64537245", "0.6451597", "0.643942...
0.74643666
1
PUT /product_groups/1 PUT /product_groups/1.json
def update @product_group = ProductGroup.find(params[:id]) respond_to do |format| if @product_group.update_attributes(params[:product_group]) format.html { redirect_to @product_group, notice: 'Product group was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @product_group.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @product_group.update(product_group_params)\n format.html { redirect_to @product_group, notice: \"Product group was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product_group }\n else\n format.html { rende...
[ "0.7319747", "0.717857", "0.7144693", "0.7133317", "0.6942322", "0.69123155", "0.6906836", "0.68793714", "0.67309684", "0.67155915", "0.6634647", "0.66333306", "0.6632108", "0.66289", "0.65920997", "0.6582122", "0.6545448", "0.65433204", "0.65422857", "0.6541781", "0.6521263"...
0.74395096
0
DELETE /product_groups/1 DELETE /product_groups/1.json
def destroy @product_group = ProductGroup.find(params[:id]) @product_group.destroy respond_to do |format| format.html { redirect_to product_groups_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @product_group.destroy\n respond_to do |format|\n format.html { redirect_to product_groups_url, notice: \"Product group was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @product_tree_group = ProductTreeGroup.find(params[:id])\n ...
[ "0.7735333", "0.77158034", "0.7650658", "0.7554933", "0.7516712", "0.73726857", "0.73586386", "0.7358454", "0.7348608", "0.7340374", "0.73220503", "0.731833", "0.7316048", "0.73030275", "0.7301992", "0.7284739", "0.7284739", "0.7282055", "0.7282055", "0.7282055", "0.7282055",...
0.7959752
0
what is the time complexity of this solution? o(n!) what happens if you increase the size of the strings? will be a lot slower p first_anagram?("gizmo", "sally") => false p first_anagram?("elvis", "lives") => true phase 2
def second_anagram?(word1, word2) p "Running second_anagram?..." start = Time.now word2 = word2.split("") #O(n) word1.each_char do |char| #O(n) char_index = word2.index(char) #O(n) if char_index.nil? #O(1) return false #O(1) else word2.delete_at(char_index) #O(1) end end word2.empty? #O(1) p "Took #{Time.now - start} seconds" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_anagram?(string1, string2)\n all_anagrams(string1).include?(string2)\nend", "def first_anagram?(str1, str2)\n all_anagrams(str1).include?(str2)\nend", "def first_anagram?(str1, str2)\n possible = str1.split(\"\").permutation.to_a #O(n!)\n possible.include?(str2.split(\"\")) #n\nend", "def...
[ "0.86453944", "0.85758716", "0.85600007", "0.8552878", "0.8546111", "0.8475641", "0.84730524", "0.8457353", "0.8450251", "0.84415144", "0.83857226", "0.8381222", "0.8343028", "0.83159333", "0.8305027", "0.8271278", "0.82649314", "0.82325995", "0.8222806", "0.8195654", "0.8173...
0.0
-1
p second_anagram?("gizcxzmoasdfg", "sallcasdfgxzy") => false p second_anagram?("eelviscxzasdfg", "elivcxasdfgzes") => true what is the time complexity of this solution? o(n) what happens if you increase the size of the strings? will be a little slower
def third_anagram?(word1, word2) p "Running third_anagram..." start = Time.now var = word1.split("").sort == word2.split("").sort puts "Took #{Time.now - start} seconds - Result: #{var}" # return var end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def second_anagram?(string1, string2) #O(n^2)\n return true if string1.empty?\n string2.length.times do |i|\n if string2[i] == string1[0]\n return second_anagram?(string1[1..-1], string2)\n end\n end\n false\nend", "def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)#O(1)\n beginning_time...
[ "0.8943164", "0.8923429", "0.8905731", "0.888033", "0.88681173", "0.8833851", "0.8813002", "0.88057226", "0.87907225", "0.8753518", "0.87507635", "0.87321794", "0.87303895", "0.87283415", "0.8717794", "0.87177163", "0.8699652", "0.8689417", "0.86874527", "0.86852944", "0.8660...
0.0
-1
=> true p fourth_anagram?("gizcxzmoasdfg", "sallcasdfgxzy") => false WHY DO WE GET VARYING TIMES EVEN WITH SAME WORDS p fourth_anagram?("eelviscxzasdfg", "elivcxasdfgzes") => true
def fifth_anagram?(word1, word2) # O(n) p "Running fifth_anagram..." start = Time.now hash1 = Hash.new(0) # hash2 = Hash.new(0) word1.each_char {|char| hash1[char] += 1} word2.each_char {|char| hash1[char] += 1} hash1.values.all? {|v| v.even?} # puts "Took #{Time.now - start} seconds" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fourth_anagram?(s1, s2)\r\n string_hash(s1) == string_hash(s2)\r\nend", "def third_anagram?(str, word)\n str.chars.sort == word.chars.sort\n end", "def third_anagram?(string, strong)\n string.chars.sort == strong.chars.sort\nend", "def fourth_anagram?(str1, str2)\n helper(str1) == helper(str2)\n...
[ "0.8488202", "0.8478943", "0.8409723", "0.84065604", "0.8361914", "0.83372366", "0.83138555", "0.8305577", "0.82907504", "0.82633984", "0.8261686", "0.8252298", "0.8227482", "0.8222696", "0.8215059", "0.82134044", "0.82103765", "0.8205123", "0.8199502", "0.8199502", "0.819864...
0.0
-1
this endpoint creates a model use that's useful for figuring out flaws in the UI
def create_model_user u = User.find_by(email: 'shahid@eff.org') # setup long fab f = u.fabs.last f.backward[0].update_attributes body: "Duis vitae nisi quis enim viverra consequat at et lorem. Morbi in quam ut tellus fermentum iaculis. Nullam erat libero, suscipit eget nullam." f.backward[1].update_attributes body: "Fusce malesuada odio orci, sit amet malesuada ipsum laoreet in. Aenean id pretium arcu. Integer volutpat gravida ante, quis rutrum est fermentum vel. Sed tempus justo ipsum, ac accumsan quam facilisis eu. Aliquam mollis euismod eros nullam." f.backward[2].update_attributes body: "Quisque quis dignissim dui. Aliquam nec varius neque. Duis vitae lacus amet." f.forward[0].update_attributes body: "Dolor sit amet, consectetur adipiscing elit. Nunc neque elit, lacinia eu neque id, venenatis finibus sem. Nunc vel dui ligula. Nullam vitae enim ut ligula euismod tempus vel eget tortor. Vestibulum quis tristique sapien. Nam cursus ac posuere." f.forward[1].update_attributes body: "Aenean ornare mi in tellus egestas rhoncus. Quisque quam ante, ultricies at pretium dictum, pulvinar convallis dolor volutpat." f.forward[2].update_attributes body: "Dolor sit amet, consectetur adipiscing elit. Nunc neque elit, lacinia eu neque id, venenatis finibus sem. Nunc vel dui ligula. Nullam vitae enim ut ligula euismod tempus vel eget tortor. Vestibulum quis tristique sapien. Nam cursus ac posuere." # setup Gif Tag f.gif_tag open("http://media2.giphy.com/media/9B5EkgWrF4Rri/giphy.gif") f.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_and_model; end", "def model\n end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def set_model\n\n # check credentials and handle Open...
[ "0.6901091", "0.6357704", "0.6298928", "0.6298928", "0.6298928", "0.6298928", "0.6298928", "0.6298928", "0.6298928", "0.6298928", "0.6298928", "0.6298928", "0.6223855", "0.6204241", "0.6204241", "0.6204241", "0.61900246", "0.61843157", "0.61738276", "0.61738276", "0.60918623"...
0.0
-1
pass in a user_id and period in params and it will find the next or previous fab
def cycle_fab_by_period(direction, params) user = User.find(params[:user_id]) current_fab = find_or_create_base_fab(user, params) @fab = (direction == :forward) ? current_fab.exactly_next_fab : current_fab.exactly_previous_fab end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_fab\n fab = self.user.fabs.where('period > ?', self.period).last\n end", "def previous_fab\n self.user.fabs.where('period < ?', self.period).first\n end", "def find_or_create_base_fab(user, params)\n t = DateTime.parse(params[:fab_period])\n user.fabs.where(period: t..(t+7)).limit(1)...
[ "0.75222033", "0.70780116", "0.65194535", "0.6234198", "0.5811905", "0.55975586", "0.55639964", "0.54987097", "0.5474077", "0.5444344", "0.5439489", "0.54295886", "0.5351375", "0.53465503", "0.533704", "0.53105617", "0.52771693", "0.5246108", "0.5236079", "0.52124244", "0.520...
0.71977055
1
Sometimes a fab doesn't exist, so we might have to build one to use as a base to find prev or next
def find_or_create_base_fab(user, params) t = DateTime.parse(params[:fab_period]) user.fabs.where(period: t..(t+7)).limit(1).first or user.fabs.build(period: t) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_fab\n user = User.find(params[:user_id])\n current_fab = Fab.find(params[:fab_id])\n @fab = current_fab.next_fab\n\n render text: \"no such fab\" and return if @fab.nil?\n\n @previous_fab_exists, @next_fab_exists = @fab.which_neighbor_fabs_exist?\n\n render '/tools/ajax_forward_back.html...
[ "0.6754162", "0.6349706", "0.6183872", "0.60250163", "0.5774865", "0.55258304", "0.52473295", "0.5052278", "0.48793095", "0.48759642", "0.48594382", "0.48481086", "0.48429623", "0.48416245", "0.48416245", "0.48228523", "0.48210976", "0.47890007", "0.47687873", "0.47675318", "...
0.53841627
6
Registration params: email, full_name, password, password_confirmation, invite
def create user = User.new params.require(:user).permit(:email, :full_name, :password, :password_confirmation, :invite) user.should_validate_invite! user.should_validate_name! if user.valid? if user.invite.data && user.invite.data[:email] == user.email # Activate and login # user.save! if user.invite.owner.instance_of?(Company) user.invite.update(data: user.invite.data.merge({ user_id: user.id }) ) else user.invite.destroy end warden.set_user(user, scope: :user) respond_to do |format| format.json { render json: { state: :login, previous_path: previous_path }} end else # Create activation token and send email # token = Token.create( name: :activation, data: { full_name: user.full_name, address: user.email, password_digest: user.password_digest, invite_id: user.invite.id } ) ProfileMailer.activation_email(token).deliver SlackWebhooksWorker.perform_async( text: t('user.activities.started_to_sign_up', name: user.full_name, email: user.email) ) if should_perform_sidekiq_worker? respond_to do |format| format.json { render json: { state: :activation }} end end else respond_to do |format| format.json { render json: { errors: user.errors }, status: 403 } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registration_params\n params.require(:registration).permit(:name, :grr, :email, :cpf, :turn)\n end", "def registration_params\n params.require(:registration).permit(:email, :password, :password_confirmation)\n end", "def registration_params\n params.require(:registration).permit(:name,...
[ "0.7402331", "0.7370224", "0.7314875", "0.7313359", "0.7295393", "0.723803", "0.71251875", "0.71043974", "0.7102159", "0.7093123", "0.7057471", "0.7006555", "0.69879895", "0.6956516", "0.6944094", "0.68957096", "0.68836075", "0.68494767", "0.6847324", "0.68035", "0.6801838", ...
0.687102
17
derived from DFS in nested hashes
def dfs(n) case n when Hash n.each do |k,v| @stack.push k dfs(v) @stack.pop end else stripped = Array.new(@stack) stripped.shift #strip off the :development or :production tag if @stack.first == @environment @env_vars[stripped.join('__').upcase] = n end tmp = Array.new(@stack).push "<%= ENV['#{stripped.join('__').upcase}'] %>" @new_config.deep_merge!(tmp.reverse.inject { |mem, var| {var => mem}}) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth_first_search\n visited = {}\n timestamp = {}\n tree_edges = {}\n back_edges = {}\n cross_edges = {}\n forward_edges = {}\n count = 0\n\n # begin workaround removing depencency to order of Hash#each\n if @index.empty? then\n preference_of_nodes = nil\n else\n prefer...
[ "0.6871196", "0.67545426", "0.6714706", "0.6621068", "0.6476852", "0.64155054", "0.6409428", "0.63520736", "0.6309223", "0.62255555", "0.61277616", "0.6091271", "0.60905826", "0.6071523", "0.60594124", "0.60304475", "0.5957895", "0.5951898", "0.59150136", "0.5896607", "0.5894...
0.54265296
90
scores for each letter
def letter_scores { "A"=>1, "B"=>3, "C"=>3, "D"=>2, "E"=>1, "F"=>4, "G"=>2, "H"=>4, "I"=>1, "J"=>8, "K"=>5, "L"=>1, "M"=>3, "N"=>1, "O"=>1, "P"=>3, "Q"=>10, "R"=>1, "S"=>1, "T"=>1, "U"=>1, "V"=>4, "W"=>4, "X"=>8, "Y"=>4, "Z"=>10 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score\n #Here are the letter values. Think about how you might put this data in a usable format for your methods above.\n scores = {a: 1, b: 3, c: 3, d: 2, e: 1,\n f: 4, g: 2, h: 4, i: 1, j: 8,\n k: 5, l: 1, m: 3, n: 1, o: 1,\n p: 3, q: 10, r: 1, s: 1, t: 1,\n u: 1, v: 4, w: 4, x: 8, ...
[ "0.824917", "0.8168501", "0.8113238", "0.80915755", "0.8042495", "0.7853455", "0.78430134", "0.78368604", "0.7829441", "0.7805414", "0.7702877", "0.76888996", "0.7581454", "0.75517035", "0.7524041", "0.75231236", "0.7522714", "0.7490279", "0.7487372", "0.7485952", "0.74232775...
0.8268655
0
Create a new good, and return the ActiveRecord
def import_bien b # Good location good_address = {} loc = BienEmplacement.new loc.pays = "France" loc.code_postal = b['CodePostal'] loc.ville = b['Ville'] # Category & Transaction type cat = BienType.find_or_create b['TypeBien'].up_first transaction_type = BienTransaction.where(:nom => b['TypeTransaction'].up_first).first return if transaction_type.nil? # find if good already exist, unless create it ref = b['Reference'] nb = Bien.where(:reference => ref).select{ |b| b.passerelle.installation == @passerelle.installation }.first nb = Bien.new if nb.nil? nb.is_accueil = false #nb.is_accueil = true if b["TEXTE_MAILING"] && (b["TEXTE_MAILING"].to_s.downcase =~ /.*virtual.*touch.*/) # update attributes nb.passerelle = @passerelle nb.reference = ref nb.bien_type = cat nb.bien_transaction = transaction_type nb.bien_emplacement = loc nb.nb_piece = b['NbPieces'].to_i nb.nb_chambre = b['NbChambres'].to_i nb.surface = b['SurfaceHabitable'].to_i nb.surface_terrain = b['SurfaceTerrain1'].to_i nb.titre = b['Titre'] if(nb.titre.nil? || nb.titre.empty?) nb.titre = b['TypeBien'].up_first end if((transaction_type.nom == "Location") && b['ChargesMensuelles'] && (b['ChargesMensuelles'].to_i > 0)) nb.prix_hors_charges = b['Prix'] nb.prix_charges_comprises = b['Prix'].to_i + b['ChargesMensuelles'].to_i else nb.prix_charges_comprises = b['Prix'] end nb.prix = nb.prix_charges_comprises nb.honoraires_agence = b['Honoraires'] nb.description = b['Texte'] nb.valeur_dpe = b['Dpe_energie'] if(b['Dpe_energie_etiquette'] && !(b['Dpe_energie_etiquette'].empty?)) nb.classe_dpe = b['Dpe_energie_etiquette'] else nb.classe_dpe = nb.classe_energie end nb.valeur_ges = b['Dpe_emission_ges'] if(b['Dpe_emission_ges_etiquette'] && !(b['Dpe_emission_ges_etiquette'].empty?)) nb.class_ges = b['Dpe_emission_ges_etiquette'] else nb.class_ges = nb.classe_ges end nb.statut = 'new' nb.save! # If new images : Drop old images, add current images if b['Photos'] && b['Photos']['Photo'] # un-attach old nb.bien_photos.each{ |photo| photo.bien = nil photo.save! } pl = b['Photos']['Photo'] # When there only exists a single image, +pl+ will directly be the hash pl = [pl] unless pl.kind_of? Array # Map photo-hashes to medias, filter out failures, and add medias to good number = 0 pl.map { |p| import_remote_media(p['UrlOriginal'], p['Position'], nb) } end nb.save! return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object\n class_name.create_from_database(id)\n end", "def construct_new_object(db_object)\n end", "def create(params_or_record)\n object = self.new(params_or_record).save\n return(object)\n end", "def create(params = {})\n model = new(params)\n model.save\n model\n ...
[ "0.6964497", "0.65887064", "0.6538817", "0.64822733", "0.64737386", "0.63603663", "0.6355029", "0.6294834", "0.6272341", "0.6272341", "0.625979", "0.6258831", "0.6258831", "0.62174654", "0.6194798", "0.6132328", "0.6132287", "0.6119409", "0.6116578", "0.61128473", "0.6091623"...
0.0
-1
FIXME: use enumerize for delivery_shift
def set_driver case delivery_shift when 'M', 'E' self.driver = User.drivers.find_by(shift: 1) when 'A' self.driver = User.drivers.find_by(shift: 2) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_transit_days\n \tresult = []\n \tdelivery_duration.times do |num|\n active_day = num_to_day((day_to_num(self.order_day) + num) % 7)\n \t\tresult << active_day if active_day != self.order_day && active_day != self.delivery_day\n \tend\n \tresult\n end", "def delivery_day\n \tnum_to_day((day_to_...
[ "0.62125605", "0.61787987", "0.5518633", "0.5471163", "0.541295", "0.53769916", "0.5300807", "0.5230528", "0.51849806", "0.5166091", "0.5156801", "0.5156801", "0.51422685", "0.51058495", "0.5087933", "0.506233", "0.50599974", "0.50599974", "0.50599974", "0.50506246", "0.50500...
0.0
-1
Create a Scalyr log endpoint Create a Scalyr for a particular service and version.
def create_log_scalyr(opts = {}) data, _status_code, _headers = create_log_scalyr_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.create_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n...
[ "0.6308854", "0.6211946", "0.55152166", "0.5481653", "0.54738533", "0.5452649", "0.5396171", "0.5358046", "0.5355882", "0.5352761", "0.5263379", "0.5165697", "0.5145589", "0.5077512", "0.5063551", "0.50387037", "0.50321275", "0.5025808", "0.49512652", "0.49510434", "0.4946709...
0.5009591
18
Create a Scalyr log endpoint Create a Scalyr for a particular service and version.
def create_log_scalyr_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.create_log_scalyr ...' end # unbox the parameters from the hash service_id = opts[:'service_id'] version_id = opts[:'version_id'] # verify the required parameter 'service_id' is set if @api_client.config.client_side_validation && service_id.nil? fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingScalyrApi.create_log_scalyr" end # verify the required parameter 'version_id' is set if @api_client.config.client_side_validation && version_id.nil? fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingScalyrApi.create_log_scalyr" end allowable_values = ["none", "waf_debug", "null"] if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement']) fail ArgumentError, "invalid value for \"placement\", must be one of #{allowable_values}" end allowable_values = [1, 2] if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version']) fail ArgumentError, "invalid value for \"format_version\", must be one of #{allowable_values}" end allowable_values = ["US", "EU"] if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region']) fail ArgumentError, "invalid value for \"region\", must be one of #{allowable_values}" end # resource path local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['name'] = opts[:'name'] if !opts[:'name'].nil? form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil? form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil? form_params['format'] = opts[:'format'] if !opts[:'format'].nil? form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil? form_params['region'] = opts[:'region'] if !opts[:'region'].nil? form_params['token'] = opts[:'token'] if !opts[:'token'].nil? form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'LoggingScalyrResponse' # auth_names auth_names = opts[:debug_auth_names] || ['token'] new_options = opts.merge( :operation => :"LoggingScalyrApi.create_log_scalyr", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LoggingScalyrApi#create_log_scalyr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.create_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n...
[ "0.63094306", "0.55148655", "0.54828", "0.5475669", "0.5457197", "0.539816", "0.5357744", "0.53551394", "0.5352624", "0.5262666", "0.51651096", "0.5146249", "0.5081378", "0.506789", "0.5038942", "0.5032302", "0.5024885", "0.5010969", "0.4952143", "0.49512643", "0.49470007", ...
0.62122124
1
Delete the Scalyr log endpoint Delete the Scalyr for a particular service and version.
def delete_log_scalyr(opts = {}) data, _status_code, _headers = delete_log_scalyr_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_log_https(opts = {})\n data, _status_code, _headers = delete_log_https_with_http_info(opts)\n data\n end", "def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unle...
[ "0.5703527", "0.5683674", "0.5658819", "0.55562216", "0.5527568", "0.5518708", "0.5513792", "0.5488694", "0.5468409", "0.54336226", "0.54132575", "0.5393415", "0.5388185", "0.53835225", "0.5351621", "0.53490615", "0.5311904", "0.5309752", "0.53036875", "0.52970815", "0.528873...
0.5467106
9
Delete the Scalyr log endpoint Delete the Scalyr for a particular service and version.
def delete_log_scalyr_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.delete_log_scalyr ...' end # unbox the parameters from the hash service_id = opts[:'service_id'] version_id = opts[:'version_id'] logging_scalyr_name = opts[:'logging_scalyr_name'] # verify the required parameter 'service_id' is set if @api_client.config.client_side_validation && service_id.nil? fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingScalyrApi.delete_log_scalyr" end # verify the required parameter 'version_id' is set if @api_client.config.client_side_validation && version_id.nil? fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingScalyrApi.delete_log_scalyr" end # verify the required parameter 'logging_scalyr_name' is set if @api_client.config.client_side_validation && logging_scalyr_name.nil? fail ArgumentError, "Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.delete_log_scalyr" end # resource path local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'InlineResponse200' # auth_names auth_names = opts[:debug_auth_names] || ['token'] new_options = opts.merge( :operation => :"LoggingScalyrApi.delete_log_scalyr", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LoggingScalyrApi#delete_log_scalyr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_log_https(opts = {})\n data, _status_code, _headers = delete_log_https_with_http_info(opts)\n data\n end", "def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unle...
[ "0.5703527", "0.5683674", "0.5658819", "0.55562216", "0.5527568", "0.5518708", "0.5513792", "0.5468409", "0.5467106", "0.54336226", "0.54132575", "0.5393415", "0.5388185", "0.53835225", "0.5351621", "0.53490615", "0.5311904", "0.5309752", "0.53036875", "0.52970815", "0.528873...
0.5488694
7
Get a Scalyr log endpoint Get the Scalyr for a particular service and version.
def get_log_scalyr(opts = {}) data, _status_code, _headers = get_log_scalyr_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.get_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n ...
[ "0.55771446", "0.5432487", "0.53849286", "0.5372218", "0.5253202", "0.5244251", "0.5240086", "0.50535065", "0.5050574", "0.50390047", "0.5026841", "0.5006919", "0.49907407", "0.49870592", "0.49691752", "0.49521002", "0.49236965", "0.49083978", "0.49076948", "0.4865271", "0.48...
0.4873481
19
Get a Scalyr log endpoint Get the Scalyr for a particular service and version.
def get_log_scalyr_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.get_log_scalyr ...' end # unbox the parameters from the hash service_id = opts[:'service_id'] version_id = opts[:'version_id'] logging_scalyr_name = opts[:'logging_scalyr_name'] # verify the required parameter 'service_id' is set if @api_client.config.client_side_validation && service_id.nil? fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingScalyrApi.get_log_scalyr" end # verify the required parameter 'version_id' is set if @api_client.config.client_side_validation && version_id.nil? fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingScalyrApi.get_log_scalyr" end # verify the required parameter 'logging_scalyr_name' is set if @api_client.config.client_side_validation && logging_scalyr_name.nil? fail ArgumentError, "Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.get_log_scalyr" end # resource path local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'LoggingScalyrResponse' # auth_names auth_names = opts[:debug_auth_names] || ['token'] new_options = opts.merge( :operation => :"LoggingScalyrApi.get_log_scalyr", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LoggingScalyrApi#get_log_scalyr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.get_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n ...
[ "0.5576281", "0.5435715", "0.5384254", "0.53750974", "0.52446705", "0.52416587", "0.50547034", "0.5053162", "0.50430775", "0.502756", "0.5007228", "0.4989312", "0.49864239", "0.49718893", "0.49535483", "0.49224108", "0.49073228", "0.4905907", "0.48698628", "0.48670986", "0.48...
0.5251684
4
List Scalyr log endpoints List all of the Scalyrs for a particular service and version.
def list_log_scalyr(opts = {}) data, _status_code, _headers = list_log_scalyr_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endpoints_list\n get \"endpoints\"\n end", "def index\n endpoint(get(services_url).body)\n end", "def list_log_https(opts = {})\n data, _status_code, _headers = list_log_https_with_http_info(opts)\n data\n end", "def list_log_https_with_http_info(opts = {})\n if @api_cli...
[ "0.65161127", "0.59915936", "0.5950381", "0.58432287", "0.5680225", "0.5652868", "0.5615075", "0.5574693", "0.54408336", "0.54379296", "0.54240924", "0.54033995", "0.5344667", "0.53297365", "0.53180766", "0.5310362", "0.5276899", "0.5261508", "0.52352315", "0.5195188", "0.518...
0.5057228
25
List Scalyr log endpoints List all of the Scalyrs for a particular service and version.
def list_log_scalyr_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.list_log_scalyr ...' end # unbox the parameters from the hash service_id = opts[:'service_id'] version_id = opts[:'version_id'] # verify the required parameter 'service_id' is set if @api_client.config.client_side_validation && service_id.nil? fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingScalyrApi.list_log_scalyr" end # verify the required parameter 'version_id' is set if @api_client.config.client_side_validation && version_id.nil? fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingScalyrApi.list_log_scalyr" end # resource path local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array<LoggingScalyrResponse>' # auth_names auth_names = opts[:debug_auth_names] || ['token'] new_options = opts.merge( :operation => :"LoggingScalyrApi.list_log_scalyr", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LoggingScalyrApi#list_log_scalyr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endpoints_list\n get \"endpoints\"\n end", "def index\n endpoint(get(services_url).body)\n end", "def list_log_https(opts = {})\n data, _status_code, _headers = list_log_https_with_http_info(opts)\n data\n end", "def list_log_https_with_http_info(opts = {})\n if @api_cli...
[ "0.65161127", "0.59915936", "0.5950381", "0.58432287", "0.5680225", "0.5652868", "0.5615075", "0.5574693", "0.54408336", "0.54379296", "0.54240924", "0.54033995", "0.5344667", "0.53297365", "0.53180766", "0.5310362", "0.5261508", "0.52352315", "0.5195188", "0.5186559", "0.517...
0.5276899
16
Update the Scalyr log endpoint Update the Scalyr for a particular service and version.
def update_log_scalyr(opts = {}) data, _status_code, _headers = update_log_scalyr_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.update_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id'...
[ "0.62463784", "0.5989424", "0.5796027", "0.56155396", "0.5508138", "0.55066663", "0.5350583", "0.53137094", "0.53058976", "0.53037494", "0.5298519", "0.5298519", "0.5298519", "0.52912253", "0.52901274", "0.52901274", "0.52901274", "0.52901274", "0.52901274", "0.52901274", "0....
0.6037402
1
Update the Scalyr log endpoint Update the Scalyr for a particular service and version.
def update_log_scalyr_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.update_log_scalyr ...' end # unbox the parameters from the hash service_id = opts[:'service_id'] version_id = opts[:'version_id'] logging_scalyr_name = opts[:'logging_scalyr_name'] # verify the required parameter 'service_id' is set if @api_client.config.client_side_validation && service_id.nil? fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingScalyrApi.update_log_scalyr" end # verify the required parameter 'version_id' is set if @api_client.config.client_side_validation && version_id.nil? fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingScalyrApi.update_log_scalyr" end # verify the required parameter 'logging_scalyr_name' is set if @api_client.config.client_side_validation && logging_scalyr_name.nil? fail ArgumentError, "Missing the required parameter 'logging_scalyr_name' when calling LoggingScalyrApi.update_log_scalyr" end allowable_values = ["none", "waf_debug", "null"] if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement']) fail ArgumentError, "invalid value for \"placement\", must be one of #{allowable_values}" end allowable_values = [1, 2] if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version']) fail ArgumentError, "invalid value for \"format_version\", must be one of #{allowable_values}" end allowable_values = ["US", "EU"] if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region']) fail ArgumentError, "invalid value for \"region\", must be one of #{allowable_values}" end # resource path local_var_path = '/service/{service_id}/version/{version_id}/logging/scalyr/{logging_scalyr_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_scalyr_name' + '}', CGI.escape(logging_scalyr_name.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['name'] = opts[:'name'] if !opts[:'name'].nil? form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil? form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil? form_params['format'] = opts[:'format'] if !opts[:'format'].nil? form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil? form_params['region'] = opts[:'region'] if !opts[:'region'].nil? form_params['token'] = opts[:'token'] if !opts[:'token'].nil? form_params['project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'LoggingScalyrResponse' # auth_names auth_names = opts[:debug_auth_names] || ['token'] new_options = opts.merge( :operation => :"LoggingScalyrApi.update_log_scalyr", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LoggingScalyrApi#update_log_scalyr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_log_scalyr(opts = {})\n data, _status_code, _headers = update_log_scalyr_with_http_info(opts)\n data\n end", "def update_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.update_log_https ...'\...
[ "0.60364985", "0.5988784", "0.57954115", "0.56161684", "0.550915", "0.55066377", "0.53505254", "0.5313251", "0.53059125", "0.5304225", "0.52992487", "0.52992487", "0.52992487", "0.5291028", "0.5289934", "0.5289934", "0.5289934", "0.5289934", "0.5289934", "0.5289934", "0.52899...
0.6245973
0
virtual field item_name (setter method)
def item_name=(name) self.item_id = Item.find_by(name: name).id if name.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name # AK as mentioned in `item.rb`, getters and setters are generated by `attr_accessor`. Kind of like in C# with properties.\r\n \"#{self.name}\"\r\n end", "def name\n \tself.item.name\n end", "def change_item_name(new_name:, **)\n self.name = new_name # This will generate the event!...
[ "0.780851", "0.7795141", "0.7459489", "0.7081856", "0.70643127", "0.70643127", "0.70234007", "0.67129064", "0.6704625", "0.6614914", "0.65696025", "0.6476148", "0.63948894", "0.6305682", "0.629535", "0.6270202", "0.62671095", "0.6245056", "0.6240958", "0.6233211", "0.6233211"...
0.74443793
3
Checks if the given key is a box (geofences) or not. A box is composed of four numbers (positive or negative, decimal or not) separed by commas.
def process(key, options = {}) before_all(key, options) match?(key, /^(?:[+-]?\d{1,3}(?:\.\d{1,7})?,?){4}$/) ? store(key, nil, options) : raise_type_error(key, "Box") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_box?(box_key, num)\n @boxes[box_key].each {|square| return true if square.number == num}\n false\n\n end", "def parse_box(key, box)\n if box.kind_of?(String)\n begin\n raw_box = box.split(\",\").map(&:to_f)\n box = [[raw_box[0], raw_box[1]], [raw_box[2], raw_bo...
[ "0.65874696", "0.6503024", "0.5919946", "0.5908663", "0.5664747", "0.56501156", "0.55428696", "0.5420609", "0.5377301", "0.5297279", "0.5212655", "0.52116174", "0.50986236", "0.5096228", "0.5089915", "0.5082816", "0.49951968", "0.49728826", "0.49382535", "0.49322402", "0.4909...
0.5080894
16
Tries to store the associated key in the filtered key, transforming it with the given process.
def store(key, process, options) if(options.has_key?(:at_least)) box_contains?(key, validator.datas[key], options[:at_least]) end if(options.has_key?(:at_most)) box_contains?(key, options[:at_most], validator.datas[key]) end super(key, ->(item){parse_box(key, validator.datas[key])}, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store(key, process, options = {})\n unless (options.has_key?(:extract) and options[:extract] == false)\n if datas.has_key?(key)\n value = ((options.has_key?(:cast) and options[:cast] == false) ? datas[key] : process.call(datas[key]))\n if(options.has_key?(:in))\n in_arr...
[ "0.724382", "0.63120264", "0.60612667", "0.59091693", "0.56819457", "0.54308206", "0.5292139", "0.5234593", "0.52061737", "0.5183842", "0.51351756", "0.5082784", "0.5082784", "0.5024683", "0.50178486", "0.50082994", "0.5007856", "0.49984244", "0.49705675", "0.49603388", "0.49...
0.45004344
62
Verify if a box contains another box.
def box_contains?(key, container, contained) container = parse_box(key, container) contained = parse_box(key, contained) result = ((container[0][0] <= contained[0][0]) and (container[0][1] <= container[0][1]) and (container[1][0] >= container[1][0]) and (container[1][1] >= container[1][1])) raise_error(type: "box.containment", contained: contained, container: container, key: key) unless result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collision_detected?\n ($boxes - Array(self)).any? do |other_box|\n # .include method with other_square\n other_box.include?(@square)\n end\nend", "def notify_collision(another_box)\n @box.overlaps_with?(another_box)\n end", "def in_box?(box_key, num)\n @boxes[box_key].each {|squa...
[ "0.7028195", "0.6791319", "0.66296095", "0.64564013", "0.64564013", "0.64564013", "0.6310608", "0.6092203", "0.60843647", "0.60819274", "0.60197717", "0.59853286", "0.59601456", "0.5803587", "0.5788798", "0.57866496", "0.5732989", "0.57077026", "0.5701991", "0.5701991", "0.57...
0.65630674
3
Parses a box given as a string of four numbers separated by commas.
def parse_box(key, box) if box.kind_of?(String) begin raw_box = box.split(",").map(&:to_f) box = [[raw_box[0], raw_box[1]], [raw_box[2], raw_box[3]]] rescue raise_error(type: "box.format", key: "key", value: box) end end return box end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def separate_comma(number)\n a = number.to_s.split('')\n b = a.size/3.0\n if a.size < 4\n p number.to_s\n elsif a.size%3 == 0\n n = -4\n (b.to_i-1).times do |i|\n a.insert(n, ',')\n n -= 4\n end\n p a.join(\"\")\n else\n n = -4\n b.to_i.times do |i|\n a.insert(n, ',')\n ...
[ "0.5725185", "0.56800514", "0.5598327", "0.5561332", "0.55471665", "0.55361533", "0.5437865", "0.5434925", "0.54308045", "0.5426325", "0.54177195", "0.5394734", "0.5390538", "0.5384195", "0.53711957", "0.5371127", "0.53222734", "0.52947557", "0.52777505", "0.52601725", "0.523...
0.6891576
0
Create a new API object. This is useful to create multiple APIs and use them with the `uses_api` method. If your application uses only one API, you should use Her::API.setup to configure the default API
def initialize(*args, &blk) setup(*args, &blk) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_object\n unless $api\n $api = FyberAPI.new(\n 'b07a12df7d52e6c118e5d47d3f9e60135b109a1f',\n {\n appid: 157,\n format: 'json',\n device_id: '2b6f0cc904d137be2e1730235f5664094b83',\n locale: 'de',\n ip: '109.235.143.11...
[ "0.7162728", "0.69256765", "0.68460214", "0.6824223", "0.6786411", "0.67235625", "0.67153436", "0.66804457", "0.663272", "0.66325116", "0.66214204", "0.66214204", "0.6605221", "0.6590835", "0.6527874", "0.65183944", "0.6503497", "0.64959615", "0.6447837", "0.64315754", "0.643...
0.0
-1
Define a custom parsing procedure. The procedure is passed the response object and is expected to return a hash with three keys: a main data Hash, an errors Hash and a metadata Hash.
def request(opts = {}) method = opts.delete(:_method) path = opts.delete(:_path) headers = opts.delete(:_headers) options = opts.delete(:_options) || {} opts.delete_if { |key, _| key.to_s =~ /^_/ } # Remove all internal parameters if method == :options # Faraday doesn't support the OPTIONS verb because of a name collision with an internal options method # so we need to call run_request directly. request.headers.merge!(headers) if headers response = @connection.run_request method, path, opts, headers else response = @connection.send method do |request| request.headers.merge!(headers) if headers timeout = options.delete(:timeout) raise "options not implemented: #{options.keys.join(', ')}" unless options.empty? request.options[:timeout] = timeout if timeout if method == :get # For GET requests, treat additional parameters as querystring data request.url path, opts else # For POST, PUT and DELETE requests, treat additional parameters as request body request.url path request.body = opts end end end { :parsed_data => response.env[:body], :response => response } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(response)\n\nend", "def parse_response!; end", "def response_parser; end", "def parse_response\n parse_address()\n parse_expires()\n parse_token_type()\n parse_token()\n end", "def parse_response(response)\n raise NotImplementedError, '.parse_response should be imple...
[ "0.66142166", "0.64953107", "0.6379111", "0.6361654", "0.6241713", "0.6183187", "0.60923916", "0.6056907", "0.6025048", "0.594682", "0.5932052", "0.59165937", "0.5916343", "0.5891151", "0.5869819", "0.58680457", "0.58312273", "0.58312273", "0.58312273", "0.5820034", "0.580842...
0.0
-1
TODO: What does this do? This should be moved to the RoutesController anyway
def surrounding_journeys @route = Route.find(params[:route_id]) @previous_journeys = @route.journeys.where('start_time < ?', params[:datetime]).order('start_time DESC').limit(2) @next_journeys = @route.journeys.where('start_time > ?', params[:datetime]).order('start_time ASC').limit(2) render layout: false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def route_index; end", "def anchored_routes; end", "def ro...
[ "0.750399", "0.7349786", "0.7349786", "0.7349786", "0.7349786", "0.7349786", "0.7349786", "0.7349786", "0.7349786", "0.7349786", "0.7349786", "0.7349786", "0.7163136", "0.71519077", "0.70389384", "0.6942796", "0.6928146", "0.69260496", "0.69260496", "0.6831481", "0.6814708", ...
0.0
-1
TODO: Add more tests later (need nc_inq) Datasetdefine_mode
def test_redef_closed nc = Dataset.new('test/data/simple.nc') nc.close() assert_raise NetCDFError do nc.define_mode() end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ndata; end", "def test_on_open\n nc = Dataset.new('test/data/simple.nc')\n assert_equal(false, nc.define_mode?)\n nc.close()\n end", "def dataset?\n true\n end", "def type\n 'dataset'\n end", "def data_complextest(db); end", "def _dataset_method\n :\"_#{self[:name]}_dataset...
[ "0.5804363", "0.56015635", "0.5573443", "0.55125856", "0.5413015", "0.5396254", "0.5368623", "0.52762866", "0.52413285", "0.52280605", "0.5182511", "0.51585704", "0.51541036", "0.51330984", "0.5105037", "0.51018524", "0.5090016", "0.5090016", "0.50616026", "0.5038587", "0.503...
0.49082994
37
TODO: Add more tests later (need functions to add dim & var) Datasetdata_mode
def test_enddef_closed nc = Dataset.new('test/data/simple.nc') nc.close() assert_raise NetCDFError do nc.data_mode() end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type\n 'dataset'\n end", "def dataset?\n true\n end", "def dataset\n @dataset ||= data_maker.dataset\n end", "def set_data_mode(data)\n puts \"Setting Data Mode to #{data}\" if $verbose\n d='DT'+(('000'+data.to_s)[-3..-1])+';'\n puts d if $verbose\n ret=send_cmd(d,'DT;',d,0.25,1.0,3)\...
[ "0.65119725", "0.6405592", "0.61668164", "0.60886604", "0.60258186", "0.6011424", "0.6011424", "0.5997819", "0.5964836", "0.5941636", "0.5868466", "0.5861052", "0.5764775", "0.5764775", "0.5764775", "0.57502174", "0.5717676", "0.55442756", "0.55337465", "0.55337465", "0.55337...
0.5294939
41
TODO: Add more tests later (need functions to add dim & var) Datasetclose
def test_close_twice nc = Dataset.new('test/data/simple.nc') nc.close() assert_raise NetCDFError do nc.close() end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_enddef_closed\n nc = Dataset.new('test/data/simple.nc')\n nc.close()\n assert_raise NetCDFError do\n nc.data_mode()\n end\n end", "def dataset\n @dataset ||= data_maker.dataset\n end", "def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end", "def test_r...
[ "0.64910495", "0.6181731", "0.61679673", "0.59678406", "0.59112984", "0.58940333", "0.58856744", "0.58856744", "0.58386785", "0.58217895", "0.5771086", "0.5771086", "0.5771086", "0.5771086", "0.5763396", "0.5763396", "0.57238877", "0.57230777", "0.56829464", "0.5674945", "0.5...
0.6141955
3
TODO: Add more tests later (need functions to add dim & var) Datasetdefine_mode?
def test_on_open nc = Dataset.new('test/data/simple.nc') assert_equal(false, nc.define_mode?) nc.close() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type\n 'dataset'\n end", "def dataset?\n true\n end", "def dim; 1; end", "def dataset\n @dataset ||= data_maker.dataset\n end", "def _dataset_method\n :\"_#{self[:name]}_dataset\"\n end", "def dataset?(name)\n datasets.key?(name)\n end", "def dataset?(name)\n ...
[ "0.6245153", "0.5984558", "0.5787449", "0.5780542", "0.56572837", "0.56534874", "0.56534874", "0.5643628", "0.5568998", "0.55264807", "0.5388349", "0.5388349", "0.5388349", "0.5386754", "0.53662676", "0.53662676", "0.53662676", "0.53662676", "0.5358804", "0.5274702", "0.52327...
0.57034177
4
GET /tweets GET /tweets.json
def userfilter @tweets = Tweet.where("user_vote < 0 or user_vote > 0").includes(:company).page params[:page] @count = Tweet.where("user_vote < 0 or user_vote > 0").count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end", "def index\n @tweets = @user.tweets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end", "def show_user_tweets\n @user_twee...
[ "0.8115453", "0.7980129", "0.786006", "0.77100396", "0.76598233", "0.75170803", "0.74347824", "0.74107563", "0.7409217", "0.73619074", "0.73584616", "0.7300687", "0.7241951", "0.7181157", "0.7123983", "0.7104852", "0.7096105", "0.70944136", "0.70827305", "0.70827305", "0.7082...
0.0
-1
GET /tweets/1 GET /tweets/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end", "def index\n @tweets = @user.tweets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end", "def show_user_tweets\n @user_twee...
[ "0.7778256", "0.773942", "0.7596882", "0.7484137", "0.7464283", "0.7458894", "0.74329543", "0.7223404", "0.712232", "0.7078807", "0.70529026", "0.70419616", "0.70405924", "0.703979", "0.70386153", "0.6974553", "0.6974553", "0.6966099", "0.6952536", "0.6951105", "0.6950016", ...
0.0
-1