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
This will actually build the result. It will return a filled Hash if successful, or raise an exception, An optional block passed can be used for error reporting
def call begin build rescue => error raise ParseParamsError, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_hash(&block); end", "def create_hash(&block); end", "def each_hash(result) # :nodoc:\n raise NotImplementedError\n end", "def to_h\n (@value || HashBuilder.new(&@block)).to_h\n end", "def initialize hash, results\n\t\t\tif results == nil or results.empty?\n\t\t\t\treturn\n\n\...
[ "0.681825", "0.681825", "0.6148317", "0.60465825", "0.59784293", "0.59296453", "0.5857065", "0.57886744", "0.57885987", "0.5660827", "0.56411403", "0.5636977", "0.5570832", "0.5535696", "0.5518773", "0.5517917", "0.5451451", "0.54295266", "0.5424815", "0.54083943", "0.5406842...
0.0
-1
A private build method, which does the actual work
def build # use guard clauses to a) avoid nested ifs b) early identify invalid values raise ArgumentError, "`a` must be a Fixnum" unless dirty.fetch(:a).is_a? Fixnum # #tap will guarantee, that a hash is returned {}.tap do |h| h[:a] = dirty.fetch(:a) # a mandatory parameter, will raise a KeyError on violation h[:b] = dirty.fetch(:b, 2) # optional, with 2 as the default h[:c] = dirty.fetch(:c) if dirty.has_key? :c # optional, no default end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build; end", "def build\r\n end", "def build\r\n end", "def build\n end", "def build(params); end", "def build\n end", "def build\r\n raise \"Not implemented\"\r\n end", "def build!\n end", "def build\n yield self\n self\n end", "def build(**)\n raise ...
[ "0.78997785", "0.78483844", "0.78483844", "0.7696243", "0.7609464", "0.7424413", "0.7407312", "0.7328072", "0.7122654", "0.70935875", "0.70397294", "0.6882323", "0.6811559", "0.66734093", "0.6671611", "0.6546134", "0.6546134", "0.6546134", "0.654368", "0.64612526", "0.6457693...
0.0
-1
Mixes in test interface into the configurable module
def enable_test_interface extend Dry::Configurable::TestInterface end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_setup\r\n \r\n end", "def default_test\n end", "def default_test\n end", "def default_test; end", "def test_defaults\n end", "def default_test\r\n end", "def tests; end", "def tests; end", "def testing\n # ...\n end", "def test_frameworks; end", "def defau...
[ "0.6991464", "0.66655016", "0.6605851", "0.65801233", "0.6562955", "0.6542284", "0.6536445", "0.6536445", "0.649413", "0.6437119", "0.6367477", "0.6367477", "0.6339698", "0.6339698", "0.63125294", "0.6263373", "0.6263373", "0.6234911", "0.6210463", "0.62079734", "0.61582726",...
0.7669683
0
to achieve the desired result. You should be able to run this file from your terminal with the command `ruby day_4/exercises/methods.rb` example: Write a method below that, when called will print your name
def print_name puts "Will Meighan" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_name(name)\nputs \"Name: #{name}\"\nend", "def print_name\n p \"Alexander Mathieu\"\nend", "def print_name(name)\n p \"Hello #{name}.\"# YOUR CODE HERE\nend", "def print_name\r\nputs \"Person called #{@name}\"\r\nend", "def print_name(name)\n puts name# YOUR CODE HERE\nend", "def print_name\...
[ "0.78771806", "0.7843837", "0.78232926", "0.7800404", "0.7784476", "0.7767753", "0.77617157", "0.7752038", "0.7751821", "0.7751821", "0.7747604", "0.7747398", "0.7746", "0.77340114", "0.77244216", "0.77244216", "0.77244216", "0.77132976", "0.77130747", "0.77130747", "0.771307...
0.78658485
1
Write a method that takes an argument of your name and prints your name
def print_name(name) puts name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_name(name)\n puts \"#{name}\"\nend", "def print_name(name)\n puts \"#{name}\"\nend", "def print_name(name)\n puts \"#{name}\"\nend", "def print_name(name)\nputs \"Name: #{name}\"\nend", "def print_name(name)\n puts \"Look there! It's #{name}!\"\nend", "def print_name(name)\n p \"#{name}\"\...
[ "0.8934815", "0.8934815", "0.8934815", "0.8892572", "0.8863323", "0.8824366", "0.8824366", "0.8824366", "0.8824366", "0.8824366", "0.8823228", "0.8819393", "0.8819393", "0.8814572", "0.8813462", "0.8813462", "0.8811984", "0.87909883", "0.87722576", "0.87722576", "0.87722576",...
0.8997463
19
Write a method that takes in 2 numbers and prints their sum, then call that method.
def sum (a, b) puts a + b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_two_num(a, b)\n puts a + b\nend", "def calc_sum_two(first, second)\n\n puts \"the sum of #{first} and #{second} is #{first + second}\"\n\nend", "def print_sum(num1, num2)\n p num1 + num2\nend", "def add_two_numbers (x,y)\n puts x + y\nend", "def sum_two(num1, num2)\n p \"#{num1} + #{num2} = ...
[ "0.8268361", "0.8160775", "0.8110773", "0.8090702", "0.8087931", "0.80878836", "0.8078098", "0.8064081", "0.8061318", "0.80469036", "0.803684", "0.8035132", "0.80345863", "0.80234927", "0.80145836", "0.8010853", "0.8001085", "0.7996767", "0.7977314", "0.79598856", "0.79591864...
0.78279155
24
Write a method that takes in two strings and prints a concatenation of those two strings, for example the arguments could be (man, woman) and the end result might be "When Harry Met Sally". Then, call that method.
def love(man, woman) puts "#{man} met #{woman} at karaoke night. The rest is history." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_concat(name_1, name_2)\n puts \"I went to the concert with \" +name_1 + \" and \" + name_2 + \".\"\nend", "def two_strings(man, woman)\n p \"When \" + man + \" Met \" + woman\nend", "def concatenation(word1, word2)\n puts \"Artist #{word1} just released their newest album, titled #{word2}.\"\nend...
[ "0.80018526", "0.7917969", "0.78921556", "0.75238246", "0.73974824", "0.73771477", "0.731658", "0.71835446", "0.71426123", "0.7141337", "0.71217495", "0.71159023", "0.7114538", "0.7113363", "0.7064323", "0.70562935", "0.70531356", "0.7050587", "0.7042087", "0.6990352", "0.698...
0.6641795
55
GET /tcpdump_logs GET /tcpdump_logs.json
def index @tcpdump_logs = TcpdumpLog.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end", "def log\n @client.get(\"#{path}/log\")\n end", "def index\n @server_monitor_logs = ServerMonitorLog.fetch_log(params) \n end", "def retrieve_logs_for_download\n parse_files_for_download\n\n outpu...
[ "0.61444736", "0.5999891", "0.59523606", "0.5877743", "0.58684826", "0.5816977", "0.58129483", "0.5808105", "0.57251155", "0.56888396", "0.56809837", "0.56621057", "0.5640947", "0.55683887", "0.5550424", "0.55443877", "0.55137545", "0.55060226", "0.5446526", "0.54307395", "0....
0.73731434
0
GET /tcpdump_logs/1 GET /tcpdump_logs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tcpdump_logs = TcpdumpLog.all\n end", "def show\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n\n respond_to do |format|\n format.html { render :show, layout: false } # show.html.erb\n format.json { render json: @httping_lo...
[ "0.7060801", "0.58853596", "0.58558685", "0.58160603", "0.5812813", "0.57942075", "0.5740912", "0.57348025", "0.5674479", "0.56278396", "0.549321", "0.54276663", "0.5424898", "0.54209805", "0.5416899", "0.541523", "0.53882927", "0.53857595", "0.5374851", "0.5368773", "0.53449...
0.0
-1
POST /tcpdump_logs POST /tcpdump_logs.json
def create @tcpdump_log = TcpdumpLog.new(tcpdump_log_params) respond_to do |format| if @tcpdump_log.save format.html { redirect_to @tcpdump_log, notice: 'Tcpdump log was successfully created.' } format.json { render :show, status: :created, location: @tcpdump_log } else format.html { render :new } format.json { render json: @tcpdump_log.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tcpdump_logs = TcpdumpLog.all\n end", "def tcpdump_log_params\n params.require(:tcpdump_log).permit(:user_id, :user_data)\n end", "def set_tcpdump_log\n @tcpdump_log = TcpdumpLog.find(params[:id])\n end", "def post_create_clone\n response = self.class.post(\"/service/#{$se...
[ "0.6375744", "0.5935233", "0.59238964", "0.5730587", "0.5652033", "0.5611735", "0.55410427", "0.5426721", "0.53939605", "0.5330068", "0.5319523", "0.52957505", "0.5282459", "0.52764916", "0.52598834", "0.52533084", "0.50917816", "0.505298", "0.5037162", "0.50034153", "0.49326...
0.6979693
0
PATCH/PUT /tcpdump_logs/1 PATCH/PUT /tcpdump_logs/1.json
def update respond_to do |format| if @tcpdump_log.update(tcpdump_log_params) format.html { redirect_to @tcpdump_log, notice: 'Tcpdump log was successfully updated.' } format.json { render :show, status: :ok, location: @tcpdump_log } else format.html { render :edit } format.json { render json: @tcpdump_log.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3LogJsonUpdate(kafka_log_dir)\n println \"kafka log dir : #{kafka_log_dir}\"\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sections.each { |section|\n ...
[ "0.5817983", "0.56800187", "0.5651337", "0.5624282", "0.56066096", "0.55394477", "0.5417865", "0.5318335", "0.52756274", "0.52443546", "0.52240497", "0.5183746", "0.5169122", "0.5164319", "0.50853044", "0.5067027", "0.50628006", "0.50576913", "0.5041863", "0.4991049", "0.4967...
0.6808326
0
DELETE /tcpdump_logs/1 DELETE /tcpdump_logs/1.json
def destroy @tcpdump_log.destroy respond_to do |format| format.html { redirect_to tcpdump_logs_url, notice: 'Tcpdump log was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @logstash = Logstash.find(params[:id])\n @logstash.destroy\n\n respond_to do |format|\n format.html { redirect_to logstashes_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-tra...
[ "0.65134597", "0.63074255", "0.6267674", "0.6016508", "0.5971034", "0.5964369", "0.5955268", "0.5905765", "0.58796513", "0.58387285", "0.5835509", "0.5817114", "0.57980984", "0.5797562", "0.57947713", "0.5781482", "0.5780291", "0.5770592", "0.57682425", "0.5756064", "0.575344...
0.7358373
0
Use callbacks to share common setup or constraints between actions.
def set_tcpdump_log @tcpdump_log = TcpdumpLog.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def tcpdump_log_params params.require(:tcpdump_log).permit(:user_id, :user_data) 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 depth first method It uses recursion to dive deep as possible. When there are no more children, it checks if the payload matches the target before backing downwards. It eventually gives up when the first_node has no more children and doesn't match the payload.
def depth_first(node, target) if node.children node.children.each do |child| depth_first(child, target) end end return 'Found your target' if node.payload == target 'No luck' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def breadth_first(node, target)\n # Setup\n queue = Queue.new\n queue.enqueue(node)\n # While queue exists\n while queue.elements?\n # Pop bottom off\n current_node = queue.dequeue\n # Check if it is target or nil\n return 'Could not locate your payload :(' if current_node.nil?\n return 'Found ...
[ "0.670371", "0.6650446", "0.6513655", "0.6368222", "0.63251084", "0.6279265", "0.6264661", "0.60817873", "0.60588306", "0.60422087", "0.6009444", "0.6006707", "0.5956425", "0.58821356", "0.5867668", "0.585436", "0.58422345", "0.5784777", "0.5778536", "0.57719797", "0.57342046...
0.7293459
0
This is the breadth first method As it works its way through the tree, it adds what it finds to a queue. Because items are dequeued based on the order they come in a firstin, firstout (FIFO) fashion, the leaves are evaulated at the end the trunk at the beginning after its branches.
def breadth_first(node, target) # Setup queue = Queue.new queue.enqueue(node) # While queue exists while queue.elements? # Pop bottom off current_node = queue.dequeue # Check if it is target or nil return 'Could not locate your payload :(' if current_node.nil? return 'Found your target' if current_node.payload == target # Otherwise add its children to # back of line for checking add_kids_to_queue(current_node, queue) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bfs(tree, value)\n q = MyQueue.new\n q.enqueue(tree)\n current_tree = q.dequeue() #need to do something when i dequeue \n \n while current_tree != nil\n puts current_tree.payload\n\n if current_tree.payload != value\n current_tree.children.each do |leaf|\n q.enqueue(leaf)\n end\n ...
[ "0.78859895", "0.7632694", "0.70792097", "0.70443314", "0.7025109", "0.7009682", "0.69752085", "0.6921961", "0.6910484", "0.6780543", "0.67169476", "0.6613039", "0.6573209", "0.6558988", "0.65461046", "0.65428656", "0.6509829", "0.64741606", "0.6433896", "0.6419744", "0.64110...
0.6873657
9
Get all events from the API, get all events in chunks defined by limit and since timestamp
def get_since(timestamp, limit=20) uri = '/api/v1/pulses/events' params = {limit: limit, since: timestamp} events = [] begin json_data = get(uri, params) page = json_data['next'] params = URI::decode_www_form(URI(page).query).to_h unless page.nil? events += json_data['results'] end while !page.nil? results = [] events.each do |event| results << OTX::Event.new(event) end return results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events_request(max_pages=100)\n results = []\n max_pages.times do |page|\n # Repeatedly request events, page by page, until we reach the final page\n # of results (or for some maximum number of pages)\n req = MobilizeAmericaRequest.new(@api_key, @org_id, page+1)\n results += req.resul...
[ "0.74314517", "0.70121956", "0.6835659", "0.6781842", "0.67541605", "0.6594201", "0.6573634", "0.65617687", "0.64882636", "0.6434823", "0.639415", "0.63327134", "0.63307613", "0.63223135", "0.6309933", "0.62536615", "0.6243847", "0.6213721", "0.61043525", "0.6102592", "0.6067...
0.6563211
7
method does nothing; as long as views/posts/new.html.rb exists, new post page will be displayed /posts/new
def new # prevents nil when checking @post.errors.any? in new.html.erb @post = Post.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new #http://localhost:3000/posts/new\n\t@post = Post.new #creates a new empty post,if a form is created for it, it will be empty as well \n end", "def new\n\t\t@post = Post.new\n\t\trender :new\n\tend", "def new\n @post = Post.new\n render :new\n end", "def new\n @page = Page.new\n ...
[ "0.739904", "0.7288742", "0.728315", "0.7162108", "0.71055907", "0.70984614", "0.70984614", "0.70984614", "0.70984614", "0.70828575", "0.7081854", "0.7072925", "0.70082563", "0.69871354", "0.6986777", "0.6961107", "0.6952532", "0.6952532", "0.69297355", "0.69042814", "0.69018...
0.6958557
16
form data from /posts/new gets sent here (/posts) via POST
def create # displays post information in JSON format # render([current,] :text => params[:post].inspect ) # render text: params[:post].inspect # get post form data from params as new Post # Rails 4.0 # @post = Post.new(params[:post].permit(:title, :text)) @post = Post.new(params[:post]) # save post in sqlite db; save returns false if invalid if @post.save # send GET request to post, conveying post id => posts#show redirect_to @post else # invalid form # same form => posts#new render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new #http://localhost:3000/posts/new\n\t@post = Post.new #creates a new empty post,if a form is created for it, it will be empty as well \n end", "def new\n respond_with(@post)\n end", "def new\n # responsbile for creating a new instance of a post\n @post = Post.new\n end", "def new\n res...
[ "0.7558007", "0.7335163", "0.72869104", "0.7255449", "0.7247171", "0.7241858", "0.71924084", "0.71924084", "0.71850437", "0.7173821", "0.7142579", "0.7125772", "0.71255106", "0.7113643", "0.70952046", "0.7083919", "0.7075052", "0.7072681", "0.7072681", "0.7072681", "0.7072681...
0.7168225
10
form data from /posts/:id/edit gets sent here (/posts/:id) via PATCH
def update # get current post form data @post = Post.find(params[:id]) # update post with form data from post/:id/edit # Rails 4.0 # if @post.update(params[:post].permit(:title, :text)) if @post.update_attributes(params[:post]) redirect_to @post else # same form => posts#edit render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n post = PostsService.getPostById(params[:id])\n @post_update_form = PostUpdateForm.new(PostUpdateForm.attributes(post))\n end", "def edit \n\t@post=Post.find(params[:id])# URL is used to get de post id to find, @post gets assigned a post object, if a form is created for it, it will map such obje...
[ "0.7390354", "0.72732234", "0.7082918", "0.7036397", "0.6946387", "0.69179606", "0.6904007", "0.689846", "0.6893338", "0.6887264", "0.6857603", "0.68479586", "0.6810948", "0.680807", "0.6804186", "0.67984134", "0.67941487", "0.67941487", "0.67924577", "0.67798615", "0.6777245...
0.706704
3
link_to 'link_name', post, method: :delete goes here
def destroy @post = Post.find(params[:id]) @post.destroy # back to posts#index redirect_to posts_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_link\n link_to 'Delete', blog_post_path(model), method: :delete\n end", "def link_to_delete(path)\n link_to 'Delete', path,\n data: { confirm: 'Are you sure you want to delete?' },\n method: 'delete',\n class: 'btn btn-danger btn-xs'\n end", "def destroy\...
[ "0.7959172", "0.7734061", "0.72457945", "0.7226492", "0.7196123", "0.70085675", "0.6975256", "0.6965957", "0.6963446", "0.69621575", "0.69582254", "0.6921334", "0.69010836", "0.69010836", "0.69007975", "0.69007975", "0.69007975", "0.68970144", "0.6888937", "0.6862053", "0.686...
0.0
-1
Register new callback See main example
def callback(event, method, callback) reg_callback(event.to_sym, method.to_sym, callback.to_sym) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback\n\n end", "def definecallback(&b)\r\n\t\t\t@callback = b\r\n\t\tend", "def callback\n end", "def callback\n\tend", "def callback_method\n run(\"on\", \"string\", \"callback\")\n end", "def add_callback(type, options, &block); end", "def callback(&block)\n @callback...
[ "0.79436696", "0.7775793", "0.7760033", "0.76499873", "0.7610878", "0.76004326", "0.75556475", "0.7364512", "0.73558766", "0.73374283", "0.7248841", "0.72468543", "0.72468543", "0.72236365", "0.7213837", "0.7213837", "0.7213837", "0.7213837", "0.7102855", "0.7096066", "0.7096...
0.70218736
23
Creates an Item ownership
def create item = current_user.find_item(params[:id]) item.assign_attributes(params[:item]) response = current_user.follow_item(item) unless response.is_a? StandardError redirect_to items_path, notice: "Item suivi" else redirect_to new_item_path(item.id), alert: response.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { r...
[ "0.71065676", "0.6800479", "0.6615203", "0.6584053", "0.65206856", "0.646244", "0.6439581", "0.6412984", "0.6397264", "0.6373707", "0.63604087", "0.6359704", "0.63543564", "0.6351245", "0.6350269", "0.6338161", "0.6331081", "0.6304055", "0.62841266", "0.62719464", "0.62632835...
0.62673426
20
Updates an Item ownership
def update item = current_user.item_infos(params[:id]) item.assign_attributes(params[:item]) response = current_user.update_item(item) unless response.is_a? StandardError redirect_to items_path, notice: "Item mis a jour" else redirect_to edit_item_path(item), alert: response.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_item\n @item = current_owner.items.find(params[:id])\n end", "def update!(**args)\n @item = args[:item] if args.key?(:item)\n end", "def update!(**args)\n @item = args[:item] if args.key?(:item)\n end", "def update\n authorize! :edit, @item\n if @item...
[ "0.6524459", "0.64993316", "0.64993316", "0.64794767", "0.6428831", "0.63823146", "0.6323374", "0.63119066", "0.6305324", "0.62764156", "0.62289596", "0.622146", "0.62140685", "0.6185285", "0.61844456", "0.6155139", "0.6139814", "0.61117005", "0.6110154", "0.6087916", "0.6087...
0.6397933
5
Deletes an Item ownership
def destroy response = current_user.unfollow_item(params[:id]) redirect_to items_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item(item)\r\n items.delete(item)\r\n item.owner = nil\r\n end", "def release_item(item)\r\n if self.items.include?(item)\r\n item.owner = nil\r\n self.items.delete(item)\r\n end\r\n end", "def release_item(item)\n if self.items.include?(item)\n it...
[ "0.7630052", "0.719516", "0.7162218", "0.71107256", "0.7108014", "0.7081457", "0.6870279", "0.6864934", "0.6802759", "0.67891395", "0.67815685", "0.6777144", "0.6731851", "0.6697997", "0.66948354", "0.6656977", "0.66555476", "0.66475236", "0.66152525", "0.6614076", "0.6613086...
0.6542159
25
Find entity by ID id: ID of the entity Returns: Entity object. Returns null entity object if no result.
def find_by_id(id) raise NotImplementedError.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entity id\n @entities.each do |e|\n return e if e.id == id\n end\n end", "def find(id)\n @adapter.find(collection, id).tap do |record|\n raise Lotus::Model::EntityNotFound.new unless record\n end\n end", "def find_by_id!(id)\n found = entities.dete...
[ "0.8043405", "0.7864867", "0.7664213", "0.7542109", "0.74993473", "0.7444415", "0.7407578", "0.7390821", "0.738587", "0.7373103", "0.7341907", "0.7315604", "0.73152214", "0.7245963", "0.7219139", "0.7219139", "0.7203896", "0.71857196", "0.71790224", "0.71552527", "0.71363026"...
0.7044
27
Find entities which match all attributes attributes: Hash of attributes to match Returns: Array of entity objects.
def find_all_by(attributes = {}) raise NotImplementedError.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def semantic_find_all\n attributes = self.class.semantic_resource.columns.collect{|c| c.name.to_sym }\n conditions = { }\n params.keys.each{|p| conditions[p] = params[p] if attributes.include?(p.to_sym) }\n self.class.semantic_resource.find(:all, :conditions => conditions)\n end"...
[ "0.6427778", "0.638782", "0.60403734", "0.57986546", "0.5785672", "0.5775297", "0.5756768", "0.5647377", "0.56201416", "0.56098604", "0.55876213", "0.55650944", "0.5556188", "0.5545368", "0.5531247", "0.5526773", "0.55104667", "0.5492941", "0.5479464", "0.5423858", "0.5418994...
0.65226793
0
Parses the response to match the format requested
def parse_response(response) # @todo Parse the response based on the @format ("txt", "json" or "xml") JSON.parse(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_response\n parse_address()\n parse_expires()\n parse_token_type()\n parse_token()\n end", "def parse_response(response)\n if response.kind_of?(Net::HTTPServerError)\n raise Jamendo::Error.new(\"Jamendo Server Error: #{response} - #{response.body}\", response)\n e...
[ "0.80483395", "0.7784271", "0.7653687", "0.75649554", "0.7493407", "0.7484105", "0.74695975", "0.74392503", "0.73845387", "0.73843646", "0.7365523", "0.7263753", "0.7251216", "0.72412694", "0.72119707", "0.720483", "0.7154983", "0.71441185", "0.7129483", "0.7105247", "0.70656...
0.77555
3
1. 2 2. nil 3 Joe 4 four 5 nil print also retunrs nil, ofc
def multiply(x,y) x * y end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greet(name)\n\n if name == \"\" || name == nil\n p nil\n else\n return \"hello #{name}!\"\n end\n\nend", "def process_nil(exp)\n return \"Qnil\"\n end", "def process_nil(exp)\n return \"NULL\"\n end", "def greet(name)\n\nif name == \"\"\n p nil\nelsif name == nil\n p nil\nelse\n \"hello...
[ "0.6752813", "0.6638299", "0.6531137", "0.64756066", "0.6266328", "0.58996147", "0.58996147", "0.58889663", "0.5857725", "0.57292926", "0.5700065", "0.56931454", "0.5655186", "0.56332463", "0.561617", "0.561617", "0.561617", "0.561617", "0.561617", "0.5598927", "0.5557926", ...
0.0
-1
GET /vegetals GET /vegetals.json
def index @vegetals = Vegetal.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end", "def index\n # get meals from the user\n @meals = @user.meals\n # create a ...
[ "0.7924275", "0.7193109", "0.6944809", "0.67600524", "0.67520845", "0.6693124", "0.65943605", "0.65157497", "0.64996415", "0.64956534", "0.64890826", "0.64443564", "0.6434203", "0.6423552", "0.6415948", "0.6415948", "0.64044166", "0.63958484", "0.6374165", "0.63310677", "0.63...
0.6897319
3
GET /vegetals/1 GET /vegetals/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end", "def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n f...
[ "0.7652288", "0.71471846", "0.7011456", "0.7005884", "0.6891121", "0.67764294", "0.66231567", "0.6618944", "0.6573228", "0.6573228", "0.65539825", "0.6551145", "0.65374017", "0.65022075", "0.64776385", "0.6455948", "0.64533406", "0.6440103", "0.64285344", "0.64171034", "0.639...
0.0
-1
POST /vegetals POST /vegetals.json
def create @vegetal = Vegetal.new(vegetal_params) respond_to do |format| if @vegetal.save format.html { redirect_to @vegetal, notice: 'Vegetal was successfully created.' } format.json { render :show, status: :created, location: @vegetal } else format.html { render :new } format.json { render json: @vegetal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end", "def meals\n get(\"/user/#{@user_id}/m...
[ "0.64241505", "0.636418", "0.59712434", "0.59712434", "0.5943987", "0.59247273", "0.58807313", "0.58673614", "0.5854373", "0.58087", "0.5793811", "0.5786672", "0.5770917", "0.5764057", "0.5638997", "0.5634328", "0.56289107", "0.5600503", "0.55712026", "0.5569794", "0.55513674...
0.56794524
14
PATCH/PUT /vegetals/1 PATCH/PUT /vegetals/1.json
def update respond_to do |format| if @vegetal.update(vegetal_params) format.html { redirect_to @vegetal, notice: 'Vegetal was successfully updated.' } format.json { render :show, status: :ok, location: @vegetal } else format.html { render :edit } format.json { render json: @vegetal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n if @meal.update_attributes(params[:meal])\n format.html { redirect_to @meal, notice: 'Meal was...
[ "0.67088336", "0.6597857", "0.64493227", "0.6436514", "0.64012647", "0.62966096", "0.62724805", "0.6168222", "0.61354554", "0.6129592", "0.6128159", "0.6116136", "0.60851675", "0.60556513", "0.60460365", "0.60314006", "0.6026244", "0.60146224", "0.6014291", "0.60077524", "0.5...
0.6393831
5
DELETE /vegetals/1 DELETE /vegetals/1.json
def destroy @vegetal.destroy respond_to do |format| format.html { redirect_to vegetals_url, notice: 'Vegetal was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n ...
[ "0.73275846", "0.7312232", "0.7207961", "0.7045363", "0.7031213", "0.6980636", "0.6958161", "0.6918578", "0.6908355", "0.690039", "0.6876018", "0.6874686", "0.68600106", "0.68297756", "0.6808887", "0.6807172", "0.6788572", "0.6788572", "0.6787185", "0.67865074", "0.67835486",...
0.6961546
6
Use callbacks to share common setup or constraints between actions.
def set_vegetal @vegetal = Vegetal.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 vegetal_params params.require(:vegetal).permit(:name, :color, :weight, :price) 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
TODO: move into resource_status.rb
def container_names (@pod.dig(:spec, :containers) + self.class.init_containers(@pod)).map { |c| c.fetch(:name) }.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_status\n lambda { |x| x.resource_status }\n end", "def resource_status\n lambda { |x| x[\"resource_status\"] }\n end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def sta...
[ "0.7921771", "0.78456193", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68320155", "0.68117785", "0.6688334", "0.66043454", "0.6593708", "0.6593708", "0.6593708", "0.6593708", "0.6590753", "0....
0.0
-1
tries to get logs from current or previous pod depending on if it restarted TODO: move into resource_status.rb
def logs(container, end_time) fetch_logs(container, end_time, previous: !!restart_details) rescue *SamsonKubernetes.connection_errors # not found or pod is initializing begin fetch_logs(container, end_time, previous: !restart_details) rescue *SamsonKubernetes.connection_errors nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_logs(container, end_time, previous:)\n name = @pod.dig_fetch(:metadata, :name)\n namespace = @pod.dig_fetch(:metadata, :namespace)\n\n if previous\n SamsonKubernetes.retry_on_connection_errors do\n tries = 3\n tries.times do |i|\n logs = @c...
[ "0.6443494", "0.6362293", "0.5801088", "0.56677365", "0.5655261", "0.5635417", "0.5576907", "0.5562362", "0.54712373", "0.54684883", "0.54573697", "0.53721106", "0.5315064", "0.52745074", "0.5199533", "0.51567996", "0.512849", "0.51157093", "0.5072117", "0.5071511", "0.504231...
0.7094788
0
if the pod is still running we stream the logs until it times out to get as much info as possible necessary since logs often hang for a while even if the pod is already done
def fetch_logs(container, end_time, previous:) name = @pod.dig_fetch(:metadata, :name) namespace = @pod.dig_fetch(:metadata, :namespace) if previous SamsonKubernetes.retry_on_connection_errors do tries = 3 tries.times do |i| logs = @client.get_pod_log(name, namespace, container: container, previous: true) # sometimes the previous containers logs are not yet available, so we have to wait a bit return logs if i + 1 == tries || !logs.start_with?("Unable to retrieve container logs") Rails.logger.error("Unable to find logs, retrying") sleep 1 end end else wait = end_time - Time.now if wait < 2 # timeout almost over or over, so just fetch logs SamsonKubernetes.retry_on_connection_errors do @client.get_pod_log(name, namespace, container: container) end else # still waiting, stream logs result = +"" begin timeout_logs(wait) do SamsonKubernetes.retry_on_connection_errors do @client.watch_pod_log(name, namespace, container: container).each do |log| result << log << "\n" end end end rescue Timeout::Error result << "... log streaming timeout" end result end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_logs()\n if @container.nil?\n 'not yet'\n else\n wait_for_start_up\n @container.logs_container\n end\n end", "def logs(container, end_time)\n fetch_logs(container, end_time, previous: !!restart_details)\n rescue *SamsonKubernetes.connection_errors # not found or p...
[ "0.67510223", "0.6507706", "0.58680236", "0.5797776", "0.57967514", "0.5644862", "0.5505035", "0.5498189", "0.548772", "0.5414216", "0.54120725", "0.53887165", "0.53561366", "0.5310271", "0.53012544", "0.52193516", "0.5210961", "0.5166049", "0.5161958", "0.5127103", "0.511051...
0.65383685
1
per default is 3 by default checks every 10s so that gives us 30s to pass
def failure_threshold(event, probe_name) return unless container_name = event.dig(:involvedObject, :fieldPath).to_s[/\Aspec.containers{(.*)}\z/, 1] return unless container = @pod.dig(:spec, :containers).detect { |c| c[:name] == container_name } return unless probe = container[probe_name] probe[:failureThreshold] || 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def throttles; end", "def worker_check_interval(interval); end", "def timer_checkpoints\n t = self.time_remaining\n if @timer_checkpoint_hash[30] < 3 && t <= 40\n @timer_checkpoint_hash[30] += 1\n tab; \"#{@time_remaining} seconds ...
[ "0.6349532", "0.62930137", "0.6247543", "0.6146383", "0.61417973", "0.6082143", "0.60600024", "0.6010581", "0.6009192", "0.5959624", "0.59469604", "0.59085053", "0.5873613", "0.5831092", "0.5830454", "0.58053994", "0.5797328", "0.57952994", "0.57734823", "0.57679296", "0.5761...
0.0
-1
Display form for users to edit their profile information
def edit add_breadcrumb t(:'hyrax.controls.home'), root_path add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path add_breadcrumb t(:'hyrax.admin.sidebar.profile'), hyrax.dashboard_profile_path @trophies = Hyrax::TrophyPresenter.find_by_user(@user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_profile\n \t@user = UsersService.findUserById(params[:id])\n \tuser = UsersService.findUserById(params[:id])\n \t@user_profile_form = UserProfileForm.new(UserProfileForm.attributes(user, :edit_profile))\n end", "def edit_profile\n @user = UserService.getUserById(params[:id])\n @profile_form = ...
[ "0.8063085", "0.794261", "0.7899535", "0.77232766", "0.7710353", "0.7619232", "0.76006776", "0.7592443", "0.75523394", "0.7516237", "0.7487753", "0.7461063", "0.74524486", "0.74344945", "0.74272305", "0.7426131", "0.7421678", "0.73960567", "0.73688626", "0.73624825", "0.73532...
0.0
-1
Process changes from profile form
def update if conditionally_update handle_successful_update redirect_to hyrax.dashboard_profile_path(@user.to_param), notice: "Your profile has been updated" else redirect_to hyrax.edit_dashboard_profile_path(@user.to_param), alert: @user.errors.full_messages end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @presenter = find_presenter\n @presenter_profile = @presenter.presenter_profile\n \n if @presenter_profile.nil?\n redirect_to new_presenter_profile_path(@presenter)\n else\n new_profile = profile_params\n new_profile[:bio_edit] = sanitize_bio(new_profile[:bio_edit])\n ...
[ "0.7027984", "0.68597144", "0.6850021", "0.67736727", "0.6676639", "0.66017526", "0.6590018", "0.65875506", "0.6583135", "0.65780526", "0.656813", "0.6565079", "0.6524092", "0.6472167", "0.6432418", "0.6392501", "0.6387466", "0.6374663", "0.6370971", "0.6366417", "0.6359698",...
0.6425936
15
Update user if they sent user params, otherwise return true. This is important because this controller is also handling removing trophies. (but we should move that to a different controller)
def conditionally_update return true unless params[:user] @user.update(user_params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n\n # below line calls a function, user_param(). user_param() does the validation. it sees whether the user entered the correct params. We dont't want the current user to put any params and do a request. only correct params should be allowed\n if @user.update(user_p...
[ "0.7609839", "0.74431664", "0.7418892", "0.73948234", "0.736899", "0.7353197", "0.7341994", "0.7333794", "0.73275036", "0.7282859", "0.72778785", "0.7264407", "0.7263601", "0.726248", "0.7256387", "0.7224601", "0.7216373", "0.7198148", "0.7196749", "0.71924657", "0.71870023",...
0.8410162
0
if the user wants to remove any trophies, do that here.
def process_trophy_removal params.keys.select { |k, _v| k.starts_with? 'remove_trophy_' }.each do |smash_trophy| smash_trophy = smash_trophy.sub(/^remove_trophy_/, '') current_user.trophies.where(work_id: smash_trophy).destroy_all end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_tower\n end", "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def remove_toy(toy)\n if toy.template.identifier != Constants::SCENE_TOY_IDENTIFIER\n undoManager.registerUndoWithTarget(self, selector: 'add_toy:', object: toy)\n @toys_in_scene.delete(t...
[ "0.70534205", "0.6549514", "0.6549514", "0.6549514", "0.6549514", "0.6531478", "0.64298946", "0.6389774", "0.63273007", "0.63021016", "0.628997", "0.6166968", "0.61511564", "0.6116899", "0.6105573", "0.6082979", "0.6055923", "0.6039372", "0.59806645", "0.5962733", "0.59596276...
0.69916236
1
Override ActiveRecord::Base to_param TODO: Is there a way to make it called automatically by routes helpers?
def to_param { project_namespace: owner.username, project_slug: slug } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_param; end", "def to_param # This overwrites the 'to_param' method (That is called by default in the views with something like: 'edit_post_path(@post)'). It is overridden so that the slug can be executed.\n self.slug #.slug method comes from the 'slug' column in the 'posts' table.\n end", "def to_p...
[ "0.7565333", "0.74053246", "0.7325163", "0.72715753", "0.71727", "0.7150078", "0.70832694", "0.70832694", "0.7062183", "0.70027167", "0.69893646", "0.69714135", "0.68639123", "0.68598944", "0.68598944", "0.68598944", "0.6859206", "0.68227917", "0.68227917", "0.68196476", "0.6...
0.0
-1
To render with the distance to
def setOrigin(origin) @origin = origin end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_measurement; end", "def distance\n self.distance_from(@origin) * 1.609344\n end", "def distance_to(loc2)\n self.point.ellipsoidal_distance(loc2.point)/1000\n end", "def distance_to_back(view)\n bb = view.model.bounds\n eye = view.camera.eye\n dir = view.camera.direction\n dis...
[ "0.6020261", "0.58282685", "0.5779742", "0.5771285", "0.5745407", "0.57192636", "0.57026416", "0.5639244", "0.56268823", "0.56268823", "0.56156003", "0.5606154", "0.56012917", "0.55733407", "0.555621", "0.5532722", "0.5525879", "0.55068237", "0.54987854", "0.549208", "0.54920...
0.0
-1
To render the distance to in json
def distance self.distance_from(@origin) * 1.609344 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance\n @data['distance']['value']\n end", "def distance\n properties['distance']\n end", "def distance\n distance_and_arc[:distance]\n end", "def distance\n distance_and_arc[:distance]\n end", "def distance object\n GeographyHelper.distance latitude, longitude, object...
[ "0.7657505", "0.72963095", "0.6667321", "0.6667321", "0.66276616", "0.6533284", "0.6524538", "0.6521682", "0.6459691", "0.6397805", "0.6287605", "0.6256217", "0.62031233", "0.61791724", "0.6121099", "0.6092789", "0.6048885", "0.59147966", "0.5911462", "0.58945143", "0.5879756...
0.62168515
12
This will probably never change; but in cases
def grant_type "refresh_token" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def used?; end", "def same; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def internship_passed; end", "def anchored; end", "def offences_by; end", "def schubert; end", "def who_we_are\r\n end", "def internal?; ...
[ "0.7232065", "0.6599151", "0.6452106", "0.6353735", "0.62078017", "0.62078017", "0.62078017", "0.62078017", "0.6190773", "0.61850023", "0.616959", "0.6167359", "0.6047141", "0.5915138", "0.5903564", "0.5885422", "0.5881407", "0.5867337", "0.58647263", "0.5864641", "0.58573776...
0.0
-1
This method is still ugly and could use some cleanup.
def api(method, url, options = {}) unless [:get, :delete, :post, :put, :patch].include? method raise "Unknown REST method: #{method}" end config = RequestConfig.new config.authorization_bearer = @authorization_bearer config.method = method config.access_token = options[:access_token] config.request_params = options[:request_params] config.request_body = options[:request_body] config.content_type = "application/json" unless url == @refresh_token_url config.form_encoding = true if url == @refresh_token_url refresh_token = options[:refresh_token] user_uid = options[:user_uid] puts "*" * 88 puts url.to_s puts method.to_s configp = config.dup puts configp.finalize!.to_hash.inspect puts "*" * 88 request = Typhoeus::Request.new url, config.finalize! request.on_complete do |response| case when response.success? puts "Success" @callback_request_made.call return Echidna::Response.new response when response.timed_out? puts "Timed out. Is google down?" return Echidna::Error.new response when response.code == 401 puts "In refresh block" if refresh_token && @client_id && @client_secret new_access_token = fetch_new_access_token(user_uid, refresh_token) options.delete(:refresh_token) options[:access_token] = new_access_token return api(method, url, options) else return Echidna::Error.new response end when response.code == 0 puts"Could not get an http response, something's wrong." return Echidna::Error.new response else puts "HTTP request failed: #{response.code}" return Echidna::Error.new response end end @hydra.queue(request) @hydra.run request end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def internal; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def continued_exception; end", "def refutal()\n end", "def escaper; end", "def used?; end", "def implementation; end", "def impl...
[ "0.71707755", "0.58906937", "0.5710041", "0.559744", "0.55509555", "0.55509555", "0.55509555", "0.55509555", "0.55278456", "0.54767865", "0.54401076", "0.53696835", "0.53450876", "0.53450876", "0.5342907", "0.53367764", "0.5315195", "0.53122306", "0.5302294", "0.5287955", "0....
0.0
-1
Set default balance to 0
def set_defaults self.balance ||= 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_balance!(value)\n\t\t@balance.balance = value\n\t\t@bet = 0 \n\tend", "def update_normal_balance\n self.normal_balance = :none\n end", "def initialize\n @balance = 0\n end", "def default_values\n self.cash ||= 0.0\n end", "def private_reset!\n @balance = 0\n end", "def balance...
[ "0.74693877", "0.74277264", "0.74271846", "0.70978135", "0.69049", "0.68594307", "0.6772159", "0.6772159", "0.67370886", "0.6696416", "0.66454554", "0.6548945", "0.6536703", "0.65297747", "0.6502492", "0.6451147", "0.64247555", "0.6390928", "0.63666725", "0.6363551", "0.63564...
0.8344647
0
Get All Product in Wishlist for User
def index @wishlist = Wishlist.where(:user_id => current_user.id) @wishlist_items = Wishitem.where(:wishlist_id => @wishlist) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wishers\n @items = UserProductWish.includes(:account).where({product: @product}).all\n end", "def index\n @wishlists = Wishlist.where(user_id: current_user.id)\n end", "def wishlist\n @lineItems = LineItem.where(\"user_id = ? AND line_item_type = ?\", current_user.id, 1)\n @items = Array.new\...
[ "0.8161806", "0.7293703", "0.70846957", "0.7038927", "0.6913601", "0.6867886", "0.6767524", "0.6754371", "0.6741246", "0.66906977", "0.662427", "0.66124076", "0.6609344", "0.6594031", "0.6560187", "0.65120506", "0.6508213", "0.6504744", "0.6483553", "0.64579093", "0.643969", ...
0.73153555
1
Add new Product to User Wishlist
def create @wishlist = Wishlist.find_by(:user_id => current_user.id) @wishlist_items = Wishitem.new(:wishlist_id => @wishlist.id, :product_id => params[:prod_id]) @wishlist_items.save if @wishlist_items.save redirect_to "/products?page=#{params[:page]}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @wish_list = current_user.wish_list\n product = Product.find(params[:product_id])\n @wish_list_item = @wish_list.add_product(product.id, @wish_list)\n\n if @wish_list_item.present?\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_lis...
[ "0.8237866", "0.8101148", "0.780466", "0.77029306", "0.76179504", "0.75451744", "0.747445", "0.73972887", "0.73569447", "0.73048335", "0.727487", "0.72177535", "0.7107785", "0.7104456", "0.70695543", "0.69813377", "0.69730824", "0.6944625", "0.68806237", "0.68629426", "0.6836...
0.74407613
7
Delete Product from User Wishlist and My Wishlist
def update @wishlist = Wishlist.where(:user_id => current_user.id) @wishlist_item = Wishitem.find_by(:wishlist_id => @wishlist, :product_id => params[:id]) @wishlist_item.destroy if params.has_key?(:page) redirect_to "/products?page=#{params[:page]}" else redirect_to mywishlist_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove\n product = Product.find(params[:id])\n wishlist = Wishlist.get_current(current_user, session)\n wishlist.products.delete(product)\n render :update do |page| \n page.remove(\"dg_#{product.id}\")\n end\n end", "def destroy\n user = current_user\n item_id = Sneaker.f...
[ "0.77121717", "0.7423772", "0.73557127", "0.7291427", "0.7243399", "0.7198574", "0.71544874", "0.7057266", "0.6974991", "0.69495976", "0.6948526", "0.69247", "0.6922548", "0.6922494", "0.6891624", "0.68876725", "0.6872537", "0.68624336", "0.6834646", "0.6803184", "0.6803184",...
0.70712453
7
GET /deweys_power_panels/1 GET /deweys_power_panels/1.xml
def show @deweys_power_panel = DeweysPowerPanel.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @deweys_power_panel } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @deweys_power_panel = DeweysPowerPanel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end", "def show\n @control_panel = ControlPanel.find(params[:id])\n\n respond_to do |format|\n format.html # sho...
[ "0.68875563", "0.6160967", "0.6099372", "0.6072872", "0.6007726", "0.595271", "0.5877756", "0.58201545", "0.5772484", "0.5761619", "0.5709142", "0.56904787", "0.55829525", "0.5543981", "0.55125684", "0.5498244", "0.549163", "0.54705864", "0.54200953", "0.5403486", "0.53592336...
0.74794734
0
GET /deweys_power_panels/new GET /deweys_power_panels/new.xml
def new @deweys_power_panel = DeweysPowerPanel.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @deweys_power_panel } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n ...
[ "0.7264215", "0.7264215", "0.7020272", "0.7006462", "0.67583954", "0.6717895", "0.6667412", "0.6500836", "0.64193964", "0.6327084", "0.62764204", "0.6251684", "0.6240131", "0.6238065", "0.6238065", "0.62156534", "0.62051886", "0.6195547", "0.61909485", "0.61761475", "0.617347...
0.77730215
0
POST /deweys_power_panels POST /deweys_power_panels.xml
def create @deweys_power_panel = DeweysPowerPanel.new(params[:deweys_power_panel]) respond_to do |format| if @deweys_power_panel.save format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully created.') } format.xml { render :xml => @deweys_power_panel, :status => :created, :location => @deweys_power_panel } else format.html { render :action => "new" } format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @deweys_power_panel = DeweysPowerPanel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end", "def update\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n\n respond_to do |format|\n if @de...
[ "0.6466403", "0.5780193", "0.577855", "0.5748411", "0.5694396", "0.54189277", "0.54148465", "0.5409598", "0.53909653", "0.53635186", "0.52615803", "0.5254718", "0.52017796", "0.5157608", "0.5105268", "0.5103327", "0.5099746", "0.5090005", "0.50723594", "0.5055526", "0.5022072...
0.67720073
0
PUT /deweys_power_panels/1 PUT /deweys_power_panels/1.xml
def update @deweys_power_panel = DeweysPowerPanel.find(params[:id]) respond_to do |format| if @deweys_power_panel.update_attributes(params[:deweys_power_panel]) format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render ...
[ "0.6222639", "0.60940707", "0.59898514", "0.57851976", "0.57086146", "0.56935716", "0.5675835", "0.56312835", "0.5628273", "0.56208944", "0.56162226", "0.55742097", "0.5571035", "0.554381", "0.5540606", "0.54907674", "0.5459304", "0.545275", "0.5413396", "0.5346857", "0.53178...
0.69261694
0
DELETE /deweys_power_panels/1 DELETE /deweys_power_panels/1.xml
def destroy @deweys_power_panel = DeweysPowerPanel.find(params[:id]) @deweys_power_panel.destroy respond_to do |format| format.html { redirect_to(deweys_power_panels_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @panel = Panel.find(params[:id])\n @panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_panels_url) }\n format.xml { head :ok }\n end\n end", "def db_delete\n assert_privileges(\"db_delete\")\n db = MiqWidgetSet.find(params[:id]) # temp var to de...
[ "0.66161394", "0.6483721", "0.6431325", "0.64098597", "0.6353968", "0.6326145", "0.61060643", "0.6058511", "0.60335845", "0.60222405", "0.59469676", "0.59414166", "0.59278786", "0.59043276", "0.5904092", "0.5876605", "0.5857822", "0.5848203", "0.58439285", "0.5841582", "0.578...
0.7286688
0
called by insurance_billing/sidebar_right also called by _patient_claim partial sums the eob payments
def ins_billing_eob_payments(billing) payment = 0 billing.eobs.each do |eob| payment += eob.payment_amount end return payment end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_payment_amount\n sum = 0.00\n unless self.insurance_payment_eobs.blank?\n self.insurance_payment_eobs.each do |eob|\n (sum = sum + eob.total_amount_paid_for_claim) unless eob.total_amount_paid_for_claim.nil?\n end\n end\n sum\n end", "def total_paid\n payments.collect{|...
[ "0.7652741", "0.67494065", "0.6648929", "0.6575665", "0.6561365", "0.6505679", "0.6489193", "0.64879656", "0.64559513", "0.64511836", "0.6368417", "0.63551235", "0.63456786", "0.633976", "0.63067675", "0.6282871", "0.6269264", "0.6218245", "0.6212941", "0.6212941", "0.6187269...
0.68316364
1
Display the dashboard No special parameters required.
def show @hooks = Hook.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashboard\r\n end", "def show\n dashboard_4\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard; end", "def dashboard\n\n end", "def dashboard\n\n end", "def dashboard\n\tend", "def show\...
[ "0.7972295", "0.78707045", "0.7781308", "0.7781308", "0.7781308", "0.7781308", "0.7781308", "0.7756131", "0.7733077", "0.7733077", "0.76448286", "0.7567058", "0.7245519", "0.71104765", "0.70144916", "0.6953155", "0.69396025", "0.69349486", "0.6761453", "0.67217267", "0.672172...
0.0
-1
Simulation for 16Bit ALU and 16Bit Multiplier By Kenneth Willeford This simulation imitates the two titled modules by copying them structurally. This program handles the structuring with more of a functional approach than object oriented. My signals and registers are represented with numbered arrays ie: [0,1,0,0] is the same as 0100 Due to this I made my own shift functions so that they can have the functionality of the shift registers. Just run the code in a ruby interpreter and it will run on it's own, the test cases are already in, you just have to press enter when prompted. ======================================================================= Logic Gates Computes &,|,^,!
def AND(x,y); if x==1 && y==1 then 1 else 0 end; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main\n\tputs \"begin press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1],[0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0],[0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1])\n\tputs \"next case, press en...
[ "0.6594194", "0.65275806", "0.5700699", "0.56970227", "0.5559927", "0.53669065", "0.53423995", "0.52245045", "0.5219603", "0.52098453", "0.51473993", "0.5113223", "0.50927085", "0.5054392", "0.50006187", "0.49979654", "0.49350786", "0.49280348", "0.49208134", "0.48980668", "0...
0.0
-1
2x1 MUX for the Signal Inverter Demonstrated The correctness of it in the VHDL programs. Essentially the logic table overlapped with XOR.
def MUX2X1(x,y) XOR(x,y); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend", "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs s...
[ "0.61308324", "0.60354596", "0.56096935", "0.49807534", "0.48948556", "0.48775753", "0.48574287", "0.48422933", "0.48116565", "0.48076978", "0.48066938", "0.47816104", "0.4742279", "0.47189614", "0.46197274", "0.46128288", "0.4603881", "0.46037883", "0.45805857", "0.45781627", ...
0.7046255
0
1Bit FullAdder Built Structurally, it outputs sum and carry out as a 2 element array
def ADDER(a,b,cin) return XOR(XOR(a,b),cin) , OR(AND(a,b),AND(cin,XOR(a,b))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summing_method\n @summed_array = @single_digit_array.sum\n end", "def full_adder (p, q, carry_in=0)\n first_adder = half_adder(p,q)\n second_adder = half_adder(first_adder[0],carry_in)\n carry_out = first_adder[1] | second_adder[1]\n sum_out = second_adder[0]\n return sum_out, carry_out\nend", "de...
[ "0.6483883", "0.6384265", "0.616403", "0.6076779", "0.6051895", "0.6030464", "0.60271865", "0.5995438", "0.5946434", "0.58819675", "0.57304466", "0.5717562", "0.5693188", "0.5693188", "0.5688276", "0.56681", "0.5656483", "0.5644136", "0.5634154", "0.5622131", "0.56212807", ...
0.0
-1
2BitDecoder Maps a 2bit op signal into a size 4 array of signals. Only one of which are true.
def DECODER2(x,y) #Sends out an array of decoded values return AND(NOT(x),NOT(y)),AND(NOT(x),y),AND(x,NOT(y)),AND(x,y) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decoder_stub(state)\n\t\t[\n\t\t\t0x7ca52a79, # 0x1da4 <main>: xor. r5,r5,r5\n\t\t\t0x4082fffd, # 0x1da8 <main+4>: bnel+ 0x1da4 <main>\n\t\t\t0x7fe802a6, # 0x1dac <main+8>: mflr r31\n\t\t\t0x3bffd00c, # 0x1db0 <main+12>: addi r31,r31,-12276\n\t\t\t0x38a53...
[ "0.5091598", "0.50061184", "0.4942068", "0.48001218", "0.47916391", "0.47879806", "0.47845063", "0.4766525", "0.4737892", "0.4711896", "0.47009572", "0.46803588", "0.466656", "0.4640637", "0.46343356", "0.4631657", "0.4624498", "0.46098036", "0.4607275", "0.4586002", "0.45826...
0.58601004
0
4X1 MUX Utilizes the 2BitDecoder to map the op signal to the correct ALU output.
def MUX4X1(x,y,a,b,op1,op0) d = DECODER2(op1,op0) OR(OR(AND(x,d[0]),AND(y,d[1])),OR(AND(a,d[2]),AND(b,d[3]))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def ALU1BIT(a,b,ci...
[ "0.58622676", "0.5829425", "0.55989224", "0.54765165", "0.45580408", "0.45497286", "0.44815424", "0.4452793", "0.43854693", "0.43729267", "0.43053705", "0.4270969", "0.42696092", "0.42582706", "0.41968408", "0.41244057", "0.4109976", "0.4109244", "0.4109063", "0.40523973", "0...
0.73065
0
1Bit ALU Computes and,or,sum and sends out the overflow, result and a carry out.
def ALU1BIT(a,b,cin,binv,op1,op2) b = MUX2X1(b,binv) sUM_RESULT = ADDER(a,b,cin) #Send out an array pair of result, cout return MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def ALU16BIT(a,b,c...
[ "0.73391306", "0.6301429", "0.56117994", "0.5508578", "0.5476454", "0.54740465", "0.54649043", "0.5460478", "0.5322453", "0.5322453", "0.5267645", "0.5259907", "0.5227519", "0.52066934", "0.52048963", "0.520191", "0.517917", "0.517917", "0.514145", "0.5128445", "0.51220125", ...
0.719777
1
OF_CHECKING for special 1Bit ALU Determines the overflow structurally.
def OF_CHECKING(a,b,sum) AND(XOR(sum,a),NOT(XOR(a,b))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkOverflow(testee)\r\n if(testee > ((2**32) - 1)/2 )\r\n return true\r\n elsif(testee < (-1) * 2**31)\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def can_overflow?\n false\n end", "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RES...
[ "0.6399198", "0.63429314", "0.59655744", "0.577092", "0.5697214", "0.5576874", "0.54894495", "0.53329", "0.5220747", "0.5174487", "0.5170145", "0.51628995", "0.51388925", "0.5131029", "0.5130343", "0.51157725", "0.5109279", "0.50655705", "0.5053869", "0.5045028", "0.5045028",...
0.52185214
9
1Bit ALU with Overflow Checking Same as ALU but with Overflow Checking
def ALU1BIT_OF (a,b,cin,binv,op1,op2) b = MUX2X1(b,binv) sUM_RESULT = ADDER(a,b,cin) puts sUM_RESULT[0] ovf = OF_CHECKING(a,b,sUM_RESULT[0]) #Send out an array triple of result, cout, overflow return MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend", "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU...
[ "0.69342935", "0.69096833", "0.6019998", "0.58267874", "0.5818347", "0.5818347", "0.5772398", "0.56728095", "0.55925494", "0.55873275", "0.558292", "0.5573747", "0.5526309", "0.5522666", "0.5484536", "0.5483262", "0.5482124", "0.5469806", "0.5417867", "0.53806317", "0.5374884...
0.7322821
0
16Bit ALU Connects 16 1Bit ALUs to create a 16 bit result. The last ALU checks for overflow.
def ALU16BIT(a,b,cin,binv,op1,op2) result = [nil]*16 15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)} result[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2) #Send out our result, carry out, and overflow return result,cout,ovf end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uint16()\n _uint16(\"uint16\")\n end", "def u16\n next_bytes(2).unpack(\"S>\").first\n end", "def uint16(*payloads)\n fixnums(2, FormatStrings::UINT16, payloads)\n end", "def i16u\n little? ? BinUtils.get_int16_le(read(2)) : BinUtils.get_int16_be(read(2)...
[ "0.65374905", "0.640786", "0.63783634", "0.6296515", "0.627977", "0.6131336", "0.5857883", "0.5770558", "0.5723808", "0.5638667", "0.5562039", "0.5472757", "0.5449914", "0.5394178", "0.5371754", "0.530306", "0.52883154", "0.52779806", "0.527611", "0.5251712", "0.5246984", "...
0.800406
0
Prints the State of the 16Bit Multiplier
def printState(count,md,mq,ac) puts(count.to_s(2)) puts("MD:" + md.join) puts("AC:" + ac.join) puts("MQ:" + mq.join) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_state\n @@rows.times do |row|\n @@columns.times do |column|\n print '%4.4s' % @state_array[row * @@columns + column].to_s,\" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end", "def MULTIPLIER16BIT(multiplicand,multiplier)\n\taccumulator = ([0]*16)+multiplier\t\t\t\t...
[ "0.61566436", "0.58458483", "0.5801427", "0.5730938", "0.5717868", "0.5710503", "0.5687146", "0.568005", "0.5645783", "0.5645231", "0.5641426", "0.5633778", "0.5554697", "0.5550404", "0.55499506", "0.5548444", "0.5537471", "0.55129886", "0.5502262", "0.54755956", "0.5473547",...
0.603645
1
16Bit Multiplier Performs shift multiplication on two register values and outputs the values in a 32bit register.
def MULTIPLIER16BIT(multiplicand,multiplier) accumulator = ([0]*16)+multiplier #Initialize Concatenated Register [AC]+[MQ] count = 16 #Initialize n-bit count. printState(count,multiplicand,accumulator[16,32],accumulator[0,16]) while(count>=0) #Start: if shiftRight(accumulator) == 1 #Shiftout rightmost bit of [AC|MQ] and test it. accumulator[0,16] = ALU16BIT(multiplicand,accumulator[0,16],0,0,1,0)[0] #If it's 1 then AC = AC+MD end printState(count,multiplicand,accumulator[16,32],accumulator[0,16]) count -=1 #Decrement n-bit count by 1. end #If count >= 0 then goto Start count = 0 printState(count,multiplicand,accumulator[16,32],accumulator[0,16]) accumulator+multiplier end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word16(a, b)\n (a << 8) | b\n end", "def word16(bytes_a, bytes_b)\n (bytes_a << 8) | bytes_b\n end", "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)}\n\tresult[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2)\...
[ "0.62553686", "0.57320726", "0.554205", "0.548405", "0.5399427", "0.5135696", "0.5019342", "0.49688086", "0.49688086", "0.496511", "0.49536118", "0.484081", "0.48359263", "0.47815377", "0.47711468", "0.47600517", "0.47363007", "0.4700563", "0.464522", "0.46444798", "0.4628473...
0.7001033
0
Shifts a Register to the Right
def shiftRight(register) register.unshift(0).pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shiftLeft(register)\n\tregister.shift\n\tregister.push(0)\nend", "def shift_right\n @mid, @value2, @right = @left, @value1, @mid\n end", "def shift_right\n self.unshift(self.pop)\n end", "def move_right\n @memory_position += 1\n @memory_position = 0 if @memory_position > 0xfffffe\n end...
[ "0.71826947", "0.6885217", "0.66808", "0.6603987", "0.6572543", "0.65169823", "0.65169823", "0.63881755", "0.6375488", "0.6358082", "0.6358082", "0.6291538", "0.6236523", "0.6179961", "0.6179961", "0.6179961", "0.60492164", "0.59982747", "0.59806234", "0.5979064", "0.5964224"...
0.8117424
0
Shifts a Register to the Left
def shiftLeft(register) register.shift register.push(0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shiftRight(register)\n\tregister.unshift(0).pop\nend", "def shift_left\n self.push(self.shift)\n end", "def shift_left\n @left, @value1, @mid = @mid, @value2, @right\n end", "def rotate_left(value, shift)\n ((value << shift) | (value >> (20 - shift))) & 0xFFFFF\n end", "def move_left\n ...
[ "0.77925456", "0.73051286", "0.72569007", "0.7148327", "0.69198847", "0.6785762", "0.6785762", "0.6723873", "0.66384447", "0.6615102", "0.66004956", "0.66004956", "0.6593669", "0.6586902", "0.6556738", "0.64791524", "0.6435789", "0.6435789", "0.6435789", "0.62645733", "0.6241...
0.84941745
0
Main Runs each of the test cases.
def main puts "begin press enter..." wait = gets MULTIPLIER16BIT([0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1],[0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0]) puts "next case, press enter..." wait = gets MULTIPLIER16BIT([0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0],[0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1]) puts "next case, press enter..." wait = gets MULTIPLIER16BIT([1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0],[0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1]) puts "next case, press enter..." wait = gets MULTIPLIER16BIT([0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1],[1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0]) puts "press enter to exit the program..." wait = gets end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n print_banner\n @test_plan.each do |plan|\n found_nodes = nodes(plan)\n if found_nodes\n found_nodes.each { |node| execute_plan_tests(node, plan) }\n end\n end\n exit @ret_code\n end", "def run\n test_files.each do |file|\n eval Fi...
[ "0.7364309", "0.7280778", "0.7182273", "0.6942154", "0.6910108", "0.69024926", "0.6895161", "0.68412733", "0.6822853", "0.6820608", "0.6791928", "0.6764579", "0.6738027", "0.6685086", "0.66567236", "0.66548216", "0.6651444", "0.6600708", "0.64860225", "0.6483401", "0.6460082"...
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 signed_in_user_filter\n if signed_in?\n redirect_to root_path, notice: \"Already logged in\"\n end\n end", "def appctrl_confirm_user\n redirect_to( signin_path() ) unless @current_user\n end", "def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\...
[ "0.6569166", "0.6430658", "0.6423167", "0.64137745", "0.63995165", "0.62902534", "0.6249426", "0.6248803", "0.6218758", "0.6173909", "0.612472", "0.61157626", "0.60806084", "0.6062998", "0.6040006", "0.60308075", "0.6022445", "0.60193825", "0.6015744", "0.6000973", "0.5993021...
0.0
-1
Confirms the correct user.
def top_layer_administrator redirect_to(root_url) unless (!current_user.role.blank? && (current_user.role.top_layer_administrator? || current_user.role.assurance_provider? || current_user.role.audit_log_reporting? || current_user.role.secondary_time_period? )) || current_user.admin? || current_user.super_admin? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n msg = \"You do not have permission to update another user's information\"\n require_correct_user(@user, msg)\n end", "def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n...
[ "0.7474259", "0.73411936", "0.7317917", "0.7183303", "0.7174887", "0.7049758", "0.70130193", "0.7012358", "0.7006517", "0.7006201", "0.7003461", "0.69663024", "0.69136065", "0.6911695", "0.690295", "0.6892608", "0.68439376", "0.6842948", "0.68397075", "0.683463", "0.6826711",...
0.0
-1
Confirms an admin user.
def admin_user #redirect_to(root_url) unless current_user.admin || current_user.super_admin?# || top_layer_administrator 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 admin_user\n\t\t\tflash_text = \"Administrative privilege required to perform this action.\"\n\t\t\tflash[:danger] = flash_text unless cu...
[ "0.79040426", "0.76734394", "0.76483005", "0.7621745", "0.760655", "0.760655", "0.7595599", "0.758948", "0.758948", "0.7503988", "0.7466696", "0.7451627", "0.74247295", "0.7411497", "0.741143", "0.7402666", "0.73996776", "0.73597306", "0.7330382", "0.731928", "0.7313488", "...
0.0
-1
Gives the list of use cases as JSon
def index @use_case_groups = @project.use_case_groups respond_to do |format| format.html # index.html.erb format.json { render json: @use_cases } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cases\n return suite.cases(data.id)\n end", "def budget_categories_data\n # @budget.budget_items.collect { |budget_item| budget_item.category.name.to_s }.to_json\n categories = Category.for_budget.to_a\n categories << Category.find_by_name(\"Miscellaneous\")\n return categories.collect { ...
[ "0.57587445", "0.5664733", "0.5617856", "0.561148", "0.5589906", "0.55422795", "0.5527791", "0.54873717", "0.54434013", "0.543456", "0.53609455", "0.532469", "0.531598", "0.52815884", "0.526973", "0.5260005", "0.5223884", "0.5221041", "0.52137494", "0.520938", "0.5200898", ...
0.55995506
4
Gives information about a certain use case
def show @use_case = UseCase.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @use_case } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info\n \"hello from EolScenarios#info\"\n end", "def usage\n self.class.const_get(:USAGE)\n end", "def test_info(project_name, plan_name, test_case_name)\n test_plan_id = test_plan_id(project_name, plan_name)\n test_cases = test_cases_for_test_plan(test_plan_id)\n\n test_cases....
[ "0.6243129", "0.62389857", "0.619952", "0.6179162", "0.6173462", "0.6150124", "0.6150124", "0.6117044", "0.61004406", "0.6063843", "0.6063843", "0.606215", "0.59914446", "0.59792864", "0.5946084", "0.5901922", "0.5897214", "0.5897214", "0.5897214", "0.58617914", "0.5857531", ...
0.55803376
49
Gives the template for creating a new use case
def new @use_case = UseCase.new @use_case.project = Project.find(params[:project_id]) @use_case.use_case_group_id = params[:group_id] respond_to do |format| format.html # new.html.erb format.json { render json: @use_case } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_template\n self.template = \"template 14231\"\n end", "def template(name); end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template_name; end", "def template_name; end", ...
[ "0.6776548", "0.676121", "0.66630906", "0.66630906", "0.66630906", "0.66630906", "0.66630906", "0.66630906", "0.66630906", "0.6563741", "0.6563741", "0.63758725", "0.6287934", "0.6234758", "0.6178252", "0.61466783", "0.61085606", "0.60365236", "0.6014146", "0.60133374", "0.60...
0.0
-1
Gives the template for edit a use case
def edit @use_case = UseCase.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_form\n 'common_templates/edit_form'\n end", "def edit\n respond_to do |format|\n format.html { render :action => resource_template(\"edit\") }\n end\n end", "def edit_partial \n return 'edit_' + self.class.to_s.underscore\n end", "def edit; end", "def edit; end", "def edi...
[ "0.70181495", "0.67989075", "0.6718922", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473",...
0.65949523
3
Creates the information for a new use case
def create @use_case = UseCase.new(params[:use_case]) @use_case.project_id = params[:project_id] @project = Project.find(params[:project_id]) if @use_case.use_case_group_id.nil? then @use_case.use_case_group_id = params[:group_id] end @use_case.data = params[:data].to_json respond_to do |format| if @use_case.save format.html { redirect_to requirements_project_use_case_path(@use_case.project, @use_case,:type => "step"), notice: 'Use case was successfully created.' } format.json { render json: @use_case, status: :created, location: @use_case } else format.html { render action: "new" } format.json { render json: @use_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @use_case = UseCase.new(use_case_params)\n # creating hard info\n @use_case.hard_infos.new(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n ...
[ "0.6796535", "0.6695031", "0.5962186", "0.59504133", "0.5933434", "0.590102", "0.5809556", "0.5787832", "0.57644856", "0.5650518", "0.5650304", "0.5643049", "0.5624123", "0.5607837", "0.5598078", "0.55879486", "0.5572236", "0.5572236", "0.556721", "0.5563951", "0.5542535", ...
0.578253
8
Changes the information of a use case
def update @use_case = UseCase.find(params[:id]) @use_case.data = params[:data].to_json respond_to do |format| if @use_case.update_attributes(params[:use_case]) if params[:subaction]=="step" format.html { redirect_to requirements_project_use_case_path(@use_case.project, @use_case, :type=>"step"), notice: 'Use case was successfully updated.' } else format.html { redirect_to project_use_case_path(@project, @use_case), notice: 'Use case was successfully updated.' } end format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @use_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_use_case\n @use_case = UseCase.find(params[:id])\n end", "def switch(name,aliases,desc,long_desc,negatable)\n abstract!\n end", "def update_case\n api.command :edit, to_case_hash\n end", "def usecase=(usecase)\n if usecase.nil?\n fail ArgumentError, 'us...
[ "0.6632282", "0.61285096", "0.6050993", "0.6009865", "0.5945823", "0.5931325", "0.59235436", "0.58690375", "0.58276093", "0.5729558", "0.56906945", "0.5671893", "0.5607212", "0.5553339", "0.55198294", "0.5519742", "0.5479967", "0.54714584", "0.5465218", "0.5465218", "0.545790...
0.5825556
9
Deletes a use case of the application
def destroy @use_case = UseCase.find(params[:id]) @use_case.destroy respond_to do |format| format.html { redirect_to project_use_cases_path @project } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n Seances::UseCases::Delete.new.call(id: params[:id])\n end", "def destroy\n @use_case = UseCase.find(params[:id])\n @use_case.destroy\n\n respond_to do |format|\n format.html { redirect_to use_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy_...
[ "0.73807347", "0.6945137", "0.6421605", "0.6356166", "0.63010746", "0.6286685", "0.6251679", "0.61958724", "0.615406", "0.6138776", "0.61189294", "0.6116951", "0.61103696", "0.60968655", "0.60899067", "0.60757285", "0.6073721", "0.60648096", "0.6053792", "0.5994568", "0.59488...
0.67705977
2
Gives the template of an use case as JSON
def template_use_case @use_case_template = UseCaseTemplate.find(params[:use_case_template_id]) @json_obj = JSON.parse(@use_case_template.template_form) respond_to do |format| format.js {render 'template_form'} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_name\n \"#{self.class.name.split('::').last.underscore}.json.jbuilder\"\n end", "def template(model_name)\n <<~HEREDOC\n {\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {}\n }\n HER...
[ "0.64434576", "0.63143045", "0.6240932", "0.6234062", "0.6234062", "0.6234062", "0.6234062", "0.6234062", "0.6234062", "0.6234062", "0.60990405", "0.6078205", "0.6074116", "0.6074116", "0.60605574", "0.6047795", "0.6011998", "0.60115516", "0.5996777", "0.5976033", "0.59388584...
0.63804716
1
Gives the list of documents of a project to attach to a use case
def attach_document @use_case = UseCase.find(params[:id]) @document_projects = DocumentProject.where(:project_id => params[:project_id]) respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_doc_info\n if (@document == nil)\n return false\n end\n \n @collection = Collection.find(@document.collection)\n @project_list = []\n @collection.projects.each do |project|\n @project_list << project\n end\n end", "def show\n @project = Project.find(params[:id])\n db...
[ "0.6299673", "0.62958926", "0.62486595", "0.605626", "0.600205", "0.5984258", "0.5937808", "0.5890469", "0.58486956", "0.5818114", "0.5812338", "0.5805676", "0.5805676", "0.5782263", "0.573144", "0.5657223", "0.56364506", "0.56298465", "0.5612092", "0.55874085", "0.5585975", ...
0.7113177
0
Adds or removes a document of a use of case
def add_document @use_case = UseCase.find(params[:id]) document_project = DocumentProject.find(params[:document_project_id]) text = @use_case.add_remove_document(document_project,params[:add]) flash[:notice] = text respond_to do |format| format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_document(doc)\n @documents[doc.uuid] = doc\n end", "def srch_add(opts={})\n\t\t\t\tsrch_client.add_document(opts)\n\t\t\tend", "def addDoc(doc)\n @docs[doc.target] = doc\n end", "def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end", "def ...
[ "0.64871144", "0.6246286", "0.61519283", "0.6036503", "0.5994312", "0.5976628", "0.582978", "0.56827986", "0.5631102", "0.56194687", "0.55908054", "0.5574139", "0.5523576", "0.54831684", "0.54561055", "0.54465383", "0.54449797", "0.54412913", "0.5429157", "0.5404755", "0.5403...
0.5533367
12
Gives the view of the requirement of a certain use case
def requirements @use_case = UseCase.find(params[:id]) @project = @use_case.project @requirements = @use_case.requirements respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_req\n @user=find_user\n if !@user.nil?\n @use_reqs=@use_case.requirements.find :all\n session[:use_case_id]=@use_case.id\n @attr=Attribute.find_by_project_id(session[:project_id])\n respond_to do |format|\n format.html { render \"requirements/index\" }\n end\n else...
[ "0.6544294", "0.63729227", "0.6077152", "0.6077152", "0.6059532", "0.6059532", "0.6059532", "0.6059532", "0.6028314", "0.6027648", "0.60089576", "0.60089576", "0.60089576", "0.5981157", "0.59562796", "0.5914783", "0.58335936", "0.5799914", "0.572479", "0.5708224", "0.5642425"...
0.6594421
0
Gives the view of the tasks of a certain use case
def tasks @use_case = UseCase.find(params[:id]) @project = @use_case.project respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end", "def show\n find_task\n end", "def interviewer_tasks\n tasks.find(:all, :conditions => { :context => 'interviewers', :show_for_context_object_tasks => t...
[ "0.7217174", "0.70797", "0.6923401", "0.68659025", "0.68518335", "0.68076086", "0.6698484", "0.665766", "0.664071", "0.66338015", "0.66276044", "0.6577122", "0.6562889", "0.652853", "0.65168786", "0.6447878", "0.6430879", "0.64280754", "0.6421458", "0.6411247", "0.63931054", ...
0.7159997
1
does not add the song to the current artist's collection of songs if it already exists therein
def genres songs.collect{ |s| s.genre }.uniq #returns collection of genres for all of the artist's songs/ does not return duplicate genres/ collects genres end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == s...
[ "0.8377536", "0.8330306", "0.8308314", "0.8289124", "0.81976336", "0.8197406", "0.8026725", "0.801024", "0.79705393", "0.7767412", "0.7725955", "0.75961816", "0.7481151", "0.74465245", "0.74440587", "0.7395014", "0.7395014", "0.7391093", "0.7391093", "0.7391093", "0.7391093",...
0.0
-1
GET /freelancer_knowledges GET /freelancer_knowledges.json
def index @freelancer_knowledges = FreelancerKnowledge.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @knowledges = Knowledge.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end", "def index\n @carrierknowledghes = Carrierknowledghe.all\n end", "def new\n @knowledge = current_user.know...
[ "0.630326", "0.60116845", "0.595098", "0.5839878", "0.5611794", "0.54542494", "0.54053175", "0.53874165", "0.5354847", "0.5344558", "0.53024244", "0.5292661", "0.5282269", "0.5247072", "0.52158225", "0.52143824", "0.5213206", "0.5210956", "0.520964", "0.5204123", "0.52009755"...
0.66673106
0
GET /freelancer_knowledges/1 GET /freelancer_knowledges/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @freelancer_knowledges = FreelancerKnowledge.all\n end", "def index\n @knowledges = Knowledge.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end", "def new\n @knowledge = current_user...
[ "0.6524159", "0.6367874", "0.621495", "0.59444463", "0.58440053", "0.5661022", "0.555433", "0.5545312", "0.5532304", "0.5502015", "0.5501858", "0.54799265", "0.54600847", "0.5446178", "0.5395857", "0.53801614", "0.53780144", "0.53762215", "0.53746635", "0.53413177", "0.534016...
0.0
-1
POST /freelancer_knowledges POST /freelancer_knowledges.json
def create @freelancer_knowledge = FreelancerKnowledge.new(freelancer_knowledge_params) respond_to do |format| if @freelancer_knowledge.save format.html { redirect_to @freelancer_knowledge, notice: 'Freelancer knowledge was successfully created.' } format.json { render :show, status: :created, location: @freelancer_knowledge } else format.html { render :new } format.json { render json: @freelancer_knowledge.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @carrierknowledghe = Carrierknowledghe.new(carrierknowledghe_params)\n\n respond_to do |format|\n if @carrierknowledghe.save\n format.html { redirect_to @carrierknowledghe, notice: 'Carrierknowledghe was successfully created.' }\n format.json { render :show, status: :created, ...
[ "0.6177058", "0.57967305", "0.5719989", "0.5719659", "0.56235546", "0.5551821", "0.5533549", "0.5421324", "0.5402464", "0.53731877", "0.52746886", "0.5257329", "0.5256773", "0.5241811", "0.52405256", "0.52355033", "0.52342623", "0.52285594", "0.5201299", "0.51998365", "0.5190...
0.49492547
66
PATCH/PUT /freelancer_knowledges/1 PATCH/PUT /freelancer_knowledges/1.json
def update respond_to do |format| if @freelancer_knowledge.update(freelancer_knowledge_params) format.html { redirect_to @freelancer_knowledge, notice: 'Freelancer knowledge was successfully updated.' } format.json { render :show, status: :ok, location: @freelancer_knowledge } else format.html { render :edit } format.json { render json: @freelancer_knowledge.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @carrierknowledghe.update(carrierknowledghe_params)\n format.html { redirect_to @carrierknowledghe, notice: 'Carrierknowledghe was successfully updated.' }\n format.json { render :show, status: :ok, location: @carrierknowledghe }\n else\n f...
[ "0.61674035", "0.5970784", "0.59621316", "0.59359676", "0.5861881", "0.5827468", "0.5781857", "0.57728577", "0.57728577", "0.57666564", "0.57656974", "0.5750609", "0.57496226", "0.5694131", "0.5683518", "0.5676585", "0.5652145", "0.5650353", "0.56306255", "0.56279796", "0.562...
0.54532874
61
DELETE /freelancer_knowledges/1 DELETE /freelancer_knowledges/1.json
def destroy @freelancer_knowledge.destroy respond_to do |format| format.html { redirect_to freelancer_knowledges_url, notice: 'Freelancer knowledge was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @knowledge = current_user.knowledges.find(params[:id])\n @knowledge.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @carrierknowledghe.destroy\n respond_to do |format|\n ...
[ "0.68897974", "0.6703361", "0.670041", "0.6646703", "0.6586873", "0.6571737", "0.6555517", "0.65274686", "0.6509075", "0.6493473", "0.6488995", "0.64743686", "0.6474076", "0.64381456", "0.64283895", "0.64078814", "0.6400561", "0.63977534", "0.63812995", "0.6376295", "0.637169...
0.6756347
1
Use callbacks to share common setup or constraints between actions.
def set_freelancer_knowledge @freelancer_knowledge = FreelancerKnowledge.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 freelancer_knowledge_params params.require(:freelancer_knowledge).permit(:freelancer_login, :knowledge_name, :certificates) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
when the number is divisible by 3, say fizz when the number is divisible by 5 say buzz when the number is divisible by 3 and 5 say fizzbuzz =begin 1.upto(100) do |i| if i % 15 == 0 puts "fizzbuzz" elsif i % 3 == 0 puts "fizz" elsif i % 5 == 0 puts "buzz" else puts i end end =end
def fizzbuzz(number) if number % 15 == 0 "fizzbuzz" elsif number % 3 == 0 "fizz" elsif number % 5 == 0 "buzz" else number end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizzbuzz\n\t 1.upto(100) do |i|\n\tif i % 5 == 0 and i % 3 == 0\n\t puts \"FizzBuzz\"\n\telsif i % 5 == 0\n\t puts \"Buzz\"\n\telsif i % 3 == 0\n\t puts \"Fizz\"\n\telse\n\t puts i\n\tend\n\tend\nend", "def fizz_buzz (i)\n 1.upto 100 do |i|\n if i % 5 == 0 && i % 3 == 0 \n p...
[ "0.86731976", "0.85912037", "0.85182214", "0.84840256", "0.84069455", "0.83743644", "0.83327276", "0.8292735", "0.8272101", "0.8271448", "0.826314", "0.82613516", "0.8231601", "0.82226473", "0.82136106", "0.8203045", "0.81914985", "0.8188712", "0.8169217", "0.8150899", "0.813...
0.0
-1
show form update user
def show @user = User.find(params[:id]) respond_to do |format| format.html { render :action => "show" } format.json { render :json => @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_form\n @user = User.find_by_id(session[:user_id])\n end", "def update_user\n end", "def update\n @title = t('admin.users.edit.title')\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n js_notify message: t('admin.users.update.success'), type: 'alert...
[ "0.7832611", "0.78088707", "0.77648675", "0.76833665", "0.75262815", "0.75237745", "0.75127196", "0.7488812", "0.7460537", "0.745417", "0.7453461", "0.7407733", "0.74016386", "0.74005425", "0.7394082", "0.73731714", "0.7373095", "0.736515", "0.73627764", "0.7353143", "0.73255...
0.0
-1
add_post takes in an argument of a post and associates that post with the author by telling the post that it belongs to that author
def add_post(post) @posts << post post.author = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self \n end", "def add_post(post)\n @posts << post #pushes post into post array so that we can compare ...
[ "0.869754", "0.869754", "0.869754", "0.8630963", "0.8447251", "0.8189614", "0.8189614", "0.8170128", "0.7595813", "0.7546151", "0.75392205", "0.7348585", "0.69672984", "0.6921335", "0.68606687", "0.672986", "0.672986", "0.6714508", "0.66496783", "0.6528957", "0.65135324", "...
0.84641385
4