query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /current_sessions/1 GET /current_sessions/1.json
def show @current_session = CurrentSession.find(params[:id]) render json: @current_session end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_sessions\n render json: Session.where(\"active = ?\", true)\n end", "def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end", "def session_get\n nessus_rest_get(\"session\")\n end", "def sh...
[ "0.71596986", "0.7003878", "0.6940284", "0.67701787", "0.66829914", "0.66670275", "0.66628975", "0.66339076", "0.6611235", "0.6605251", "0.65850353", "0.65761393", "0.65448236", "0.65324587", "0.65189487", "0.65189487", "0.65189487", "0.65189487", "0.64848053", "0.64633274", ...
0.75761646
0
POST /current_sessions POST /current_sessions.json
def create @current_session = CurrentSession.new(params[:current_session]) if @current_session.save render json: @current_session, status: :created, location: @current_session else render json: @current_session.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @session = SessionService.new(current_user).create_from_web! session_params\n\n respond_to do |format|\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render json: @session, status: :created }\n end\n end", "def start_sessio...
[ "0.62603176", "0.6230183", "0.6180256", "0.6149209", "0.61460674", "0.61383927", "0.6127799", "0.6124924", "0.6105057", "0.60965884", "0.5979226", "0.5959011", "0.5946521", "0.5939322", "0.5934287", "0.5908267", "0.5896295", "0.5876511", "0.5853818", "0.5848023", "0.5841254",...
0.748424
0
PATCH/PUT /current_sessions/1 PATCH/PUT /current_sessions/1.json
def update @current_session = CurrentSession.find(params[:id]) if @current_session.update(params[:current_session]) head :no_content else render json: @current_session.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update\n @session_resource = SessionResource.find(params[:id])\n\n if @session_resource.update(session_resource_params)\n head :no_content\n else\n render json: @session_resource.errors, status: :unp...
[ "0.6773565", "0.66347265", "0.6614955", "0.6555495", "0.6543775", "0.6543775", "0.6542582", "0.6464822", "0.6443306", "0.63708633", "0.6321665", "0.63013595", "0.629584", "0.628795", "0.6265235", "0.62536585", "0.62536585", "0.62536585", "0.62536585", "0.62098366", "0.6202420...
0.7385423
0
DELETE /current_sessions/1 DELETE /current_sessions/1.json
def destroy @current_session = CurrentSession.find(params[:id]) @current_session.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end", "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok ...
[ "0.7546458", "0.7240697", "0.722711", "0.720965", "0.7125998", "0.70720625", "0.7063802", "0.70515925", "0.7045978", "0.7045341", "0.70375925", "0.6954826", "0.69311565", "0.69306254", "0.6923306", "0.6908489", "0.68709755", "0.68671006", "0.68425214", "0.6836479", "0.6809975...
0.72297907
2
returns ARRAY of direction_deltas based on whether the piece is a king or soldier.
def set_direction_deltas_based_on_king_status_and_color if kinged direction_deltas = KING_DIRECTION_DELTAS else direction_deltas = SOLDIER_DIRECTION_DELTAS end # flip the deltas depeneding on which where the pieces are facing. self.color == :black ? facing_multiplier = 1 : facing_multiplier = -1 direction_deltas.each do |delta| delta.map! do |index| index * facing_multiplier end end direction_deltas end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directions\n return UP_DIRS + DOWN_DIRS if king\n color == :white ? UP_DIRS : DOWN_DIRS\n end", "def possibleMovements\n deltas = []\n DIRECTIONS.each do |delta|\n deltas.push(delta) if canMoveBy? delta\n end\n deltas\n end", "def directions\n DIRECTIONS\n end", "def enemy_di...
[ "0.62428254", "0.6149118", "0.59590465", "0.5847815", "0.5843281", "0.5813812", "0.57934564", "0.5773558", "0.5732841", "0.57278794", "0.57106537", "0.5710548", "0.5645648", "0.5553922", "0.55151993", "0.54956174", "0.5441648", "0.5393219", "0.5391681", "0.53884345", "0.53870...
0.6097453
2
Returns definition string for this class's constructor
def get_definition(cls, bld, fun) bld.add("/// <summary>") bld.add("/// Reads one result using the specified filter parameters") bld.add("/// </summary>") bld.startFunction("public " + get_function_signature(cls, bld, fun)) get_body(cls, bld, fun) bld.endFunction end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_definition(codeClass, cfg)\n conDef = String.new\n indent = \" \"\n\n conDef << indent << \"# Constructor\\n\"\n\n conDef << indent << \"def initialize()\\n\"\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n for var in varArray\n if var.elementId == CodeElem::E...
[ "0.7193215", "0.7015597", "0.68123895", "0.6808615", "0.6745797", "0.6610482", "0.6578627", "0.63820237", "0.630252", "0.62772644", "0.62686354", "0.6244232", "0.6216291", "0.61941147", "0.6112199", "0.6097629", "0.6087779", "0.60620534", "0.60224324", "0.6001831", "0.5992851...
0.0
-1
the mutation method _obj is parent object, which in this case is nil args are the arguments passed _ctx is the GraphQL context (which would be discussed later)
def call(_obj, args, ctx) if ctx[:current_user].blank? raise GraphQL::ExecutionError.new("Authentication required.") else user = User.find_by(id: ctx[:current_user][:id]) end if args[:name].blank? error = GraphQL::ExecutionError.new("This field is required.", options: { field: "name_field" } ) ctx.add_error(error) end if args[:email].blank? error = GraphQL::ExecutionError.new("This field is required.", options: { field: "email_field" } ) ctx.add_error(error) end if args[:message].blank? error = GraphQL::ExecutionError.new("This field is required.", options: { field: "message_field" } ) ctx.add_error(error) end if args[:category].blank? error = GraphQL::ExecutionError.new("This field is required.", options: { field: "category_field" } ) ctx.add_error(error) end accepted_categories = ['Employment Opportunities', 'General Questions', 'Suggestion', 'Something Else'] if error.present? raise GraphQL::ExecutionError.new(ctx.errors) end mail = Mail.new mail.from = Email.new(email: 'support@jamesgallagher.co') mail.subject = 'Inquiry - James Gallagher' personalization = Personalization.new personalization.add_to(Email.new(email: args[:email])) personalization.add_substitution(Substitution.new(key: '-name-', value: args[:name])) mail.add_personalization(personalization) mail.template_id = '13b8f94f-bcae-4ec6-b752-70d6cb59f932' sg = SendGrid::API.new(api_key: "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") begin response = sg.client.mail._("send").post(request_body: mail.to_json) rescue Exception => e puts e.message end Inquiry.create!( name: args[:name], email: args[:email], message: args[:message], category: args[:category] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end", "def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end", "def update!(**args)\n @mutation_context = args[:mutation...
[ "0.65596694", "0.65596694", "0.65596694", "0.5902132", "0.5861612", "0.580183", "0.5696194", "0.56958014", "0.5448331", "0.5357971", "0.5352801", "0.5303301", "0.52614623", "0.5225044", "0.5191746", "0.5154176", "0.5154176", "0.5144797", "0.51191396", "0.5087069", "0.50791335...
0.0
-1
Adds a remember token in digest form to the database and creates two cookies for the user that logs in.
def remember(user) user.remember cookies.permanent.signed[:user_id] = user.id cookies.permanent[:remember_token] = user.remember_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remember!(cookies)\n cookie_expiration = 10.years.from_now\n cookies[:remember_me] = { :value => \"1\",\n :expires => cookie_expiration }\n self.authorization_token = unique_identifier\n save!\n cookies[:authorization_token] = { :value => authorization_token,\n :expires => cookie_e...
[ "0.77533257", "0.77488613", "0.773324", "0.7685765", "0.7661955", "0.76143205", "0.760548", "0.7587984", "0.75822616", "0.7577065", "0.7541134", "0.75278544", "0.75133455", "0.74843866", "0.74745387", "0.7467267", "0.74627763", "0.7444205", "0.74207646", "0.73831546", "0.7380...
0.0
-1
Returns the current logged in user.
def current_user if (user_id = session[:user_id]) @current_user ||= User.find_by(id: user_id) elsif (user_id = cookies.signed[:user_id]) user = User.find_by(id: user_id) if user && user.authenticated(cookies[:remember_token]) log_in user @current_user = user end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end", "def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end", "def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n ...
[ "0.84699243", "0.84194994", "0.8411229", "0.8362353", "0.83438027", "0.8321469", "0.83055735", "0.8301718", "0.8301718", "0.8286003", "0.82849735", "0.8275174", "0.82517356", "0.825006", "0.8203894", "0.81748176", "0.81680363", "0.816268", "0.81472313", "0.8137677", "0.813648...
0.0
-1
Calls the current_user method above to check for a logged in user.
def logged_in? !current_user.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_and_set_current_user_if_logged_in\n\n if x = Services::PropsFromServer.props[:current_user]\n\n user = User.parse(x)\n\n CurrentUser.set_user_and_login_status(user, true)\n\n end\n\n end", "def check_current_user\n if !current_user.nil?\n Thread.current[:use...
[ "0.7641624", "0.75562036", "0.7522021", "0.7450313", "0.7401374", "0.7387889", "0.7384047", "0.7384047", "0.7344179", "0.7319652", "0.72893524", "0.72702", "0.7268101", "0.72503144", "0.72426987", "0.7234913", "0.7192522", "0.716954", "0.7169324", "0.7169324", "0.7169324", ...
0.0
-1
Deletes the rember token digest from the database and both cookies.
def forget(user) user.forget cookies.delete(:user_id) cookies.delete(:remember_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_cookie(cookies)\n cookies.delete('token')\n @user.update(token: '')\n end", "def destroy\n\t\tcookies.delete(:auth_token)\n\t\tredirect_to root_url\n\tend", "def delete_cookie\n cookies.delete :auth_token\n end", "def destroy\n @token.destroy\n\n...
[ "0.6797032", "0.65304476", "0.6466311", "0.6444831", "0.6335044", "0.6201575", "0.61564255", "0.6135223", "0.60680383", "0.6034675", "0.602228", "0.60193723", "0.6016331", "0.6014343", "0.6001633", "0.5973922", "0.59739083", "0.59739083", "0.596917", "0.59651345", "0.59497726...
0.0
-1
Calls the forget method above, deletes the session cookie and sets the current user instance variable to nil.
def log_out forget(current_user) session.delete(:user_id) @current_user = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout\n forget_user_from_cookie(current_user)\n session.clear\n @current_user = nil\n end", "def log_out\n forget(current_user) #called from user.rb. it sets remember_token attribute to nil.\n session.delete(:user_id) #deletes session.\n @current_user = nil # new value of this instance va...
[ "0.83014494", "0.8291249", "0.8194289", "0.8160981", "0.8135859", "0.8128195", "0.81079453", "0.8101312", "0.8101312", "0.80956066", "0.8093549", "0.809146", "0.80810225", "0.80788547", "0.8076023", "0.8073099", "0.8065215", "0.80618143", "0.80574983", "0.8053794", "0.8045801...
0.0
-1
:responseMessage, :amountReceived, :cardNumberMask, :cardType, :cardTypeCode, :responseCode, :transactionID, :xref Checks for attributes
def ifFlex if method == "flex" if card_number.length != 7 errors.add(:cardNumber, 'unique ID must be 7 digits') end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_response(response)\r\n\r\n#\r\n#\tSetup default response values.\r\n#\r\n message = nil\r\n authorization = nil\r\n success = false\r\n exception = nil\r\n#\r\n#\tExtract key elements from the response.\r\n#\r\n reasonCode = response.Get(RocketGate::GatewayResponse::RE...
[ "0.61268073", "0.60191095", "0.5977031", "0.5905689", "0.5897183", "0.58259875", "0.58104795", "0.57855916", "0.56892395", "0.5680177", "0.561494", "0.5587721", "0.5579416", "0.5546234", "0.55269426", "0.5503862", "0.54973763", "0.5494215", "0.54765517", "0.5470537", "0.54669...
0.0
-1
GET /users GET /users.json
def index @users = User.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n para...
[ "0.82109934", "0.7873764", "0.7860689", "0.78108346", "0.78067017", "0.7678852", "0.76586664", "0.76318866", "0.7582366", "0.75291824", "0.7487637", "0.74485743", "0.7439024", "0.7437192", "0.7427442", "0.73978853", "0.73978853", "0.73978853", "0.73978853", "0.7377353", "0.73...
0.0
-1
GET /users/1 GET /users/1.json
def show @user = User.find_by(params[:id]) @weather = OpenWeatherApi.new("dae8d10e4ffe898434f2932fc31d48d2").get_weather(current_user.checklists.last.destination) @description = @weather['weather'][0]['description'] @icon = @weather['weather'][0]['icon'] @temp = @weather['main']['temp'] @humidity = @weather['main']['humidity'] wind = @weather['wind']['speed'] @wind = wind.round # @temp = @weather.get_weather('miami')['weather'][0]['description'] @date = @user.checklists.last.date # @weather = OpenWeatherApi.new('dae8d10e4ffe898434f2932fc31d48d2').get_weather(@user.checklists.last.destination)['main'] # Start of destination scrape destUrl = "http://www.10best.com/destinations/all/" destResponse = HTTParty.get(destUrl) # p response.headers['Content-Type'] #String => Nokgiri::HTML => DocumentObjectModel (DOM) destDom = Nokogiri::HTML(destResponse.body) # p dom.css('html') #gives everything wthin the html tag destinations = destDom.css('a.rss') @cities = [] destinations.each do |city| @cities << city.text end @links = [] destinations.each do |link| @links << 'http://www.10best.com' + link['href'] end # End of destination scrape @cityQuery = @cities.sample cat = "Miami" if @cities.include? @@citySearch @cityQuery = @@citySearch cat = @@cityCat @tryit = @@cityCat else @tryit = "NOpe!" end @citySelect = @cityQuery.split(",")[0] @cityIndex = @cities.index(@cityQuery) # Start of attractions scrape @attrUrl = @links[@cityIndex] + "attractions/best-attractions-activities/" attrResponse = HTTParty.get(@attrUrl) #String => Nokgiri::HTML => DocumentObjectModel (DOM) attrDom = Nokogiri::HTML(attrResponse.body) # p dom.css('html') #gives everything wthin the html tag attractions = attrDom.css('.list-headline h2') @venue = [] attractions.each do |place| @venue << place.text end # Get two random attractions and give them their own variables @venues = @venue.sample(3) @venue_one = @venues[0] @venue_two = @venues[1] @venue_three = @venues[2] # Index of random photo to grab correct picture @index_one = @venue.index(@venue_one) @index_two = @venue.index(@venue_two) @index_three = @venue.index(@venue_three) images = attrDom.css('img.lazy') @image = [] images.each do |picture| @image << 'https:' + picture['data-src'] end # Select image link based on index of random photo @image_one = @image[@index_one] @image_two = @image[@index_two] @image_three = @image[@index_three] # End of attractions scrape # # Start of Flickr API FlickRaw.api_key="3d403357fbd5a290f43a9b6cd0216a4a" FlickRaw.shared_secret="7ea1e588cac6c790" args = {:tags => "#{@citySelect} #{cat}"} @flickrsearch = [] discovered_pictures = flickr.photos.search args discovered_pictures.each{|p| url = FlickRaw.url p; @flickrsearch << url} # @flickrpics = @flickrsearch.map {|f| "<img src='#{f}'>"} # End of Flickraw API end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ...
[ "0.81049806", "0.77023244", "0.77010894", "0.7625595", "0.75821865", "0.74811673", "0.74603444", "0.7446582", "0.7305236", "0.72992796", "0.72888285", "0.72772574", "0.72345036", "0.72321355", "0.72321355", "0.72321355", "0.72321355", "0.72321355", "0.72321355", "0.72321355", ...
0.0
-1
POST /users POST /users.json
def create @user = User.new(user_params) @user.user_id = current_user.id respond_to do |format| if @user.save format.html { redirect_to @user, notice: 'user was successfully created.' } format.json { render :show, status: :created, location: @user } else format.html { render :new } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69...
0.0
-1
PATCH/PUT /users/1 PATCH/PUT /users/1.json
def update respond_to do |format| if @user.update(user_params) format.html { redirect_to @user, notice: 'user was successfully updated.' } format.json { render :show, status: :ok, location: @user } else format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "de...
[ "0.7225568", "0.7129473", "0.70036036", "0.6903525", "0.6821961", "0.68157715", "0.6708618", "0.66936064", "0.66810983", "0.6673763", "0.6672601", "0.6664346", "0.6664346", "0.6659468", "0.6659468", "0.6654875", "0.66486204", "0.66436917", "0.6641295", "0.6635214", "0.6618464...
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user.destroy respond_to do |format| format.html { redirect_to users_url, notice: 'user was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\...
[ "0.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7250935", "0.7250935"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find_by(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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:id, :first_name, :last_name, :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.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
Import an ActionSpace into the current context
def import_actionspace(name, as: nil) raise ArgumentError, "name may not be nil" if name.nil? # 1. Find the ActionSpace by name space = ActionSpace[name] raise ActionSpaceNotFound, "ActionSpace #{name} not found" if space.nil? # 2. Store the runner context raise InvalidImport, "No Fastlane runner context available" unless respond_to?(:runner) space.runner = runner # 3. Define a method to get the ActionSpace. # TODO: This applies to all instances of the class. Revisit this. self.class.send :define_method, as || name do space end space end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_space(slug, headers=default_headers)\n raise StandardError.new \"An export directory must be defined to import space.\" if @options[:export_directory].nil?\n @logger.info(\"Importing space definition from #{@options[:export_directory]}.\")\n\n # Loop over all provided files sorting files ...
[ "0.54147905", "0.53291094", "0.53291094", "0.53291094", "0.53291094", "0.5287347", "0.52700603", "0.5247813", "0.5226853", "0.5176238", "0.5129133", "0.5105586", "0.5099724", "0.50697017", "0.5039565", "0.5032458", "0.49889284", "0.49663967", "0.49304217", "0.49274954", "0.49...
0.82096606
0
strip off fields we are not interested in flatten and clean up entities
def cleanup(s) # use these fields: # :created_at, :text, :screen_name, # :hashtags, :urls, :user_mentions # puts "#{s.methods(all: false)}".red puts "language: #{s.lang}".red puts "#hashtags: #{s.hashtags.size}".bold if s.hashtags.any? hashtags = s.hashtags.to_a.map { |o| o["text"] } urls = s.urls.to_a.map { |o| o["expanded_url"] } user_mentions = s.user_mentions.to_a.map { |o| o["screen_name"] } { text: s[:text], screen_name: s[:user][:screen_name], created_at: s[:created_at], hashtags: hashtags, urls: urls, user_mentions: user_mentions } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_all_fields\n self.attributes.each{|a| a.strip! if a.class == 'String'}\n end", "def strip_attributes\n self.title = self.title.try :strip\n self.url = self.url.try :strip\n self.author = self.author.try :strip\n self.content = self.content.try :strip\n self.summary = self.summary.try ...
[ "0.6245511", "0.620712", "0.6163294", "0.60491514", "0.5951184", "0.591756", "0.5915053", "0.5903186", "0.58924365", "0.5860621", "0.58602786", "0.5823026", "0.57840526", "0.577622", "0.57332706", "0.57332706", "0.57135624", "0.5686968", "0.56647885", "0.5660902", "0.56240076...
0.0
-1
GET /daftar_pustaka GET /daftar_pustaka.json
def index @daftar_pustaka = DaftarPustaka.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.jso...
[ "0.64741474", "0.64741474", "0.63958836", "0.63112706", "0.62870246", "0.62870246", "0.6265626", "0.62654", "0.62566334", "0.62493145", "0.6246949", "0.6225987", "0.62189925", "0.6215199", "0.62139684", "0.62055737", "0.6189482", "0.6186862", "0.61809856", "0.6174301", "0.617...
0.6936833
0
GET /daftar_pustaka/1 GET /daftar_pustaka/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @daftar_pustaka = DaftarPustaka.all\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to d...
[ "0.6771569", "0.6655729", "0.6655729", "0.6578853", "0.6528574", "0.6527508", "0.65047264", "0.6503954", "0.6503954", "0.6501789", "0.6493941", "0.643001", "0.6425088", "0.64178", "0.6405621", "0.6390617", "0.6386576", "0.637904", "0.6369358", "0.6342857", "0.6332944", "0.6...
0.0
-1
POST /daftar_pustaka POST /daftar_pustaka.json
def create @daftar_pustaka = DaftarPustaka.new(daftar_pustaka_params) respond_to do |format| if @daftar_pustaka.save format.html { redirect_to @daftar_pustaka, notice: 'Daftar pustaka was successfully created.' } format.json { render :show, status: :created, location: @daftar_pustaka } else format.html { render :new } format.json { render json: @daftar_pustaka.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @pendaftaran_kela = PendaftaranKela.new(pendaftaran_kela_params)\n\n respond_to do |format|\n if @pendaftaran_kela.save\n format.html { redirect_to @pendaftaran_kela, notice: 'Pendaftaran kela was successfully created.' }\n format.json { render :show, status: :created, locatio...
[ "0.65138674", "0.64529973", "0.6334612", "0.6326551", "0.63072807", "0.62934387", "0.6178204", "0.6172406", "0.6167182", "0.61153257", "0.60744447", "0.60525304", "0.60468113", "0.6038483", "0.6029605", "0.60258555", "0.5994244", "0.59879124", "0.5983816", "0.59740674", "0.59...
0.7356641
0
PATCH/PUT /daftar_pustaka/1 PATCH/PUT /daftar_pustaka/1.json
def update respond_to do |format| if @daftar_pustaka.update(daftar_pustaka_params) format.html { redirect_to @daftar_pustaka, notice: 'Daftar pustaka was successfully updated.' } format.json { render :show, status: :ok, location: @daftar_pustaka } else format.html { render :edit } format.json { render json: @daftar_pustaka.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'P...
[ "0.6638611", "0.6603569", "0.65865296", "0.64734924", "0.6443528", "0.6413243", "0.6400266", "0.6313068", "0.62998617", "0.6287508", "0.6282582", "0.6281036", "0.6269964", "0.625709", "0.6254592", "0.62453187", "0.62443733", "0.62443125", "0.62412333", "0.6233259", "0.6231693...
0.6606028
1
DELETE /daftar_pustaka/1 DELETE /daftar_pustaka/1.json
def destroy @daftar_pustaka.destroy respond_to do |format| format.html { redirect_to daftar_pustaka_index_url, notice: 'Daftar pustaka was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefi...
[ "0.7377338", "0.7170511", "0.7088328", "0.7088328", "0.7065751", "0.7039237", "0.70054245", "0.69947666", "0.69709456", "0.6968309", "0.696827", "0.69667447", "0.6957981", "0.6956779", "0.695293", "0.69516134", "0.69466037", "0.6941161", "0.69376105", "0.69376105", "0.6937610...
0.70608634
5
Use callbacks to share common setup or constraints between actions.
def set_daftar_pustaka @daftar_pustaka = DaftarPustaka.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 daftar_pustaka_params params.require(:daftar_pustaka).permit(:judul, :keterangan, :lampiran) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /nvs_mig_statuses GET /nvs_mig_statuses.json
def index @nvs_mig_statuses = NvsMigStatus.all respond_to do |format| format.html # index.html.erb format.json { render json: @nvs_mig_statuses } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @mstatuses = Mstatus.all\n end", "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end", "def statuses; end", "def show\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.71034646", "0.6481675", "0.6381433", "0.6374229", "0.6349098", "0.6274565", "0.619839", "0.619839", "0.61975145", "0.6116875", "0.6069184", "0.6049143", "0.6027578", "0.5956398", "0.5915856", "0.590662", "0.5885558", "0.58767056", "0.5872109", "0.58536625", "0.58460623", ...
0.7528968
0
GET /nvs_mig_statuses/1 GET /nvs_mig_statuses/1.json
def show @nvs_mig_status = NvsMigStatus.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @nvs_mig_status } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @nvs_mig_statuses = NvsMigStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_mig_statuses }\n end\n end", "def index\n @mstatuses = Mstatus.all\n end", "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed...
[ "0.74588054", "0.6977914", "0.62716216", "0.6211762", "0.617108", "0.6168839", "0.61321396", "0.61321396", "0.61110187", "0.61087644", "0.6075625", "0.6030972", "0.5855255", "0.5826434", "0.5814863", "0.58050567", "0.57935035", "0.57774115", "0.5757139", "0.57382226", "0.5728...
0.67431724
2
GET /nvs_mig_statuses/new GET /nvs_mig_statuses/new.json
def new @nvs_mig_status = NvsMigStatus.new respond_to do |format| format.html # new.html.erb format.json { render json: @nvs_mig_status } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def create\n @nvs_mig_status = NvsMigStatus.new(params[:nvs_mig_status])\n @nvs_mig_status.project_id = @project.id\n\n respond_to d...
[ "0.75146556", "0.7132476", "0.71241945", "0.70829153", "0.68519", "0.67919815", "0.67425627", "0.6682156", "0.66818756", "0.662713", "0.65712076", "0.65712076", "0.65410477", "0.6536709", "0.6524999", "0.6507983", "0.6507983", "0.6507983", "0.6496631", "0.64817965", "0.647103...
0.7507979
1
POST /nvs_mig_statuses POST /nvs_mig_statuses.json
def create @nvs_mig_status = NvsMigStatus.new(params[:nvs_mig_status]) @nvs_mig_status.project_id = @project.id respond_to do |format| if @nvs_mig_status.save format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully created.' } format.json { render json: @nvs_mig_status, status: :created, location: @nvs_mig_status } else format.html { render action: "new" } format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_statuses\n end", "def create_statuses\n end", "def index\n @nvs_mig_statuses = NvsMigStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_mig_statuses }\n end\n end", "def index\n @mstatuses = Mstatus.all\n end", "def cr...
[ "0.68328726", "0.68328726", "0.6366447", "0.6148457", "0.5890538", "0.5773629", "0.5696787", "0.5686594", "0.5681192", "0.564406", "0.554794", "0.5481174", "0.54770535", "0.54740757", "0.54636455", "0.5444942", "0.54257244", "0.54051775", "0.53952366", "0.5367676", "0.5345306...
0.6518876
2
PUT /nvs_mig_statuses/1 PUT /nvs_mig_statuses/1.json
def update @nvs_mig_status = NvsMigStatus.find(params[:id]) respond_to do |format| if @nvs_mig_status.update_attributes(params[:nvs_mig_status]) format.html { redirect_to @nvs_mig_status, notice: 'Nvs mig status was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @nvs_mig_status.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_statuses }\n else\n format...
[ "0.5958617", "0.58586216", "0.58586216", "0.5837707", "0.58347857", "0.58189565", "0.5786008", "0.57777596", "0.5738836", "0.57193196", "0.57174826", "0.5681061", "0.5663469", "0.5645419", "0.56323946", "0.5621716", "0.55810857", "0.5563385", "0.5556815", "0.5552249", "0.5550...
0.67268234
0
DELETE /nvs_mig_statuses/1 DELETE /nvs_mig_statuses/1.json
def destroy @nvs_mig_status = NvsMigStatus.find(params[:id]) @nvs_mig_status.destroy respond_to do |format| format.html { redirect_to nvs_mig_statuses_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @reqstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mstatus.destroy\n respond_to do |format|\n format.html { redirect_to mstatuses_url, notice: 'Status was successfu...
[ "0.70992434", "0.7002245", "0.6963927", "0.69634676", "0.69461757", "0.6926119", "0.6820154", "0.68076384", "0.6738203", "0.6724101", "0.6711532", "0.6703818", "0.6702871", "0.66834754", "0.66821355", "0.66765624", "0.6651592", "0.6651592", "0.66339177", "0.66328657", "0.6631...
0.7784638
0
this method returns the sorted hash of webpages with no of visits based on no of visits in descending order
def calculate_most_viewed_pages pages_with_frequency = calculate_page_frequency pages_with_frequency.sort_by { |_key, value| value }.reverse.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_unique_page_views\n ip_frequency_per_page = calculate_ip_frequency_per_page\n ip_frequency_per_page.transform_values { |value| value.uniq.length }.sort_by { |_key, value| value }.reverse.to_h\n end", "def unique_visit\n parsed_result.each do |result|\n visit_hash[result.first] = resu...
[ "0.7275074", "0.69860864", "0.6939138", "0.6897497", "0.66608834", "0.65018773", "0.6475812", "0.64252084", "0.64078504", "0.6171827", "0.6138484", "0.60916656", "0.60874623", "0.5985514", "0.5985357", "0.592972", "0.5925328", "0.58569795", "0.5801313", "0.5788764", "0.578700...
0.6993947
1
this method returns the sorted hash of webpages with no of unique visits based on no of unique visits in descending order
def calculate_unique_page_views ip_frequency_per_page = calculate_ip_frequency_per_page ip_frequency_per_page.transform_values { |value| value.uniq.length }.sort_by { |_key, value| value }.reverse.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.uniq.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def find_unique_page_visits(visits)\n unique_visits_hash = Hash.new(0)\n unique_addresses_hash = Array.new\n visits.each do |visit|\n ...
[ "0.7481599", "0.6887685", "0.686704", "0.6817499", "0.6805365", "0.6704389", "0.6495376", "0.6410606", "0.6409974", "0.64058053", "0.60670227", "0.6037895", "0.60190415", "0.6015504", "0.59360945", "0.5905298", "0.5905298", "0.5905298", "0.5874615", "0.5871076", "0.5855887", ...
0.76342076
0
this is a private method for returning the hash of pages and their corresponding frequency of visits
def calculate_page_frequency page_frequency_hash = {} pages_array = [] @data.split("\n").each do |line| pages_array << line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL end pages_array.each do |page| page_frequency_hash[page].nil? ? page_frequency_hash[page] = 1 : page_frequency_hash[page] += 1 end page_frequency_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_page_visits(visits)\n visits_hash = Hash.new(0)\n visits.each do |visit|\n visits_hash[visit.page] += 1\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return visits_hash\nend", "def total_visit\n parsed_result.each do |result|\n visit_has...
[ "0.7714523", "0.70905674", "0.69267744", "0.69012433", "0.68318075", "0.6717959", "0.66150737", "0.6596183", "0.65781957", "0.64680403", "0.6318332", "0.61998767", "0.6187754", "0.6138905", "0.6136407", "0.6070792", "0.60587674", "0.59996647", "0.5976026", "0.5935271", "0.591...
0.7654522
1
this is a private method for returning the hash of pages and their corresponding frequency of unique visits
def calculate_ip_frequency_per_page ip_frequency_per_page_hash = {} @data.split("\n").each do |line| page_url = line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL ip_frequency_per_page_hash[page_url] = [] unless ip_frequency_per_page_hash[page_url] ip_frequency_per_page_hash[page_url] << line.match(Regex::IP_ADDRESS)[0] if line =~ Regex::IP_ADDRESS end ip_frequency_per_page_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_page_visits(visits)\n visits_hash = Hash.new(0)\n visits.each do |visit|\n visits_hash[visit.page] += 1\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return visits_hash\nend", "def find_unique_page_visits(visits)\n unique_visits_hash = Hash.new...
[ "0.76156753", "0.7477628", "0.7345562", "0.7314882", "0.72767776", "0.69916", "0.6907622", "0.66866446", "0.66371316", "0.63823867", "0.62839025", "0.6170911", "0.6140501", "0.61292213", "0.60885084", "0.6034281", "0.60309714", "0.6014932", "0.6014932", "0.6014932", "0.599096...
0.6514058
9
update relationship (keep the record)
def updatestatus # other user @relationship = Relationship.find(params[:id]) status = params[:relationship][:status] # create relationship if current_user.id == @relationship.follower_id @relationship.status = status @relationship.save @user = User.find(@relationship.followed_id) if status == "FOLLOWING" || status == "REQUEST" @user.update_attributes!(:notify => "YES") end respond_to do |format| format.html # index.html.erb format.json { render :json=> { :user=>@user.as_json(:only => [:id, :name, :tender, :invitation_token, :notify, :privateprofile], :methods => [:photo_url], :include => { :drinks => { :only => [:id, :name] }, :workvenues => { :only => [:id, :fs_venue_id, :name] } } ) } } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(attrs)\n @attrs.update(attrs[:relationship]) unless attrs[:relationship].nil?\n self\n end", "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs[:relationship]) unless attrs[:relationship].nil?\n self\n end", "def update!(**args)\n @relation = args[:relat...
[ "0.7292227", "0.71883357", "0.7148545", "0.7010047", "0.6958773", "0.67847145", "0.67368144", "0.6595965", "0.64890707", "0.63468003", "0.62852514", "0.62825483", "0.6273581", "0.6271799", "0.6225059", "0.62232465", "0.6221497", "0.6198202", "0.6186048", "0.6179714", "0.61675...
0.0
-1
p calculate_total_1(31.99, 0.15, 0.08) p calculate_total_1(0.15, 0.08, 31.99)
def calculate_total_2(info) tip_amt = info[:price] * info[:tip] tax_amt = info[:price] * info[:tax] info[:price] + tip_amt + tax_amt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_t1(price, tip, tax)\n tax_amount = price * tax\n tip_amount = price * tip\n price + tip_amount + tax_amount\nend", "def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end", "def calc_return(total, pool, commission)\n if pool == 0\n return 0\n elsif total == 0\n ...
[ "0.6879973", "0.67622167", "0.6657539", "0.6612627", "0.6587358", "0.656407", "0.65630376", "0.6561427", "0.64806914", "0.6459962", "0.6435332", "0.6415027", "0.63927615", "0.6373905", "0.6363716", "0.63554835", "0.6332464", "0.63104635", "0.6303777", "0.6297794", "0.6289773"...
0.6542172
8
Internal: Updates the standings points, goals, results of teams in a match. match a string in the format "Home Team 0 0 Away Team", includes the teams and goals for update.
def update_standings(match) home_team, away_team = get_match_teams(match) home_team_goals, away_team_goals = get_match_goals(match) save_match_result(home_team, home_team_goals, away_team_goals) save_match_result(away_team, away_team_goals, home_team_goals) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_teams\n if (home_team != nil and away_team != nil)\n puts \"Updating teams\"\n #match = Matchup.new(params)\n home_team.updateResults(self)\n away_team.updateResults(self)\n home_team.save\n away_team.save\n else\n return false\n end\n e...
[ "0.71209383", "0.65185446", "0.6468156", "0.64107573", "0.6388802", "0.6321186", "0.6294751", "0.6293475", "0.62733483", "0.6227035", "0.62262446", "0.61532116", "0.60718673", "0.60554236", "0.6043873", "0.6020962", "0.59756714", "0.59331685", "0.5929624", "0.59246397", "0.59...
0.7898494
0
Internal: Resets the team standings in a league points, goals, results of teams in a match. Clears the team instance variable and uses the update_standings method to create new teams and standings.
def reset_standings @teams.clear @matches.each { |match| update_standings(match) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_standings(match)\n\t\thome_team, away_team = get_match_teams(match) \n\t\thome_team_goals, away_team_goals = get_match_goals(match)\n\t\tsave_match_result(home_team, home_team_goals, away_team_goals)\n\t\tsave_match_result(away_team, away_team_goals, home_team_goals)\n\tend", "def reset\n @roun...
[ "0.6546848", "0.65100235", "0.60607445", "0.5985785", "0.59726113", "0.5947998", "0.5935943", "0.5896813", "0.58856", "0.58662164", "0.5864433", "0.58328974", "0.5800734", "0.57623667", "0.5756863", "0.57123566", "0.5697158", "0.5684034", "0.5679345", "0.56528586", "0.5648832...
0.8577282
0
Called for every frame
def update @player.shape.body.reset_forces 6.times do if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then @player.move_left end if button_down? Gosu::KbRight or button_down? Gosu::GpRight then @player.move_right end #if button_down? Gosu::KbUp or button_down? Gosu::GpRight then # @player.shape.body.a += 0.1 # # puts @player.shape.body.a.inspect #end #if button_down? Gosu::KbDown or button_down? Gosu::GpRight then # @player.shape.body.a -= 0.1 # puts @player.shape.body.a.inspect #end @space.step 1.0/10.0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frames; end", "def frame; end", "def frame=(pos); end", "def c_frame?; end", "def frame_reset\n @delta_time = @frame_to_skip = 0\n @ruby_time = @current_time = @last_time = @last_second_time = Time.new\n reset_gc_time\n reset_ruby_time\n @last_frame_count = Graphics.frame_count\n end", ...
[ "0.75351626", "0.74464256", "0.7228442", "0.6771172", "0.66857177", "0.66337997", "0.66227144", "0.65079665", "0.64800376", "0.6469522", "0.64419365", "0.6440652", "0.63844496", "0.63645774", "0.63602835", "0.63563836", "0.6330764", "0.62287503", "0.6153098", "0.6152806", "0....
0.0
-1
Used for status setting
def update_status case @part.status when 'Unstarted' @part.status = 'Started' @part.user = current_user @part.bitbucket.post_user(current_user.email) if @part.name == 'Prototype' @part.create_activity key: 'part.started', owner: current_user @part.start_rep_points when 'Started' @part.status = 'Finished' @part.create_activity key: 'part.finished', owner: current_user when 'Finished' @part.status = 'In Review' @part.create_activity key: 'part.in_review', owner: current_user when 'In Review' @part.status = 'Accepted' @part.accepted_rep_points @part.create_activity key: 'part.accepted', owner: current_user end @part.save redirect_to :back end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status=(status); end", "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end", "def statuses; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", ...
[ "0.8149229", "0.78564215", "0.77720827", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.76866704", "0.76866704", "0.76866704", "0.76866704", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "...
0.0
-1
Used for status setting
def unstart_part @part.unstart_rep_points @part.status = 'Unstarted' @part.user = nil @part.save @part.create_activity key: 'part.unstarted', owner: current_user @part.bitbucket.delete_users if @part.name == 'Prototype' redirect_to idea_build_path(@part.idea), notice: 'You successfully unstarted the part.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status=(status); end", "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end", "def statuses; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", ...
[ "0.8149229", "0.78564215", "0.77720827", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.77566534", "0.76866704", "0.76866704", "0.76866704", "0.76866704", "0.7619133", "0.7619133", "0.7619133", "0.7619133", "...
0.0
-1
It's guaranteed that the answer exists. If there are several answers, return the one which starts from the smallest index. Example For s = "adobecodebanc" and t = "abc", the output should be minSubstringWithAllChars(s, t) = "banc".
def minSubstringWithAllChars(s, t) (0..s.size).lazy.map { |l| (0..s.size - l).lazy.map { |i| s[i, l] } .find { |x| t.each_char.all? { |c| x[c] } } }.find { |x| x } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a)\n shortest = a.min_by &:length\n maxlen = shortest.length\n maxlen.downto(0) do |len|\n 0.upto(maxlen - len) do |start|\n substr = shortest[start,len]\n return substr if a.all?{|str| str.include? substr }\n end\n end\nend", "def find_short(s)\n l = s.split(\" \").min_by { |x|...
[ "0.75384796", "0.7133405", "0.71118397", "0.70624894", "0.7019326", "0.6991536", "0.69448656", "0.69309896", "0.69285893", "0.6918347", "0.6918347", "0.6912162", "0.6883463", "0.6875524", "0.6865224", "0.6849213", "0.68350965", "0.6816007", "0.6801082", "0.67993903", "0.67703...
0.8336636
0
method is inherited from the superclass
def index list render('list') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def overrides; end", "def custom; end", "def custom; end", "def implementation; end", "def implementation; end", "def schubert; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def methods; end", "def methods; end",...
[ "0.76834434", "0.7112112", "0.6950881", "0.6950881", "0.6906725", "0.6906725", "0.6821159", "0.6815375", "0.6809549", "0.6809549", "0.6809549", "0.6809549", "0.67698467", "0.67698467", "0.67698467", "0.67698467", "0.67181605", "0.67181605", "0.6623702", "0.660279", "0.660279"...
0.0
-1
by default, rails escape all user input
def create #pull the position out of the params hash and store it in a variable new_position=params[:subject].delete(:position) # instantiate a new object using form parameters @subject= Subject.new(params[:subject]) #save the object if @subject.save #if save succeeds #once we saved the @subject, we can update its position @subject.move_to_position(new_position) flash[:notice]="Subject created." #flash hash stores messages, like a cookie #if save succeeds, redirect to the list action redirect_to(:action=> "list") #if save fails, redisplay the form so user can fix problems else @subject_count = Subject.count+1 render('new') #@subject will be prepopulated with previous entries end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape(value)\n end", "def cgi_escape(input); end", "def escape(string); end", "def escape(input); input.to_s.gsub('\"', '\\\\\"'); end", "def escape(str); end", "def escape(string)\n #This is a stub, used for indexing\n end", "def escape_text input\n escape input, text_...
[ "0.73058057", "0.7294034", "0.7084897", "0.6987313", "0.69075394", "0.68791115", "0.68633604", "0.66831464", "0.6659106", "0.66294634", "0.65568584", "0.65271634", "0.6507189", "0.647592", "0.6474997", "0.6465555", "0.6460189", "0.6450522", "0.6440561", "0.640173", "0.6394344...
0.0
-1
The name of the current host (localhost, for example)
def current_host request.host end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hostname\n name + '.localhost'\n end", "def this_host_name\n if is_zz?\n return zz[:local_hostname]\n end\n\n return @this_host_name if @this_host_name != nil\n\n instances = ey['environment']['instances']\n # assume localhost if can't find\n @this_host_name = 'localhost'\n\n ...
[ "0.8553182", "0.8275436", "0.81809926", "0.81391937", "0.81391937", "0.8119555", "0.80694807", "0.8069345", "0.7945337", "0.7904412", "0.7888484", "0.78743154", "0.7873891", "0.78717595", "0.78184223", "0.7805399", "0.7719257", "0.7698445", "0.769077", "0.7684536", "0.7663995...
0.8002826
8
Return the users's sytem information as a hash
def user_system_info { :system => NoPlanB::HttpHeaderUtils.extract_system_info(request.env['HTTP_USER_AGENT']), :browser => NoPlanB::HttpHeaderUtils.extract_browser_info(request.env['HTTP_USER_AGENT']), :ip_address => request.remote_ip } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def system_info\n si = SysInfo.new\n si.to_hash\n rescue \n {}\n end", "def get_sysinfo\n\t\tsystem_data = {}\n\t\tkernel_version = cmd_exec(\"uname -a\")\n\t\tversion = read_file(\"/etc/release\").split(\"\\n\")[0].strip\n\t\tsystem_data[:version] = version\n\t\tsystem_data[:kernel] = kerne...
[ "0.64183915", "0.57973886", "0.5750404", "0.5722617", "0.55965203", "0.55174446", "0.54820746", "0.5453869", "0.54414773", "0.5435998", "0.5395313", "0.5321904", "0.5319565", "0.53152806", "0.5296854", "0.52829486", "0.52786267", "0.5278059", "0.5275649", "0.52735764", "0.527...
0.5099999
42
Return the referer information if it was via search, return the search terms used
def referer_info { :url => request.env["HTTP_REFERER"], :host => NoPlanB::UrlUtils.hostname(request.env["HTTP_REFERER"]), :search_engine => NoPlanB::UrlUtils.is_search_engine?(request.env["HTTP_REFERER"]), :search_terms => NoPlanB::UrlUtils.extract_search_terms(request.env["HTTP_REFERER"]) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def searchterm\r\n @@st.get_searchterm(referer)\r\n end", "def referer; end", "def referer\n @request[FREFERER]\n end", "def referer_from_request request\n if referer = attribute_from_request(request, :referer)\n TingYun::Agent::HTTPClients::URIUtil.strip_query_str...
[ "0.69649386", "0.64264566", "0.6320683", "0.6199506", "0.6028654", "0.58727735", "0.584195", "0.5787574", "0.56166077", "0.5594525", "0.5562957", "0.55564165", "0.5523787", "0.5522118", "0.5482786", "0.5435953", "0.54346365", "0.5345462", "0.5341624", "0.53237164", "0.5307201...
0.7557255
0
Move player with the WSAD buttons
def move(char) case char.downcase when 'w', 'k' map.move_player(:north) when 's', 'j' map.move_player(:south) when 'a', 'h' map.move_player(:west) when 'd', 'l' map.move_player(:east) when 'r' map.reset when 'x' exit else raise MoveNotPermitted end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_player_movement\r\n # Move player in the direction the directional button is being pressed\r\n case Input.dir4\r\n when 2\r\n move_down\r\n when 4\r\n move_left\r\n when 6\r\n move_right\r\n when 8\r\n move_up\r\n end\r\n end", "def Move(player, start, stop)\r...
[ "0.7159028", "0.6981592", "0.68961", "0.6568368", "0.6521871", "0.6520447", "0.65121025", "0.6511944", "0.6480536", "0.6441577", "0.6434692", "0.6425564", "0.63888067", "0.63888067", "0.63793147", "0.63711643", "0.6351329", "0.631678", "0.6302136", "0.62883", "0.62497365", ...
0.5915981
66
It works a lot like Bundler. We provide some core modules by default. This ensures at least the ability to construct a basic environment.
def github(name, version, options = nil) options ||= {} options[:repo] ||= "boxen/puppet-#{name}" mod name, version, :github_tarball => options[:repo] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_environment; end", "def setup_context\n self['console'] = Console.new\n load RUNTIME_PATH\n\n opal = self['opal']\n opal['loader'] = Loader.new opal, self\n opal['fs'] = FileSystem.new opal, self\n opal['platform']['engine'] = 'opal-gem'\n\n # eval \"opal.require('cor...
[ "0.6607848", "0.62972605", "0.6268261", "0.6249248", "0.618101", "0.60742056", "0.6032821", "0.60235703", "0.6010405", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", "0.6009741", ...
0.0
-1
Build a service from a service description. The service description can either be a string giving the project name, or it can be a record describing the service. If it's a simple string, it will be interpreted as though it were a record containing only the project name. The project record has these fields: NAME DESCRIPTION service project name for a service (either this or library are required) library project name for a library (either this or service are required) downstream OPTIONAL list of projects that directly depend on this one archive OPTIONAL name of the generated WAR file (default = $project.war) wlp OPTIONAL name of the WLP instance to deploy to (default = $normalized_project.war) The 'normalized project' is the project name with any recognized suffix removed. The only recognized suffix is 'service' (e.g. project 'ariservice' has a default service name of 'ari').
def initialize_project(project_desc) project_name = extract_project(project_desc) repo_name = extract_repository(project_desc) repo_path = File.expand_path(repo_name, $project_dir) repo = initialize_repo(project_desc, repo_path) if project_desc[:library] Project::Library.new( repository: repo, sub_project: (project_name == repo_name) ? nil : project_name, auto_reset: $options[:auto_reset], mvn_flags: project_desc[:mvn_flags], pull_branches: $pull_branches, rebase_branches: $rebase_branches, local_branches: $local_branches, basis_branch: project_desc[:basis_branch] || $global_basis_branch, always_build: project_desc[:always_build] ) else Project::Service.new( repository: repo, sub_project: (project_name == repo_name) ? nil : project_name, archive: project_desc[:archive], service: project_desc[:wlp], restart: project_desc[:restart], auto_reset: $options[:auto_reset], mvn_flags: project_desc[:mvn_flags], pull_branches: $pull_branches, rebase_branches: $rebase_branches, local_branches: $local_branches, basis_branch: project_desc[:basis_branch] || $global_basis_branch ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_service(name, description)\n response = @client.post(\"/api/v1/services\", { \"name\" => name, \"description\" => description })\n return JSON.parse(response.body)\n end", "def parse_service_yaml service_yaml_text\n return nil unless service_yaml_text && !service_yaml_text.empty?...
[ "0.56258726", "0.5333281", "0.5274084", "0.51164347", "0.51129496", "0.5043704", "0.5030223", "0.499239", "0.49863032", "0.49497426", "0.49423024", "0.48808274", "0.48239368", "0.4815402", "0.48146513", "0.4779233", "0.47615486", "0.47334135", "0.46988174", "0.46753865", "0.4...
0.54059
1
This method is just here because I want the descs list at the very bottom of the file
def process_descs(descs) if $options[:readonly] branch_report descs else build_the_world descs end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def desc; end", "def desc\n\tend", "def desc\n\tend", "def add_desc(heading,list)\n description = \"\\n\\n#{heading}: #{list.length.to_s}\\n\\n\\t\"\n description << list.join(\"\\n\\t\") unless list.empty?\n description\n end", "def load_long_desc_file(path)\n if ::File.extname(path) ==...
[ "0.653615", "0.6517724", "0.6517724", "0.64309126", "0.6331982", "0.62967014", "0.62569886", "0.6231334", "0.62243974", "0.6200707", "0.6195624", "0.61647594", "0.6160527", "0.6131406", "0.6069356", "0.60113496", "0.599692", "0.5985559", "0.5985559", "0.59829885", "0.5948528"...
0.58648264
28
Publish an event to the queue
def publish(event) exchange.publish(event) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_event event\n @event_queue << event\n end", "def publish_event(event)\n @event_bus.publish(Domain::EventMessage.as_message(event))\n end", "def publish\n raise 'Event already published' if published\n\n begin\n ::SNT::Core::MQ.publisher.publish(event_contex...
[ "0.8039173", "0.77513444", "0.74168557", "0.74051875", "0.73826945", "0.7163963", "0.7132995", "0.7132995", "0.7105684", "0.7042068", "0.69849694", "0.6973809", "0.69404465", "0.69388026", "0.6871741", "0.6835738", "0.6757857", "0.67524415", "0.6705046", "0.66898024", "0.6688...
0.76841867
2
Listen for an event from the queue
def listen(&block) queue.bind(exchange).subscribe do |delivery_info, metadata, event| block.call(event) end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_event event\n @event_queue << event\n end", "def setup_queue_listener\n service_queue.subscribe(:block => true) do |info, properties, payload|\n log.debug \"Received message: #{payload}...\"\n @return_info = nil\n rpc_wrapper.call { process(info, properties, payload...
[ "0.7066768", "0.7052746", "0.6905035", "0.68616337", "0.67937094", "0.6746992", "0.67265016", "0.6616742", "0.6599773", "0.6596181", "0.6584961", "0.6571458", "0.6507917", "0.6462799", "0.6460936", "0.6445918", "0.64383596", "0.63638663", "0.63591737", "0.631059", "0.631059",...
0.6724736
7
Queues are used to receive events
def queue # Probably should be a UUID in the real world @queue ||= channel.queue(self.object_id.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal_queue; end", "def queue(*queues)\n end", "def dispatch\n queue << nil\n while message = queue.shift\n consumers.each do |consumer|\n if response = consumer.on_message(message)\n @queue += Array(response)\n end\n ...
[ "0.72783893", "0.6948128", "0.6929715", "0.6898411", "0.6898411", "0.6830583", "0.6767041", "0.67299604", "0.6631542", "0.65903133", "0.65895563", "0.65895563", "0.65695035", "0.6567283", "0.6556751", "0.65265745", "0.6524798", "0.65216345", "0.65173316", "0.6488111", "0.6479...
0.617012
43
Exchanges are used to publish events
def exchange @exchange ||= channel.fanout(QUEUE_NAME) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchanges\n @exchanges ||= {}\n end", "def exchanges\n\t\t\t@exchanges ||= {}\n\t\tend", "def exchanges\n @channel.exchanges\n end", "def initialize\n @exchanges = {}\n end", "def exchange\n @exchange ||= produce_exchange\n end", "def event_bus; end", "def event_bus; end", ...
[ "0.6925797", "0.6866954", "0.6835345", "0.68192106", "0.6454724", "0.60323125", "0.60323125", "0.6024625", "0.59110385", "0.586145", "0.5852531", "0.5753328", "0.57448405", "0.57171965", "0.5716946", "0.56829387", "0.5618979", "0.5583908", "0.5556776", "0.55445117", "0.552846...
0.5506514
25
wired to app/views/recommendations/show.html.erb by default (naming convention) display a recommendation (if the application doesn't exist, redirect to the page for all the apps)
def show @recommendation = App.find(params[:id]) if @recommendation.nil? redirect_to action: :index end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recommendation }\n end\n end", "def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.h...
[ "0.6652366", "0.6652366", "0.66444224", "0.65463555", "0.6293512", "0.6205064", "0.61723804", "0.6117695", "0.60913736", "0.60365653", "0.6010551", "0.60035425", "0.5958093", "0.5955163", "0.5933526", "0.5902165", "0.5866141", "0.5815659", "0.5805442", "0.5796318", "0.5781879...
0.79500365
0
wired to app/views/recommendations/new.html.erb by default (naming convention) that view GET a blank form for creating a new recommendation, submitting with POST
def new @recommendation = App.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @recommend = Recommend.new\n\n respond_to do |format|\n format.html\n format.json { render json: @recommend }\n end\n end", "def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recomme...
[ "0.7623733", "0.7510904", "0.7510904", "0.7254059", "0.7253947", "0.7070545", "0.6916067", "0.6916067", "0.67938554", "0.67545456", "0.67545456", "0.67349833", "0.67207897", "0.67207897", "0.6696563", "0.6690227", "0.6687838", "0.6671333", "0.6657233", "0.6657233", "0.6657233...
0.65902364
35
POST a newly filled form to create a new recommendation
def create if true #@recommendation = Recommendation.new() #@recommendation.nameDotNumber = params[:app][:nameDotNumber] #@recommendation.course = params[:app][:course] @new_rec = App.find_by(:nameDotNumber => params[:recommendation][:nameDotNumber]) @new_rec.update(:approved => "true") @new_rec.save if @recommendation.save redirect_to @recommendation, notice: "Successfully Saved!" else render new end else redirect_to home_url flash.alert = "No Recommendations available!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @recommendation = Recommendation.new(recommendation_params)\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to @recommendation, notice: \"Recommendation was successfully created.\" }\n format.json { render :show, status: :created, location: @recomme...
[ "0.7032842", "0.7019406", "0.70150524", "0.7005337", "0.6943381", "0.6895716", "0.6862189", "0.68396866", "0.68253726", "0.67107415", "0.66553706", "0.6653533", "0.66033715", "0.6578308", "0.6578308", "0.65775067", "0.65510046", "0.6534104", "0.6496202", "0.64802897", "0.6422...
0.6403965
22
wired to app/views/recommendations/update.html.erb by default (naming convention) that view GET a filled form for updating an recommendation, submitting with PUT
def edit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @recommend = Recommend.find(params[:id])\n\n respond_to do |format|\n if @recommend.update_attributes(params[:recommend])\n format.html { redirect_to @recommend, notice: 'Recommend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html...
[ "0.7669512", "0.73655653", "0.7292783", "0.7273938", "0.726564", "0.7188805", "0.7153184", "0.7153006", "0.7068589", "0.694214", "0.6856132", "0.6799903", "0.67891777", "0.67732835", "0.6760946", "0.67606205", "0.670224", "0.66717964", "0.6662548", "0.6653837", "0.66175264", ...
0.0
-1
PUT the edited form to update a recommendation
def update @recommendation_to_update = Recommendation.find(params[:id]) @recommendation_to_update.update(:nameDotNumber => params[:app][:nameDotNumber]) @recommendation_to_update.update(:course => params[:app][:course]) @recommendation_to_update.save redirect_to home_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @recommend = Recommend.find(params[:id])\n\n respond_to do |format|\n if @recommend.update_attributes(params[:recommend])\n format.html { redirect_to @recommend, notice: 'Recommend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html...
[ "0.8095108", "0.80392814", "0.7918458", "0.786596", "0.7856543", "0.7820544", "0.7716968", "0.76070845", "0.7534149", "0.75269604", "0.75019777", "0.7447656", "0.7321776", "0.7176609", "0.7160014", "0.7087019", "0.7070621", "0.704455", "0.7034007", "0.69927377", "0.6984685", ...
0.7370448
12
wired to app/views/recommendations/destroy.html.erb by default (naming convention)
def destroy @recommendation.destroy redirect_to action: :index, notice: "Successfully deleted!" # use redirect instead of render to avoid double submission (double deletion) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_view\n super\n end", "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to(recommendations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recommendation = R...
[ "0.6771026", "0.6476143", "0.6476143", "0.6451297", "0.64286983", "0.6419741", "0.63975173", "0.6362883", "0.6356044", "0.6321648", "0.62987703", "0.6298714", "0.62985754", "0.6293573", "0.62812376", "0.6242178", "0.62248", "0.6218811", "0.61885214", "0.61388904", "0.610874",...
0.6862138
0
the snippet below is shared by show, edit, update, destroy
def set_application @application = Application.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_show\n\tend", "def update_show\n\tend", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; en...
[ "0.7237227", "0.7237227", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "0.7186812", "...
0.0
-1
1. serve(dispatcher) 2. serve(obj, accept = obj.public_methods)
def serve(obj, accept = obj.public_methods) if obj.is_a?(Dispatcher) # 2. @dispatcher = obj else # 1. @dispatcher = ObjectDispatcher.new(obj, accept) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serves(&method_def)\n this.module_eval(&method_def)\n end", "def router; end", "def do_dispatch(env)\n path = env['PATH_INFO']\n\n # Try to serve a public file\n ret = dispatch_public(env, path)\n return ret if not ret.nil?\n\n log.debug \"Checking for routes that match: #{...
[ "0.6186424", "0.6169457", "0.610142", "0.60769296", "0.6063888", "0.6063888", "0.6063888", "0.5908438", "0.58783454", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5845831", "0.5831505", ...
0.8196175
0
1. listen(listener, obj = nil, accept = obj.public_methods) 2. listen(host, port, obj = nil, accept = obj.public_methods)
def listen(arg1, arg2 = nil, arg3 = nil, arg4 = nil) if arg1.respond_to?(:listen) # 1. listener = arg1 obj = arg2 accept = arg3 || obj.public_methods else # 2. listener = TCPServerTransport.new(Address.new(arg1,arg2)) obj = arg3 accept = arg4 || obj.public_methods end unless obj.nil? serve(obj, accept) end listener.listen(self) @listeners.push(listener) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen\r\n end", "def listen(p0) end", "def listen(p0) end", "def listen(p0) end", "def listen\n # TODO\n self\n end", "def listen\n #Start listening for input.\n start_listen\n\n #Start listening for errors.\n start_listen_errors\n end", "def define_listening\n end", "def l...
[ "0.76528496", "0.72869116", "0.72869116", "0.72869116", "0.71229774", "0.7050147", "0.7030404", "0.7012588", "0.6949588", "0.693439", "0.68662006", "0.6817472", "0.6783147", "0.67808944", "0.6667576", "0.6654661", "0.6650915", "0.6618438", "0.65849304", "0.657565", "0.657565"...
0.8365881
0
method to find the resulting array
def cartProd @items = [] @arr1.each{ |a| @arr2.each{ |b| item = [] << a << b @items << item } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_array_finding_method(source, thing_to_find)\n i = 0\n t = 0\n output_array = []\n while i < source.length\n if source[i].to_s.include?(thing_to_find)\n output_array[t] = source[i].to_s\n t += 1\n end\n i +=1\n end\n return output_array\nend", "def my_array_finding_method(source, t...
[ "0.653251", "0.6500074", "0.6495656", "0.6495656", "0.6337211", "0.6333217", "0.62255305", "0.6201148", "0.6165521", "0.6163836", "0.60529613", "0.6027575", "0.6019639", "0.60153335", "0.5986668", "0.5986668", "0.5986668", "0.5986668", "0.5893575", "0.58699024", "0.58367825",...
0.0
-1
GET /viks GET /viks.json
def index @viks = Vik.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end", "def index\n @ivas = Iva.all\n\n render json: @ivas\n end", "def index\n @vets = Vet.all\n end", "def index\n @curriculu...
[ "0.65858173", "0.6456122", "0.63259727", "0.6293573", "0.62791246", "0.62752664", "0.62547666", "0.6234687", "0.6215123", "0.61998016", "0.61779594", "0.6154071", "0.61339784", "0.61324036", "0.6128269", "0.61232793", "0.61231965", "0.61050344", "0.6099721", "0.60862076", "0....
0.7048386
0
GET /viks/1 GET /viks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @viks = Vik.all\n end", "def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end", "def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.e...
[ "0.69221544", "0.6581487", "0.6558614", "0.6468531", "0.6377664", "0.63646936", "0.6353888", "0.62866795", "0.62602574", "0.6256544", "0.6234775", "0.62321854", "0.6228583", "0.6224482", "0.62148714", "0.6198122", "0.6195573", "0.61877054", "0.6175475", "0.61603016", "0.61585...
0.0
-1
POST /viks POST /viks.json
def create @vik = Vik.new(vik_params) respond_to do |format| if @vik.save format.html { redirect_to @vik, notice: 'Vik was successfully created.' } format.json { render :show, status: :created, location: @vik } else format.html { render :new } format.json { render json: @vik.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vik_params\n params.require(:vik).permit(:name, :location)\n end", "def create\n @giang_vien = GiangVien.new(params[:giang_vien])\n\n respond_to do |format|\n if @giang_vien.save \n format.json { render json: @giang_vien, status: :created, location: @giang_vien }\n else ...
[ "0.6172804", "0.58882076", "0.5830775", "0.57994336", "0.56898636", "0.5686878", "0.56786937", "0.56700015", "0.56625277", "0.55536073", "0.55027765", "0.54527456", "0.54484797", "0.54446036", "0.54393137", "0.5434924", "0.5427928", "0.5426976", "0.5415377", "0.53994936", "0....
0.70241755
0
PATCH/PUT /viks/1 PATCH/PUT /viks/1.json
def update respond_to do |format| if @vik.update(vik_params) format.html { redirect_to @vik, notice: 'Vik was successfully updated.' } format.json { render :show, status: :ok, location: @vik } else format.html { render :edit } format.json { render json: @vik.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => ...
[ "0.6780158", "0.66067696", "0.6600787", "0.6560724", "0.6530162", "0.65068805", "0.6479475", "0.6433835", "0.64264435", "0.6409649", "0.6301586", "0.6284471", "0.62842095", "0.62006736", "0.6155299", "0.6155299", "0.61254007", "0.6120311", "0.6092638", "0.60796314", "0.605813...
0.6187387
14
DELETE /viks/1 DELETE /viks/1.json
def destroy @vik.destroy respond_to do |format| format.html { redirect_to viks_url, notice: 'Vik was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",...
[ "0.7256057", "0.6970375", "0.688252", "0.6804187", "0.6804187", "0.6804187", "0.6804187", "0.6798722", "0.6796759", "0.67771894", "0.67722774", "0.6752068", "0.6714451", "0.67109984", "0.66842383", "0.6680114", "0.6680101", "0.6666853", "0.6665063", "0.66644883", "0.6658954",...
0.70095015
1
Use callbacks to share common setup or constraints between actions.
def set_vik @vik = Vik.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 vik_params params.require(:vik).permit(:name, :location) 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
This is the worker bee decoding the html into our "standard" document. Future implementations could simply override this implementationspecific code to help this grow more widely.
def parse_response(response) Lita.logger.debug "parse_response started." gimme_what_you_got = {} valid_products = {} products = {} response.split(/\n/).each do |line| if matches = line.match(/window.siteData = (.*)/) site_hash = JSON.parse matches[1].sub /;$/, '' valid_products = site_hash['page']['properties']['contentAreas']['userContent']['content']['cells'][0]['content']['properties']['products'] end if matches = line.match(/window.__BOOTSTRAP_STATE__ = (.*)/) whatevenintheshitsquarespace = JSON.parse matches[1].sub /;$/, '' products = whatevenintheshitsquarespace['commerceLinks']['products'] end end valid_products products live_products = [] valid_products.each do |p| live_products.push products[p] unless products[p].nil? end live_products.each_with_index do |beer, idx| tap = idx + 1 tap_type = '' beer_name = beer['name'].sub(/ 32oz Crowler/, '') full_text_search = "#{tap} #{beer_name}" gimme_what_you_got[tap] = { type: tap_type, name: beer_name.to_s, search: full_text_search } end gimme_what_you_got end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_html\n @document.encoding = 'UTF-8'\n @best_candidate = nil\n end", "def html_parser; end", "def parse_page\n @doc = Nokogiri::HTML(@html)\n end", "def decode_html html\n coder = HTMLEntities.new\n coder.decode html\n end", "def normalize!\n data = read\n html...
[ "0.7067447", "0.6876506", "0.64721465", "0.64503837", "0.62700224", "0.6265628", "0.6217451", "0.60732317", "0.60644275", "0.60518336", "0.6009913", "0.60089463", "0.60034865", "0.5994988", "0.5970744", "0.59587073", "0.594608", "0.5942444", "0.5865918", "0.58497345", "0.5842...
0.0
-1
Return the desc of the beer, "Amber ale 6.9%"
def get_beer_desc(noko) beer_desc = '' if (beer_desc_matchdata = noko.to_s.gsub(/\n/, '').match(/(<br\s*\/*>)(.+%) /)) beer_desc = beer_desc_matchdata[2].gsub(/\s+/, ' ').strip end beer_desc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energyEfficiency()\n\t\t\t\t\"Carbs \" + carbsPercent().round(2).to_s + \"%,\\nProteins \" + proteinsPercent().round(2).to_s + \"%\\nLipids \" + lipidsPercent().round(2).to_s + \"%\\n\"\n\t\t\tend", "def rating; \"Д/379 (stub)\"; end", "def description\n @beverage.description + \", Whip\"\n end", "d...
[ "0.6462237", "0.6441269", "0.63953495", "0.6373386", "0.63125324", "0.62942344", "0.62895375", "0.6236919", "0.62263834", "0.6210379", "0.61975354", "0.61975354", "0.61898255", "0.6172515", "0.61663246", "0.6158286", "0.61243033", "0.6109774", "0.61012185", "0.60737103", "0.6...
0.63752687
5
Add :dirty header to only regenerate this page after :update, :page_is_dirty
def initialize(args = {}) super args load_module end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dirty\n self.headers.first_or_create(:name => :dirty)\n end", "def not_dirty\n self.headers.first(:name => :dirty).destroy\n end", "def dirty?\n return !self.headers.first(:name => :dirty).nil?\n end", "def dirty; end", "def generate\n generate_header\n generate_content\n #not_d...
[ "0.6809865", "0.64503604", "0.6274907", "0.6079029", "0.5994897", "0.5992384", "0.58762354", "0.58762354", "0.5804008", "0.5747538", "0.5706043", "0.5515261", "0.54522103", "0.54360807", "0.54360807", "0.53960854", "0.537391", "0.5361784", "0.5338269", "0.53277785", "0.532777...
0.0
-1
GET /sf_cases GET /sf_cases.json
def index @sf_cases = SFCase.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t# get the current surgeon of the all case details\n\t\tcases = current_user.cases.order_by(:schedule_date=> :asc).collect{|surgery_case| surgery_case if (surgery_case.schedule.schedule_date.to_date.past? || surgery_case.schedule.schedule_date.to_date.today?)}.reject(&:blank?).take(10)\n\t\tif cases....
[ "0.715896", "0.69107765", "0.6797807", "0.6761355", "0.657797", "0.65129423", "0.65129423", "0.6412592", "0.63628095", "0.6210903", "0.61823046", "0.61806405", "0.61806405", "0.6171995", "0.6159974", "0.6093763", "0.6049241", "0.60326046", "0.6031662", "0.5975629", "0.5954513...
0.72299254
0
GET /sf_cases/1 GET /sf_cases/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t# get the current surgeon of the all case details\n\t\tcases = current_user.cases.order_by(:schedule_date=> :asc).collect{|surgery_case| surgery_case if (surgery_case.schedule.schedule_date.to_date.past? || surgery_case.schedule.schedule_date.to_date.today?)}.reject(&:blank?).take(10)\n\t\tif cases....
[ "0.6922507", "0.68706536", "0.67165285", "0.662248", "0.656913", "0.6553731", "0.6504053", "0.6504053", "0.6438967", "0.6431048", "0.641304", "0.6373067", "0.6326853", "0.6326853", "0.62571526", "0.6208362", "0.61903924", "0.6170537", "0.61690533", "0.61580616", "0.6157325", ...
0.0
-1
POST /sf_cases POST /sf_cases.json
def create @sf_case = SFCase.create(sf_case_params.to_h.symbolize_keys) respond_to do |format| if @sf_case.sf_valid? set_success_flash_message("Case was successfully created.") format.html { redirect_to @sf_case} format.json { render :show, status: :created, location: @sf_case.Id } else set_flash_error_message format.html { render :new } format.json { render json: @sf_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to cases_path, notice: 'Case was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cases_path }\n else\n format.html { ren...
[ "0.6427756", "0.64235866", "0.6267116", "0.62058043", "0.62058043", "0.6066181", "0.6026911", "0.598927", "0.59323823", "0.5841091", "0.5833083", "0.5807662", "0.57961", "0.57737774", "0.57610583", "0.57447016", "0.57447", "0.57298386", "0.5726006", "0.5719866", "0.57009304",...
0.6343145
2
PATCH/PUT /sf_cases/1 PATCH/PUT /sf_cases/1.json
def update h = sf_case_params.to_h h[:Id] = params[:id] @sf_case = SFCase.update(h.symbolize_keys) respond_to do |format| if @sf_case.sf_valid? set_success_flash_message("Case was successfully updated.") format.html { redirect_to sf_case_path(h["Id"])} format.json { render :show, status: :ok, location: @sf_case } else set_flash_error_message format.html { redirect_to edit_sf_case_path(@sf_case.Id) } format.json { render json: @sf_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @use_case = UseCase.find(params[:id])\n @use_case.data = params[:data].to_json\n\n respond_to do |format|\n if @use_case.update_attributes(params[:use_case])\n\n if params[:subaction]==\"step\"\n format.html { redirect_to requirements_project_use_case_path(@use_case.proje...
[ "0.6711896", "0.65818405", "0.6581335", "0.65460473", "0.6439138", "0.6439138", "0.6423243", "0.6403417", "0.63707453", "0.6334637", "0.6314163", "0.63080406", "0.62844574", "0.6270418", "0.624075", "0.6198778", "0.6185872", "0.6181805", "0.61810464", "0.61653215", "0.6143116...
0.64969677
4
DELETE /sf_cases/1 DELETE /sf_cases/1.json
def destroy SFCase.destroy(params["id"]) respond_to do |format| set_success_flash_message("Case was successfully destroyed.") format.html { redirect_to "/sf_cases" } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to...
[ "0.70907694", "0.70324045", "0.7020169", "0.7004433", "0.6951409", "0.69214576", "0.6884835", "0.6859916", "0.685938", "0.68189925", "0.6804692", "0.6779232", "0.67689085", "0.6729938", "0.6727825", "0.6718378", "0.6718378", "0.6716785", "0.67131567", "0.67049474", "0.6701929...
0.69513464
5
Use callbacks to share common setup or constraints between actions.
def set_sf_case @sf_case = SFCase.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 sf_case_params params.require(:sf_case).permit(SFCase.attributes) 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.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_session @session = Session.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 session_params params.require(:session).permit(:start_time, :end_time, :session_teacher, :session_student) 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
For simplicity reasons no User model was created with an api_token attribute A bare simple string is used and saved in Rails credentials mocking up a user based generated JWT that is usually stored in DB
def client_has_valid_token? request.headers["Authorization"] == Rails.application.credentials.guessing_access_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_token\n @user = T.must(current_user)\n\n authorize @user, policy_class: SettingsPolicy\n\n token = @user.api_token\n\n # Create a token if the user doesn't already have one.\n if token.nil?\n @user.api_token = Devise.friendly_token\n @user.save\n token = @user.api_token\n e...
[ "0.6974089", "0.69622314", "0.6945459", "0.6909285", "0.69007576", "0.6790934", "0.6765667", "0.6760278", "0.67437714", "0.6720777", "0.67206866", "0.6710268", "0.66933376", "0.6693311", "0.6672992", "0.66634095", "0.66634095", "0.66334426", "0.6629927", "0.66106445", "0.6610...
0.0
-1
POST /list_items POST /list_items.json
def create lip = list_item_params list_type_id: params[:list_type_id] new_item = current_user.list_items.create(lip) respond_with new_item end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n\n nested = params[:list].delete(:list_items_attributes)\n\n @list = List.new( params[:list] )\n @list.user = current_user\n\n rec...
[ "0.7753604", "0.7101967", "0.7082251", "0.6967588", "0.6956351", "0.6956212", "0.6954016", "0.6908964", "0.690295", "0.6868863", "0.68454075", "0.68431216", "0.6766986", "0.67519885", "0.67479295", "0.67349887", "0.67172563", "0.6651018", "0.6648578", "0.66200054", "0.6611196...
0.6363618
36
PATCH/PUT /list_items/1 PATCH/PUT /list_items/1.json
def update respond_to do |format| if @list_item.update(list_item_params) format.html { redirect_to @list_item, notice: 'List item was successfully updated.' } format.json { render json: @list_item, status: :ok } else format.html { render :edit } format.json { render json: @list_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end", "def update\n \n @list_item = ListItem.find(params[:id])\n\n if @list_item.update(list_i...
[ "0.785564", "0.75691766", "0.744534", "0.73121583", "0.7253285", "0.719917", "0.71629083", "0.7143798", "0.71381116", "0.7136673", "0.71193355", "0.70707685", "0.7003887", "0.69743145", "0.6894114", "0.68894434", "0.6853641", "0.68194073", "0.68167084", "0.67479396", "0.67471...
0.7044775
12
DELETE /list_items/1 DELETE /list_items/1.json
def destroy respond_to do |format| if @list_item.destroy format.html { redirect_to @list_item, notice: 'List item was successfully destroyed.' } format.json { render json: @list_item, status: :ok } else format.html { render :edit } format.json { render json: @list_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @list_item = ListItem.find(params[:id])\n @list_item.destroy\n\n respond_to do |format|\n format.html { render :nothing => true}\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\...
[ "0.76235086", "0.76060545", "0.75157684", "0.7390796", "0.7390005", "0.7372139", "0.7369137", "0.73567873", "0.7350935", "0.73371667", "0.7300441", "0.7285203", "0.726407", "0.7252846", "0.722049", "0.72115844", "0.7200179", "0.71998066", "0.71998066", "0.71998066", "0.719980...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_list_item @list_item = ListItem.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 list_item_params extras={} params.require(:list_item).merge(extras).except(:id).permit(:list_type_id, :user_id, :title, :description, :link, :onHold, :suggested) 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.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
before filters confirms a loggedin user
def logged_in_user unless logged_in? store_location flash[:danger] = "Please log in." redirect_to login_url end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_filter\n if current_user\n true\n end\n end", "def signed_in_user_filter\n if signed_in?\n redirect_to root_path, notice: \"Already logged in\"\n end\n end", "def run_filters\n set_user\n authorize\n end", "def current_user_required\n\t\t# Have to add \".filter(sel...
[ "0.75316554", "0.7312693", "0.7113758", "0.6977065", "0.69458735", "0.69021463", "0.68362516", "0.6732569", "0.6713503", "0.66977555", "0.6653625", "0.66313475", "0.66086006", "0.66001356", "0.6572119", "0.65679175", "0.65579724", "0.65499", "0.6535345", "0.65286064", "0.6522...
0.0
-1
confirms an admin user
def admin_user redirect_to(root_url) unless current_user.admin? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm_admin\n \tunless session[:admin]\n \t\tflash[:notice] = \"You are not an admin.\"\n \t\tredirect_to(user_path( :id => session[:user_id]))\n \tend\n end", "def confirm_admin\n @confirm_admin = true if session[:role_name] == 'Administrator'\n end", "def confirm_admin\n redirect_to root_...
[ "0.7697981", "0.74684256", "0.7379142", "0.7310748", "0.71069634", "0.7019786", "0.7013378", "0.6966331", "0.6966331", "0.68908453", "0.6883885", "0.682983", "0.682983", "0.68054116", "0.68000907", "0.6790239", "0.6789358", "0.6779583", "0.67254925", "0.67254925", "0.66813904...
0.0
-1
GET /card_font_alignments/1 GET /card_font_alignments/1.json
def show @card_font_alignment = CardFontAlignment.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @card_font_alignment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @card_font_alignment = CardFontAlignment.find(params[:id])\n @card_font_alignment.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_alignments_url }\n format.json { head :no_content }\n end\n end", "def new\n @card_font_alignment = CardFontAlignment....
[ "0.66101265", "0.6536163", "0.646186", "0.64389396", "0.6203049", "0.57254547", "0.5626999", "0.5492396", "0.5450507", "0.5401853", "0.522552", "0.5133387", "0.50661206", "0.4997977", "0.49974945", "0.49731597", "0.49700686", "0.4935001", "0.48866022", "0.487189", "0.48540306...
0.7276746
0
GET /card_font_alignments/new GET /card_font_alignments/new.json
def new @card_font_alignment = CardFontAlignment.new respond_to do |format| format.html # new.html.erb format.json { render json: @card_font_alignment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @card_font_alignment = CardFontAlignment.new(params[:card_font_alignment])\n\n respond_to do |format|\n if @card_font_alignment.save\n format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully created.' }\n format.json { render json: @card_f...
[ "0.79074895", "0.70507497", "0.6903067", "0.61349833", "0.60049313", "0.60009766", "0.5960521", "0.58572", "0.5854738", "0.58233094", "0.57233936", "0.56212837", "0.55723643", "0.55496264", "0.5477544", "0.54649806", "0.5435956", "0.5429204", "0.54198223", "0.54026717", "0.53...
0.79214334
0
POST /card_font_alignments POST /card_font_alignments.json
def create @card_font_alignment = CardFontAlignment.new(params[:card_font_alignment]) respond_to do |format| if @card_font_alignment.save format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully created.' } format.json { render json: @card_font_alignment, status: :created, location: @card_font_alignment } else format.html { render action: "new" } format.json { render json: @card_font_alignment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @card_font_alignment = CardFontAlignment.find(params[:id])\n\n respond_to do |format|\n if @card_font_alignment.update_attributes(params[:card_font_alignment])\n format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully updated.' }\n format....
[ "0.6230673", "0.6140851", "0.6020684", "0.59134793", "0.5847937", "0.5342949", "0.53206", "0.5187375", "0.5163735", "0.51530045", "0.5037608", "0.50356025", "0.49705786", "0.49447054", "0.49132535", "0.4880144", "0.4845965", "0.47975308", "0.47599897", "0.4710284", "0.4700965...
0.7196551
0