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
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce ...
def make url require 'formula' path=Pathname.new url /(.*?)[-_.]?#{path.version}/.match path.basename raise "Couldn't parse name from #{url}" if $1.nil? or $1.empty? path=Formula.path $1 raise "#{path} already exists" if path.exist? template=<<-EOS require 'brewkit' class #{Fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_license()\n return true\n end", "def terms_of_use\n end", "def northern_irish_driving_licence; end", "def private; end", "def uk_driving_licence(*args); end", "def conscientious_require; end", "def show_license(license)\n # Checks if lang is nil and we want to show the license\n if...
[ "0.57156974", "0.5524911", "0.54178184", "0.5336742", "0.52185327", "0.52011347", "0.5181892", "0.5154649", "0.5061321", "0.5045618", "0.50357175", "0.50057185", "0.4968437", "0.49581352", "0.49526992", "0.4936816", "0.49328077", "0.49031973", "0.49028283", "0.48731747", "0.4...
0.0
-1
Export an inmemory zip file
def export_zip stringio = Zip::ZipOutputStream::write_buffer do |zip| @zip = zip export end @zip = nil stringio.rewind stringio.sysread end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_output_file(zip_out, contents); end", "def zipfile; end", "def zip_contents; end", "def export!\n render_manifest_output_and_keys\n render_zip\n end", "def zipfile metadata\n cmd = \"cd #{Myreplicator.configs[@export_obj.source_schema][\"export_stg_dir\"]}; gzip #{@export_obj.filen...
[ "0.7257156", "0.7191876", "0.7125167", "0.6901076", "0.68293995", "0.68284345", "0.6668527", "0.6636499", "0.6613755", "0.66121507", "0.6592297", "0.65809727", "0.65809727", "0.65637213", "0.65578926", "0.65561503", "0.6540651", "0.6533629", "0.6488329", "0.64851934", "0.6480...
0.8067922
0
find all the problems in the contest
def process(vid, cid) return false if !downloaded?(vid, cid) issue = self.issue(vid, cid) or return false Dir.mktmpdir do |tmpdir| pdfpath = File.expand_path("tasks.pdf", tmpdir) FileUtils.copy(File.expand_path(issue[:tasks][:local], DATAPATH), pdfpath) importer = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def completed_tests()\n test_array = []\n self.problems.each do |problem|\n problem.tests.each do |test|\n test_array.push(test)\n end\n end\n test_array\n end", "def evaluate_problems(competition)\n\t\ttotal_value=0\n\t\tproblems=competition.problems\n\t\tproblems.each do |p|\n\t\t...
[ "0.6190463", "0.61540973", "0.60258454", "0.5969899", "0.59127706", "0.584345", "0.58268154", "0.57409143", "0.56881815", "0.56736636", "0.5670737", "0.5670737", "0.5670737", "0.56604046", "0.5659035", "0.5647351", "0.5647351", "0.5643008", "0.56395864", "0.5614464", "0.56011...
0.0
-1
send request to the server
def send_request method, params = nil if params.nil? raise ArgumentError, "Invalid request params" else required = { 'api_key' => @api_key } params = required.merge(params) params = URI.escape(params.collect{ |k,v| "#{k}=#{v}"}.join('&')) end url = @api_url + method + '/?' + para...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_request; end", "def send_request(req); end", "def send_request\n @response = _send_request\n end", "def send_request(method, url)\n @response = client.run_request(method, url, @body, headers) do |req|\n req.params = params\n end\n end", "def request(request)\n @socket.re...
[ "0.8128962", "0.7990024", "0.7520173", "0.7367704", "0.7351351", "0.73228204", "0.7234618", "0.7189119", "0.7187505", "0.7108176", "0.707105", "0.70435274", "0.7036366", "0.70097595", "0.69799113", "0.6951126", "0.69380516", "0.69192815", "0.6890673", "0.68865067", "0.6849669...
0.0
-1
search for icons by search term
def search options = { :q => 'icon', :p => 0, :c => 10, :min => 1, :max => 48 } options[:p] = 0 if options.key?(:p) == false options[:c] = 10 if options.key?(:c) == false options[:min] = 32 if options.key?(:min) == false options[:max] = 256 if options.key?(:max) == false params = { :l => 0, :price =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_images(searchterm,params={})\n @opensearch.search_images(searchterm,params) \n end", "def find(term, limit = nil, offset = nil, page = nil)\n fail(ArgumentError, \"Missing search term\") unless term\n\n term = OAuth::Helper.escape(term)\n\n args = {\n \"limit\" => limit,\n...
[ "0.6808523", "0.6582033", "0.63925064", "0.6306836", "0.626858", "0.6228679", "0.59968823", "0.59809095", "0.59626794", "0.5925217", "0.59235996", "0.59014636", "0.5890067", "0.5851597", "0.58468145", "0.58439004", "0.58327216", "0.5821099", "0.57887274", "0.5773422", "0.5763...
0.6958384
0
get information about an icon
def icondetails id = 1, size = 128 params = { 'id' => id, 'size' => size } json = send_request 'icondetails', params json['icon'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def icons_info\n @icons_info ||= icons_file\n end", "def icons_info\n @icons_info ||= icons_file\n end", "def icon\n @icon\n end", "def icon\n return @icon\n end", "def icon\n self.number\n end", "def ImageList_ExtractIcon(hi, himl, i)\r\n Imag...
[ "0.79145163", "0.7874623", "0.76688135", "0.7537786", "0.7498887", "0.7463171", "0.71790737", "0.7157221", "0.7057239", "0.70553154", "0.69658804", "0.69658804", "0.69625115", "0.6955847", "0.6941654", "0.68783444", "0.6839928", "0.6758574", "0.67052096", "0.66538805", "0.663...
0.7533383
4
Finds availabilities for given dates
def availabilities(from_date: Time.now, until_date: Time.now+(60*60*24*21)) PrioTicket::Availabilities.find(distributor_id: distributor_id, ticket_id: ticket_id, identifier: identifier, from_date: from_date, until_date: until_date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def availabilities_in_week(start_date)\n start = DateTime.strptime(start_date, '%d%m%Y')\n lessons = self.lessons\n lessons_booked = lessons.select{ |l| ((start)..(start + 7.days)).cover?(DateTime.strptime(l.date, '%d/%m/%Y')) }\n availabilities_booked = lessons_booked.map{ |l| l.availability }\n\n...
[ "0.72452563", "0.724396", "0.7182133", "0.69379896", "0.6872821", "0.6759642", "0.67054135", "0.664762", "0.6605514", "0.6585795", "0.65750283", "0.6564675", "0.65532166", "0.6548881", "0.65443146", "0.65385735", "0.64950466", "0.6480737", "0.64701647", "0.63960576", "0.63725...
0.74297297
0
this is inserted into the generated SQL from a dataset that contains PlaceHolder instances.
def to_s_append( ds, s ) s << '$' << name.to_s s << ':' << sql_field.to_s if sql_field s << '/*' << small_source << '*/' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_raw(ds)\n ds.insert(_insert_values)\n end", "def _insert_raw(ds)\n ds.insert(_insert_values)\n end", "def _insert_raw(ds)\n if use_prepared_statements_for?(:insert)\n _set_prepared_statement_server(model.send(:prepared_insert, @values.keys)).call(@values)...
[ "0.6786418", "0.6786418", "0.6777619", "0.6422716", "0.63909847", "0.62797374", "0.6246351", "0.6246351", "0.6210117", "0.6189278", "0.6176895", "0.61633205", "0.6124721", "0.61202407", "0.61100423", "0.60818094", "0.6022399", "0.60028553", "0.5988677", "0.59847426", "0.59806...
0.0
-1
two methods for handling transfer of data from file on disk to in memory variable and back again. expecting comma separated values separated by new line. no UID is stored because program uses position in array as identifier.
def open_and_read_data(film_array) # my_file = File.new("movies.txt", 'r') # my_file.each do |x| # my_array = x.split(",") # film_array << {:title => my_array[0], :year => my_array[1], :poster => my_array[2]} # end my_db = PG.connect(dbname:"movies_db") result = my_db.exec ( "SELECT * FROM movies;") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processData(arg)\n\t\tarr = arg.split(',')\n\t\t@mutex.synchronize do\n\t\t\tif not @deviceList.has_key?(arr[0])\n\t\t\t\t@deviceList.store(arr[0],arr[1..arr.length-1].join(','))\n\t\t\telse\n\t\t\t\t@deviceList.delete(arr[0])\n\t\t\t\t@deviceList.store(arr[0],arr[1..arr.length-1].join(','))\n\t\t\tend\n\t\ten...
[ "0.5660035", "0.55838126", "0.54941976", "0.54727644", "0.523948", "0.52379113", "0.5209643", "0.5207784", "0.520403", "0.5186931", "0.5171146", "0.5158244", "0.5144452", "0.5126861", "0.5120187", "0.5113336", "0.51039493", "0.5098792", "0.50978553", "0.50946784", "0.50665253...
0.0
-1
The & is used to convert the block into a Proc. The block is code or string we write between do/end when we call the get method
def get(path, &handler) route("GET", path, &handler) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(&block)\n @get = block\n end", "def get(&block)\n @get = block\n end", "def test(&block)\n puts \"&block is, #{block}\"\nend", "def procasaurus( &block )\n\tputs \"I am a procasaurus.\"\n\tputs block.class\n\t# note the proc must be the last parameter and must start with amp...
[ "0.7290018", "0.7290018", "0.7022297", "0.69305694", "0.68302673", "0.6777883", "0.67337775", "0.67337775", "0.67092", "0.67059463", "0.67059463", "0.67059463", "0.67059463", "0.67059463", "0.67059463", "0.67059463", "0.67059463", "0.67059463", "0.67059463", "0.67059463", "0....
0.0
-1
for a more detailed explanation visit parameter env is the Rack environment. It has a lot of information about the request, like what HTTP verb was used, the request path, the host, and more. Rack uses handlers to run Rack applications. Each Ruby webserver has its own handler, for example WEBrick handler (WEBrick is in...
def call(env) @request = Rack::Request.new(env) verb = @request.request_method requested_path = @request.path_info handler = @routes.fetch(verb, {}).fetch(requested_path, nil) if handler # give handler access to all of the methods, on the instance of Nancy::Base result = i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(env)\n request = Request.new(env) \n snip, part, format = request_uri_parts(request)\n if snip\n params = request.params.merge(:snip => snip, :part => part, \n :format => format, :method => request.request_method.downcase)\n [200, {\"C...
[ "0.6750106", "0.6576148", "0.6571003", "0.6568376", "0.65419793", "0.65309167", "0.6527685", "0.6522015", "0.64645225", "0.6431155", "0.64295185", "0.6384102", "0.6384102", "0.6381795", "0.63423926", "0.63111126", "0.6309203", "0.62849087", "0.62822634", "0.6281018", "0.62807...
0.6354718
14
The routes hash, is composed of 'verb' hash. If the 'verb' hash is nil or false then set it to an empty hash. Each verb hash will have a key of path and value of handler.
def route(verb, path, &handler) @routes[verb] ||= {} @routes[verb][path] = handler end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route(verb, path, &handler)\n # Create a hash for the verb if it is the first time\n @routes[verb] ||= {}\n @routes[verb][path] = handler\n end", "def verb_path\n return nil if @binding.nil?\n\n {\n get: @binding.get,\n post: @bin...
[ "0.73924065", "0.65694636", "0.6506219", "0.6502631", "0.6412564", "0.63211185", "0.6212518", "0.610627", "0.61059004", "0.59511936", "0.58770293", "0.5830702", "0.5737376", "0.5670195", "0.56641734", "0.5645849", "0.56389254", "0.56389254", "0.56389254", "0.56233925", "0.560...
0.7196783
1
The Rack::Request class that wraps the env has a method called params It contains information about all parameters provided to the method GET, POST etc.
def params @request.params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "def request_params( params = {} )\n params\n end", "def request_params(params =...
[ "0.74828255", "0.74828255", "0.7341165", "0.72824854", "0.7257607", "0.72190523", "0.7148285", "0.70696753", "0.7033119", "0.69964164", "0.6968505", "0.6944733", "0.69156665", "0.687332", "0.67790824", "0.67790824", "0.673949", "0.67321944", "0.67121804", "0.6629057", "0.6628...
0.6823642
14
Accepts either an Apartment model or just it's id.
def lives_in?(apartment) if apartment.instance_of? Apartment self.apartment_id == apartment.id else self.apartment_id == apartment end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_apartment\n p = params.require(:apartment).permit(:id)\n @apartment = Apartment.find(p[:id])\n end", "def set_apartment\n @apartment = Apartment.find(params[:id])\n end", "def set_apartment\n @apartment = Apartment.find(params[:id])\n end", "def set_apartment\n @apartment = ...
[ "0.76682997", "0.7626054", "0.7626054", "0.7476759", "0.7476759", "0.7476759", "0.7476759", "0.7476759", "0.7218129", "0.71261305", "0.71054274", "0.67330074", "0.6707702", "0.66411734", "0.6453904", "0.6384737", "0.63841414", "0.63320696", "0.63257605", "0.630376", "0.630267...
0.6153049
31
GET /daw_staffs GET /daw_staffs.json
def index @daw_staffs = DawStaff.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @staff }\n end\n end", "def show\n @admin_staff = Admin::Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format....
[ "0.73016983", "0.72635597", "0.7223957", "0.7223957", "0.7223957", "0.6966919", "0.69554794", "0.6925387", "0.68722874", "0.6862624", "0.68491805", "0.6831344", "0.6810101", "0.6809221", "0.6749645", "0.6684676", "0.6656269", "0.6647757", "0.65464646", "0.64964813", "0.649361...
0.7641452
0
GET /daw_staffs/1 GET /daw_staffs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @staff }\n end\n end", "def show\n @admin_staff = Admin::Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format....
[ "0.7673598", "0.7637277", "0.7392293", "0.7186867", "0.7127463", "0.7098114", "0.7098114", "0.7098114", "0.7048721", "0.70287937", "0.69876605", "0.696683", "0.68974644", "0.68321043", "0.6791419", "0.66895956", "0.6678651", "0.6643439", "0.6633024", "0.66316295", "0.6622505"...
0.0
-1
POST /daw_staffs POST /daw_staffs.json
def create @daw_staff = DawStaff.new(daw_staff_params) respond_to do |format| if @daw_staff.save format.html { redirect_to @daw_staff, notice: 'Daw staff was successfully created.' } format.json { render :show, status: :created, location: @daw_staff } else format.html { rend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @admin_staff = Admin::Staff.new(params[:admin_staff])\n\n respond_to do |format|\n if @admin_staff.save\n format.html { redirect_to @admin_staff, notice: 'Staff was successfully created.' }\n format.json { render json: @admin_staff, status: :created, location: @admin_staff }\n...
[ "0.7301264", "0.72698396", "0.7239322", "0.72360516", "0.7231124", "0.7231124", "0.7231124", "0.7231124", "0.7231124", "0.7135001", "0.7097655", "0.6819066", "0.6801925", "0.67507523", "0.6728633", "0.6605395", "0.66008806", "0.65511316", "0.6542314", "0.6523404", "0.6493325"...
0.7431339
0
PATCH/PUT /daw_staffs/1 PATCH/PUT /daw_staffs/1.json
def update respond_to do |format| if @daw_staff.update(daw_staff_params) format.html { redirect_to @daw_staff, notice: 'Daw staff was successfully updated.' } format.json { render :show, status: :ok, location: @daw_staff } else format.html { render :edit } format.json { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n if @staff.update_attributes(params[:staff])\n format.html { redirect_to @staff, notice: 'Staff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ...
[ "0.7562473", "0.74874884", "0.74796045", "0.7462472", "0.7436857", "0.7429535", "0.7429535", "0.7429535", "0.7429535", "0.7363397", "0.7299227", "0.70667696", "0.69624496", "0.68947405", "0.6861138", "0.6828282", "0.67834955", "0.6770791", "0.6769483", "0.67028415", "0.669708...
0.7303915
10
DELETE /daw_staffs/1 DELETE /daw_staffs/1.json
def destroy @daw_staff.destroy respond_to do |format| format.html { redirect_to daw_staffs_url, notice: 'Daw staff was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @dtc_staff.destroy\n respond_to do |format|\n format.html { redirect_to dtc_staffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @staff = Staff.find(params[:id])\n @staff.destroy\n\n respond_to do |format|\n format.html { redirect_to staffs_...
[ "0.7536451", "0.7509676", "0.7498178", "0.726725", "0.72505623", "0.7235755", "0.72308755", "0.7208269", "0.7208269", "0.7208269", "0.7208269", "0.7208269", "0.7208269", "0.71547824", "0.7141131", "0.71076417", "0.706569", "0.6980673", "0.69593006", "0.69533783", "0.68866634"...
0.7407141
3
Use callbacks to share common setup or constraints between actions.
def set_daw_staff @daw_staff = DawStaff.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.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.533122...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def daw_staff_params params.require(:daw_staff).permit(:staff_fechaingr, :staff_fechasalida, :staff_estado) 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
Find all Permissions for a Role. This method gets the hierarchy for the given Role and uses that to get all the Permissions for the Role and its ancestors.
def find_all_for_role(role) roles = role.get_parents roles << role return find_for_role(roles.collect(&:id)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_permissions\n return permissions unless role\n (permissions + role.permissions).uniq\n end", "def all_permissions\n permissions = Array.new\n \n all_roles.each do |role|\n permissions.concat(role.permissions)\n end\n \n return permissions\n end", "def permissions\n if @p...
[ "0.6684336", "0.66211104", "0.6481366", "0.6431652", "0.6382324", "0.6132833", "0.60629493", "0.6011105", "0.5865704", "0.57300186", "0.57195795", "0.5710485", "0.5655695", "0.5594754", "0.55089045", "0.55083287", "0.55035955", "0.5466078", "0.54609054", "0.5441278", "0.54219...
0.7234645
0
Find Permissions that are not already associated with the given Role ID.
def find_not_for_role(role_id) return find_by_sql( ["select p.* from #{prefix}permissions p where id not in (select permission_id from #{prefix}roles_permissions rp where role_id in (?)) order by name", role_id] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def existing_permissions(role)\n role.permissions.where.not(action: CardPermissions::STATELESS_ACTIONS).where.not(filter_by_card_id: nil)\n end", "def get_role_permissions(role_id, options = {})\n raise Auth0::MissingParameter, 'Must supply a valid role_id' if role_id.to_s.empty?\n\n re...
[ "0.6568086", "0.5648365", "0.52970177", "0.5175157", "0.5149231", "0.5091609", "0.49884784", "0.49706683", "0.4963955", "0.48393002", "0.48190293", "0.47772923", "0.47085202", "0.47055438", "0.4696977", "0.46765888", "0.46592882", "0.4654791", "0.46505627", "0.4648672", "0.46...
0.78119415
0
I worked on this challenge [by myself, with: Ting Wang] I spent [2] hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode =begin write destructive method that takes array of m...
def pad!(array, min_size, value = nil) #destructive # Your code here if array.length >= min_size return array else (min_size-array.length).times do array.push(value) end return array end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if min_size <= array.length\n return array\n else\n padding = array.length - min_size\n counter = array.length\n while counter < min_size\n array << value\n counter += 1\n end\n return array\n end\n\nend", ...
[ "0.79426736", "0.7869509", "0.78492945", "0.7846753", "0.77904177", "0.777918", "0.7743648", "0.7729251", "0.77223885", "0.77185184", "0.7692154", "0.7686906", "0.768184", "0.76794994", "0.7664979", "0.76619613", "0.76599354", "0.76551133", "0.76481646", "0.76479095", "0.7639...
0.74825007
53
NATIVE: save NATIVE: to_json Evaluates a symbol given arguments. The `eval` method combines a call to `bind` (which returns an executer) with a call to `forward` (executor method). For the common use case, where you might repeatedly evaluate with same arguments, eval is slow. In that case, you should call `bind` once a...
def eval(ctx: nil, **kwargs) ctx ||= Context.default bind(ctx, kwargs).forward end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json(*args)\n eval(to_s).to_json(*args)\n end", "def as_json(*args)\n eval(to_s).as_json(*args)\n end", "def e *args\n do_conn(:eval, *args).to_ruby\n end", "def eval(expr, *rest) end", "def eval(*args) # :nodoc:\n Evaler.eval(args[0], *args)\n end", "def eval(*args...
[ "0.66314995", "0.64470035", "0.6245916", "0.58221024", "0.5551132", "0.55450517", "0.5522364", "0.54952365", "0.540085", "0.540085", "0.540085", "0.540085", "0.540085", "0.540085", "0.5347043", "0.5232621", "0.5174498", "0.5070076", "0.50673705", "0.5062544", "0.5059726", "...
0.5813623
4
0 [ Extension ]
def resourceType 'DomainResource' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension=(_arg0); end", "def extension=(_arg0); end", "def extensions=(_arg0); end", "def extension; end", "def extension; end", "def extension; end", "def extension; end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def ext; end", "def ext; end", "def by_e...
[ "0.7810194", "0.7810194", "0.7509491", "0.7443637", "0.7443637", "0.7443637", "0.7443637", "0.7392554", "0.7392554", "0.7392554", "0.69900113", "0.69900113", "0.68408746", "0.6797157", "0.65653044", "0.65653044", "0.65653044", "0.64997584", "0.63475174", "0.63475174", "0.6347...
0.0
-1
Hold a TCP connection
def run port puts "Starting Proxy to #{$remote_server}:#{$remote_port}. Listening on #{port}" @server = TCPServer.new port loop do Thread.start @server.accept do |s| proxy_request s s.close end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect\n close\n @socket = TCPSocket.new(@host, @port)\n @socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)\n self\n end", "def connect\n disconnect if connected?\n @socket = TCPSocket.new(@host, @port)\n @socket.setsockopt(::Socket::SOL_SOCKET, ::Socket...
[ "0.7162248", "0.6706746", "0.64792055", "0.64475334", "0.6408113", "0.6403394", "0.63417244", "0.6305441", "0.6296608", "0.6264374", "0.62571186", "0.620909", "0.61935544", "0.61622906", "0.61554366", "0.60870916", "0.60687864", "0.6055266", "0.60446376", "0.60377574", "0.603...
0.0
-1
Forward on the data
def proxy_request client req = parse_request client query = req.query.map { |k, v| "#{k}=#{v}" }.join '&' query = '?' << query unless query.strip.empty? query = URI::encode query server = TCPSocket.new($remote_server, $remote_port) write_request_enveloped req, server # Read response ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward()\n @forward\n end", "def forward; end", "def forward; end", "def forward\n end", "def fast_forward()\n @ole.FastForward()\n end", "def forward(payload)\n @forwarded << payload\n end", "def forward(offset = 1)\n self[offset]\n @buffer.slice!(0, off...
[ "0.72300833", "0.7155595", "0.7155595", "0.7137253", "0.6614509", "0.6561502", "0.6466372", "0.6241267", "0.61805415", "0.612633", "0.60970294", "0.60970294", "0.6091827", "0.60483736", "0.60045964", "0.60045964", "0.5944573", "0.5909576", "0.5902064", "0.58766985", "0.582706...
0.0
-1
Steps: 1) Compute the frequency maps first 2) Iterate to match against the first freq map 3) Repeat with a subset...
def compute_freq_map(str) # OPTIMIZATION IDEA: Make this function also be able to determine if the curr_freq_map matches the last_freq_map freq_map = {} str.each_char do |char| if freq_map[char] freq_map[char] += 1 else freq_map[char] = 1 end end return freq_map end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_frequencies(keys)\n @frequencies = {}\n threads = []\n\n key_lengths = keys.map(&:size).uniq\n key_lengths.each do |key_length|\n threads << Thread.new do\n results_hash = key_frequency(key_length, @seq)\n @frequencies.merge!(results_hash)\n end\n end\n threads.each(&:join)\n @frequ...
[ "0.6500147", "0.6401881", "0.60444576", "0.60373384", "0.58859545", "0.5856809", "0.58528644", "0.58308876", "0.58307946", "0.581327", "0.5791292", "0.5771471", "0.57164544", "0.5710772", "0.5703279", "0.56845486", "0.56402916", "0.5639673", "0.56208384", "0.56185883", "0.559...
0.58499163
7
Finds the User with the ID stored in the session with the key :current_user_id This is a common way to handle user login in a Rails application; logging in sets the session value and logging out removes it.
def current_user @_current_user ||= session[:current_user_id] && User.find_by_id(session[:current_user_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_current_user\n if session[:current_user_id]\n @user = User.find_by(id: session[:current_user_id])\n else\n @user = nil\n end\n end", "def find_current_user\n if is_logged_in?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",...
[ "0.8125412", "0.80807096", "0.80496895", "0.80496895", "0.8038555", "0.7968024", "0.794948", "0.7944813", "0.7939633", "0.79233617", "0.7760321", "0.7756851", "0.7740799", "0.77388847", "0.7725845", "0.76925015", "0.76538205", "0.76373136", "0.7626508", "0.7620851", "0.761516...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_barbasedef @barbasedef = Barbasedef.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 barbasedef_params params.require(:barbasedef).permit(:name, :summary) 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.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
results in context highlights from solr, if available If multiple highlight results, we join them together with ellipses. We put ellipses at beginning and end either way. html_safe string is returned, with the tags around highlights.
def search_highlights @search_highlights ||= begin highlights = HIGHLIGHT_SOLR_FIELDS.collect {|field| get_highlights(field) }.flatten.slice(0, MAX_HIGHLIGHT_SNIPPETS) if highlights.present? "…".html_safe + safe_join(highlights, " …") + "…".html_safe else "" end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_eds_payload(str, html_safe = false)\n return str if str.blank?\n \n unless configuration.highlighting\n str = str.html_safe if html_safe \n return str\n end\n \n parts = \n str.split(%r{(</?highlight>)}).collect do |substr|\n case substr\n when \"<highlight...
[ "0.6916405", "0.67094064", "0.6442041", "0.637197", "0.6370584", "0.6370584", "0.6370584", "0.63705367", "0.6291517", "0.6244367", "0.62073857", "0.61958396", "0.60848373", "0.6080314", "0.6006171", "0.60004467", "0.5915987", "0.59129435", "0.58779025", "0.58693653", "0.58577...
0.7338639
0
This method generates an array of all moves that can be made after the current move.
def parent=(node) if self.parent == nil @parent = node node.children << self unless node == nil || node.children.include?(self) else self.parent.children.delete(self) @parent = node node.children << self unless node == nil || node.children.include?(self) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_positio...
[ "0.7454174", "0.74464506", "0.74061584", "0.7373708", "0.7237665", "0.72349995", "0.72153026", "0.72115785", "0.7204031", "0.7179857", "0.7140204", "0.7115495", "0.70883703", "0.7080224", "0.7071242", "0.7061038", "0.7033329", "0.70262533", "0.698371", "0.697463", "0.69518507...
0.0
-1
GET /leagues GET /leagues.json
def index @leagues = League.all render json: @leagues, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @leagues = League.all\n end", "def index\n @leagues = League.all\n end", "def index\n @leagues = League.all\n end", "def index\n @leagues = League.all\n end", "def index\n @leagues = League.all\n end", "def index\n @leagues = League.all\n end", "def index\n @leagu...
[ "0.72702163", "0.72702163", "0.72702163", "0.72702163", "0.72702163", "0.72702163", "0.72702163", "0.7116544", "0.6857395", "0.6766124", "0.6766124", "0.6766124", "0.6547337", "0.653582", "0.6523566", "0.64594334", "0.6428697", "0.6428697", "0.6428417", "0.6427674", "0.639503...
0.77704555
0
GET /leagues/1 GET /leagues/1.json
def show render json: @league, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @leagues = League.all\n render json: @leagues, status: :ok\n end", "def index\n @leagues = League.all\n end", "def index\n @leagues = League.all\n end", "def index\n @leagues = League.all\n end", "def index\n @leagues = League.all\n end", "def index\n @leagues ...
[ "0.76706994", "0.7194191", "0.7194191", "0.7194191", "0.7194191", "0.7194191", "0.7194191", "0.7194191", "0.6878007", "0.6878007", "0.6791747", "0.6768176", "0.6759958", "0.67438954", "0.67438954", "0.67438954", "0.66949946", "0.66024595", "0.65559477", "0.6517691", "0.648639...
0.6974465
8
POST /leagues POST /leagues.json
def create @league = League.new(league_params) @league.owner = current_user.id @league.state = 'created' if @league.save render json: @league, status: :created else render json: @league.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @team = Team.new(team_params)\n @leagues = League.all.order(:name)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n f...
[ "0.6851047", "0.6758509", "0.63933396", "0.6391315", "0.6391315", "0.638866", "0.6344112", "0.62674415", "0.6173461", "0.61726165", "0.6154017", "0.6122917", "0.61171585", "0.6106965", "0.61043733", "0.60935944", "0.60935944", "0.6028569", "0.5998626", "0.5971303", "0.5966277...
0.6281464
7
PATCH/PUT /leagues/1 PATCH/PUT /leagues/1.json
def update @league.update(league_params) @league.state = leagues_helper.setup_draft(@league) if @league.state == 'draft' if @league.save render json: @league, status: :ok else render json: @league.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @leagues = League.all.order(:name)\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit...
[ "0.6919794", "0.6544281", "0.65329516", "0.65209115", "0.64573574", "0.64573574", "0.6433156", "0.64185727", "0.6417147", "0.64124393", "0.6395037", "0.6365824", "0.630945", "0.630945", "0.630945", "0.6266754", "0.62488395", "0.6244272", "0.6239223", "0.62324923", "0.6088433"...
0.6363483
12
DELETE /leagues/1 DELETE /leagues/1.json
def destroy @league.destroy respond_to do |format| format.html { redirect_to leagues_url, notice: 'League was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @league.destroy\n respond_to do |format|\n format.html { redirect_to leagues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @league.destroy\n respond_to do |format|\n format.html { redirect_to leagues_url }\n format.json { head :no_content ...
[ "0.75054145", "0.75054145", "0.73300433", "0.72945654", "0.7277773", "0.7277773", "0.7262296", "0.7252311", "0.7250237", "0.7193223", "0.7193223", "0.7193223", "0.7193223", "0.71160394", "0.7051514", "0.7051514", "0.7011887", "0.7011887", "0.69736177", "0.69720757", "0.697141...
0.69082683
23
Use callbacks to share common setup or constraints between actions.
def set_league @league = League.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.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.533122...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def league_params params.require(:league).permit(:owner, :state, :name, :season, :rules, :team_ids) 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
Reloads the data from a ROM, dropping any changes.
def reread STRUCTURE.each do |entry| bytes = @rom.read_table(entry.to_s << '_table', @index) byte = (entry == :enemy_alt ? bytes[0] : bytes[1]) value = byte.unpack('C').first instance_variable_set('@' << entry.to_s, value) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload_from_rom\n @representation = nil\n clear_cache\n present\n self\n end", "def reload\n old_data = @data.dup\n self.load\n @data = old_data.merge! @data\n end", "def reload\n @raw_devices = nil\n @devices = nil\n end", "def relo...
[ "0.6788623", "0.6769127", "0.6558204", "0.64953417", "0.6489817", "0.64381015", "0.63603354", "0.632929", "0.6265165", "0.6241301", "0.616229", "0.61247736", "0.6122747", "0.60684067", "0.60652", "0.60652", "0.60652", "0.60652", "0.60597235", "0.60441077", "0.60441077", "0....
0.0
-1
Returns a hash of battler data.
def to_hash hash = {} STRUCTURE.each do |entry| hash[entry] = instance_variable_get('@' << entry.to_s) end { @index => { battler: hash } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weapons_hash()\n return @weapons\n end", "def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end", "def hash\n data.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n e...
[ "0.6494269", "0.64409184", "0.626951", "0.61782706", "0.61782706", "0.61782706", "0.6171944", "0.61579007", "0.61211807", "0.60641754", "0.60481745", "0.6046736", "0.6006937", "0.59938353", "0.5983348", "0.594136", "0.59406394", "0.5937848", "0.5889254", "0.58645093", "0.5859...
0.64469194
1
Well formatted, comma separated list of package manifest(s)
def format_manifests(manifests) return "" if manifests.empty? formatted = manifests.map { |e| "`#{e.fileName}`" } return formatted.first if formatted.size == 1 output = formatted.join(', ') output[output.rindex(',')] = ' and' return output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_manifest()\n res = []\n @items.each do |item|\n sources = item[:sources]\n sources = [ sources ] unless sources.kind_of?(Array)\n sources.each do |src|\n # TODO - want to split into multiple packages\n #if pkg == :main\n # next unless item[:dest] =~ /(LIB|BIN)...
[ "0.7292605", "0.67965317", "0.6628775", "0.6624495", "0.65781564", "0.65577203", "0.6497614", "0.64621454", "0.63287157", "0.6299323", "0.62695205", "0.6132585", "0.61137474", "0.6066708", "0.59285027", "0.58851", "0.5842899", "0.57532895", "0.57370335", "0.57001513", "0.5685...
0.7099647
1
Warning message for not updated package manifest(s)
def manifests_warning_message(updated:, not_updated:) return "Unable to construct warning message." if updated.empty? || not_updated.empty? updated_manifests_names = format_manifests(updated) not_updated_manifests_names = format_manifests(not_updated) updated_article = updated.size == 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_pkg_manifest\n log.info(log_key) { \"Validating package manifest\" }\n shellout!(\"pkglint -c /tmp/lint-cache -r http://pkg.oracle.com/solaris/release #{pkg_manifest_file}.5.res\")\n end", "def unverifiable_packages_message\n if nagios_mode?\n puts \"CRIT: available meta...
[ "0.6532708", "0.63751614", "0.63485336", "0.6220866", "0.6175077", "0.59797096", "0.5945484", "0.5926796", "0.5913569", "0.5798618", "0.57659674", "0.56986755", "0.5664891", "0.5639935", "0.56158787", "0.56158787", "0.56158787", "0.56138366", "0.56010437", "0.5533654", "0.552...
0.67177624
0
GET /student_pastors/1 GET /student_pastors/1.json
def show @student_pastor = StudentPastor.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @student_pastor } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @student_pastor = StudentPastor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_pastor }\n end\n end", "def show\n @pastor = Pastor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.j...
[ "0.68931544", "0.67525065", "0.650483", "0.63462853", "0.63257235", "0.6304948", "0.6257498", "0.62518764", "0.62506497", "0.6239033", "0.620212", "0.6168702", "0.6168702", "0.6168702", "0.6168702", "0.6168702", "0.6168702", "0.6168702", "0.6168702", "0.61497366", "0.61369705...
0.7767356
0
GET /student_pastors/new GET /student_pastors/new.json
def new @student_pastor = StudentPastor.new respond_to do |format| format.html # new.html.erb format.json { render json: @student_pastor } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @student_pastor = StudentPastor.new(params[:student_pastor])\n\n respond_to do |format|\n if @student_pastor.save\n format.html { redirect_to @student_pastor, notice: 'Student pastor was successfully created.' }\n format.json { render json: @student_pastor, status: :created, l...
[ "0.7661788", "0.73621243", "0.69997334", "0.69997334", "0.69997334", "0.69997334", "0.69997334", "0.69997334", "0.69997334", "0.69997334", "0.69997334", "0.69997334", "0.69997334", "0.6993131", "0.6948406", "0.69192564", "0.69192564", "0.69045335", "0.6894181", "0.6866139", "...
0.80677927
0
POST /student_pastors POST /student_pastors.json
def create @student_pastor = StudentPastor.new(params[:student_pastor]) respond_to do |format| if @student_pastor.save format.html { redirect_to @student_pastor, notice: 'Student pastor was successfully created.' } format.json { render json: @student_pastor, status: :created, location: @s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @student_pastor = StudentPastor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_pastor }\n end\n end", "def create\n @pastor = Pastor.new(params[:pastor])\n\n respond_to do |format|\n if @pastor.save\n format.html {...
[ "0.6643624", "0.65170926", "0.6223908", "0.61326945", "0.61088014", "0.6101225", "0.6095551", "0.60908675", "0.60556877", "0.6037607", "0.60322857", "0.6017427", "0.6017427", "0.6000516", "0.6000516", "0.6000516", "0.6000516", "0.6000516", "0.6000516", "0.6000516", "0.5998368...
0.77261823
0
PUT /student_pastors/1 PUT /student_pastors/1.json
def update @student_pastor = StudentPastor.find(params[:id]) respond_to do |format| if @student_pastor.update_attributes(params[:student_pastor]) format.html { redirect_to @student_pastor, notice: 'Student pastor was successfully updated.' } format.json { head :no_content } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @student_pastor = StudentPastor.new(params[:student_pastor])\n\n respond_to do |format|\n if @student_pastor.save\n format.html { redirect_to @student_pastor, notice: 'Student pastor was successfully created.' }\n format.json { render json: @student_pastor, status: :created, l...
[ "0.65384436", "0.653231", "0.6169853", "0.6140663", "0.61274755", "0.6057805", "0.6011538", "0.5993363", "0.5988719", "0.5966995", "0.59589064", "0.5957743", "0.594992", "0.594992", "0.5948967", "0.59444606", "0.5940916", "0.5940916", "0.5940916", "0.5940916", "0.5940916", ...
0.7465485
0
DELETE /student_pastors/1 DELETE /student_pastors/1.json
def destroy @student_pastor = StudentPastor.find(params[:id]) @student_pastor.destroy respond_to do |format| format.html { redirect_to student_pastors_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dojo_student = DojoStudent.find(params[:id])\n @dojo_student.destroy\n\n respond_to do |format|\n format.html { redi...
[ "0.74062777", "0.7327531", "0.7311033", "0.72869974", "0.72869974", "0.72869974", "0.72869974", "0.7247813", "0.7247813", "0.7247813", "0.7247813", "0.7247813", "0.7247813", "0.7247813", "0.7247813", "0.72464544", "0.72303545", "0.7179007", "0.7179003", "0.7150752", "0.711116...
0.77852803
0
after init goes this
def viewDidLoad super self.new_game self.init_views end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_init\n end", "def at_init\n\n\t\tend", "def init; end", "def init; end", "def init; end", "def init; end", "def init\n\n end", "def post_init\n end", "def post_initialize\n end", "def initialize\n \n end", "def after_initialize\n end", "def initialize\n\t\t\n...
[ "0.7316231", "0.729778", "0.71569735", "0.71569735", "0.71569735", "0.71569735", "0.6976079", "0.6973773", "0.69328094", "0.691006", "0.69059026", "0.69034815", "0.68837523", "0.6874612", "0.6874612", "0.687004", "0.68225247", "0.68225247", "0.68225247", "0.67766607", "0.6767...
0.0
-1
for the title to the top to work!
def viewWillAppear(animated) self.tabBarController.navigationItem.title = "Challenge" navigationController.setNavigationBarHidden(false, animated:true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title_comp; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title;...
[ "0.7283688", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.72557646", "0.723821", ...
0.0
-1
clear views > prepare for new question
def clear view.subviews.each {|sv| sv.removeFromSuperview} @buttons = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_views\n @views = []\n end", "def view_completed_question\n nil\n end", "def view_completed_question\n nil\n end", "def reload\n @view = nil\n end", "def without_answers\n \n @questions = Question.with_no_answer\n render(:action => \"index...
[ "0.6759937", "0.629768", "0.629768", "0.6165435", "0.61149687", "0.6073838", "0.59904444", "0.59013075", "0.5884912", "0.58706564", "0.58602554", "0.584081", "0.5829056", "0.5829056", "0.58266854", "0.5801996", "0.5794913", "0.57833517", "0.5748165", "0.5746897", "0.5746675",...
0.0
-1
correct answer > next question
def correct_answer new_question @label_quess.text = "That's correct!" @label_quess.textColor = UIColor.blueColor # return @scores = 0 if @scores > 10000 # @scores += 1 return @correct = 0 if @correct > 10000 @correct +=1 @label_corect.text = " ✓: " + @correct.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask\n\t\tbegin\n\t\t\tputs self\n\t\t\tprint \"Su respuesta: \" \n\t\t\tanswerno = gets.to_i - 1\n\t\tend while (answerno < 0 or answerno >= @answers.length)\n\t\t#Comprobamos si es correcta la respuesta\n\t\t@answers[answerno].is_right? \n\tend", "def correct_answer\n @correct_answer ||= question.correct...
[ "0.7329604", "0.6891757", "0.68385226", "0.6801242", "0.6760172", "0.67583776", "0.6710438", "0.6639845", "0.6638809", "0.66375464", "0.6619883", "0.66191876", "0.6590683", "0.6584695", "0.65689814", "0.6536283", "0.65306854", "0.6516849", "0.65057814", "0.6478167", "0.646286...
0.6457734
21
quiz incorrect answer > removes leaf
def incorrect_answer(button_index) @label_quess.text = "Guess once more!" @label_quess.textColor = UIColor.alloc.initWithRed(0.8,green: 0.6,blue: 0.73, alpha:1.0) @buttons[button_index].removeFromSuperview # return @scores = 0 if @scores < -10000 # @scores -= 1 return @incorrect = 0 if @incorre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answers_tree_answer(hash, question)\r\n return '' if hash.blank?\r\n return '' if hash[question.id.to_s].blank?\r\n answer = hash[question.id.to_s]\r\n case question.presentation_type\r\n when :select\r\n answer = '' if answer == SELECT_DEFAULT_ITEM_SELECT_TEXT or answer.blank?\r\n when ...
[ "0.6047108", "0.60117066", "0.57431483", "0.5726063", "0.5679989", "0.5610361", "0.5550587", "0.55292463", "0.5525631", "0.54978704", "0.5480546", "0.5473414", "0.54553354", "0.5448356", "0.5443587", "0.5443456", "0.5387563", "0.5364041", "0.5353842", "0.53534096", "0.5345643...
0.55815125
6
Creates a reader backend using the backend (id) and options/backend_options provided in initialize or set_backend
def build_backend(backend_id, backend_options = {}) backend_options ||= {} return provided_backends[backend_id].call(backend_options) rescue NoMethodError return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize( backend = nil, config = {} )\n backend ||= :memory\n \n begin\n adapter = RG::Adapters.const_get(\"#{backend.to_s.capitalize}Adapter\")\n @adapter = adapter.new(config)\n rescue LoadError\n Raise \"Cannot find the backend #{backend}\"\n end\n \n ...
[ "0.6634583", "0.6001137", "0.5701367", "0.55813736", "0.55740213", "0.5462918", "0.5437071", "0.5347042", "0.52582026", "0.51693845", "0.51693845", "0.5145798", "0.5129581", "0.51263016", "0.5108897", "0.50842905", "0.50548244", "0.5041924", "0.5040088", "0.50011784", "0.5000...
0.5922982
2
GET /store_statuses GET /store_statuses.json
def index @store_statuses = StoreStatus.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end", "def index\n @statuses = Status.all\n end", "def index\n @statuses = Status.all\n end", "def index\n @statuses = Status.search.page params[:page]\n end", "def statuses\n request(:get, \...
[ "0.72544754", "0.69744104", "0.69744104", "0.68255156", "0.6654326", "0.6653253", "0.66249615", "0.65639514", "0.65376085", "0.6500529", "0.64696914", "0.6361791", "0.62999684", "0.62743556", "0.62606096", "0.62606096", "0.6236873", "0.6224736", "0.61934674", "0.6171486", "0....
0.7153697
1
GET /store_statuses/1 GET /store_statuses/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end", "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end", "def index\n @statuses = Status.all\n end", "def index\n @statuses = Status.all\n end", "def show\n respond_to do |f...
[ "0.7021377", "0.68061745", "0.66051686", "0.66051686", "0.6505067", "0.6485522", "0.64609283", "0.6454332", "0.64352286", "0.6398631", "0.63677955", "0.62488604", "0.62419677", "0.62202764", "0.6178675", "0.6177947", "0.6177947", "0.6169073", "0.61594343", "0.6143382", "0.614...
0.0
-1
POST /store_statuses POST /store_statuses.json
def create @store_status = StoreStatus.new(store_status_params) respond_to do |format| if @store_status.save format.html { redirect_to @store_status, notice: 'Store status was successfully created.' } format.json { render action: 'show', status: :created, location: @store_status } e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_statuses\n end", "def create_statuses\n end", "def create\n @status = current_user.statuses.new(status_params)\n\n if current_user.state_facebook? && @status.content?\n current_user.facebook(current_user).put_wall_post(@status.content)\n end\n\n if current_user.state_twitter? && @...
[ "0.7142386", "0.7142386", "0.67227024", "0.66257393", "0.6510674", "0.6439483", "0.63645303", "0.6335565", "0.625719", "0.62567663", "0.6179161", "0.6100332", "0.60944486", "0.60434484", "0.600176", "0.5988189", "0.59721303", "0.59419614", "0.5919201", "0.59117156", "0.589824...
0.60359687
14
PATCH/PUT /store_statuses/1 PATCH/PUT /store_statuses/1.json
def update respond_to do |format| if @store_status.update(store_status_params) format.html { redirect_to @store_status, notice: 'Store status was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_statuses }\n else\n format...
[ "0.6790479", "0.65059984", "0.6407725", "0.6335584", "0.63221794", "0.631513", "0.63048303", "0.62264353", "0.6191398", "0.6153902", "0.6137764", "0.6137764", "0.6134112", "0.6115771", "0.6115771", "0.6098844", "0.6076639", "0.6054197", "0.60441667", "0.60313606", "0.6014596"...
0.64752954
2
DELETE /store_statuses/1 DELETE /store_statuses/1.json
def destroy @store_status.destroy respond_to do |format| format.html { redirect_to store_statuses_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuses_...
[ "0.7336414", "0.7328965", "0.72982854", "0.72600675", "0.7209169", "0.71997994", "0.719944", "0.71223193", "0.7104896", "0.7099507", "0.70560086", "0.7027517", "0.7027517", "0.70213896", "0.6992022", "0.6981976", "0.6963037", "0.69610506", "0.69547796", "0.69520944", "0.69120...
0.7772572
0
Use callbacks to share common setup or constraints between actions.
def set_store_status @store_status = StoreStatus.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 store_status_params params.require(:store_status).permit(:name, :description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
get a particular user
def show render json: UserService.get_user(params[:id]), includes: 'questions, answers' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(user_id)\n return User.find(user_id)\n end", "def get(user_id)\n User.find user_id\n end", "def get_user(id)\n @users[id]\n end", "def retrieve(user_id:)\n User.new get_request(\"users/#{user_id}\").body.dig(\"user\")\n end", "def user(id)\n self.class.get(\"/user/#{...
[ "0.8153753", "0.81086797", "0.80374885", "0.79977304", "0.78845227", "0.7880631", "0.78491616", "0.78206974", "0.7814181", "0.78031653", "0.7780717", "0.7732421", "0.77295816", "0.77205384", "0.7713921", "0.7689921", "0.7688631", "0.765955", "0.7658898", "0.76357746", "0.7635...
0.0
-1
update details of user
def update user = @user_service.update_user(params[:id]) render json: user, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_user\n end", "def update\n\t\t@user = current_user\n\t\t@user.name = params[:name]\n\t\t@user.phone = params[:phone]\n\t\t@user.phone_operator = params[:phone_operator]\n\t\tif @user.save\n\t\t\tsession[:user_id] = @user.id\n\t\t\tflash[:notice] = \"Details Updated.\"\n\t\t\tredirect_to(dashboard_p...
[ "0.83226067", "0.7762521", "0.7744057", "0.7651048", "0.76406354", "0.7633024", "0.76067615", "0.75961024", "0.7546906", "0.7533257", "0.7527413", "0.7524687", "0.74869066", "0.74855274", "0.745683", "0.7437064", "0.7435419", "0.74341494", "0.74296194", "0.7403295", "0.737656...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.permit("name", "email_id", "password", "password_confirmation","id","remember") 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.6980244", "0.6782812", "0.6745103", "0.6741142", "0.6733961", "0.65925", "0.6503602", "0.64967257", "0.64822173", "0.64796996", "0.6456357", "0.6439594", "0.63803256", "0.6376499", "0.63644457", "0.6319286", "0.6299465", "0.6298051", "0.62935406", "0.62923044", "0.6291212"...
0.0
-1
A string suitable for displaying to the user
def human_name "reverse UDP" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_string(options, object, length = nil)\n \":#{object}\"\n end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n render().join \"\\n\"\n end", "def to_s\n Alf::Renderer.text(self).execute(\"\"...
[ "0.7143428", "0.6978515", "0.6970994", "0.6902787", "0.6883123", "0.6868609", "0.6845904", "0.6808934", "0.6791878", "0.6788074", "0.67876154", "0.67875713", "0.6786277", "0.6786277", "0.6786277", "0.6786277", "0.67828447", "0.677699", "0.6754529", "0.674938", "0.67454743", ...
0.0
-1
A URI describing what the payload is configured to use for transport
def payload_uri addr = datastore['LHOST'] uri_host = Rex::Socket.is_ipv6?(addr) ? "[#{addr}]" : addr "udp://#{uri_host}:#{datastore['LPORT']}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri_endpoint\n URI( self.endpoint )\n end", "def endpoint\n \"#{@scheme}://#{@host}#{@path}\"\n end", "def uri\n \"http://#{hostname}:#{port}#{path}\"\n end", "def payload_uri\n addr = datastore['LHOST']\n uri_host = Rex::Socket.is_ipv6?(addr) ? \"[#{addr}]\" : addr\...
[ "0.7326122", "0.70676017", "0.6936119", "0.6895129", "0.68764997", "0.6833289", "0.6833289", "0.6822625", "0.68185604", "0.68165785", "0.68165785", "0.6805891", "0.6781272", "0.6781272", "0.6781272", "0.6781272", "0.6781272", "0.6781272", "0.6781272", "0.6781272", "0.6781272"...
0.6349102
62
A URI describing where we are listening
def listener_uri(addr = datastore['ReverseListenerBindAddress']) addr = datastore['LHOST'] if addr.nil? || addr.empty? uri_host = Rex::Socket.is_ipv6?(addr) ? "[#{addr}]" : addr "udp://#{uri_host}:#{bind_port}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri(location, options={})\n ops = resolve_defaults(options)\n @listener.register(location, ops[:handler], ops[:in_front])\n end", "def listener_uri(addr = datastore['ReverseListenerBindAddress'])\n addr = datastore['LHOST'] if addr.nil? || addr.empty?\n uri_host = Rex::Socket.is_ipv6?(addr...
[ "0.7068179", "0.7039041", "0.65697294", "0.64794505", "0.6290014", "0.6240302", "0.6240302", "0.6240302", "0.62150824", "0.6081083", "0.60782856", "0.60782856", "0.6043254", "0.6019149", "0.60067594", "0.5982672", "0.5982672", "0.5911158", "0.5911158", "0.5911158", "0.5911158...
0.6658383
2
Initializes the reverse UDP handler and ads the options that are required for all reverse UDP payloads, like local host and local port.
def initialize(info = {}) super register_options( [ Opt::LHOST, Opt::LPORT(4444) ], Msf::Handler::ReverseUdp) # XXX: Not supported by all modules register_advanced_options( [ OptAddress.new('ReverseListenerBindAddress', [ false, 'The specific IP address to bin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(*args)\n super\n register_advanced_options([ OptString.new('PayloadBindPort', [false, 'Port to bind reverse tcp socket to on target system.']) ], self.class)\n end", "def initialize(info = {})\n super\n\n register_options(\n [\n OptAddressLocal.new('LHOST', \"The local lis...
[ "0.65543383", "0.6352248", "0.62823206", "0.62640744", "0.62408626", "0.6180614", "0.58634037", "0.5860333", "0.58194184", "0.57735574", "0.57515275", "0.5707791", "0.5702452", "0.56881255", "0.55498624", "0.5523968", "0.55148077", "0.5379042", "0.536166", "0.5293796", "0.525...
0.7327963
0
Starts the listener but does not actually attempt to accept a connection. Throws socket exceptions if it fails to start the listener.
def setup_handler ex = false comm = case datastore['ReverseListenerComm'].to_s when "local"; ::Rex::Socket::Comm::Local when /\A[0-9]+\Z/; framework.sessions[datastore['ReverseListenerComm'].to_i] else; nil end unless comm.is_a? ::Rex::Socket::Comm comm = nil end loca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_listening\n # If socket's already dead (probably couldn't connect to server), don't\n # try to listen!\n if @irc.dead_socket\n $stderr.puts \"Dead socket, can't start listening!\"\n end\n\n @irc.start_listening\n end", "def start_listening\n # We don't want to spaw...
[ "0.7034988", "0.6534681", "0.6533588", "0.6454579", "0.6194987", "0.6191662", "0.61774564", "0.6162225", "0.6142987", "0.60596836", "0.605722", "0.60349405", "0.60331583", "0.60232544", "0.5951607", "0.58284456", "0.5751554", "0.5744468", "0.57395965", "0.5731748", "0.5719088...
0.0
-1
Closes the listener socket if one was created.
def cleanup_handler stop_handler # Kill any remaining handle_connection threads that might # be hanging around conn_threads.each { |thr| thr.kill rescue nil } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n @socket.close unless closed?\n end", "def close\n @socket.close if @socket\n end", "def close\n @socket.close if @socket\n @socket = nil\n end", "def close\n if @socket\n @socket.close\n @socket = nil\n end\n end", "def close\n ...
[ "0.7537935", "0.75271004", "0.74639684", "0.74506307", "0.74506307", "0.7415628", "0.7396619", "0.7334758", "0.72950494", "0.72950494", "0.72692597", "0.7240079", "0.7171701", "0.7104085", "0.7103169", "0.7079316", "0.7044943", "0.7044702", "0.7017634", "0.70102155", "0.69851...
0.0
-1
Starts monitoring for an inbound connection.
def start_handler queue = ::Queue.new local_port = bind_port self.listener_thread = framework.threads.spawn("ReverseUdpHandlerListener-#{local_port}", false, queue) { |lqueue| loop do # Accept a client connection begin inbound, peerhost, peerport = self.listener_sock.recvfr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_monitoring_connection\n @connection_monitor_thread ||= Thread.new{monitor_connection}\n @connection_monitor_thread.abort_on_exception = true\n end", "def start\n while @mStatus <= 0\n connect\n monitor\n sleep 5\n end\n end", "def start()\n #start listening\n...
[ "0.7127821", "0.6537719", "0.6303413", "0.6227494", "0.6199862", "0.6177123", "0.61248994", "0.5987855", "0.58710474", "0.57403034", "0.5734516", "0.5710067", "0.5686743", "0.5679955", "0.5659746", "0.5648756", "0.563604", "0.56200635", "0.561724", "0.5589407", "0.552557", ...
0.0
-1
Stops monitoring for an inbound connection.
def stop_handler # Terminate the listener thread if (self.listener_thread and self.listener_thread.alive? == true) self.listener_thread.kill self.listener_thread = nil end # Terminate the handler thread if (self.handler_thread and self.handler_thread.alive? == true) self.handler_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect()\n @connection.stop()\n @timer.stop()\n @broadcast.stop()\n end", "def disconnect!\n context.with_connection do |connection|\n connection.disconnect!\n end\n @monitor.stop! and true\n end", "def close\n stop_mon...
[ "0.6537387", "0.65260106", "0.64852804", "0.6484103", "0.64126724", "0.6323893", "0.62988794", "0.61819345", "0.61819345", "0.61819345", "0.615664", "0.5959128", "0.58726543", "0.5813472", "0.574481", "0.5726481", "0.57257944", "0.57007384", "0.56981146", "0.56845814", "0.567...
0.0
-1
Current Page Getter Function
def CurrentPage puts "I'm now on " + $browser.url puts $newline end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_page\n @current_page\n end", "def current\n pages.current\n end", "def current_page\n @page\n end", "def current_page; end", "def current_page; end", "def current_url\n page.current_url\n end", "def current_url\n page.current_url\n end", "def current_pa...
[ "0.85425204", "0.85376126", "0.8527303", "0.83972895", "0.83972895", "0.78911185", "0.78911185", "0.784822", "0.784424", "0.7789581", "0.7695593", "0.76877403", "0.7544167", "0.7520961", "0.7467442", "0.745932", "0.73963654", "0.73963654", "0.7268972", "0.7256631", "0.7251495...
0.0
-1
Close Browser at End of Process
def Close # Close browser $browser.close $headless.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_browser\r\n @browser.quit\r\n sleep 1\r\n end", "def closeBrowser(step)\n @browser.quit\n end", "def quit\n @browser.close\n end", "def close_browser\n Logbook.step('Stop webdriver. The End of a test:)')\n @browser.quit\n Logbook.publish_results\n end", "def c...
[ "0.83717036", "0.80212253", "0.8010782", "0.7982948", "0.7916633", "0.7818423", "0.7782694", "0.7777068", "0.7771974", "0.77489245", "0.7514655", "0.751333", "0.75048435", "0.7440187", "0.7433957", "0.7403237", "0.7367189", "0.73507506", "0.73507506", "0.73507506", "0.7153575...
0.74014306
16
Handles Push Notification Dialgoue Boxes
def WaitOnPushNotification # If the push notifications pop-up exists if $browser.button(:id => 'onesignal-popover-cancel-button', :text => "No Thanks").exists? # Click it $browser.div(:id => 'onesignal-popover-container').button(:id => 'onesignal-popover-cancel-button', :text => "No Than...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(notif)\n\n end", "def receive_push\r\n check_configuration_options\r\n\tperform_login_on_codeporting\r\n end", "def send_notification\n\n\n end", "def deliver_push_notification\n return unless push_notification_sent_at.nil? # avoid double send\n return if self.user == self.created...
[ "0.6556472", "0.6413598", "0.58749735", "0.5833219", "0.5783709", "0.57629114", "0.57496244", "0.57494247", "0.5738502", "0.5688309", "0.5664872", "0.5572573", "0.54509896", "0.5439419", "0.5414866", "0.53963596", "0.53568995", "0.53534395", "0.53472716", "0.5343723", "0.5328...
0.56034315
11
Log Out Works on Customer & Expert
def LogOut # If the button exists if $browser.li(:class => 'logout').a.exists? # Click it $browser.li(:class => 'logout').a.click puts "I clicked it!" puts $newline elsif $browser.li(:name => "Sign Out").a.exists? # Click it $browser.li(:name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer_log_out\n customer_forget(current_customer)\n session.delete(:customer_id)\n @current_customer = nil\n end", "def log_out\n session.delete(:customer_id)\n @current_user = nil\n end", "def logged_out\n end", "def logged_out\n end", "def logged_out\n end", "def log_out\n\t\...
[ "0.7868675", "0.7792956", "0.76881063", "0.76881063", "0.76881063", "0.768341", "0.75354064", "0.750438", "0.74911577", "0.74613196", "0.7451808", "0.74361014", "0.7432242", "0.74068284", "0.7378364", "0.73607826", "0.73536116", "0.7339166", "0.7321832", "0.73194176", "0.7317...
0.0
-1
Round 2: Write a Ruby function called transmogrifier. This function should accept three arguments, which you can assume will be numbers. Your function should return the "transmogrified" result The transmogrified result of three numbers is the product (numbers multiplied together) of the first two numbers, raised to the...
def transmogrifier(num1, num2, num3) (num1 * num2) ** num3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transmogrifier(num1, num2, num3)\n transmogrified = ((num1*num2) * num3)\n return transmogrified \nend", "def transmogrifier (num1,num2,num3)\n (num1 * num2)**num3\nend", "def transmogrifier num1,num2,num3\n\t(num1 * num2) ** num3\nend", "def transmogrifier(num1, num2, num3)\n return (num1*num2)**n...
[ "0.82524425", "0.80094874", "0.8008593", "0.80019045", "0.78830814", "0.78711694", "0.77784026", "0.75917584", "0.75241375", "0.7464589", "0.7348357", "0.7176132", "0.7048055", "0.6249168", "0.6213523", "0.61913073", "0.61766", "0.6163073", "0.61580056", "0.61580056", "0.6151...
0.79931957
4
14466001271480793216 Round 3: Write a function called toonify that takes two parameters, accent and sentence. If accent is the string "daffy", return a modified version of sentence with all "s" replaced with "th". If the accent is "elmer", replace all "r" with "w". Feel free to add your own accents as well! If the acce...
def toonify(accent, sentence) if accent == "daffy" sentenceArr = sentence.split('') sentenceArr.map! do |word| if word == 's' word = 'th' else word = word end end p sentenceArr.join() elsif accent == "elmer" sentenceArr = sentence.split('') sentenceArr.map! do |word| if word == 'r' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toonify(accent, sentence)\n if accent == 'daffy'\n return sentence.gsub('s', 'th')\n elsif accent == 'elmer'\n return sentence.gsub('r', 'w')\n else\n return sentence\n end\nend", "def toonify (accent, sentence)\n if accent == 'daffy'\n return sentence.gsub('s','th')\n elsif accent ==...
[ "0.8865192", "0.8841811", "0.884038", "0.88109416", "0.87727475", "0.8735886", "0.87067103", "0.8633264", "0.84461343", "0.829749", "0.81620044", "0.78748906", "0.77530813", "0.6478893", "0.6248279", "0.62424964", "0.61491364", "0.60907257", "0.60635185", "0.6055779", "0.6008...
0.85577387
8
Round 4: Write a function wordReverse that accepts a single argument, a string. The method should return a string with the order of the words reversed. Don't worry about punctuation.
def wordReverse(string) reverseStr = string.reverse stringArr = reverseStr.split(' ') stringArr.map! do |word| word.reverse end p stringArr.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_reverse(string)\n reversed_word = string.split(' ').reverse().join(' ').reverse()\nend", "def word_reverse(string)\n reversed_word = string.split(' ').reverse().join(' ')\nend", "def wordReverse(string)\n\tp string.split(\" \").reverse().join(\" \")\nend", "def word_reverse(str)\n p str.split('...
[ "0.82855254", "0.82056856", "0.81669194", "0.81563914", "0.811685", "0.810931", "0.8103567", "0.8093986", "0.8059358", "0.79546773", "0.7953473", "0.7926345", "0.79189456", "0.7897339", "0.7864427", "0.778332", "0.778332", "0.7755196", "0.77361137", "0.7735487", "0.7717128", ...
0.76616925
23
Round 5: Write a function letterReverse that accepts a single argument, a string. The function should maintain the order of words in the string but reverse the letters in each word. Don't worry about punctuation. This will be very similar to round 4 except you won't need to split them with a space.
def letterReverse(string) p string.split.map { |letter| letter.reverse }.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letterReverse(aString)\n return aString.reverse!.split.reverse.join(\" \")\nend", "def letterReverse (str)\n str.split('').reverse.join('')\nend", "def letter_reverse(str)\n p str.reverse.split(' ').reverse.join(' ')\nend", "def letter_reverse (str)\n str.split(' ').map { |each| each.reverse }.jo...
[ "0.81620204", "0.8111769", "0.8053039", "0.80062443", "0.79069597", "0.78482634", "0.7812622", "0.763309", "0.7631261", "0.75426495", "0.7532432", "0.74946827", "0.7486836", "0.7466241", "0.7450304", "0.7432678", "0.7405353", "0.7390955", "0.7387538", "0.7380061", "0.7380061"...
0.8029695
3
Round 6: Write a function longest that accepts a single argument, an array of strings. The method should return the longest word in the array. In case of a tie, the method should return either.
def longest(stringArray) longestString = '' stringArray.each do |word| if word.length > longestString.length longestString = word end end p longestString end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_word_in_array(array)\n array.max_by{|word|word.length}\nend", "def longest_string(arr)\n arr.max_by { |word| word.length }\nend", "def longest_string(array_of_strings)\n answer=array_of_strings.max_by(&:length)\n return answer\nend", "def longest (arr)\n arr.max_by {|str| str.length}\nen...
[ "0.8197651", "0.8179683", "0.8108934", "0.803707", "0.80356383", "0.8030882", "0.8028485", "0.80223167", "0.8020009", "0.7987662", "0.7950328", "0.79398894", "0.7836119", "0.7826005", "0.7823644", "0.7804605", "0.77950037", "0.77919525", "0.77645206", "0.7737268", "0.7710573"...
0.776887
18
Test that chef picks up environments properly NOTE: This shells out to ssh, so may not be windowscompatible
def test_chef_environment # If no environment is specified chef needs to use "_default" and attribute from cookbook actual = cook_environment(run_list: ["recipe[environment_cookbook]"]) assert_equal "_default/untouched", actual # If one is specified chef needs to pick it up and get override attibute ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_chef_env\n require 'json'\n require 'rubygems'\n require 'ohai'\n require 'mixlib/shellout'\n o = Ohai::System.new\n o.all_plugins\n\n env_command =\n Mixlib::ShellOut.new('sudo', 'knife',\n 'node', 'show',\n o[:fqdn] || o[:hostname], '-E',\n ...
[ "0.6822053", "0.6784564", "0.6361845", "0.61242837", "0.61056685", "0.60971", "0.608593", "0.6084377", "0.60739976", "0.600311", "0.59918594", "0.59809303", "0.59617084", "0.59402686", "0.59326386", "0.5924452", "0.59231645", "0.5898028", "0.58944976", "0.5893877", "0.5869489...
0.66220546
2
members of the fibonacci sequence. Use iteration for this solution.
def fibs(num) arr = [0, 1] (2..num).each do |_i| arr << arr[-1] + arr[-2] end arr.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibs (n) #Non-recursive\n\n\t# n = number of Fibonacci sequence members.\n\t# 0, 1, 1, 2, 3, 5, 8, 13, ..\t\n\tfib_seq = []\n\t(0..n).each do |i|\n\t\tif i == 0\n\t\t\tfib_seq << 0\n\t\telsif i == 1\n\t\t\tfib_seq << 1\n\t\telse\n\t\t\tfib_seq << fib_seq[i-2] + fib_seq[i-1]\n\t\tend\n\tend\n\tfib_seq\nend", ...
[ "0.7643195", "0.73379314", "0.73224497", "0.73213613", "0.7295443", "0.7258869", "0.7250122", "0.72448426", "0.7226035", "0.721592", "0.7210224", "0.7207872", "0.7207872", "0.7207872", "0.7207872", "0.7207872", "0.7176632", "0.7168276", "0.7165586", "0.7161415", "0.7155688", ...
0.0
-1
Returns a cached reference to a variable or searches all surrounding scopes for a variable. If no variable is found, it returns nil and a nested scope will create the variable in itself.
def search_local(name) if variable = variables[name] return variable.nested_reference end if variable = search_scopes(name) variables[name] = variable return variable.nested_reference end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_local(name)\n if variable = variables[name]\n return variable.nested_reference\n end\n\n if variable = search_scopes(name)\n variables[name] = variable\n return variable.nested_reference\n end\n end", "def find_var(name, depth = 0)\n if slot = @variable...
[ "0.7324895", "0.7097481", "0.7019526", "0.70029527", "0.6507184", "0.64780706", "0.62492335", "0.5825572", "0.5741889", "0.57131094", "0.5703127", "0.56036466", "0.5538539", "0.552702", "0.5493559", "0.5455178", "0.5453637", "0.5410711", "0.53584826", "0.5346111", "0.5346111"...
0.7247394
1
Compact pagination for bootstrap: it returns the html with the series of links to the pages we use a numeric input tag to set the page and the PagyCompact javascript to navigate
def pagy_nav_bootstrap_compact(pagy, id=caller(1,1)[0].hash) tags, link, p_prev, p_next, p_page, p_pages = '', pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.page, pagy.pages tags << %(<nav id="pagy-nav-#{id}" class="pagy-nav-bootstrap-compact pagination" role="navigation" aria-label="pager">) t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pagy_nav_bootstrap_compact(pagy, id=caller(1,1)[0].hash)\n tags = ''; link = pagy_link_proc(pagy)\n\n tags << %(<nav id=\"pagy-nav-#{id}\" class=\"pagy-nav-bootstrap-compact pagination\" role=\"navigation\" aria-label=\"pager\">)\n\n tags << link.call(MARKER, '', %(style=\"display: none;\" ))\...
[ "0.7354639", "0.70751286", "0.7037223", "0.70318216", "0.6847071", "0.6691428", "0.6634772", "0.6622153", "0.65920603", "0.65696055", "0.6555688", "0.6486752", "0.6390522", "0.6357316", "0.6314701", "0.63077", "0.6300955", "0.6286011", "0.6264418", "0.6256125", "0.62517524", ...
0.74574405
0
GET /searches GET /searches.json
def index console @api_key = ENV['OMDB_API_KEY'] @searches = Search.all @title = "" @year = "" @movie = params["watchlist"] if @movie.present? @title = @movie["title"] @year = @movie["year"] end unless @title.ascii_only? then @title = @title.delete!("^\u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render js...
[ "0.7737936", "0.7604427", "0.75483096", "0.71530956", "0.7150144", "0.7135791", "0.70674586", "0.70497304", "0.69962347", "0.6986162", "0.6971139", "0.6954953", "0.6952561", "0.69155294", "0.69155294", "0.69155294", "0.69155294", "0.69155294", "0.68742293", "0.68722004", "0.6...
0.0
-1
GET /searches/1 GET /searches/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render js...
[ "0.75890523", "0.7334231", "0.72093153", "0.6881175", "0.6876399", "0.68220216", "0.6811118", "0.679834", "0.6723004", "0.6711217", "0.6615113", "0.66145045", "0.6614429", "0.66067135", "0.660033", "0.65943927", "0.65943927", "0.65943927", "0.65943927", "0.65943927", "0.65873...
0.0
-1
POST /searches POST /searches.json
def create @search = Search.new(search_params) respond_to do |format| if @search.save format.html { redirect_to @search, notice: 'Search was successfully created.' } format.json { render :show, status: :created, location: @search } else format.html { render :new } fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_saved_search(query)\n post(\"/saved_searches/create.json\", :query => query)\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to action: 'new', query: @search.query }\n format.json { render ...
[ "0.7084899", "0.6884717", "0.6710713", "0.6676579", "0.66688097", "0.6651328", "0.6585242", "0.6556189", "0.6556189", "0.6556189", "0.6556189", "0.6538073", "0.6513207", "0.6496471", "0.6496471", "0.6496471", "0.64599264", "0.6417524", "0.63896906", "0.6380659", "0.6355009", ...
0.65506697
15
PATCH/PUT /searches/1 PATCH/PUT /searches/1.json
def update respond_to do |format| if @search.update(search_params) format.html { redirect_to @search, notice: 'Search was successfully updated.' } format.json { render :show, status: :ok, location: @search } else format.html { render :edit } format.json { render json: @se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n \n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n \n else\n format.html { render action: 'edit' }\n format.json { render js...
[ "0.6523013", "0.64405704", "0.64405704", "0.64405704", "0.64405704", "0.64357704", "0.6407116", "0.6393757", "0.6393757", "0.6393757", "0.6303679", "0.63006175", "0.626469", "0.6253344", "0.62046325", "0.61592996", "0.6137171", "0.6128129", "0.61119336", "0.60919917", "0.6073...
0.6197303
22
DELETE /searches/1 DELETE /searches/1.json
def destroy @search.destroy respond_to do |format| format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_conten...
[ "0.7580943", "0.7580943", "0.7580943", "0.7580943", "0.7580943", "0.74685574", "0.7426589", "0.7426589", "0.7426589", "0.7426589", "0.7409526", "0.7379234", "0.736118", "0.7341903", "0.7330409", "0.72786564", "0.72729903", "0.7175998", "0.716888", "0.71024615", "0.70764536", ...
0.7241274
23
Use callbacks to share common setup or constraints between actions.
def set_search @search = Search.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 search_params params.require(:watchlist).permit(:title, :year) 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.6980244", "0.6782812", "0.6745103", "0.6741142", "0.6733961", "0.65925", "0.6503602", "0.64967257", "0.64822173", "0.64796996", "0.6456357", "0.6439594", "0.63803256", "0.6376499", "0.63644457", "0.6319286", "0.6299465", "0.6298051", "0.62935406", "0.62923044", "0.6291212"...
0.0
-1
parses an string of (key:value) type
def parseValuedParam(param) re = /(?<type>\w+)([:,](?<value>\d+))?/ values = re.match(param) if values [values[:type], values[:value].to_i] else [nil, nil] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_kv(str)\n str.split(' ').map{|attr|\n k, v = attr.split('=')\n if v.start_with?('\"') && v.end_with?('\"')\n v = v.gsub(/^\"/, '').gsub(/\"$/, '').gsub('\\\"', '\"')\n elsif v =~ /^\\d+$/\n v = v.to_i\n elsif v =~ /^\\d+\\.\\d+$/\n v = v.to_f\n else\n ...
[ "0.75577146", "0.71265453", "0.68391126", "0.6706726", "0.6630361", "0.6548276", "0.64909357", "0.63652986", "0.6340327", "0.62516564", "0.6248559", "0.62472993", "0.61571294", "0.61548096", "0.61395556", "0.6107254", "0.6102183", "0.6059797", "0.6038212", "0.6020092", "0.600...
0.560414
65
reads input flags and interprets the complex ones
def readFlags @opt_parser.parse! Aerospike.logger.level = Logger::ERROR if @options[:debug_mode] Aerospike.logger.level = Logger::INFO end @binDataType, binDataSz = parseValuedParam(@options[:bin_def]) if binDataSz @binDataSize = @options[:binDataSz] else case @binDataType when 'B' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_argv_flags argsIn\r\n skipVal = argsIn.length + 1\r\n argsIn.each_with_index do |argIn, ind|\r\n next if skipVal == ind\r\n arg = argIn.downcase()\r\n if arg[0].eql? '-'\r\n symAgr = strip_to_sym(arg)\r\n if @options[symAgr].is_a? String\r\n @options[symAgr] = a...
[ "0.62771344", "0.5893965", "0.5831405", "0.5801768", "0.5610603", "0.55427206", "0.54595923", "0.54402757", "0.54268163", "0.54268163", "0.5421077", "0.53503495", "0.5344305", "0.5331775", "0.5298137", "0.52838135", "0.5275749", "0.5266341", "0.52598274", "0.52404505", "0.521...
0.65957445
0
new random bin generator based on benchmark specs
def getBin case @binDataType when 'B' bin = Bin.new('information', BytesValue.new(randString(@binDataSize))) when 'S' bin = Bin.new('information', StringValue.new(randString(@binDataSize))) else bin = Bin.new('information', IntegerValue.new(2**63)) end bin end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand\n num = SecureRandom.random_number(@n)\n @bins.each do |k, freq|\n num -= freq\n return k if num < 0\n end\n end", "def gen_128_16_std_breqd_instance(n, seed)\n c = 128*n\n wmax = c\n pmax = 16*wmax\n gen_std_breqd_instance(n, c, wmax, pmax, seed)\nend", "def gen...
[ "0.6763671", "0.66782683", "0.6661606", "0.6586074", "0.65835947", "0.6525753", "0.6501633", "0.6501633", "0.64407665", "0.6409461", "0.6404485", "0.63940716", "0.63081956", "0.6299621", "0.62863046", "0.6265731", "0.6265731", "0.62601304", "0.62601304", "0.6199694", "0.61457...
0.6461311
8
Check for hashes and arrays inside 'hash'. Convert any hashes.
def hash2os(hash) hash.each_key do |key| hash[key] = hash2os(hash[key]) if hash[key].is_a?(Hash) chk_array(hash[key]) if hash[key].is_a?(Array) end hash = OpenStruct.new(hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_hash(hash)\n Hash[hash.collect { |k, v| [k.to_s, v.is_a?(Hash) ? sanitize_hash(v) : v] }]\n end", "def chk_array(array)\n array.each_index do |i|\n array[i] = hash2os(array[i]) if array[i].is_a?(Hash)\n chk_array(array[i]) if array[i].is_a?(Array)\n end\n end", "def check!...
[ "0.64220667", "0.60592985", "0.6046087", "0.6033029", "0.6001755", "0.58945966", "0.58659005", "0.5837792", "0.5826125", "0.5757494", "0.5745125", "0.57349855", "0.57062465", "0.56991285", "0.5695672", "0.5685542", "0.56316", "0.5631012", "0.5589926", "0.55872285", "0.5585158...
0.52301073
54
Check for hashes and arrays inside 'array'. Convert any hashes.
def chk_array(array) array.each_index do |i| array[i] = hash2os(array[i]) if array[i].is_a?(Hash) chk_array(array[i]) if array[i].is_a?(Array) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_array(string_hash_or_array)\n case string_hash_or_array\n when Array then string_hash_or_array\n when String, Hash then [string_hash_or_array]\n else []\n end\n end", "def processArray(arr)\n\t\treturn processString(arr[0]) if arr.length == 1\n\t\tretu...
[ "0.68319005", "0.6329024", "0.6253009", "0.6178197", "0.61321175", "0.6070314", "0.60056955", "0.59892225", "0.59033036", "0.58633107", "0.5852944", "0.5824064", "0.5816158", "0.5791922", "0.5791922", "0.5765369", "0.5735678", "0.573262", "0.5731002", "0.57147986", "0.5649349...
0.77869207
0
Create functions for 2 or 3 input parameters, which will be supplied by the user
def two_inputs puts "Enter the first number" first = gets.chomp.to_f puts "Enter the second number" second = gets.chomp.to_f return first, second end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_3(x, y, z)\nend", "def do_something (one, two, three)\nend", "def function(action1, action2, action3)\n puts \"To '#{action1}', '#{action2}', or '#{action3}' a function all mean the same thing.\"\nend", "def do_something(thing_one, two, three)\n end", "def do_something(par_1, par_2, par_3)\n\n\ne...
[ "0.658768", "0.65005785", "0.6335151", "0.633353", "0.6265185", "0.6243425", "0.61717075", "0.6170074", "0.6109275", "0.60968894", "0.6092381", "0.60531807", "0.6022601", "0.6017714", "0.59879214", "0.5984866", "0.59843934", "0.5934941", "0.59049153", "0.5889453", "0.5877582"...
0.5323023
84