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
Return the average for the entire class.
def class_average(grade_hash) averages(grade_hash).map{|k, v| v}.inject {|sum, n| sum + n } / grade_hash.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_average(data)\n ind_avgs = averages(data).values\n ind_avgs.sum/ind_avgs.length\nend", "def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+) / grade_hash.length\nend", "def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n ...
[ "0.82577485", "0.76192003", "0.7570708", "0.7541172", "0.7539687", "0.75102514", "0.7488115", "0.7438756", "0.7403346", "0.7396515", "0.73954564", "0.7336673", "0.73212093", "0.72724485", "0.72568274", "0.7254238", "0.7252965", "0.724596", "0.7242883", "0.71528244", "0.715064...
0.7168934
19
Return an array of the top `number_of_students` students.
def top_students(grade_hash, number_of_students) averages(grade_hash).sort_by { |k, v| v}.reverse.map{ |k, v| k }.take(number_of_students) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_students(grade_hash, number_of_students)\n averages(grade_hash)\n .sort_by { |key, value| value }.reverse\n .map { |key, value| key}\n .take(number_of_students)\nend", "def top_students(grade_hash, number_of_students)\n averages(grade_hash)\n .sort_by { |key, value| value}.reverse\n .map {...
[ "0.75698096", "0.7545575", "0.75126565", "0.74994767", "0.74357885", "0.7402287", "0.7275602", "0.72337484", "0.7097617", "0.6574678", "0.64220905", "0.6365745", "0.59663564", "0.59427667", "0.59349966", "0.5889596", "0.58893615", "0.58598256", "0.5789828", "0.5715849", "0.56...
0.74699235
4
If title is nil then list's name will be used
def initialize(rows, cols, row, col, title_prefix) @win = Window.new(rows, cols, row, col) @title_prefix = title_prefix @max_contents_len = @win.maxx - 3 # 2 for borders end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_item_title resource, title=nil, url=nil\n if title.nil?\n title = get_object_title(resource)\n end\n name = resource.class.name.split(\"::\")[0]\n\n html = \"<div class=\\\"list_item_title\\\">\"\n case name\n when \"DataFile\",\"Model\",\"Sop\"\n image = image_tag(((name =...
[ "0.7108575", "0.6939402", "0.6780712", "0.67578566", "0.6687497", "0.6681466", "0.66554624", "0.66378325", "0.6587936", "0.6537159", "0.65369594", "0.65208983", "0.6468742", "0.6468742", "0.6466663", "0.6462387", "0.64544976", "0.64544976", "0.64544976", "0.6454359", "0.64543...
0.0
-1
TODO: Use a Pathname for all path operations instead of File. Add support for relative_to and relative_from to ContentList (find?)
def params=(value={}) @params.merge! value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def by_path(path); end", "def path() end", "def path() end", "def path() end", "def find(path); end", "def find(path); end", "def relative_path(from, to); end", "def find\n \"#{content_path}#{clean_path}\"\n end", "def path\n [name]\n end", "def paths; end", "def paths; end"...
[ "0.6397883", "0.62302995", "0.62302995", "0.62302995", "0.6218775", "0.6218775", "0.61442447", "0.6039749", "0.60135907", "0.598302", "0.598302", "0.598302", "0.598302", "0.598302", "0.59793216", "0.5971854", "0.5967793", "0.5967793", "0.5967793", "0.5967793", "0.5967793", ...
0.0
-1
Can I call body() ?
def exists? has_block? or File.exists? @source_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body(&b...
[ "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.8219701", "0.7325007", "0.72796917", "0.72785705", "0.7263836", "0.7181263", ...
0.0
-1
Returns Array of content objects
def all(pattern=nil) pattern.nil? ? values : find(pattern) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_content_array\n as_array[1]\n end", "def to_a\n @content.collect { |item| assemble(item) }\n end", "def get_content\n @list \n end", "def all_contents()\n contents = self.content.flatten.map do |c|\n case c\n when Eddy::Models::Loop::Repeat then c.all_con...
[ "0.74823767", "0.7383836", "0.73720443", "0.7314305", "0.72937274", "0.7222643", "0.70200545", "0.6971542", "0.6869591", "0.68611676", "0.67865294", "0.6771617", "0.66984236", "0.6658677", "0.6644731", "0.66279995", "0.6610689", "0.65894824", "0.65894824", "0.6584376", "0.657...
0.0
-1
Scans the filenames (keys) and uses fnmatch to find maches
def find(pattern) patterns= [pattern].flatten contents=[] self.each_pair do |path, content| patterns.each do |pattern| contents << content if Content.path_match? path, pattern end end contents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def [] files\n # This stores all our matches\n match_hash = {}\n\n # Go through each file, check if the file basename matches the regexp.\n files.each do |f|\n path, file = File.split(f)\n\n if (m = match_against(file))\n replacement = populate_based_on(m)\n match_hash[f] = if p...
[ "0.71927226", "0.68013054", "0.66792953", "0.6646147", "0.66382146", "0.6477008", "0.63355696", "0.63240385", "0.63197905", "0.6228209", "0.6207012", "0.6207012", "0.61748576", "0.61735636", "0.61734897", "0.61669827", "0.61559474", "0.6147952", "0.61410373", "0.6129819", "0....
0.0
-1
Find isn't fuzzy for Special Content. It looks for full
def find(uri) _try_variations_of(uri) do |path| content= get path return [content] unless content.nil? end unless uri.nil? [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find; end", "def fuzzy\n find_all do |entry|\n entry.fuzzy?\n end\n end", "def find(args, mode); end", "def fuzzy_match_cutoff\n 0.3\n end", "def search(word)\n \n end", "def fuzzy_match( query )\n return self.keywords.fuzzy_match(query)\n end", "...
[ "0.6190677", "0.6162378", "0.6019823", "0.5992193", "0.5988968", "0.58333576", "0.5829763", "0.57963175", "0.5771", "0.5766586", "0.575435", "0.57537246", "0.57297295", "0.5687712", "0.5685527", "0.56648237", "0.56595695", "0.56316835", "0.56194305", "0.56108576", "0.5606262"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def query_params params.require(:query).permit(:name, :label, :description, :created_by, :sql, :conditions) 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.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.629117...
0.0
-1
Mimic processing a Message.
def initialize(params) @success = verify_params(params) @to = params['To'] @body = params['Body'] @sent = Time.now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_message(message)\n end", "def process(message)\n end", "def message\n process_mess\n end", "def process_msgs\n end", "def process_message(message)\n # TODO: May want to ignore some messages (say, if the community string is wrong)\n message.respond(dispatch(message))\n en...
[ "0.8461261", "0.8082676", "0.7521292", "0.7445535", "0.73384756", "0.7263055", "0.72422", "0.71891767", "0.7145564", "0.7136363", "0.69771695", "0.68373334", "0.67442685", "0.6737987", "0.6714277", "0.6692327", "0.6615596", "0.6610975", "0.65869033", "0.65688455", "0.6556698"...
0.0
-1
Produce output representing whether the SMS succeeded or failed.
def to_json [status, price, date] .reduce(&:merge) .to_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_case\n if @succeeded\n color_print(\"Success\", :green)\n else\n color_print(\"Error\", :red)\n end\n end", "def print_success_message\n puts \"You have that!\"\n true #why should this return true also? #see my comment on line 53, and look at how it's called on line 96.\n e...
[ "0.6590119", "0.65091443", "0.6333734", "0.62522495", "0.6244143", "0.6223656", "0.620248", "0.61982536", "0.6186588", "0.61556876", "0.615144", "0.61461496", "0.6141668", "0.612807", "0.6064222", "0.6017497", "0.5996178", "0.5984132", "0.5977204", "0.5977204", "0.5969359", ...
0.0
-1
Represent the date sent. If the attempt to send an SMS failed, do not list the date.
def date success ? { 'datesent' => sent } : {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sent_at\n # Use date it arrived (created_at) if mail itself doesn't have Date: header\n self.mail.date || self.created_at\n end", "def date_sent\n (@date_sent ||= Time.now)\n end", "def sent_date_time\n return @sent_date_time\n end", "def rezm_sent_at(messag...
[ "0.711625", "0.7098766", "0.68883586", "0.65229815", "0.64769065", "0.6459162", "0.6444061", "0.64272773", "0.64107627", "0.6361319", "0.62694746", "0.6267607", "0.62067914", "0.61887294", "0.61887294", "0.61657304", "0.6086277", "0.59660363", "0.5945253", "0.59290093", "0.59...
0.72233725
0
Represent the state of the message. Since no actual process exists, constrain possible statuses to success or failure.
def status { 'status' => success ? 'sent' : 'failed' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n @message\n end", "def status\n @status = valid? ? :ok : :unprocessable_entity\n end", "def state\n case pipeline.status\n when 'scheduled', 'created', 'pending', 'preparing', 'waiting_for_resource' then 'pending'\n when 'running' then 'in_progress'\n ...
[ "0.6846644", "0.66293347", "0.66269106", "0.66153204", "0.6553104", "0.6549327", "0.6549327", "0.64767283", "0.64706343", "0.64233404", "0.6397229", "0.6392587", "0.63582593", "0.63575286", "0.63084304", "0.63084304", "0.62993824", "0.6264156", "0.62407106", "0.6214449", "0.6...
0.67070526
1
Represent the cost to send the message. Possibilities are constrained to 3 cents and nothing, predicated on success.
def price { 'price' => success ? '0.03' : '0.00' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cost \n return @extra_cost + @basic_transfer.cost\n end", "def cost\n 0.99\n end", "def cost\n 0.89\n end", "def cost\n 1.99\n end", "def cost\n deductible * RATE\n end", "def cost \n return @extra_cost + @basic_prescription.cost\...
[ "0.7053993", "0.7001518", "0.68387604", "0.68177027", "0.6712944", "0.67117095", "0.66972893", "0.66611934", "0.662616", "0.66118824", "0.6604087", "0.6595827", "0.6568853", "0.6534658", "0.65143603", "0.6513975", "0.65128374", "0.648792", "0.6480241", "0.6462425", "0.6441847...
0.0
-1
Implement minimal checking for the parameters. The body must be between 1 and 1600 bytes and a recipient must be specified.
def verify_params(params) return false if params['Body'].to_s.empty? return false if params['Body'].to_s.bytes.size > 1600 return false unless /\+\d+$/.match(params['To']) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_contact_params?(params)\n r = false\n if !params[:sender_name].blank? and !params[:sender_address].blank? and !params[:message_title].blank? and !params[:message_content].blank? and ((params[:spamcode]).to_i==session[:spamcode])\n r = true\n end\n r\n end", "def check_body\n return...
[ "0.6257262", "0.62062675", "0.604068", "0.59841824", "0.59495634", "0.59108865", "0.5833521", "0.5759481", "0.5754569", "0.56618327", "0.5660789", "0.56534964", "0.56401455", "0.56372935", "0.56369144", "0.56369144", "0.56258637", "0.5601738", "0.5601738", "0.5595988", "0.559...
0.74228776
0
Return self information as XML format.
def to_xml xml = "<video>\n" instance_variables.each do |attr| value = instance_variable_get(attr).to_s value.gsub!(/<br \/>/, "\n") value.gsub!(/<.*?>/m, '') value.gsub!(/&/m, '&amp;') value.gsub!(/'/m, '&apos;') value.gsub!(/"/m, '&quot;') value.gsub!(/</m, '&lt;') value.gsub!(/>/m, '&gt;') attr.sub!(/@/, '') xml += "<#{attr}>#{value}</#{attr}>\n" end xml += "</video>\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xml\n Builder.new(self).to_s\n end", "def to_xml\n return self.to_s\n end", "def to_s\n return self.xml\n end", "def to_xml\n self.to_s\n end", "def to_xml\n self.to_s\n end", "def to_xml\n\t\tend", "def to_xml\n\t\tend", "def toxml\n\t\tend", "def to_...
[ "0.8245678", "0.7968069", "0.7896388", "0.78679055", "0.78679055", "0.78621125", "0.78621125", "0.78136575", "0.77696186", "0.77696186", "0.77483726", "0.77027947", "0.74953514", "0.7491028", "0.7374572", "0.7369681", "0.7342213", "0.73354864", "0.73279244", "0.73279244", "0....
0.0
-1
indicate which filters should be used for a taxon this method should be customized to your own site
def applicable_filters fs = [] fs << Spree::ProductFilters.taxons_below(self) ## unless it's a root taxon? left open for demo purposes fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter) fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter) #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter) #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter) fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter) fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter) fs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applicable_filters\n fs = []\n # fs << ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::Core::ProductFilters.price_filter if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs << Spree::Core::ProductFilters.brand_fil...
[ "0.78932637", "0.7071814", "0.69712204", "0.685666", "0.672113", "0.6628986", "0.6628986", "0.6591011", "0.6569453", "0.6543019", "0.641639", "0.639161", "0.6359569", "0.63292855", "0.62359864", "0.6152389", "0.6072267", "0.60580826", "0.6039936", "0.6020098", "0.6017978", ...
0.7828286
2
Maybe, we need to touch all parents to get this correct, so that if we have several levels all levels get purged. TODO: Check the above
def touch_parent parent.touch unless self.root? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prune!\n return if root? #you cannot prune the root\n if normal?\n parent.normal_children.delete(self)\n else\n parent.fallback_child = nil\n end\n old_parent = parent\n @parent = nil\n old_parent.prune! if old_parent.useless?\n end", "def prune\n @p...
[ "0.6893962", "0.6711634", "0.6710706", "0.6627064", "0.65189135", "0.64971334", "0.6472203", "0.64084005", "0.63511866", "0.63097423", "0.6296388", "0.62556016", "0.62530047", "0.6212412", "0.6178907", "0.6177991", "0.6177724", "0.6171208", "0.6070927", "0.6063836", "0.605035...
0.0
-1
GET /date_types GET /date_types.json
def index @date_types = DateType.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end", "def index\n @day_types = DayType.all\n end", "def dates(options = {})\n response= handle_errors{ self.class.get('/dates', :query => options)}\n response[\"dates\"][\"date\"].coll...
[ "0.66776365", "0.6325213", "0.62087154", "0.6102505", "0.6034797", "0.6030782", "0.6030451", "0.6009954", "0.59701437", "0.5924832", "0.58510274", "0.58478266", "0.5820071", "0.5819705", "0.581955", "0.58057934", "0.579429", "0.57843554", "0.57743937", "0.5768278", "0.5755300...
0.72657067
0
GET /date_types/1 GET /date_types/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @date_types = DateType.all\n end", "def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end", "def index\n @day_types = DayType.all\n end", "def show\n @daytype = Daytype.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.71094894", "0.6316097", "0.6144529", "0.60725075", "0.6045335", "0.58933055", "0.5879858", "0.5834459", "0.58333653", "0.5807335", "0.5768128", "0.57291234", "0.5724598", "0.57200366", "0.5688002", "0.5673136", "0.5666195", "0.56491745", "0.5648382", "0.564753", "0.5644372...
0.0
-1
POST /date_types POST /date_types.json
def create @date_type = DateType.new(date_type_params) respond_to do |format| if @date_type.save format.html { redirect_to @date_type, notice: 'Date type was successfully created.' } format.json { render :show, status: :created, location: @date_type } else format.html { render :new } format.json { render json: @date_type.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_type_params\n params.require(:date_type).permit(:name, :plainformat, :senml)\n end", "def day_type_params\n params.require(:day_type).permit(:regular, :date_created, :user_id)\n end", "def index\n @date_types = DateType.all\n end", "def set_date_type\n @date_type = DateType....
[ "0.68476063", "0.625859", "0.6105931", "0.5966543", "0.5753207", "0.57398176", "0.5701953", "0.5670615", "0.553455", "0.55009395", "0.53920853", "0.538366", "0.53686196", "0.53437", "0.53318053", "0.530309", "0.5285749", "0.5282978", "0.52421695", "0.52421695", "0.5223831", ...
0.66282433
1
PATCH/PUT /date_types/1 PATCH/PUT /date_types/1.json
def update respond_to do |format| if @date_type.update(date_type_params) format.html { redirect_to @date_type, notice: 'Date type was successfully updated.' } format.json { render :show, status: :ok, location: @date_type } else format.html { render :edit } format.json { render json: @date_type.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_date_type\n @date_type = DateType.find(params[:id])\n end", "def update!(**args)\n @datetime_type = args[:datetime_type] if args.key?(:datetime_type)\n @relative_datetime_type = args[:relative_datetime_type] if args.key?(:relative_datetime_type)\n end", "def update\n ...
[ "0.6116652", "0.6111879", "0.6074576", "0.60144544", "0.5822412", "0.581994", "0.57916695", "0.57500225", "0.5743233", "0.5733215", "0.57003224", "0.5675863", "0.565949", "0.5617479", "0.56149954", "0.5588106", "0.5571418", "0.55656815", "0.55635613", "0.5543424", "0.55303806...
0.6957204
0
DELETE /date_types/1 DELETE /date_types/1.json
def destroy @date_type.destroy respond_to do |format| format.html { redirect_to date_types_url, notice: 'Date type was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @daytype = Daytype.find(params[:id])\n @daytype.destroy\n\n respond_to do |format|\n format.html { redirect_to daytypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @important_date.destroy\n respond_to do |format|\n format.html { redirect_t...
[ "0.69580823", "0.67848355", "0.661884", "0.6575049", "0.6469206", "0.6463357", "0.6452886", "0.6434698", "0.6407215", "0.6403275", "0.6400748", "0.6393986", "0.6391941", "0.63683903", "0.6365056", "0.635072", "0.6338716", "0.63292414", "0.6319649", "0.631415", "0.6312569", ...
0.75766355
0
Use callbacks to share common setup or constraints between actions.
def set_date_type @date_type = DateType.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 date_type_params params.require(:date_type).permit(:name, :plainformat, :senml) 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.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.629117...
0.0
-1
Synthesize a DNA sequence based on the protein structure. (This is the opposite of what is been generally done in all our cells).
def synthesize(protein) adn = '' for a in (0..protein.length-1) aminoacido = protein[a,1] entropy = rand(100-10) + 10 if (@aminoacidos.include?(aminoacido)) adn = adn + @codons[aminoacido][entropy % (@codons[aminoacido].length)] end end @synthesize = adn end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protein_seq\n return Bio::Sequence::NA.new(self.cds_seq).translate.seq\n end", "def sequence\n return self.dna.sequence\n end", "def getFtsSequences\n @gb.each_cds do |ft|\n ftH = ft.to_hash\n loc = ft.locations\n loc = \"c#{ft.locations[0].to_s}\" if ft.locations[0].stran...
[ "0.6554843", "0.64947975", "0.6158699", "0.60337305", "0.5968296", "0.5963453", "0.5910268", "0.5885515", "0.58660525", "0.58171636", "0.5802675", "0.5797402", "0.5782115", "0.57353973", "0.5722169", "0.5709884", "0.5706161", "0.56867725", "0.56834424", "0.56555855", "0.56435...
0.77522105
0
True if enabled verbose mode, false otherwise
def verbose_mode? @output_level == :verbose end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verbose?\n @verbose ||= !!options[:verbose]\n end", "def verbose?\n @verbose\n end", "def verbose?\n @options[:verbose]\n end", "def verbose?\n @verbose_output\n end", "def verbose?\n ENV['VERBOSE']\n end", "def verbose?\n options.verbose?\n end", ...
[ "0.87371767", "0.8724991", "0.866884", "0.8655055", "0.8603056", "0.8598856", "0.85889673", "0.85677564", "0.85677564", "0.8550767", "0.85381067", "0.85202295", "0.84754527", "0.8462254", "0.8460945", "0.84185976", "0.8409885", "0.8395572", "0.82515574", "0.82280624", "0.8216...
0.87636286
0
True if enabled silence mode, false otherwise
def silence_mode? @output_level == :silence end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def silentMode mode\r\n\t\t@silentMode = !mode\r\n\tend", "def silence=(value)\n @silence = value\n end", "def kiosk_mode_require_mono_audio\n return @kiosk_mode_require_mono_audio\n end", "def quiet_mode?\n @@quiet_mode\n end", "def suppressed?\n @suppresse...
[ "0.6956469", "0.68906647", "0.66498286", "0.65987605", "0.6543598", "0.64025843", "0.6348118", "0.63417685", "0.63307863", "0.627814", "0.62723184", "0.6271102", "0.6265686", "0.62561756", "0.62256557", "0.62167805", "0.61764544", "0.61732996", "0.6155254", "0.6146577", "0.61...
0.8601792
0
allowed array as aggregator, show expenses and circumstances
def deep_extract aggregator = '' @source.each_char do |symbol| if DEEP_SCRAB.match?(symbol) aggregator.insert(-1, symbol) else next if aggregator.empty? @storage << aggregator.to_i aggregator.clear end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expense_list\n\n end", "def build_all_expenses\n expenses = Expense.includes(:financial_type).current.all\n loans = Loan.includes(:financial_type).current.all\n result = []\n\n expenses.each do |e|\n holder = {}\n holder[:expense_id] = e.id\n holder[:name] = e.name\n holder[:...
[ "0.66664606", "0.59740484", "0.5871034", "0.5723415", "0.5699931", "0.56713086", "0.5639887", "0.56073034", "0.56073034", "0.56073034", "0.56025136", "0.55677676", "0.55441064", "0.5528225", "0.55245876", "0.5522593", "0.5515859", "0.5513813", "0.5509823", "0.5476721", "0.547...
0.0
-1
key is the last element and should not include bad characters ... could be faster by not jumping through hash generation and parsing
def vault_path(key, direction = :encode) parts = SecretStorage.parse_secret_key(key) parts[:key] = convert_path(parts[:key], direction) SecretStorage.generate_secret_key(parts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hashify(key)\n array = key.split('')\n count = array.count\n index = array.inject(0) do |object,char|\n object += char.ord ** count\n count -= 1\n object\n end\n index % 89\n end", "def str_hash(key)\n key.bytes.inject(&:+)\n end", "def hashify(key)\n array = key.split...
[ "0.6784983", "0.6477835", "0.6450952", "0.6109658", "0.6081626", "0.60426044", "0.6031243", "0.60230654", "0.60202855", "0.60048664", "0.59856784", "0.5916765", "0.5916414", "0.5888078", "0.5888078", "0.58744115", "0.5871993", "0.58299124", "0.58299124", "0.58153516", "0.5782...
0.0
-1
convert from/to escaped characters
def convert_path(string, direction) string = string.dup if direction == :decode ENCODINGS.each { |k, v| string.gsub!(v.to_s, k.to_s) } elsif direction == :encode ENCODINGS.each { |k, v| string.gsub!(k.to_s, v.to_s) } else raise ArgumentError, "direction is required" end string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_escaped_chars; end", "def esc(inString)\n #2015-04-04 BN: gsub stumbles on apostrophes so I created a unique treatment for them\n # from http://stackoverflow.com/questions/8929218/how-to-replace-an-apostrophe-using-gsub\n inString = inString.gsub(/[']/, \"\\\\\\\\\\'\")\n\n #For each of t...
[ "0.762698", "0.749829", "0.74687576", "0.7393609", "0.7189774", "0.70227057", "0.7012753", "0.7010447", "0.69984215", "0.69752836", "0.6856872", "0.6843667", "0.68365383", "0.68054014", "0.67955446", "0.67667705", "0.67494166", "0.67342466", "0.6729072", "0.6718489", "0.67071...
0.0
-1
uncomment when you have Enumerable included
def to_s pairs = inject([]) do |strs, (k, v)| strs << "#{k.to_s} => #{v.to_s}" end "{\n" + pairs.join(",\n") + "\n}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inclusions; end", "def through; end", "def collect; end", "def refute_includes(collection, obj, msg = T.unsafe(nil)); end", "def includes\n []\n end", "def exclude; end", "def each_identity; end", "def excluded; end", "def inclusions=(_arg0); end", "def includes() return @includes...
[ "0.59435934", "0.5794355", "0.5722233", "0.5718117", "0.569589", "0.5684911", "0.5664752", "0.566228", "0.5641536", "0.5562596", "0.55595744", "0.5515245", "0.5475617", "0.5450039", "0.5450039", "0.54184806", "0.53960466", "0.53936493", "0.53872144", "0.5383926", "0.53793705"...
0.0
-1
PUBLIC METHODS Heading defines the main means of addressing the model
def heading has_reverse? ? "#{left_name} & #{right_name}" : left_name.pluralize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model\n end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model; end", "def model\n end", "def model\n end", "def model\n end", "def make_and_model; end",...
[ "0.7811159", "0.77944857", "0.77944857", "0.77944857", "0.77944857", "0.77944857", "0.77944857", "0.77944857", "0.77944857", "0.77944857", "0.77944857", "0.75905144", "0.75905144", "0.75905144", "0.73525065", "0.7091324", "0.7091324", "0.7091324", "0.7091324", "0.69711334", "...
0.0
-1
Convert a value to a string. :param value: A value to log. :type value: object :param max_chars: Optional maximum number of characters to return. :type max_chars: int :rtype: str
def value_to_log_string(value, max_chars=100000) if value.nil? output = 'NULL' elsif (!!value == value) output = value == true ? 'TRUE' : 'FALSE' elsif (value.is_a? String) output = value elsif (value.is_a? Hash) || (value.is_a? Array) output = serialize(value) else output = value.inspect end return output.length > max_chars ? output[0,max_chars] : output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_str() @value.to_s end", "def to_str\n value.to_s\n end", "def to_str; value; end", "def to_str()\n @value.to_s\n end", "def to_str()\n @value.to_s\n end", "def to_str\n @value.to_s\n end", "def display_string(value)\n return nil unless value\n\n last...
[ "0.6354454", "0.62859535", "0.62643635", "0.6206465", "0.6206465", "0.615024", "0.6084755", "0.6042674", "0.591187", "0.58266956", "0.5817441", "0.5817441", "0.58111787", "0.58111787", "0.58097726", "0.58094937", "0.57605016", "0.5751637", "0.5751637", "0.5729551", "0.5729551...
0.8212074
0
Given an unsorted array of integers, find the length of longest increasing subsequence.
def length_of_lis(nums) len = [] (0...nums.size).map { |i| len[i] = (0...i) .select { |j| nums[j] < nums[i] } .map { |j| len[j] + 1 }.max || 1 }.max || 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_increasing_subseq(arr)\n n = arr.size\n lis = Array.new(n, 1)\n\n (0 ... n).each do |i|\n (0 ... i).each do |j|\n if arr[i] > arr[j] && lis[j] + 1 > lis[i]\n lis[i] = lis[j] + 1\n end\n end\n end\n\n max_len = 0\n\n (1 ... n).each do |k|\n max_len = lis[k] if max_len < l...
[ "0.831789", "0.8275999", "0.8068185", "0.78885883", "0.77659017", "0.77349216", "0.76564074", "0.76090544", "0.7581987", "0.7537164", "0.7443197", "0.7394068", "0.7334525", "0.7297614", "0.72319055", "0.71900326", "0.71841055", "0.716932", "0.715301", "0.70578575", "0.7048522...
0.6463361
68
GET /movies GET /movies.json
def index if params[:query].blank? @movies = Movie.all.includes(:roles => :artist) else @movies = Movie.all.includes(:roles => :artist).where('CONCAT(title, description) LIKE ?', "%#{params[:query]}%") end respond_to do |format| format.html format.json {response.headers["XXXXXXX"]="Test header value"; render :index; } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movies\n get('Movies')\n end", "def pull_movies(options = {})\n response = HTTParty.get(build_url('movie', options), headers: HEADERS, debug_output: $stdout)\n JSON.parse(response.body)\n end", "def index\n @movies = @category.movies.find(:all)\n\n respond_to do |format|\n f...
[ "0.8227555", "0.7484902", "0.74789107", "0.74730414", "0.74474025", "0.7354044", "0.7354044", "0.7354044", "0.7354044", "0.7354044", "0.7354044", "0.73434794", "0.7283256", "0.7214987", "0.7197649", "0.7150194", "0.7128301", "0.703391", "0.70069593", "0.70027626", "0.69713336...
0.0
-1
GET /movies/1 GET /movies/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movies\n get('Movies')\n end", "def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movie }\n end\n end", "def show\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n format.ht...
[ "0.7840408", "0.7417043", "0.7417043", "0.7417043", "0.7417043", "0.7417043", "0.7417043", "0.7337925", "0.7307941", "0.7254705", "0.7145913", "0.712192", "0.7111538", "0.70936346", "0.7092198", "0.70896614", "0.70844346", "0.7034522", "0.6987229", "0.69613814", "0.6960965", ...
0.0
-1
POST /movies POST /movies.json
def create @movie = Movie.new(movie_params) respond_to do |format| if @movie.save format.html { redirect_to @movie, notice: 'Movie was successfully created.' } format.json { render :show, status: :created, location: @movie } else format.html { render :new } format.json { render json: @movie.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @movie = Movie.new(params[:movie])\n\n respond_to do |format|\n if @movie.save\n format.html { redirect_to root_path, notice: 'Movie was successfully created.' }\n format.json { render json: @movie, status: :created, location: @movie }\n else\n format.html { render...
[ "0.6940328", "0.69084406", "0.69084406", "0.69084406", "0.69084406", "0.69084406", "0.6874596", "0.6850059", "0.6839644", "0.6839644", "0.6839644", "0.6839644", "0.6839644", "0.6839644", "0.6839644", "0.6839644", "0.6839644", "0.67754805", "0.67748934", "0.67748934", "0.67677...
0.68476635
8
PATCH/PUT /movies/1 PATCH/PUT /movies/1.json
def update respond_to do |format| if @movie.update(movie_params) format.html { redirect_to @movie, notice: 'Movie was successfully updated.' } format.json { render :show, status: :ok, location: @movie } else format.html { render :edit } format.json { render json: @movie.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @movie = Movie.find(params[:id])\n\n respond_to do |format|\n if @movie.update_attributes(params[:movie])\n format.html { redirect_to @movie, notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit...
[ "0.682313", "0.682313", "0.682313", "0.682313", "0.682313", "0.682313", "0.6808907", "0.6808907", "0.6808907", "0.6738455", "0.6642947", "0.66350293", "0.66241276", "0.6600331", "0.65768725", "0.652991", "0.6511667", "0.64808124", "0.64519566", "0.6444685", "0.64314324", "0...
0.6672542
24
DELETE /movies/1 DELETE /movies/1.json
def destroy @movie.destroy respond_to do |format| format.html { redirect_to movies_url, notice: 'Movie was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to movies_url }\n format.json { head :ok }\n end\n end", "def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.ht...
[ "0.75603294", "0.7552992", "0.7552992", "0.7552992", "0.7552992", "0.7552992", "0.7552992", "0.7552992", "0.7529331", "0.7491699", "0.7491699", "0.7491699", "0.7491699", "0.7437082", "0.731825", "0.72664374", "0.72664374", "0.72664374", "0.7200594", "0.71660435", "0.7161143",...
0.71991533
37
Use callbacks to share common setup or constraints between actions.
def set_movie @movie = Movie.includes(:roles => :artist).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 movie_params # binding.pry params.require(:movie).permit(:title, :rating, :description, :image, :remote_image_url, :new_role=>[:name,:artist_id], :deleted_roles=>[]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
Returns true if the user has not liked/disliked this userpost. TODO refactor to use userpost likes so it can be eager loaded
def has_liked_userpost(feed_item) @like = Like.where(user_id: current_user.id, userpost_id: feed_item.id).first !@like.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def liked?(user_id)\n !StoryLike.where(story_id: self.id, user_id: user_id).empty?\n end", "def liked_by_user?\n\t\tLike.where(user_id: current_user.id, post_id:\n\t \tparams[:post_id]).exists?\n\tend", "def liked_by? user\n not likes.reject { |like| like.created_by != user }.blank?\n end", "def alre...
[ "0.7740143", "0.76276106", "0.74901193", "0.74237555", "0.73891246", "0.73232496", "0.72884035", "0.72400546", "0.6986224", "0.69815326", "0.6885913", "0.68716097", "0.6849016", "0.68221384", "0.68069357", "0.6805849", "0.6777121", "0.6776313", "0.672645", "0.67037654", "0.67...
0.7471337
3
load_and_authorize_resource before_filter :load_permissions GET /service_fee_masters GET /service_fee_masters.json
def index @ref_id = params[:ref_id] if @ref_id.present? @service_fee_masters = ServiceFeeMaster.where(appt_type_id: @ref_id).paginate(:page => params[:page], :per_page => 8).order('created_at desc') else @service_fee_masters = ServiceFeeMaster.all.paginate(:page => params[:page], :per_page => 8).order('created_at desc') end respond_to do |format| format.html format.csv { send_data @service_fee_masters.to_csv } format.xls { send_data @service_fee_masters.to_csv(options={col_sep: "\t"}) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_permissions\n authorize! :manage, :all\n end", "def show\n #@admission_category = AdmissionCategory.find(params[:id])\n #load_and_authorize_resource will load the object\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admission_category }\n...
[ "0.692439", "0.64561164", "0.6223231", "0.62064433", "0.6175169", "0.60592353", "0.6048326", "0.60462195", "0.5926586", "0.59210706", "0.59180725", "0.59042186", "0.58937514", "0.58688277", "0.58581007", "0.5849994", "0.5842349", "0.58324313", "0.5831767", "0.5826162", "0.582...
0.0
-1
GET /service_fee_masters/1 GET /service_fee_masters/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_service_fee_master\n @service_fee_master = ServiceFeeMaster.find(params[:id])\n end", "def index\n @masterservices = Masterservice.all\n end", "def index\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end", "def show\n #@klass_fee = KlassFee.find(...
[ "0.65771776", "0.619064", "0.61666965", "0.59563553", "0.59007967", "0.58653265", "0.58653265", "0.58653265", "0.58424574", "0.5839547", "0.5768863", "0.5759841", "0.5727925", "0.57160187", "0.5711347", "0.5703594", "0.566025", "0.56498694", "0.56169856", "0.5613496", "0.5613...
0.0
-1
POST /service_fee_masters POST /service_fee_masters.json
def create @service_fee_master = ServiceFeeMaster.new(service_fee_master_params) @lab_services = LabService.order(:title).where("title ilike ?", "%#{params[:service_id]}") @lab_list = @lab_services.map { |a|[a.title+" ",a.id] } respond_to do |format| if @service_fee_master.save format.js {flash[:notice] = "Service Price set successfully"} render js: "window.location='#{service_fee_masters_path}'" # format.html { redirect_to @service_fee_master, notice: 'Service fee master was successfully created.' } format.json { render :show, status: :created, location: @service_fee_master } else format.js {render :new } # format.html { render :new } format.json { render json: @service_fee_master.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @masterservice = Masterservice.new(masterservice_params)\n\n respond_to do |format|\n if @masterservice.save\n format.html { redirect_to @masterservice, notice: 'Masterservice was successfully created.' }\n format.json { render :show, status: :created, location: @masterservice...
[ "0.6352072", "0.6292741", "0.6271491", "0.60904247", "0.59160525", "0.5911744", "0.587214", "0.58307415", "0.5817307", "0.57919586", "0.5708881", "0.5687162", "0.56744826", "0.5671503", "0.5668393", "0.5658906", "0.5593016", "0.5574562", "0.5570478", "0.5556146", "0.553897", ...
0.5768649
10
PATCH/PUT /service_fee_masters/1 PATCH/PUT /service_fee_masters/1.json
def update respond_to do |format| @lab_services = LabService.order(:title).where("title ilike ?", "%#{params[:service_id]}") @lab_list = @lab_services.map { |a|[a.title+" ",a.id] } if @service_fee_master.update(service_fee_master_params) format.js {flash[:notice] = "Service Price updated successfully"} render js: "window.location='#{service_fee_masters_path}'" # format.html { redirect_to @service_fee_master, notice: 'Service fee master was successfully updated.' } format.json { render :show, status: :ok, location: @service_fee_master } else format.js { render :edit } # format.html { render :edit } format.json { render json: @service_fee_master.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_service_fee_master\n @service_fee_master = ServiceFeeMaster.find(params[:id])\n end", "def update\n @service_master.update(service_master_params)\n @service_master = ServiceMaster.new\n @service_masters = ServiceMaster.all\n end", "def update\n respond_to do |format|\n if @ten...
[ "0.66956145", "0.62606007", "0.6223662", "0.6200142", "0.618547", "0.60530746", "0.60413677", "0.59918755", "0.59916294", "0.59193003", "0.59193003", "0.5904678", "0.59031504", "0.58763945", "0.5853103", "0.5849413", "0.5844674", "0.5827796", "0.58174866", "0.58031285", "0.57...
0.59294426
9
DELETE /service_fee_masters/1 DELETE /service_fee_masters/1.json
def destroy @service_fee_master.destroy respond_to do |format| format.html { redirect_to service_fee_masters_url, notice: 'Service fee master was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n #@service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to service_requests_url }\n format.json { he...
[ "0.70563775", "0.68811965", "0.6873279", "0.68265927", "0.6809721", "0.6780554", "0.6771565", "0.67550975", "0.675444", "0.67267853", "0.6705528", "0.6690599", "0.66415983", "0.6618945", "0.6616808", "0.6603041", "0.6580283", "0.6576496", "0.65674555", "0.6561558", "0.6561558...
0.7525406
0
Use callbacks to share common setup or constraints between actions.
def set_service_fee_master @service_fee_master = ServiceFeeMaster.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 service_fee_master_params params.require(:service_fee_master).permit(:appt_type_id, :service_id, :req_urgency, :fee, :fee, :comment, :user_id, :active_status, :del_status) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
Write a program that finds the summation of every number from 1 to num. The number will always be a positive integer greater than 0. For example: summation(2) > 3 1 + 2 summation(8) > 36 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8
def summation(num) sum = (0..num).inject(:+) return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summation(num)\n sum = 0\n (0..num).each do |v|\n sum += v\n end\n return sum\nend", "def summation(num)\n (1..num).reduce(:+)\nend", "def sum_nums(num)\n\t\n\tnumbers = []\n\tnum_sum = num\n\t\nuntil numbers.length == num_sum\n\tnumbers.push(num)\n\tnum = num - 1\nend\n return\tnumbers.inject(:+...
[ "0.8285817", "0.8111951", "0.79816926", "0.7883295", "0.78497005", "0.78097075", "0.77513206", "0.7672171", "0.765522", "0.7603721", "0.75755507", "0.7544605", "0.74838483", "0.74794173", "0.7444679", "0.7411247", "0.73807675", "0.7358488", "0.7338669", "0.7331674", "0.731992...
0.8223749
1
This sets a default url for img_url
def img_url(url= "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7G9JTqB8z1AVU-Lq7xLy1fQ3RMO-Tt6PRplyhaw75XCAnYvAYxg") self[:img_url] || url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_url\n \"http://placehold.it/330&text=pic\"\n end", "def default_url\n \"/images/fallback/\" + [thumb, \"images.jpeg\"].compact.join('_')\n end", "def image_url=(value)\n @image_url = value\n end", "def default_url\n file_path = [\n 'fallbacks',\n ([...
[ "0.7641445", "0.7637398", "0.75667113", "0.75113946", "0.7481265", "0.7475889", "0.7445678", "0.7438472", "0.74116886", "0.74017924", "0.7334999", "0.7323653", "0.7316799", "0.7315881", "0.7311957", "0.7311957", "0.7311957", "0.7310905", "0.73030686", "0.72964346", "0.7296434...
0.8146946
0
This adds up all votes on a Post instance
def score votes.sum(:vote) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def up_votes\n # we find the up votes for a post by passing value: 1 to where. This fetches a collection of votes with a value of 1. \n # We then call count on the collection to get a total of all up votes.\n votes.where(value: 1).count\n end", "def vote_sum\n sum = 0.0\n votes.each do |v|\n ...
[ "0.7320817", "0.67779607", "0.67779", "0.6758999", "0.6758999", "0.67505", "0.66547763", "0.6654599", "0.66474044", "0.6647028", "0.66211236", "0.6620512", "0.6609348", "0.66054505", "0.6598206", "0.6598206", "0.659603", "0.6586943", "0.65743285", "0.65593696", "0.6553084", ...
0.5846956
98
test initialization of scm_config model.
def test_ut_scm_config_11 scmconfig=ScmConfig.new( :tool => "SVN", :tool_ids => "2", :repo_path => "http://a.b.c/x/y/z/fred.gif", :master_name => "yyy", :interval => "1 2 3 4 5" ) assert_equal("SVN",scmconfig.tool) assert_equal(2,scmconfig.tool_ids) assert_equal("http://a.b.c/x/y/z/fred.gif",scmconfig.repo_path) assert_equal("yyy",scmconfig.master_name) assert_equal("1 2 3 4 5",scmconfig.interval) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n set_config\n end", "def run_init\n run(\n result:\n ::Kitchen::Terraform::Client::Command\n .init(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .disable_input\n .enable_lock\n ...
[ "0.63181204", "0.59727895", "0.590677", "0.5834351", "0.58281654", "0.58216506", "0.58216506", "0.5799086", "0.5766356", "0.57654744", "0.57353806", "0.5708215", "0.56972647", "0.56972647", "0.5692014", "0.5646665", "0.56405616", "0.5638941", "0.5631678", "0.56181866", "0.561...
0.6953844
0
The notification sections to query (i.e. some combination of 'alert' and 'message').
def sections(*values) values.inject(self) { |res, val| res._sections(val) or fail ArgumentError, "Unknown value for sections: #{val}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notifications\n return notification_data_source.notifications\n end", "def get_informations\n infos = []\n @config.keys.each do |key|\n section = get_section(key) \n infos << section unless section[SECTION].empty?\n end\n\n infos\n end", "def notification_query_options\n ...
[ "0.6209621", "0.61607766", "0.58959293", "0.58232737", "0.57313263", "0.57070625", "0.56588477", "0.5648819", "0.5601814", "0.5579196", "0.55764675", "0.5562135", "0.5533302", "0.55194706", "0.5508215", "0.5496175", "0.54874396", "0.5476777", "0.54582846", "0.5457401", "0.544...
0.0
-1
Whether to group the result by section. Each section is fetched separately if set.
def groupbysection() merge(notgroupbysection: 'true') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_groupings(section)\n groupings.select do |grouping|\n grouping.inviter.present? &&\n grouping.inviter.has_section? &&\n grouping.inviter.section.id == section.id\n end\n end", "def sectionless_groupings\n groupings.select do |grouping|\n grouping.inviter.present? &&\n ...
[ "0.6653073", "0.6242842", "0.5973519", "0.5877339", "0.58506346", "0.57811224", "0.573271", "0.5702878", "0.558101", "0.5554483", "0.55435246", "0.54614896", "0.5451912", "0.5451912", "0.54374576", "0.54325724", "0.5421929", "0.5419253", "0.54154307", "0.5411119", "0.53864753...
0.75516576
0
If specified, notifications will be returned formatted this way.
def format(value) _format(value) or fail ArgumentError, "Unknown value for format: #{value}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notifications\n\t\tif signed_in?\n\t\t\tn = current_user.extra.notifications\n\t\t\tif n > 0\n\t\t\t\t\"(\" + n.to_s + \")\"\n\t\t\tend\n\t\tend\n\tend", "def implements()\n return Formatter::AllNotifications\n end", "def notifications\n return notification_data_source.notifications\n end",...
[ "0.73642445", "0.7050159", "0.65640235", "0.6540165", "0.65398955", "0.6452714", "0.63602924", "0.63456655", "0.63105524", "0.63105524", "0.63039947", "0.6252113", "0.6235196", "0.62245494", "0.62135285", "0.61572766", "0.61407244", "0.61347324", "0.6118244", "0.609483", "0.6...
0.0
-1
The maximum number of notifications to return.
def limit(value) merge(notlimit: value.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_queue_count()\n @max_queue_count\n end", "def notification_count\n @notifications.size\n end", "def maximum_number_of_subscriptions\n to_i description['MaximumNumberOfSubscriptions']\n end", "def maximum_limit\n 100\n end", "def max_size()\n AC...
[ "0.7090089", "0.7000239", "0.6928119", "0.6872609", "0.6661234", "0.6627118", "0.66134554", "0.65881795", "0.65714866", "0.6563829", "0.65515566", "0.65440553", "0.65402323", "0.65402323", "0.6520012", "0.64886814", "0.646381", "0.6418118", "0.63793105", "0.6371775", "0.63534...
0.0
-1
When more results are available, use this to continue.
def continue(value) merge(notcontinue: value.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def more_results?()\n #This is a stub, used for indexing\n end", "def nextResults\n # Update results\n updateResults(@nextURI)\n\n # Update nextURI\n updateNextURI\n end", "def collect_results\n while collect_next_line; end\n end", "def next\n @offset = get_c...
[ "0.6856364", "0.6659899", "0.6610145", "0.65927607", "0.64521414", "0.6300242", "0.62713784", "0.6229127", "0.6226629", "0.6225181", "0.6166342", "0.6166259", "0.61467385", "0.613649", "0.6115628", "0.609281", "0.6053826", "0.60190403", "0.59856635", "0.59817326", "0.5966061"...
0.0
-1
Whether to show unread notifications first (only used if groupbysection is not set).
def unreadfirst() merge(notunreadfirst: 'true') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alertunreadfirst()\n merge(notalertunreadfirst: 'true')\n end", "def messageunreadfirst()\n merge(notmessageunreadfirst: 'true')\n end", "def unread_unsent_notifications_for_group\n @unread_unsent_notifications_for_group ||= unread_unsent_notifications.where('notify_user_notifi...
[ "0.66753554", "0.6600046", "0.59955627", "0.5908684", "0.5637081", "0.56228733", "0.5591421", "0.54860646", "0.54667956", "0.5426075", "0.53889394", "0.5369551", "0.5282837", "0.5277263", "0.52666", "0.52404803", "0.52293825", "0.52293825", "0.52293825", "0.52086717", "0.5206...
0.67506945
0
Only return notifications for these pages. To get notifications not associated with any page, use [] as a title.
def titles(*values) values.inject(self) { |res, val| res._titles(val) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notifications(page = 1)\n\t\t\toptions = {\"page\" => page}\n\t\t\tdata = oauth_request(\"/notifications.xml\", options)\n\t\t\tHashie::Mash.new(data)\n\t\tend", "def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end", "def unread\n @no...
[ "0.7350555", "0.6858124", "0.6816594", "0.6766858", "0.6652018", "0.655177", "0.65412754", "0.6513629", "0.64992", "0.6464262", "0.64615136", "0.64535964", "0.64499205", "0.6448492", "0.6446471", "0.64436567", "0.6392558", "0.63788307", "0.6375476", "0.6360596", "0.63553476",...
0.0
-1
Whether to show bundle compatible unread notifications according to notification types bundling rules.
def bundle() merge(notbundle: 'true') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notifications(options = {})\n #:type => nil is a hack not to give Messages as Notifications\n notifs = Mailboxer::Notification.recipient(messageable).where(:type => nil).order(\"mailboxer_notifications.created_at DESC\")\n if options[:read] == false || options[:unread]\n notifs = notifs.unread\n ...
[ "0.60254747", "0.60046065", "0.5750039", "0.5735491", "0.5693279", "0.567705", "0.567705", "0.565127", "0.5643616", "0.56188816", "0.56040865", "0.5576926", "0.5576926", "0.5576926", "0.55723315", "0.55688816", "0.5545965", "0.5506293", "0.54885525", "0.5474304", "0.5463058",...
0.0
-1
When more alert results are available, use this to continue.
def alertcontinue(value) merge(notalertcontinue: value.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processNewAlerts\n @session.alerts.each{ |alert|\n if alert.is_a? Libtorrent::TorrentAlert\n if alert.handle.valid? && alert.handle.has_metadata\n addToHashList @torrentAlerts, alert.handle.name, alert\n end\n else\n @globalAlerts.push alert\n # For now since n...
[ "0.6236559", "0.62298495", "0.59650147", "0.5909893", "0.5829572", "0.57904965", "0.57714844", "0.5761191", "0.575035", "0.5750261", "0.57377535", "0.5633875", "0.5598365", "0.55437165", "0.55178237", "0.55099726", "0.5477545", "0.547445", "0.5454355", "0.5425227", "0.5419196...
0.0
-1
Whether to show unread message notifications first (only used if groupbysection is set).
def alertunreadfirst() merge(notalertunreadfirst: 'true') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def messageunreadfirst()\n merge(notmessageunreadfirst: 'true')\n end", "def unreadfirst()\n merge(notunreadfirst: 'true')\n end", "def first_unread_message\n gmail.inbox.find(:unread).find do |email|\n email.to[0].mailbox.include? 'performance_group'\n end\n ...
[ "0.71720797", "0.6777947", "0.63756937", "0.60128605", "0.58948237", "0.55301636", "0.55196303", "0.55063695", "0.54435074", "0.53889734", "0.5360408", "0.5358087", "0.53355694", "0.5327617", "0.5326357", "0.5317087", "0.53119147", "0.5297274", "0.52712506", "0.52646446", "0....
0.68281925
1
When more message results are available, use this to continue.
def messagecontinue(value) merge(notmessagecontinue: value.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def more_messages\n log \"Getting more_messages\"\n log \"Old start_index: #@start_index\"\n max = @start_index - 1\n @start_index = [(max + 1 - @limit), 1].max\n log \"New start_index: #@start_index\"\n fetch_ids = search_query? ? @ids[@start_index..max] : (@start_index..max).to_a\n ...
[ "0.6732006", "0.6601795", "0.6452948", "0.63930404", "0.63930404", "0.61950535", "0.6094057", "0.60731316", "0.5949222", "0.5941145", "0.5919673", "0.58985794", "0.5880351", "0.58434576", "0.5819928", "0.58031005", "0.5787979", "0.5755168", "0.57054293", "0.56794137", "0.5663...
0.0
-1
Whether to show unread alert notifications first (only used if groupbysection is set).
def messageunreadfirst() merge(notmessageunreadfirst: 'true') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alertunreadfirst()\n merge(notalertunreadfirst: 'true')\n end", "def unreadfirst()\n merge(notunreadfirst: 'true')\n end", "def unread_unsent_notifications_for_group\n @unread_unsent_notifications_for_group ||= unread_unsent_notifications.where('notify_user_notifications.group_...
[ "0.73922783", "0.64193135", "0.60340273", "0.5913231", "0.55172455", "0.5419864", "0.5388397", "0.5372058", "0.5277307", "0.5254512", "0.52172506", "0.51779145", "0.51201063", "0.5119448", "0.5119257", "0.51112986", "0.5104817", "0.5090765", "0.50587803", "0.5055235", "0.5046...
0.6516782
1
True to opt in to a summary notification of notifications on foreign wikis.
def crosswikisummary() merge(notcrosswikisummary: 'true') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notification?\n false\n end", "def notification?\n kind == 'notification'\n end", "def friendship_notifications?\n notification_friendship\n end", "def allow_notification?\n true\n end", "def notify_about?(object)\n case mail_notification\n when 'all'\n true\n ...
[ "0.6594851", "0.65313923", "0.62009525", "0.6191261", "0.61354214", "0.6061729", "0.58664525", "0.58542126", "0.58359814", "0.5816598", "0.58139724", "0.5789417", "0.5789104", "0.5744822", "0.57379067", "0.5737229", "0.5686071", "0.56637776", "0.56433636", "0.56124765", "0.56...
0.0
-1
human readable description of modeling approach
def modeler_description return "The difference between actual spaces and effective spaces takes into account the zone multipliers. The goal was to get average floor area assuming that each space represents a room vs. a collection of rooms. This was used to help determine average space sizes of different space types from the prototype buildings. In some cases I had to manaually adjust for where a space didn't map to a single room." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end", "def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end", "def m...
[ "0.7710149", "0.76145315", "0.75934714", "0.74018747", "0.7299891", "0.7296635", "0.727943", "0.71912926", "0.71912926", "0.7191264", "0.7100944", "0.70977926", "0.70629936", "0.7045383", "0.7044268", "0.70413125", "0.7040473", "0.7032938", "0.70267737", "0.70182866", "0.6987...
0.6415888
94
define the arguments that the user will input
def arguments(model) args = OpenStudio::Ruleset::OSArgumentVector.new return args end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arguments; end", "def arguments; end", "def arguments; end", "def arguments\n \"\"\n end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end...
[ "0.73753476", "0.73753476", "0.73753476", "0.70890766", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301",...
0.0
-1
define what happens when the measure is run
def run(model, runner, user_arguments) super(model, runner, user_arguments) # report initial condition of model runner.registerInitialCondition("The building started with #{model.getSpaces.size} spaces.") model.getSpaceTypes.each do |space_type| count = 0 space_type.spaces.each do |space| count += space.multiplier end avg_si = space_type.floorArea/count.to_f avg_ip = OpenStudio::convert(avg_si,'m^2','ft^2').get.round(2) total_ip = OpenStudio::convert(space_type.floorArea,'m^2','ft^2').get.round(2) runner.registerInfo("#{space_type.name} has #{count} spaces, with average area of #{avg_ip} ft^2. Total is #{total_ip}") end # report final condition of model runner.registerFinalCondition("The building finished with #{model.getSpaces.size} spaces.") return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure; end", "def measure=(_arg0); end", "def measure\n\t\t1\n\tend", "def measure(*args, &b)\n end", "def communicate_measure_result(_ = nil, _ = nil); end", "def communicate_measure_result(_ = nil, _ = nil); end", "def called\n self.measurement.called\n end", "def measure\n ...
[ "0.79848707", "0.7639643", "0.7635365", "0.7170765", "0.6692624", "0.6692624", "0.66722536", "0.6630833", "0.6598638", "0.65878135", "0.6532798", "0.6481993", "0.64055425", "0.640108", "0.6332412", "0.6283968", "0.6283968", "0.6283968", "0.6279644", "0.62679017", "0.6242105",...
0.0
-1
Returns the Github application client id token
def github_client_id Rails.application.secrets.github_client_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def github_client\n Octokit::Client.new access_token: self.setting.user_with_token.client_token\n end", "def client_token\n data[:client_token]\n end", "def github_token\n @token ||= `git config --get github.token`.strip\n @token ||= ENV[:GITHUB_TOKEN].strip\n end", "def github_acces...
[ "0.7501476", "0.7447308", "0.74122256", "0.7323662", "0.7323662", "0.71145886", "0.7102536", "0.70341754", "0.7018743", "0.70145434", "0.69606066", "0.69483244", "0.69306904", "0.69146997", "0.68549716", "0.6705575", "0.6693155", "0.668805", "0.6685557", "0.6682286", "0.66376...
0.7969239
0
Returns the Github application client secret token
def github_client_secret Rails.application.secrets.github_client_secret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def github_client_id\n Rails.application.secrets.github_client_id\n end", "def github_access_token\n ENV['GITHUB_ACCESS_TOKEN'].to_s.strip\n end", "def github_access_token\n ENV['GITHUB_ACCESS_TOKEN'].to_s.strip\n end", "def access_token_secret\n ENV[ACCESS_TOKEN_SECRET_NAM...
[ "0.78900313", "0.76030743", "0.76030743", "0.74173665", "0.73845094", "0.73499817", "0.7325451", "0.7317063", "0.73031265", "0.71057224", "0.7009393", "0.69867927", "0.6916015", "0.6916015", "0.6916015", "0.6909455", "0.68841285", "0.6881899", "0.68732166", "0.6862052", "0.68...
0.8031789
0
Returns the time to live for the application tokens
def app_token_ttl Rails.application.secrets.app_token_ttl end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_time\n self.update_column( :expires, Time.zone.now + TOKEN_LIFE )\n end", "def get_token_lifetime(key)\n get_option(key, :token_lifetime)\n end", "def get_token\n ((Time.now.to_f - Time.mktime(2009,\"jan\",1,0,0,0,0).to_f) * 10**6).to_i\n end", "def token_expiration_window\n # ...
[ "0.7071629", "0.6883635", "0.68361783", "0.6726614", "0.66432464", "0.65695566", "0.6436392", "0.6431436", "0.6397224", "0.6394523", "0.63889563", "0.63877726", "0.63877726", "0.6380337", "0.63707626", "0.63573396", "0.62971747", "0.6259793", "0.6237177", "0.62358016", "0.620...
0.7367036
0
Returns the JWT secret token
def app_jwt_token_secret Rails.application.secrets.app_jwt_token_secret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secret_key\n jwt_config['secret_key']\n end", "def token\n @token ||= JWT.decode(jwt_string, secret_key, true, verify_expiration: false)\n end", "def jwt_auth_token( secret )\n\n # expire in 5 minutes\n exp = Time.now.to_i + 5 * 60\n\n # just a standard claim\n exp_payload =...
[ "0.8322586", "0.82596344", "0.8209815", "0.81041306", "0.7801555", "0.7672593", "0.76580507", "0.7597972", "0.7572802", "0.75662464", "0.7505271", "0.750182", "0.74904364", "0.74904364", "0.74904364", "0.74458724", "0.7396309", "0.73956704", "0.7382424", "0.7374001", "0.73686...
0.7923671
4
=begin rdoc Fork and start a Webrick instance running the LocalHttpd::WebApp application. =end
def start @pid = Process.fork do if (@options.rack) # NOTE: This does not support command-line setting of repo! opts = { :server => :webrick, :host => @host, :port => @port} PlanR::Application::LocalHttpd::WebApp.run!( repo, opts ) else # rack doesn't do the one thing we need it to: # pass WebApp instantiation arguments to Webrick.mount opts = { :BindAddress => @host, :Port => @port} @webrick = ::WEBrick::HTTPServer.new(opts) @webrick.mount "/", Servlet, [ PlanR::Application::LocalHttpd::WebApp, @options ] @webrick.start end end trap('INT') { Process.kill 'INT', @pid } trap('TERM') { Process.kill 'INT', @pid } self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start\n UI.info \"Starting up WEBrick...\"\n if running?\n UI.error \"Another instance of WEBrick::HTTPServer is running.\"\n false\n else\n @pid = Spoon.spawnp('ruby',\n File.expand_path(File.join(File.dirname(__FILE__), %w{webrick server.rb})),\n @options...
[ "0.7510591", "0.730642", "0.71709186", "0.6983111", "0.68436265", "0.68065315", "0.67875445", "0.67814744", "0.67613155", "0.6760062", "0.6728673", "0.67258686", "0.67251605", "0.67126906", "0.66903764", "0.6665408", "0.66606337", "0.66182804", "0.65731376", "0.6565935", "0.6...
0.82225764
0
=begin rdoc Stop the Server process. In the controlling process, this kills the server PID. In the server process, this invokes Webrickshutdown. =end
def stop # use pid in controlling process, webrick in server process @webrick.shutdown if @webrick Process.kill('INT', @pid) if @pid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_stop\n Process.kill 'INT', 0\n end", "def stop_server\n Thin::Server.kill(CloudCrowd.pid_path('server.pid'), 0)\n end", "def stop\n @server.stop if @server.running?\n end", "def stop_server\n if ! @wbthread.nil? && @wbthread.alive?\n # signal server thread to quit\n ...
[ "0.82698625", "0.800173", "0.7851701", "0.7813708", "0.7780696", "0.77486914", "0.7745027", "0.7737806", "0.76892287", "0.7641148", "0.7619365", "0.7592064", "0.7574186", "0.75473267", "0.7530517", "0.7472893", "0.7460063", "0.74366367", "0.7433465", "0.73848146", "0.73754734...
0.85341537
0
return next available port for webrick to listen on
def get_avail_port(host) host ||= (Socket::gethostbyname('')||['localhost'])[0] infos = Socket::getaddrinfo(host, nil, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE) fam = infos.inject({}) { |h, arr| h[arr[0]]= arr[2]; h } sock_host = fam['AF_INET'] || fam['AF_INET6'] sock = sock_host ? TCPServer.open(sock_host, 0) : TCPServer.open(0) port = sock.addr[1] sock.close port end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_available_port\n server = TCPServer.new(\"127.0.0.1\", 0)\n server.addr[1]\n ensure\n server.close if server\n end", "def find_port(port)\n port += 1 while port_bound?('127.0.0.1', port)\n port\nend", "def find_open_port\n server = TCPServer.new('127.0.0.1', 0)\n port = server.a...
[ "0.7473285", "0.74472576", "0.7336912", "0.73342365", "0.71801054", "0.7119723", "0.70559543", "0.7030518", "0.691836", "0.6826297", "0.6766134", "0.67562294", "0.67159766", "0.67068946", "0.6651516", "0.6651516", "0.66267836", "0.6593085", "0.65703666", "0.65703666", "0.6521...
0.6558905
20
Last session was within the last 7 days
def active_access?(count = 7) last_access_at && last_access_at > count.days.ago end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def past_sport_sessions\n sport_sessions_confirmed.where('date < ?', Date.today).limit(3) #TODO: maybe we should use DateTime.now or Date.now\n end", "def session_last_user_activity\n session[:last_activity]\n end", "def login_time_last_30_days\n login_time_since(30.days.ago)\n end", "def upcomi...
[ "0.6614078", "0.6447288", "0.62581825", "0.62561285", "0.6252952", "0.6152374", "0.6101172", "0.6074486", "0.60292363", "0.6003135", "0.60014", "0.59913844", "0.5986005", "0.59738046", "0.59658146", "0.5957874", "0.59527296", "0.59514606", "0.5950408", "0.58968997", "0.587487...
0.597615
13
Last session was more than 7 days ago
def inactive_access?(count = 7) !active_access?(count) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_last_user_activity\n session[:last_activity]\n end", "def login_time_last_30_days\n login_time_since(30.days.ago)\n end", "def get_session_age\n return Time.now.to_i - session.last_checkin.to_i\n end", "def past_sport_sessions\n sport_sessions_confirmed.where('date < ?', Date.today...
[ "0.6567803", "0.65608984", "0.65503633", "0.6289638", "0.6248826", "0.6241176", "0.6206185", "0.6200619", "0.6173619", "0.6169644", "0.6154641", "0.6126301", "0.6087326", "0.6087326", "0.6084633", "0.60753185", "0.60572237", "0.60571456", "0.6014135", "0.59815365", "0.5977482...
0.0
-1
custom method with argument
def initialize(id, name, address) @id = id @name = name @address = address end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def argue(argument)\n argument\nend", "def method(arg0)\n end", "def method(arg0)\n end", "def arg; end", "def meth(\n **\n ); end", "def argue(argument)\n return argument\nend", "def add_argument(arg); end", "def add_argument(arg); end", "def add_argument(arg); end", "def meth(\n ...
[ "0.7025194", "0.69801486", "0.69801486", "0.69365025", "0.68236065", "0.6809622", "0.67950326", "0.67950326", "0.67950326", "0.67503744", "0.66862065", "0.66191095", "0.6570104", "0.6570104", "0.6551439", "0.6543108", "0.6543108", "0.6543108", "0.65203226", "0.65169376", "0.6...
0.0
-1
Instance method with default argument
def display_details() puts "Customer id is #{@id} " puts "Customer name is #{@name} " puts "Customer address is #{@address} " end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(*args)\n default\n end", "def default=(_arg0); end", "def meth( x = nil)\nend", "def default; end", "def default; end", "def default\n end", "def a_method(arg1, arg2='default value')\n do_stuff\n end", "def meth(\n # this is important\n important_arg...
[ "0.79363966", "0.7668559", "0.7354355", "0.7236202", "0.7236202", "0.7233034", "0.7228414", "0.71951133", "0.7113134", "0.6972962", "0.6897148", "0.68696153", "0.68696153", "0.6865064", "0.6841292", "0.68165755", "0.6731259", "0.6727561", "0.6727561", "0.6693945", "0.6665807"...
0.0
-1
Instance method with default argument
def total_no_customer() @@no_of_customer+=1 puts "The total number of customer is #{@@no_of_customer} " puts " " end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(*args)\n default\n end", "def default=(_arg0); end", "def meth( x = nil)\nend", "def default; end", "def default; end", "def default\n end", "def a_method(arg1, arg2='default value')\n do_stuff\n end", "def meth(\n # this is important\n important_arg...
[ "0.79370904", "0.76697576", "0.73546267", "0.72378266", "0.72378266", "0.7234604", "0.7228585", "0.7195097", "0.7113543", "0.6973876", "0.68984073", "0.6870769", "0.6870769", "0.6866557", "0.6842268", "0.68171555", "0.67325634", "0.67280877", "0.67280877", "0.6694391", "0.666...
0.0
-1
TODO: Refactor, move to a separate controller.
def upload_image if params[:item_image][:crop_x].to_i == 0 && params[:item_image][:crop_y].to_i == 0 \ && params[:item_image][:crop_w].to_i == 0 && params[:item_image][:crop_h].to_i == 0 @item_image = ItemImage.where('item_token = ? AND item_id is ?', params[:item_image][:item_token], nil).first else @item_image_old = ItemImage.where('item_token = ?', params[:item_image][:item_token]).last if @item_image_old.nil? @item_image = @item_image_old else @item_image = @item_image_old.dup @item_image.image = @item_image_old.image @item_image.item_id = nil end end if @item_image.nil? @item_image = ItemImage.new end # item = Item.find_by_token(params[:item_image][:item_token]) # @item_image.item_id = item.id if params[:item_image][:image] array_item_image = params[:item_image][:image].original_filename.split('.').last params[:item_image][:image].original_filename = "#{DateTime.now.strftime("%Y_%m_%d_%H_%M_%S")}" + "." + array_item_image.to_s end @item_image.image = params[:item_image][:image] @item_image.item_token = params[:item_image][:item_token] @item_image.crop_x = params[:item_image][:crop_x] @item_image.crop_y = params[:item_image][:crop_y] @item_image.crop_w = params[:item_image][:crop_w] @item_image.crop_h = params[:item_image][:crop_h] @item_image.rate = params[:item_image][:rate] if @item_image.save respond_to do |format| format.js { render :upload_image_success } end else respond_to do |format| format.js { render :upload_image_error } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller\n end", "def controller\n end", "def...
[ "0.6420727", "0.6420727", "0.6420727", "0.6420727", "0.6420727", "0.6420727", "0.6420727", "0.6420727", "0.6420727", "0.6420727", "0.6345062", "0.6345062", "0.6316518", "0.6276356", "0.6247326", "0.6247326", "0.6247326", "0.6247326", "0.6247326", "0.6247326", "0.6247326", "...
0.0
-1
Function for finding the name of a process given it's PID
def find_procname(pid) name = nil @client.sys.process.get_processes.each do |proc| if proc['pid'] == pid.to_i name = proc['name'] end end return name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_process_name\n processes = client.sys.process.get_processes\n current_pid = session.sys.process.getpid\n processes.each do |proc|\n return proc['name'] if proc['pid'] == current_pid\n end\n return nil\n end", "def find_process_id(process_name)\n process = remote_processes.find {...
[ "0.83733445", "0.7197474", "0.70219266", "0.68831986", "0.6874601", "0.67912555", "0.6779756", "0.67587376", "0.6654644", "0.6572169", "0.65699637", "0.65699637", "0.6537542", "0.6528335", "0.6482057", "0.64375377", "0.643414", "0.63666916", "0.63474447", "0.6315337", "0.6308...
0.8645071
0
Find all PID's for a given process name
def find_pids(name) proc_pid = [] @client.sys.process.get_processes.each do |proc| if proc['name'].downcase == name.downcase proc_pid << proc['pid'] end end return proc_pid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_process_pids(image_name)\n pid_array = Array.new\n command = 'tasklist /FI \"IMAGENAME eq ' + \"#{image_name}\"\"\"\n command_output = `#{command}`\n command_output.each_line do |line|\n if line =~ /^#{image_name}/\n pid_array << line.split(/ +/)[1]\n end\n end\n return p...
[ "0.78839636", "0.773156", "0.7584752", "0.74315757", "0.73934597", "0.7349696", "0.7264297", "0.724404", "0.7221079", "0.7221079", "0.71751213", "0.7042624", "0.70245075", "0.70057946", "0.691484", "0.69085664", "0.68566096", "0.67504126", "0.67255795", "0.66665334", "0.66398...
0.8596876
0
Dumps the memory for a given PID
def dump_mem(pid,name, toggle) host,port = @client.tunnel_peer.split(':') # Create Filename info to be appended to created files filenameinfo = "_#{name}_#{pid}_" + ::Time.now.strftime("%Y%m%d.%M%S") # Create a directory for the logs logs = ::File.join(Msf::Config.log_directory, 'scripts', 'proc_memdump') # Create the log directory ::FileUtils.mkdir_p(logs) #Dump file name dumpfile = logs + ::File::Separator + host + filenameinfo + ".dmp" print_status("\tDumping Memory of #{name} with PID: #{pid.to_s}") begin dump_process = @client.sys.process.open(pid.to_i, PROCESS_READ) rescue print_error("Could not open process for reading memory!") raise Rex::Script::Completed end # MaximumApplicationAddress for 32bit or close enough maximumapplicationaddress = 2147418111 base_size = 0 while base_size < maximumapplicationaddress mbi = dump_process.memory.query(base_size) # Check if Allocated if mbi["Available"].to_s == "false" file_local_write(dumpfile,mbi.inspect) if toggle file_local_write(dumpfile,dump_process.memory.read(mbi["BaseAddress"],mbi["RegionSize"])) print_status("\tbase size = #{base_size/1024}") end base_size += mbi["RegionSize"] end print_status("Saving Dumped Memory to #{dumpfile}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_memory(i, opts={}); get_memory(i, opts).hexdump; end", "def pid_memory\n file_format.pids[self[:pid]] ||= { :last_memory_reading => -1, :current_memory_reading => -1 }\n end", "def dump\n puts \"Memory dump:\"\n @content.each_index do |index|\n puts \"%0.5d: %0.4o\" % [index, @c...
[ "0.7120959", "0.6760381", "0.65458465", "0.63837844", "0.62730616", "0.6123218", "0.6077946", "0.60441667", "0.59871006", "0.5829059", "0.57639396", "0.5539883", "0.55204976", "0.549366", "0.5461519", "0.5439264", "0.5406448", "0.53775597", "0.5373298", "0.53700906", "0.53603...
0.7830577
0
Function to query process Size
def get_mem_usage( pid ) p = @client.sys.process.open( pid.to_i, PROCESS_QUERY_INFORMATION | PROCESS_VM_READ ) if( p ) begin if( not @client.railgun.get_dll( 'psapi' ) ) @client.railgun.add_dll( 'psapi' ) end # http://msdn.microsoft.com/en-us/library/ms683219%28v=VS.85%29.aspx if( not @client.railgun.psapi.functions['GetProcessMemoryInfo'] ) @client.railgun.psapi.add_function( 'GetProcessMemoryInfo', 'BOOL', [ [ "HANDLE", "hProcess", "in" ], [ "PBLOB", "ProcessMemoryCounters", "out" ], [ "DWORD", "Size", "in" ] ] ) end r = @client.railgun.psapi.GetProcessMemoryInfo( p.handle, 72, 72 ) if( r['return'] ) pmc = r['ProcessMemoryCounters'] # unpack the PROCESS_MEMORY_COUNTERS structure (http://msdn.microsoft.com/en-us/library/ms684877%28v=VS.85%29.aspx) # Note: As we get the raw structure back from railgun we need to account # for SIZE_T variables being 32bit on x86 and 64bit on x64 mem = nil if( @client.platform =~ /win32/ ) mem = pmc[12..15].unpack('V').first elsif( @client.platform =~ /win64/ ) mem = pmc[16..23].unpack('Q').first end return (mem/1024) end rescue p "Exception - #{$!}" end p.close end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend", "def get_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend", "def current_proc_used_mem\n #pid, size = `ps ax -o pid,rss | grep -E \"^[[:space:]]*#{$$}\"`.strip.split.map(&:to_i)\n #`ps -o rss -p #{$$}`.chomp.split(\"\\n\").last.to...
[ "0.73414606", "0.734064", "0.7326635", "0.72384304", "0.70804155", "0.70088387", "0.69960773", "0.69369686", "0.68792355", "0.6877563", "0.68744785", "0.68744785", "0.6847648", "0.6839052", "0.6816184", "0.6803115", "0.6793036", "0.67754847", "0.67159593", "0.6699418", "0.667...
0.6745675
18
Base 64 decode, convert base 64 string to binary content Decodes / converts base 64 UTF8 text string to binary content
def edit_text_base64_decode(request, opts = {}) data, _status_code, _headers = edit_text_base64_decode_with_http_info(request, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base64_decode(string)\n SSL.base64_decode(string)\n end", "def base64_decode(string)\n SSL.base64_decode(string)\n end", "def decode(string)\n Base64.decode64(string)\n end", "def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a b...
[ "0.77251726", "0.77251726", "0.75442106", "0.7541767", "0.74189585", "0.7303875", "0.72659075", "0.7251851", "0.71538424", "0.71538424", "0.71455646", "0.7125728", "0.70656073", "0.6980052", "0.69579655", "0.6957261", "0.6900413", "0.6869287", "0.68567014", "0.6763753", "0.67...
0.6115034
55
Base 64 decode, convert base 64 string to binary content Decodes / converts base 64 UTF8 text string to binary content
def edit_text_base64_decode_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_base64_decode ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling EditTextApi.edit_text_base64_decode" end # resource path local_var_path = '/convert/edit/text/encoding/base64/decode' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Base64DecodeResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: EditTextApi#edit_text_base64_decode\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base64_decode(string)\n SSL.base64_decode(string)\n end", "def base64_decode(string)\n SSL.base64_decode(string)\n end", "def decode(string)\n Base64.decode64(string)\n end", "def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a b...
[ "0.7725709", "0.7725709", "0.75449055", "0.75424063", "0.7419948", "0.73043716", "0.7265499", "0.7252951", "0.7154137", "0.7154137", "0.7144952", "0.7126555", "0.70659447", "0.6979753", "0.6958805", "0.6957194", "0.6901581", "0.6869887", "0.6857393", "0.67643476", "0.6758812"...
0.0
-1
Detect, check if text string is base 64 encoded Checks, detects if input string is base 64 encoded
def edit_text_base64_detect(request, opts = {}) data, _status_code, _headers = edit_text_base64_detect_with_http_info(request, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end", "def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end", "def valid_base64?(string)\n return false unless string.is_a?(String)\n ...
[ "0.77336544", "0.77336544", "0.74906963", "0.6642859", "0.65283483", "0.64735115", "0.6441664", "0.63351643", "0.63319427", "0.6258758", "0.6255561", "0.6255561", "0.62454295", "0.61974543", "0.6190941", "0.6158988", "0.6140333", "0.611493", "0.6114576", "0.6087864", "0.60878...
0.63093257
9
Detect, check if text string is base 64 encoded Checks, detects if input string is base 64 encoded
def edit_text_base64_detect_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_base64_detect ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling EditTextApi.edit_text_base64_detect" end # resource path local_var_path = '/convert/edit/text/encoding/base64/detect' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Base64DetectResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: EditTextApi#edit_text_base64_detect\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end", "def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end", "def valid_base64?(string)\n return false unless string.is_a?(String)\n ...
[ "0.7734977", "0.7734977", "0.7492275", "0.66429627", "0.6529098", "0.64741683", "0.64426994", "0.63358283", "0.633199", "0.63087136", "0.6258804", "0.6256823", "0.6256823", "0.62453866", "0.6198839", "0.61921984", "0.61596966", "0.6141271", "0.61154413", "0.61153513", "0.6088...
0.0
-1
Base 64 encode, convert binary or file data to a text string Encodes / converts binary or file data to a text string
def edit_text_base64_encode(request, opts = {}) data, _status_code, _headers = edit_text_base64_encode_with_http_info(request, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_base64(text)\n Base64.strict_encode64(text).strip\n end", "def b64_e(data)\n Base64.encode64(data).chomp\n end", "def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n ...
[ "0.76493204", "0.73975974", "0.7248933", "0.72290087", "0.7072631", "0.69880325", "0.6906852", "0.6890942", "0.67682904", "0.67168826", "0.67168826", "0.66970366", "0.66615707", "0.6649137", "0.66388893", "0.66282266", "0.6616499", "0.65718377", "0.6554283", "0.65180314", "0....
0.57393616
69
Base 64 encode, convert binary or file data to a text string Encodes / converts binary or file data to a text string
def edit_text_base64_encode_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_base64_encode ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling EditTextApi.edit_text_base64_encode" end # resource path local_var_path = '/convert/edit/text/encoding/base64/encode' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Base64EncodeResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: EditTextApi#edit_text_base64_encode\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_base64(text)\n Base64.strict_encode64(text).strip\n end", "def b64_e(data)\n Base64.encode64(data).chomp\n end", "def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n ...
[ "0.7648406", "0.73963034", "0.7247658", "0.7227718", "0.70721227", "0.6988505", "0.69052285", "0.6891448", "0.6769234", "0.6716464", "0.6716464", "0.66976434", "0.6662091", "0.66487396", "0.6637941", "0.6627886", "0.66167414", "0.657141", "0.6552477", "0.65162027", "0.6441005...
0.0
-1
Set, change line endings of a text file Sets the line ending type of a text file; set to Windows, Unix or Mac.
def edit_text_change_line_endings(line_ending_type, input_file, opts = {}) data, _status_code, _headers = edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_ending=(value)\n @line_ending = value || \"\\r\\n\"\n end", "def setEol(eol)\n unless /(?i)^(unix|dos|mac)$/.match(eol)\n raise Error.new(Pdfcrowd.create_invalid_value_message(eol, \"setEol\", \"pdf-to-text\", \"Allowed values are unix, dos, mac.\", \"set_eol\"), 470);\...
[ "0.634094", "0.5782405", "0.57073706", "0.57019454", "0.56270206", "0.5606324", "0.55476177", "0.55101746", "0.5403119", "0.5399155", "0.5396579", "0.53315276", "0.52787334", "0.5249558", "0.5242004", "0.5239195", "0.51631784", "0.51631784", "0.508451", "0.5050614", "0.488000...
0.68490213
0
Set, change line endings of a text file Sets the line ending type of a text file; set to Windows, Unix or Mac.
def edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_change_line_endings ...' end # verify the required parameter 'line_ending_type' is set if @api_client.config.client_side_validation && line_ending_type.nil? fail ArgumentError, "Missing the required parameter 'line_ending_type' when calling EditTextApi.edit_text_change_line_endings" end # verify the required parameter 'input_file' is set if @api_client.config.client_side_validation && input_file.nil? fail ArgumentError, "Missing the required parameter 'input_file' when calling EditTextApi.edit_text_change_line_endings" end # resource path local_var_path = '/convert/edit/text/line-endings/change' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) header_params[:'lineEndingType'] = line_ending_type # form parameters form_params = {} form_params['inputFile'] = input_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ChangeLineEndingResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: EditTextApi#edit_text_change_line_endings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_text_change_line_endings(line_ending_type, input_file, opts = {})\n data, _status_code, _headers = edit_text_change_line_endings_with_http_info(line_ending_type, input_file, opts)\n data\n end", "def line_ending=(value)\n @line_ending = value || \"\\r\\n\"\n end", "def setEol(eol)...
[ "0.68497586", "0.6341286", "0.57823133", "0.57073545", "0.570237", "0.5607141", "0.55474347", "0.5509994", "0.5402241", "0.53981376", "0.5395558", "0.5331249", "0.52781695", "0.52503693", "0.5241467", "0.5238761", "0.5163444", "0.5163444", "0.50835234", "0.50502414", "0.48794...
0.562701
5
Detect line endings of a text file Detect line ending type (Windows, Unix or Mac) of an input file.
def edit_text_detect_line_endings(input_file, opts = {}) data, _status_code, _headers = edit_text_detect_line_endings_with_http_info(input_file, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend", "def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend", "def guess_line_ending(filehandle, options)\n counts = {\"\\n\" => 0, \"\\r\" => 0, \...
[ "0.6703327", "0.6703327", "0.6207632", "0.6109223", "0.60947007", "0.5926948", "0.5896254", "0.58617353", "0.57788646", "0.56891596", "0.5603125", "0.5536574", "0.55011284", "0.5449394", "0.5424629", "0.53867227", "0.53442526", "0.52886736", "0.5246215", "0.5242452", "0.52294...
0.7301763
0
Detect line endings of a text file Detect line ending type (Windows, Unix or Mac) of an input file.
def edit_text_detect_line_endings_with_http_info(input_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_detect_line_endings ...' end # verify the required parameter 'input_file' is set if @api_client.config.client_side_validation && input_file.nil? fail ArgumentError, "Missing the required parameter 'input_file' when calling EditTextApi.edit_text_detect_line_endings" end # resource path local_var_path = '/convert/edit/text/line-endings/detect' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['inputFile'] = input_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DetectLineEndingsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: EditTextApi#edit_text_detect_line_endings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_text_detect_line_endings(input_file, opts = {})\n data, _status_code, _headers = edit_text_detect_line_endings_with_http_info(input_file, opts)\n data\n end", "def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend", "def getFileLineEnd...
[ "0.7301583", "0.6703883", "0.6703883", "0.62086535", "0.61099255", "0.6094957", "0.59279126", "0.5895707", "0.57786936", "0.56895846", "0.56022954", "0.55387455", "0.5502004", "0.54500234", "0.5424423", "0.5385529", "0.53450817", "0.5289995", "0.5244717", "0.5243275", "0.5230...
0.58623785
8
Find a regular expression regex in text input Find all occurrences of the input regular expression in the input content, and returns the matches
def edit_text_find_regex(request, opts = {}) data, _status_code, _headers = edit_text_find_regex_with_http_info(request, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matching_lines(regex); end", "def matches(s, re)\n start_at = 0\n matches = []\n while(m = s.match(re, start_at))\n matches.push(m)\n start_at = m.end(0)\n end\n matches\n end", "def matches(s, re)\r\n start_at = 0\r\n matches = [ ]\r\n while(m = s.match(re, ...
[ "0.71646434", "0.7088026", "0.6991352", "0.68928456", "0.6569699", "0.65328544", "0.6454069", "0.6361761", "0.62941855", "0.6291894", "0.61693704", "0.6130515", "0.61188555", "0.6113431", "0.6106083", "0.6015748", "0.597976", "0.5974627", "0.59642094", "0.59586", "0.59459805"...
0.6205902
10
Find a regular expression regex in text input Find all occurrences of the input regular expression in the input content, and returns the matches
def edit_text_find_regex_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EditTextApi.edit_text_find_regex ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling EditTextApi.edit_text_find_regex" end # resource path local_var_path = '/convert/edit/text/find/regex' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'FindStringRegexResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: EditTextApi#edit_text_find_regex\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matching_lines(regex); end", "def matches(s, re)\n start_at = 0\n matches = []\n while(m = s.match(re, start_at))\n matches.push(m)\n start_at = m.end(0)\n end\n matches\n end", "def matches(s, re)\r\n start_at = 0\r\n matches = [ ]\r\n while(m = s.match(re, ...
[ "0.7165732", "0.70880353", "0.6991217", "0.6893286", "0.6569845", "0.65322", "0.6453851", "0.6362643", "0.6295005", "0.62933683", "0.62046385", "0.6170565", "0.61315477", "0.611829", "0.61130303", "0.61058277", "0.6016935", "0.5980959", "0.59751236", "0.5965583", "0.5959748",...
0.0
-1
Find a string in text input Finds all occurrences of the input string in the input content, and returns the matches
def edit_text_find_simple(request, opts = {}) data, _status_code, _headers = edit_text_find_simple_with_http_info(request, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_text text\n @lookups.each do |rx_curr|\n return true if text =~ rx_curr\n end\n false\n end", "def partial_matches_for(input_string)\n # [\"aardvark\", \"apple\"]\n @word_list.select do |word|\n word.start_with?(input_string)\n end\n end", "def textmatch(text, terms)\n ...
[ "0.68030685", "0.6795328", "0.67800766", "0.6778386", "0.67155194", "0.6652916", "0.6603315", "0.6558996", "0.6537478", "0.64943457", "0.64856493", "0.6435088", "0.62865627", "0.6266953", "0.6253671", "0.62390107", "0.62112385", "0.62011117", "0.6197337", "0.61906886", "0.618...
0.0
-1