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
returns all the posts for that author
def post Post.all.select {|post| post.author == self} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def posts_by_author(author_name, posts = nil)\n posts ||= published_weblog\n posts.select { |post| post._unwrap.attributes[:author_name] == author_name }\n end", "def posts \n Post.all.select {|post| post.author == self}\n end", "def index\n\n res_posts = Post.select(\"id, title, auth...
[ "0.785051", "0.7511507", "0.69503725", "0.6928265", "0.686226", "0.68462634", "0.6828634", "0.6724405", "0.6708099", "0.6612329", "0.6588582", "0.658194", "0.65734744", "0.65687484", "0.6535433", "0.65340316", "0.6526605", "0.6521133", "0.65062875", "0.6497817", "0.649556", ...
0.7008851
2
creates a new post associated with an author, arg of title
def add_post_by_title(title) post = Post.new(title) @posts << post post.author = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_post_by_title(title)\n post = Post.new(title)\n post.author = self\n end", "def add_post_by_title(post_title)\n post = Post.new(post_title)\n post.author = self\n end", "def add_post_by_title(title)\n title = Post.new(title) #to create a new song\n title.author = self #associate the...
[ "0.7600629", "0.7553732", "0.74361897", "0.7324124", "0.72305596", "0.7164605", "0.7142949", "0.70749205", "0.70749205", "0.7053139", "0.7024011", "0.69883764", "0.69826555", "0.69823897", "0.6977838", "0.6957114", "0.6918186", "0.68804014", "0.6868529", "0.6810128", "0.67696...
0.7188947
5
Returns how many seconds the stream has been up relative to the current time.
def uptime Time.now - live_since end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def up_time\n (Process.clock_gettime(Process::CLOCK_MONOTONIC) - (@start[:time] || Time.now)).round(3)\n end", "def seconds\n (Time.now - @start_time).to_i\n end", "def up_time(formatted: true)\n up = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - (@start[:time] || Time.now)).round(3)).to...
[ "0.7677821", "0.7196022", "0.7172543", "0.7127302", "0.6991997", "0.69709736", "0.69305724", "0.69130003", "0.69061303", "0.69061303", "0.6776878", "0.67712706", "0.6742", "0.66927725", "0.6668665", "0.66654384", "0.6591835", "0.65767556", "0.6573498", "0.65607405", "0.655458...
0.65258616
22
read_cart_solved_file read the data of the solved cartfile
def read_solved_info(file_path) nil if File.exist? file_path cart_file_resolved = {} IO.foreach(file_path.to_s) do |block| block = block.strip next if block.empty? || (block == "\n") meta = /((?i)binary|git|github)\s+"([^"]+)"\s+"([^"]+)"/.match(block) if meta type = meta[1] f_name = %r{/([^./]+)((?i).git|.json)?$}.match(meta[2])[1] url = meta[2] hash = meta[3] else puts "#{'***'.cyan} warning could not analysis #{block}" next end cart_file_resolved[f_name] = CartFileResolved.new_cart_solved(f_name, type, url, hash) end cart_file_resolved end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_cart_file(project_name, cart_file, is_private = false)\n cart_file_data = {}\n\n if File.exist? cart_file\n IO.foreach(cart_file) do |block|\n block = block.strip\n next if (block == '') || (block[0] == \"\\#\")\n\n meta = /((?i)binary|git|github)\\s+\"([^\"]+)\"\\s+(~>|==|>=)?\\s?\"?(...
[ "0.65166515", "0.5792084", "0.5531755", "0.5453012", "0.54495186", "0.5363613", "0.53139305", "0.5303696", "0.5253286", "0.52237546", "0.5196882", "0.51803017", "0.51794356", "0.5155329", "0.51530117", "0.5138323", "0.5134909", "0.512134", "0.5098019", "0.508683", "0.50642645...
0.72441465
0
Test cases for new NXAPI client APIs
def test_config_string client.config("int et1/1\ndescr panda\n") run = client.show('show run int et1/1') desc = run.match(/description (.*)/)[1] assert_equal(desc, 'panda') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_api\n load_config\n require 'extensions/metasploit/extension.rb'\n @api = BeEF::Extension::Metasploit::RpcClient.instance\n @api.unit_test_init()\n end", "def test_firecloud_api_available\n # check that API is up\n api_available = @fire_cloud_client.api_available?\n assert [true, fa...
[ "0.6492589", "0.6174731", "0.6107737", "0.6079551", "0.6062778", "0.6040521", "0.6040521", "0.60344553", "0.6019894", "0.6005491", "0.59881204", "0.5984419", "0.59623224", "0.5918656", "0.58807135", "0.58807135", "0.5863611", "0.5861292", "0.5843076", "0.5823098", "0.5811425"...
0.0
-1
This is for veda
def age_of_file create_date = get_hash("file-creation-date")["file_creation_date"] return nil unless create_date.present? now = DateTime.now create_date = create_date.to_date (now.year * 12 + now.month) - (create_date.year * 12 + create_date.month) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verdi; end", "def\n \nend\n\n\n# 6. sentence_maker refactored solution", "def terpene; end", "def termsig(*) end", "def formation; end", "def villian; end", "def dv; end", "def term; end", "def vin; end", "def qv\n end", "def trd; end", "def completed_text_extraction\n end", ...
[ "0.6274245", "0.6101376", "0.6068473", "0.60192806", "0.5975726", "0.5966838", "0.5930941", "0.5920931", "0.59102404", "0.5859669", "0.5820374", "0.5790232", "0.5775537", "0.572825", "0.5686462", "0.56388056", "0.5619968", "0.5619968", "0.5600224", "0.5561784", "0.555618", ...
0.0
-1
This is our own
def age_of_response (self.created_at.to_date - Date.current).to_i.abs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def custom; end", "def custom; end", "def implementation; end", "def implementation; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def weber; end", "def initialize\n\t\t\n\tend", "def refutal...
[ "0.8069144", "0.68271047", "0.68271047", "0.67499936", "0.67499936", "0.67381346", "0.67099595", "0.67099595", "0.67099595", "0.67099595", "0.66572666", "0.65200466", "0.6515392", "0.651037", "0.6482828", "0.6467459", "0.64659846", "0.6444987", "0.6444987", "0.6441607", "0.64...
0.0
-1
the image belonging to a particular Goth full url
def goth_image_full_tag(goth) image = image_path "goths/#{goth.name}.jpg" url = "#{root_url.chomp('/')}#{image}" image_tag url, :alt => goth.name, :title => goth.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imgurl\n picref.imgurl if picref\n end", "def display_img_url(url)\n url.sub(/s90$/, 's360') \n # recipe_response = Faraday.get(\"http://api.yummly.com/v1/api/recipe/#{id}\",\n # _app_id: ENV['YUMMLY_APP_ID'],\n # _app_key: E...
[ "0.73055774", "0.7218375", "0.72099346", "0.7188667", "0.7140367", "0.70719445", "0.7063624", "0.7036462", "0.7018791", "0.7007271", "0.7006407", "0.6990234", "0.69687253", "0.69687253", "0.69551283", "0.6948127", "0.69265306", "0.6925522", "0.69134057", "0.6897684", "0.68957...
0.0
-1
link to this Goths voting page on gothornot.com
def goth_vote_link(goth) link_to goth.name, "http://gothornot.com/?vote_username=#{goth.name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vote(id)\n require_login!\n url = get(ITEM_URL % id).match(/<a id=up_\\d+ onclick=\"return vote\\(this\\)\" href=\"(vote\\?[^\"]+)\">/)[1]\n get(BASE_URL + '/' + url)\n end", "def vote(id)\n require_login!\n url = get(ITEM_URL % id).match(/<a id=up_\\d+ onclick=\"return vote\\(this\\)\" href=...
[ "0.66571367", "0.66571367", "0.6273372", "0.6111617", "0.59387475", "0.5918416", "0.589596", "0.5848515", "0.58344", "0.5804372", "0.57919234", "0.578811", "0.57858884", "0.57737035", "0.5696298", "0.5670926", "0.56668305", "0.5627904", "0.5623263", "0.5599123", "0.55739385",...
0.7825385
0
the url for the permalink to this goth
def goth_permalink_url(goth) month = sprintf('%0.2d', goth.published_at.month) day = sprintf('%0.2d', goth.published_at.day) goth_url :year => goth.published_at.year, :month => month, :day => day, :name => goth.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permalink\n return \"#{uri}\"\n end", "def permalink\n \"/#{object.permalink}\"\n end", "def permalink\n link(:perma)\n end", "def permalink; end", "def permalink; end", "def permalink\n url = @path.inject(:+).to_s\n\n Henshin.local? ? url[1..-1] : ...
[ "0.8632819", "0.8527186", "0.8285557", "0.8266239", "0.8266239", "0.8168464", "0.81603986", "0.81181335", "0.7971718", "0.79575455", "0.79575455", "0.79242206", "0.7724979", "0.7715039", "0.7700807", "0.7697792", "0.76456875", "0.7614023", "0.7610313", "0.7610313", "0.7516649...
0.7848972
12
the permalink to this goth
def goth_permalink(goth) link_to goth.name, goth_permalink_url(goth) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permalink; end", "def permalink; end", "def permalink\n return \"#{uri}\"\n end", "def permalink\n \"/#{object.permalink}\"\n end", "def permalink\n link(:perma)\n end", "def to_param\n permalink\n end", "def to_param\n permalink\n end", "de...
[ "0.8678026", "0.8678026", "0.84956646", "0.84514797", "0.8408636", "0.8218145", "0.80672824", "0.80672824", "0.79882973", "0.797339", "0.79569006", "0.78528285", "0.7766291", "0.77095556", "0.77095556", "0.7696111", "0.7680731", "0.75978494", "0.7596632", "0.75609857", "0.755...
0.8252487
5
format the published date in a specific format
def goth_published_date(goth) goth.published_at.strftime('%b %d, %Y %H:%M') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatted_published\n @published.strftime('%A, %d %B %Y at %I:%M %P')\n end", "def display_day_published\r\n \"Published : #{created_at.strftime('%-b %-d, %Y')}\"\r\n end", "def display_day_published\n \"Published : #{created_at.strftime('%-b %-d, %Y')}\"\n end", "def date_published_human...
[ "0.8077744", "0.77866924", "0.77467966", "0.7656828", "0.7423921", "0.7363599", "0.7309931", "0.72206575", "0.71988964", "0.7184258", "0.7175025", "0.71683204", "0.7143294", "0.71169347", "0.7104327", "0.7073137", "0.7038109", "0.7037857", "0.7002609", "0.69767714", "0.696298...
0.74460495
4
GET /tipo_trabajadors GET /tipo_trabajadors.json
def index @tipo_trabajadors = TipoTrabajador.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def index\n @trabajos = Trabajo.al...
[ "0.6562359", "0.6500437", "0.64546704", "0.63996834", "0.6310231", "0.6305107", "0.62981945", "0.62163496", "0.6206355", "0.61817247", "0.61596525", "0.6147515", "0.61049557", "0.6093744", "0.60577226", "0.6054802", "0.6052211", "0.60461366", "0.6036726", "0.6007146", "0.5988...
0.7252939
0
GET /tipo_trabajadors/1 GET /tipo_trabajadors/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tipo_trabajadors = TipoTrabajador.all\n end", "def set_tipo_trabajador\n @tipo_trabajador = TipoTrabajador.find(params[:id])\n end", "def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territ...
[ "0.7104367", "0.66184956", "0.65020293", "0.64033294", "0.6400978", "0.6352777", "0.63370687", "0.6297046", "0.62849295", "0.6217141", "0.6176439", "0.6155556", "0.6155483", "0.6123801", "0.61114955", "0.6108812", "0.6104833", "0.6070155", "0.6040697", "0.6033544", "0.6026104...
0.0
-1
POST /tipo_trabajadors POST /tipo_trabajadors.json
def create @tipo_trabajador = TipoTrabajador.new(tipo_trabajador_params) respond_to do |format| if @tipo_trabajador.save format.html { redirect_to @tipo_trabajador, notice: 'Tipo trabajador was successfully created.' } format.json { render :show, status: :created, location: @tipo_trabajador } else format.html { render :new } format.json { render json: @tipo_trabajador.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n params[:trabajador][:rut] = RUT::format(params[:trabajador][:rut])\n\n @trabajador = Trabajador.new(trabajador_params)\n\n\n respond_to do |format|\n if @trabajador.save\n format.html { redirect_to @trabajador, notice: 'Trabajador was successfully created.' }\n format.json ...
[ "0.6625965", "0.6608725", "0.65799993", "0.64939344", "0.6410962", "0.6407443", "0.6405803", "0.6390898", "0.6349625", "0.62839717", "0.62795424", "0.62637067", "0.62425405", "0.62313706", "0.62252784", "0.6202286", "0.61469483", "0.6119907", "0.61034614", "0.610071", "0.6009...
0.6867104
0
PATCH/PUT /tipo_trabajadors/1 PATCH/PUT /tipo_trabajadors/1.json
def update respond_to do |format| if @tipo_trabajador.update(tipo_trabajador_params) format.html { redirect_to @tipo_trabajador, notice: 'Tipo trabajador was successfully updated.' } format.json { render :show, status: :ok, location: @tipo_trabajador } else format.html { render :edit } format.json { render json: @tipo_trabajador.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\...
[ "0.6830515", "0.66924304", "0.6628453", "0.66159123", "0.65230185", "0.64359015", "0.6402536", "0.6401434", "0.6396593", "0.6382682", "0.6351393", "0.631393", "0.63039446", "0.62860847", "0.62812626", "0.6269185", "0.62585235", "0.6235594", "0.62296796", "0.6224965", "0.62175...
0.6860651
0
DELETE /tipo_trabajadors/1 DELETE /tipo_trabajadors/1.json
def destroy @tipo_trabajador.destroy respond_to do |format| format.html { redirect_to tipo_trabajadors_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n form...
[ "0.73667073", "0.7229712", "0.7203466", "0.71501136", "0.71416914", "0.7120663", "0.7115516", "0.71129674", "0.7096762", "0.7094668", "0.70917386", "0.7079775", "0.7078534", "0.70775104", "0.70770556", "0.70713866", "0.70652306", "0.7058963", "0.70537335", "0.70482737", "0.70...
0.7584279
0
Use callbacks to share common setup or constraints between actions.
def set_tipo_trabajador @tipo_trabajador = TipoTrabajador.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 tipo_trabajador_params params.require(:tipo_trabajador).permit(:tpt_descripcion) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
STONE PATH TASK RELATED METHODS _____________________________________________________________________ We need to create the stone path task "Evaluate Proposal" and assign it to a workbench of an Organization
def send_evaluate_prop task = @proposal.evaluate_proposals.create task.workbench = Organization.find params[:organization][:organization_id] task.save redirect_to :action => "pending" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_task(issue)\n # If there is a passed in OF project name, get the actual project object\n issue.omnifocus_project = omnifocus.project if issue.project\n # If there is a passed in OF context name, get the actual context object\n # Update the context property to be the actual context object not the contex...
[ "0.59835935", "0.59361476", "0.58880985", "0.58620656", "0.57810533", "0.57810533", "0.57759297", "0.56767803", "0.56474423", "0.5628783", "0.5627273", "0.5621204", "0.56188095", "0.55861264", "0.5567494", "0.55378795", "0.5525232", "0.55142766", "0.54967266", "0.54824024", "...
0.7015244
0
The return value should be the same Array object
def reverse!(arr) (arr.length/2).times do |index| reverse_index = (index + 1) * -1 arr[index], arr[reverse_index] = arr[reverse_index], arr[index] end arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array\n raise \"Not implemented\"\n end", "def array\n @array\n end", "def to_a; Array(force) end", "def get_items\r\n @arr.to_a\r\n end", "def array()\n\t\t@array\n\tend", "def to_a\n @arr\n end", "def array\n @@array\n end", "def to_a; [Array]; end", "def to_a\n A...
[ "0.7645756", "0.7599514", "0.75716114", "0.75341016", "0.7507874", "0.74518794", "0.7431948", "0.7399464", "0.7382109", "0.73289883", "0.73252046", "0.7265848", "0.72507924", "0.72284776", "0.7178822", "0.7127985", "0.7096249", "0.7096249", "0.7070436", "0.7070436", "0.693419...
0.0
-1
string that formats the number into `hours:minutes`.
def time_conversion(minutes) hr = 0 min = 0 while minutes >= 0 if minutes >= 60 minutes = minutes - 60 hr = hr + 1 elsif minutes < 10 min = 0.to_s + minutes.to_s return hr.to_s + ':' + min.to_s else min = minutes return hr.to_s + ':' + min.to_s end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n '%02d:%02d' % [(@hours % 24), @minutes]\n end", "def to_s\n \"#{hour.to_s.rjust(2, '0')}:#{minute.to_s.rjust(2, '0')}\"\n end", "def time_string\n\n\t\thours = @seconds/3600 #if not an hour will be stored as 0\n\t\tremainder = @seconds%3600 #modulo gives the amount that remains\n\t\tspri...
[ "0.7928271", "0.78091055", "0.7585962", "0.75253963", "0.73511595", "0.73159844", "0.7277624", "0.7219083", "0.72127175", "0.7150531", "0.712606", "0.71113944", "0.7082153", "0.7060469", "0.70344335", "0.6981567", "0.6966789", "0.6950467", "0.6944295", "0.69270724", "0.688313...
0.6320184
82
Fetch an individual webhook log Returns a single webhook log based on the webhook log ID.
def get_webhook_log(webhook_log_id, opts = {}) data, _status_code, _headers = get_webhook_log_with_http_info(webhook_log_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details(webhook_log_id)\n API::request(:get, \"webhook_logs/#{webhook_log_id}\")\n end", "def details(webhook_log_id)\n API::request(:get, FundAmerica.base_uri + \"webhook_logs/#{webhook_log_id}\")\n end", "def load_log(log_id)\n service.get log_path(log_id)\n end", "def get_w...
[ "0.78363913", "0.76144254", "0.70088166", "0.6947628", "0.6822728", "0.66448677", "0.6503367", "0.63644373", "0.635094", "0.63412386", "0.6335594", "0.627689", "0.6248079", "0.59931105", "0.59767085", "0.5949538", "0.5918574", "0.59119946", "0.5880635", "0.583994", "0.5837623...
0.72591716
2
Fetch an individual webhook log Returns a single webhook log based on the webhook log ID.
def get_webhook_log_with_http_info(webhook_log_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LogsApi.get_webhook_log ...' end # verify the required parameter 'webhook_log_id' is set if @api_client.config.client_side_validation && webhook_log_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_log_id' when calling LogsApi.get_webhook_log" end # resource path local_var_path = '/logs/{Webhook Log ID}'.sub('{' + 'Webhook Log ID' + '}', webhook_log_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'WebhookLogResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: LogsApi#get_webhook_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details(webhook_log_id)\n API::request(:get, \"webhook_logs/#{webhook_log_id}\")\n end", "def details(webhook_log_id)\n API::request(:get, FundAmerica.base_uri + \"webhook_logs/#{webhook_log_id}\")\n end", "def get_webhook_log(webhook_log_id, opts = {})\n data, _status_code, _h...
[ "0.78363913", "0.76144254", "0.72591716", "0.70088166", "0.6822728", "0.66448677", "0.6503367", "0.63644373", "0.635094", "0.63412386", "0.6335594", "0.627689", "0.6248079", "0.59931105", "0.59767085", "0.5949538", "0.5918574", "0.59119946", "0.5880635", "0.583994", "0.583762...
0.6947628
4
Fetch a list of webhook logs Returns a list of webhook logs. Response includes pagination.
def get_webhook_logs(opts = {}) data, _status_code, _headers = get_webhook_logs_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(options={})\n Mailgun.submit(:get, log_url, options)\n end", "def get_webhook_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsApi.get_webhook_logs ...'\n end\n # resource path\n local_var_path = '/log...
[ "0.68233037", "0.67531914", "0.64127994", "0.640695", "0.6367033", "0.6350066", "0.62848735", "0.627408", "0.6247584", "0.6181621", "0.6174508", "0.61253816", "0.6123115", "0.61198145", "0.61084515", "0.61021256", "0.6092713", "0.60861313", "0.60808295", "0.6077693", "0.60727...
0.69760996
0
Fetch a list of webhook logs Returns a list of webhook logs. Response includes pagination.
def get_webhook_logs_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LogsApi.get_webhook_logs ...' end # resource path local_var_path = '/logs/webhooks' # query parameters query_params = {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil? query_params[:'created_at_from'] = opts[:'created_at_from'] if !opts[:'created_at_from'].nil? query_params[:'created_at_to'] = opts[:'created_at_to'] if !opts[:'created_at_to'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'WebhookLogListResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: LogsApi#get_webhook_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_webhook_logs(opts = {})\n data, _status_code, _headers = get_webhook_logs_with_http_info(opts)\n data\n end", "def get_webhook_logs(opts = {})\n data, _status_code, _headers = get_webhook_logs_with_http_info(opts)\n data\n end", "def list(options={})\n Mailgun.submit(:get...
[ "0.6977267", "0.6977267", "0.68222547", "0.64133584", "0.64061975", "0.6368022", "0.6349391", "0.62849885", "0.6274245", "0.62468076", "0.61816764", "0.6174881", "0.612498", "0.61221844", "0.611875", "0.6108985", "0.6101719", "0.6093711", "0.60864645", "0.60806674", "0.607851...
0.6753846
3
What ruby methods return Last statement mostly. Differences between puts and returning values puts doesnot return any value
def void_method # prints and returns nil puts "Hey there" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_me_2\n \"I'm printing the return value!!!\"\nend", "def add (a, b)\n puts 1\n puts 2 \n (a+b)\n return result\n \nend", "def say_hi\n # output \"hi\" to console\n puts \"hi\"\n # return 10 (implicit return)\n 10\nend", "def puts\n end", "def print_me\n \"I'm printing the return value...
[ "0.647758", "0.6423839", "0.64021486", "0.6380447", "0.62487465", "0.62479407", "0.61865354", "0.61702883", "0.61702883", "0.61702883", "0.61702883", "0.61702883", "0.616525", "0.6112354", "0.6034298", "0.6019449", "0.60040617", "0.59787375", "0.59483546", "0.59483546", "0.59...
0.0
-1
Initialize a new session command
def initialize(command, output=nil, exit_code=nil, duration=0) @command = command @output = output || '' @exit_code = Integer(exit_code) rescue 1 if exit_code != nil @duration = Float(duration) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(command, session_id: DEFAULT_SESSION_ID, **options)\n\t\t\t\tsuper(command, **options)\n\t\t\t\t\n\t\t\t\t@session_id = session_id\n\t\t\t\t@hosts = {}\n\t\t\tend", "def initialize(command, session_id: DEFAULT_SESSION_ID, **options)\n\t\t\t\tsuper(command, **options)\n\t\t\t\t\n\t\t\t\t@session_id...
[ "0.7198026", "0.7198026", "0.6787802", "0.67759883", "0.65970576", "0.6582366", "0.6564245", "0.6547552", "0.64557767", "0.64456356", "0.64143497", "0.63714004", "0.6357132", "0.63165104", "0.63165104", "0.62855434", "0.62584424", "0.62372094", "0.6222839", "0.6218442", "0.61...
0.0
-1
Check if exit code is successful
def success? exit_code == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def successful?\n exit_code == 0\n end", "def success?\n exit_status == 0\n end", "def failure?\n exit_code != 0\n end", "def success?\n # note that Linux ruby returns nil when exitstatus is nil and a termsig\n # value is set instead.\n return @exitstatus ...
[ "0.85816276", "0.8432675", "0.82690567", "0.8076867", "0.800863", "0.79440194", "0.7924232", "0.7910442", "0.7878337", "0.77925354", "0.7749073", "0.77309525", "0.7727352", "0.76924384", "0.74531144", "0.7442919", "0.74366957", "0.73715097", "0.7360381", "0.7334392", "0.73311...
0.85124886
1
Check if exit code is not successful
def failure? exit_code != 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def successful?\n exit_code == 0\n end", "def success?\n exit_code == 0\n end", "def success?\n exit_status == 0\n end", "def has_errors?\n return @exitcode == 2 || @exitcode == 1\n end", "def check_exit_code!(executable, command, output)\n if $?.exitstatus != 0\n...
[ "0.8159192", "0.81381655", "0.80043775", "0.7929908", "0.79036874", "0.7856349", "0.77918094", "0.7761623", "0.7742327", "0.773521", "0.76649433", "0.76373565", "0.75694597", "0.7563239", "0.7501878", "0.73997825", "0.7399176", "0.73874354", "0.73707736", "0.7368859", "0.7236...
0.8578123
0
Get command string representation
def to_s "[#{command}] => #{exit_code}, #{output.to_s.bytesize} bytes, #{duration} seconds" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n return command\n end", "def to_s\n #N Without this we won't see the command as a command and a list of arguments\n return command.join(\" \")\n end", "def to_s\n msg = ''\n msg += \"Command: #{name}\\n\"\n options.each { |o| msg += \" \" + o.inspect + \"\\n\"...
[ "0.8940828", "0.8541477", "0.84562266", "0.788356", "0.77758795", "0.7649866", "0.7648143", "0.76115394", "0.7568072", "0.7483873", "0.74796283", "0.74681383", "0.7255104", "0.72177637", "0.72001135", "0.7198535", "0.7195408", "0.71894324", "0.71782744", "0.717323", "0.709393...
0.6500204
52
Get command hash representation
def to_hash { 'command' => command, 'output' => output, 'exit_code' => exit_code, 'start_time' => start_time, 'finish_time' => finish_time, 'duration' => duration } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n return to_s.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n to_s.hash\n end", "def hash\n guid.hash\n end", "def to_s\n return command\n end", "def sha\n result_hash['sha']\n end", "def hash\n bytes.hash\n end", "def...
[ "0.68387944", "0.68181884", "0.6811138", "0.6676236", "0.6658556", "0.6637129", "0.66223294", "0.6580984", "0.65313035", "0.6515141", "0.64987963", "0.64987963", "0.64987963", "0.6452458", "0.6376503", "0.6376503", "0.63650006", "0.63459384", "0.63429177", "0.63394654", "0.63...
0.0
-1
def delete(value) node = find(value)
def delete(val) node = find(val) if node == @root @root = nil return end parent = find_parent(@root, node) left = node.left right = node.right if left.nil? && right.nil? parent.right = nil if parent.value < val parent.left = nil if parent.value >= val elsif left.nil? ^ right.nil? if parent.left == node if left parent.left = left left.parent = parent else parent.left = right right.parent = parent end else if left parent.right = left left.parent = parent else parent.right = right right.parent = parent end end else max_node = maximum(left) max_node_parent = find_parent(@root, max_node) max_node_left_parent = find_parent(@root, max_node.left) if max_node.left max_node_parent.right = max_node.left max_node_left_parent = max_node_parent end if parent.left = node parent.left = max_node max_node_parent = parent max_node.left = left max_node.right = right else parent.right = max_node max_node_parent = parent max_node.left = left max_node.right = right end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(value)\n delete_node(find(value))\n end", "def delete(value)\n find_node(value)&.delete\n end", "def delete_value value\r\n #find the pointer to the wanted node using LIST-SEARCH(value)\r\n #then delete that node with LIST-DELETE-BY-NODE(node)\r\n delete_node(self.search(val...
[ "0.91359234", "0.88986707", "0.8377089", "0.74857455", "0.74094534", "0.7394371", "0.73394036", "0.7283283", "0.7240872", "0.7142393", "0.7105025", "0.70814717", "0.70785296", "0.7066136", "0.7043158", "0.7040808", "0.6990629", "0.69229645", "0.692151", "0.6920725", "0.688194...
0.6344213
61
helper method for delete:
def maximum(tree_node = @root) if tree_node.right == nil return tree_node else maximum(tree_node.right) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n \n end", "def delete\n \n end", "def delete\n end", "def delete\n\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n\n\tend", "def delete\n ...
[ "0.8373501", "0.80260485", "0.8013269", "0.80042505", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.7956913", "0.79107374", "0.7799738", "0.77781236", "0.7493549", "0.7422571", "0.74152577", "0.7396308", "0.73679674", "0.7326224", "0.7326224...
0.0
-1
optional helper methods go here:
def check_height(node) return 0 if node.nil? leftHeight = check_height(node.left) return -1 if leftHeight == -1 rightHeight = check_height(node.right) return -1 if rightHeight == -1 diff = leftHeight - rightHeight if diff.abs > 1 -1 else [leftHeight, rightHeight].max + 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optional; end", "def private; end", "def extra; end", "def maybe; end", "def missing?; end", "def optional_positionals; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def required_defaults; end", "def missing; end", "def fallbacks=(_arg0); end", "de...
[ "0.69155395", "0.63777965", "0.63065875", "0.630489", "0.6272949", "0.6183755", "0.6118551", "0.6118551", "0.6118551", "0.6118551", "0.60868585", "0.607827", "0.60669255", "0.5997471", "0.5997471", "0.59624225", "0.59624225", "0.592993", "0.5926435", "0.5921328", "0.59058464"...
0.0
-1
FORCE to implement content_for in controller
def view_context super.tap do |view| (@_content_for || {}).each do |name,content| view.content_for name, content end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end", "def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name, content|\n view.content_for name, content\n ...
[ "0.75152975", "0.7484351", "0.73812956", "0.73812956", "0.73812956", "0.72570103", "0.7173389", "0.7173389", "0.7173389", "0.7066237", "0.690314", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0.68770504", "0....
0.75203246
0
Set the Typekit API token to be used for subsequent calls.
def set_token(token) headers 'X-Typekit-Token' => token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_token\n @token = ENV[\"TYPEFORM_API_TOKEN\"]\n end", "def token=(value)\n resources.each do |klass|\n klass.headers['Authorization'] = 'OAuth ' + value.to_s\n end\n @token = value\n end", "def set_token(token)\n @token = token\n connection.headers[\"Authorization\...
[ "0.8389733", "0.6701101", "0.6693454", "0.6683265", "0.6674756", "0.6674756", "0.66705334", "0.6670426", "0.66278774", "0.66165125", "0.66165125", "0.6578287", "0.6567888", "0.6512362", "0.6512362", "0.6512362", "0.6512362", "0.6512362", "0.6512362", "0.6512362", "0.6512362",...
0.7869871
1
List kits available for this account
def kits Kit.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_kits\n resp = make_request :get, \"kits\"\n check_response_for_field resp, \"kits\"\n end", "def list_kits\n resp = make_request :get, \"kits\"\n check_response_for_field resp, \"kits\"\n end", "def list\n @keychain.keys\n end", "def list_keychains(params: {})\n ca...
[ "0.7334027", "0.7283168", "0.6660857", "0.64934003", "0.618094", "0.60779953", "0.60741824", "0.6027156", "0.5885507", "0.5884199", "0.58786285", "0.5831911", "0.5817243", "0.5783725", "0.5706927", "0.56496024", "0.56414753", "0.5640115", "0.5562918", "0.55515516", "0.5524134...
0.79159564
0
Retrieve a specific kit
def kit(id) Kit.find id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kit_info(id)\n resp = make_request :get, \"kits/#{id}\"\n check_response_for_field resp, \"kit\"\n end", "def view_kit(id)\n resp = @api.kit_info(id)\n @io.display_kit_info resp\n # return the id so a queued operation can continue operating on this kit\n id\n end", "def list_and_select_...
[ "0.75393397", "0.7160241", "0.7072034", "0.6804429", "0.6804191", "0.67395633", "0.64189094", "0.6237461", "0.6189816", "0.6045735", "0.6020105", "0.6009366", "0.59802115", "0.59235466", "0.5886868", "0.5882871", "0.57290673", "0.5700375", "0.5651597", "0.5621777", "0.5605619...
0.8031954
0
Create a new kit
def create_kit(params) Kit.create(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @kit = Kit.new(kit_params)\n\n respond_to do |format|\n if @kit.save\n format.html { redirect_to @kit, notice: 'Kit was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kit }\n else\n format.html { render action: 'new' }\...
[ "0.7430464", "0.7135066", "0.6733496", "0.6472933", "0.6398942", "0.6250337", "0.6247657", "0.6246657", "0.6230436", "0.6216024", "0.621553", "0.62020403", "0.6110378", "0.599956", "0.5852804", "0.5847052", "0.58352584", "0.58348656", "0.5829124", "0.5781603", "0.5770647", ...
0.8472343
0
Retrieve a specific library
def library(id, params = {}) Library.find(id, params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lib\n @data['lib']\n end", "def lib\n @obj['lib']\n end", "def library\n @library ||= if options[:library]\n Library.new options[:library]\n else\n Library.default\n end\n end", "def library\n @library ||= Boson.library(@lib)\n end", "def lookup_libra...
[ "0.71253145", "0.71221596", "0.6963573", "0.69346046", "0.6808484", "0.6787976", "0.6554174", "0.65033144", "0.6461247", "0.6393595", "0.6387844", "0.6356294", "0.6340667", "0.6304145", "0.62782234", "0.6270947", "0.6258735", "0.6249006", "0.6243697", "0.6242975", "0.6168018"...
0.70618236
2
Retrieve a specific Family
def family(id) Family.find(id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def family_by_name(name)\n Family.find_by_name(name)\n end", "def family_id\n @gapi.family_id\n end", "def family_by_slug(slug)\n Family.find_by_slug(slug)\n end", "def set_family\n @family = Family.friendly.find(params[:id])\n end", "def show\n ...
[ "0.7319066", "0.72770315", "0.7051443", "0.69871736", "0.6946799", "0.686697", "0.68240356", "0.6779231", "0.6779231", "0.67632324", "0.67632324", "0.67552435", "0.674776", "0.6692872", "0.6689179", "0.668413", "0.66783065", "0.66376096", "0.66012436", "0.65974367", "0.641618...
0.7985308
0
Retrieve a Family by Typekit slug
def family_by_slug(slug) Family.find_by_slug(slug) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(slug)\n type = slug.to_s.demodulize.classify\n\n subclasses.find do |subclass|\n subclass.name.gsub(prefix, '') == type.to_s.gsub(prefix, '')\n end || raise(TypeError.new(type, types.to_sentence))\n end", "def find_territory\n Territory.find_by_slug(params[:slug])\n...
[ "0.6009303", "0.60016066", "0.5965216", "0.5937498", "0.59104013", "0.5902866", "0.563796", "0.55027175", "0.5432597", "0.5427232", "0.54232746", "0.53789157", "0.53659797", "0.53165007", "0.52633023", "0.525835", "0.52394164", "0.5228476", "0.52264816", "0.52117825", "0.5211...
0.81811064
0
Retrieve a Family by font family name
def family_by_name(name) Family.find_by_name(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def family\n @family ||= family_options.map do |font_name, font_options|\n name = parse_font_name(font_name)\n\n options = font_options.sort.uniq\n\n options.any? ? \"#{name}:#{options.join(',')}\" : name\n end.join('|')\n end", "def _font_family(id)\n {\n 0x...
[ "0.728838", "0.68707097", "0.67631054", "0.6666355", "0.663432", "0.65537095", "0.65502644", "0.64358795", "0.63719773", "0.6371882", "0.6363303", "0.6351897", "0.6331646", "0.63307244", "0.63152313", "0.6279574", "0.61627495", "0.6132671", "0.6091355", "0.6053745", "0.603033...
0.7447777
0
returns the next consecutive semester and year same as above, except instance method
def get_next_semester_and_year return Semester.get_next_semester_and_year(semester, year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def year\n ((semester - 1) / 2) + 1\n end", "def next_year\n AcademicYear.find_by(year: self.year + 1)\n end", "def semester\n time = time_from_enrollment\n @semester = time.div(1.year / 2) + 1\n @semester = 1 if @semester <= 0\n return @semester\n end", "def get_next_yr\n\tset_cur_year(...
[ "0.7330652", "0.7274078", "0.7120933", "0.69841176", "0.67547953", "0.6654071", "0.6459806", "0.6417507", "0.640847", "0.6392686", "0.6349299", "0.63334507", "0.63226867", "0.62452334", "0.62261397", "0.62091297", "0.6134392", "0.61342484", "0.6108077", "0.6076894", "0.606788...
0.82644194
0
create course plan upon creation of this object
def create_dependancies create_course_plan() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_plan(plan:, params:)\n plan.visibility = if params['visibility'].blank?\n Rails.configuration.x.plans.default_visibility\n else\n plan_params[:visibility]\n end\n\n plan.template = ::Template.find(p...
[ "0.7099112", "0.6871856", "0.6776368", "0.6689112", "0.66603893", "0.664613", "0.6638801", "0.66221654", "0.6507207", "0.6475637", "0.6458986", "0.64198494", "0.6397307", "0.63888514", "0.6360201", "0.6333031", "0.62535614", "0.62380975", "0.62363654", "0.6230729", "0.6204257...
0.6861223
2
this gives access to whole current_user method, not just the instance variable at the end
def current_user @current_user ||= User.find_by(session_token: session[:session_token]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_method\n current_user\n end", "def current_user_method=(null) ; end", "def current_user\n # super: don't change anything, i just want the exact same behavior \n # as in the method that we are overriding\n\n # what this line means is that if the user is logged in, super is ...
[ "0.8299376", "0.7794885", "0.77624124", "0.7723858", "0.7723858", "0.7689758", "0.76258844", "0.7620822", "0.76131666", "0.76031643", "0.758844", "0.75508606", "0.75508606", "0.75508606", "0.75508606", "0.7548721", "0.7538826", "0.7501709", "0.7491304", "0.74585354", "0.74585...
0.0
-1
Note: anagrams are case insensitive
def is_anagram(test, original) test.downcase.chars.sort == original.downcase.chars.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anagrams(str1, str2)\n \nend", "def anagrams?(s1, s2)\n return false if s1.downcase == s2.downcase\n \n a1 = s1.downcase.delete(' ').chars.sort\n a2 = s2.downcase.delete(' ').chars.sort\n\n a1 == a2\nend", "def anagrams(word, words)\n words.select { |w| w.chars.sort == word.chars.sort }\nend", "de...
[ "0.75699884", "0.75572324", "0.7518256", "0.75123924", "0.7488728", "0.7429856", "0.74218625", "0.73521656", "0.73521656", "0.73305047", "0.7320855", "0.73087585", "0.7303195", "0.729514", "0.72927284", "0.72831845", "0.7215724", "0.7166948", "0.71664363", "0.71656036", "0.71...
0.740001
7
follow character straigh and diagonal
def follow_char(character) sx = distance_x_from(character.x) sy = distance_y_from(character.y) if sx != 0 && sy != 0 move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2) elsif sx != 0 move_straight(sx > 0 ? 4 : 6) elsif sy != 0 move_straight(sy > 0 ? 8 : 2) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonal_up_to_string(row_index, col_index)\n #move to edge\n until row_index == @rows - 1 || col_index == 0\n row_index += 1\n col_index -= 1\n end\n\n #form diagonal string from edge\n diagonal_string = \"\"\n while row_index > 0 && col_index < @cols\n diagonal_string += @gri...
[ "0.66723865", "0.64288956", "0.63903207", "0.6275684", "0.62707317", "0.6252836", "0.6166597", "0.60894215", "0.590144", "0.5861546", "0.5823039", "0.5768013", "0.5763936", "0.5752961", "0.57455945", "0.57381254", "0.5736229", "0.57319665", "0.5724865", "0.57094526", "0.57042...
0.64770716
1
jump to specific tiles
def jumpto_tile(x, y) jumpto(0, [x, y]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goto(obj, tile=nil)\r\n @x = obj.x\r\n @y = obj.y\r\n @mapx = tile.mapx\r\n @mapy = tile.mapy\r\n @tile = tile\r\n if @tile != nil\r\n @tile.occupy(self)\r\n end\r\n end", "def move_one begTile\n @maze.get_adjacent_tiles(begTile).each do |tile...
[ "0.681838", "0.62129366", "0.6167943", "0.6155464", "0.60703015", "0.6056737", "0.6056698", "0.6022444", "0.5966098", "0.59534216", "0.5945517", "0.59411716", "0.59160763", "0.5876896", "0.5866439", "0.57733643", "0.5735784", "0.5730152", "0.5722916", "0.5709836", "0.570626",...
0.8066769
0
jumpto character ( 0 = Game Player, 1 and up event id)
def jumpto(char_id, tilexy=nil) char_id > 0 ? char = $game_map.events[char_id] : char = $game_player tilexy.nil? ? condxy = [char.x, char.y] : condxy = [tilexy[0], tilexy[1]] jx = + eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] >= @x jy = - eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] <= @y jx = - eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] <= @x jy = - eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] <= @y jx = - eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] <= @x jy = + eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] >= @y jx = + eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] >= @x jy = + eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] >= @y jump(jx, jy) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def button_up(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n @player.reset_jump if @player.is_jumping?\r\n end\r\n end", "def jump_to(id, x, y, w=true)\n RME::deprecated_command(\"jump_to\", \"use 'event_jump_to' or 'player_jump_to'\")\n event(id).jump_to...
[ "0.64133227", "0.63104606", "0.629183", "0.6197666", "0.61967546", "0.6068926", "0.6065987", "0.6033089", "0.5984827", "0.5938752", "0.5879962", "0.5853165", "0.5837707", "0.58167446", "0.5796538", "0.57891744", "0.5763", "0.57578504", "0.5698879", "0.5692215", "0.5684462", ...
0.6219987
3
check if the game player and follower are executing an action
def battler_acting? return true if @user_casting[0] > 0 || @targeting[0] return true if @knockdown_data[0] > 0 and battler.deadposing.nil? return true if @anime_speed > 0 return true if @hookshoting[0] || @making_spiral if self.is_a?(Game_Player) $game_player.followers.each {|f| return true if f.battler_acting?} end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_follower_trigger_there(new_x, new_y)\n if @follower.x == new_x && @follower.y == new_y\n if @follower.is_a?(Game_Event)\n @follower.start\n else\n @follower.turn_toward_player\n $game_temp.common_event_id = Game_CommonEvent::FOLLOWER_SPEECH\n end\n return true\...
[ "0.6903992", "0.6797321", "0.67035985", "0.6558808", "0.65544456", "0.6514515", "0.6471418", "0.6412456", "0.6354953", "0.6318409", "0.63113207", "0.6252101", "0.62439406", "0.62260234", "0.6203342", "0.6194806", "0.61806506", "0.61745524", "0.61683846", "0.6153533", "0.61532...
0.65894246
3
Short script call for poping damage text
def pop_damage(custom=nil) $game_player.damage_pop.push(DamagePop_Obj.new(self, custom)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_guts_text(target)\n Sound.play_guts_text\n add_text(sprintf(target.personal_guts_text, target.name))\n wait\n end", "def nosourceack(text)\n\t$k.kill\nend", "def debriefingText _args\n \"debriefingText _args;\" \n end", "def cutText _obj, _args\n \"_obj cutText _args;\" \n ...
[ "0.5921499", "0.5880296", "0.58796114", "0.57674116", "0.5720242", "0.56746346", "0.5632962", "0.5628977", "0.5602111", "0.5583087", "0.55467975", "0.55304", "0.5518704", "0.5517159", "0.55096453", "0.5476529", "0.5476529", "0.5474976", "0.54239386", "0.5423123", "0.54055077"...
0.5278185
38
check if target is unable to move
def force_stopped? return true if @anime_speed > 0 || @knockdown_data[0] > 0 || @stopped_movement > 0 || @hookshoting[0] || @angle_fx != 0.0 return true if @making_spiral return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_possible?(target)\n self != target && # Can't target self\n same_scope?(target) && # can't be in different scopes\n # !(left..right).include?(target.left..target.right) # this needs tested more\n # detect impossible move\n !((left <= target.left && right >= tar...
[ "0.74644154", "0.71156967", "0.70899296", "0.707074", "0.7050552", "0.70411783", "0.7007994", "0.69982064", "0.69719344", "0.69525206", "0.6940839", "0.6916816", "0.690473", "0.68897563", "0.68881404", "0.687826", "0.68647015", "0.68563604", "0.6839208", "0.6814066", "0.68090...
0.0
-1
detect map edges ignoring loop maps
def facing_corners? case $game_map.map.scroll_type when 1 then return false if @direction == 2 || @direction == 8 when 2 then return false if @direction == 4 || @direction == 6 when 3 then return false end m = $game_map unless @x.between?(1, m.width - 2) && @y.between?(1, m.height - 2) return true if @x == 0 and @direction == 4 return true if @y == 0 and @direction == 8 return true if @x == m.width - 1 and @direction == 6 return true if @y == m.height - 1 and @direction == 2 end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_cut(map)\n while map.length > 2\n # This is ok\n v1,v2 = get_vertices(map)\n # Merge \n map[v1] = merge_edges(map,v1,v2)\n # Delete\n remove_vertex(map,v2)\n # Remove occurences\n convert_vertex(map,v2,v1)\n # Remove loops\n remove_loops(map,v1)\n\n end\nend", "def detect...
[ "0.6547455", "0.61576617", "0.60997134", "0.60704964", "0.59761924", "0.5971062", "0.5939902", "0.5888411", "0.584122", "0.5788956", "0.57717705", "0.5769368", "0.57355434", "0.5722286", "0.569292", "0.5672831", "0.5640647", "0.55659765", "0.55559874", "0.5538701", "0.5536794...
0.0
-1
process the tool and verify wheter can be used
def process_tool_action(item) PearlKernel.load_item(item) return if !battler.tool_ready?(item) unless PearlKernel.has_data? if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor) msgbox('Tool data missing') if $DEBUG return end if item.scope.between?(1, 6) msgbox('Tool data missing') if $DEBUG return elsif item.scope == 0 return elsif !battler.usable?(item) RPG::SE.new("Cursor1", 80).play if self.is_a?(Game_Player) return end end if PearlKernel.has_data? and not usable_test_passed?(item) RPG::SE.new("Cursor1", 80).play if self.is_a?(Game_Player) return end @user_casting = [PearlKernel.tool_castime,item] if PearlKernel.has_data? if @user_casting[0] > 0 @animation_id = 0 @animation_id = PearlKernel.tool_castanimation else load_abs_tool(item) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkTools()\n\n\tif (PATH_CLANG_FORMAT.empty?)\n\t\tabort(\"Unable to find clang-format!\");\n\tend\n\n\tif (PATH_UNCRUSTIFY.empty?)\n\t\tabort(\"Unable to find uncrustify!\");\n\tend\n\nend", "def execute\r\n rSuccess = true\r\n\r\n # First check that every tool we will need is present\r\n #...
[ "0.6355947", "0.63529354", "0.6146238", "0.60259074", "0.60054994", "0.59902626", "0.59874237", "0.5971715", "0.5957396", "0.592961", "0.5899867", "0.58807075", "0.5835918", "0.58157206", "0.57754046", "0.5729184", "0.5723038", "0.57070875", "0.5686424", "0.56852263", "0.5658...
0.5753044
15
load the abs tool
def load_abs_tool(item) return if @knockdown_data[0] > 0 PearlKernel.load_item(item) return if self.is_a?(Game_Follower) and @targeted_character.nil? if !@targeting[0] and self.battler.is_a?(Game_Actor) if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item) # apply target to skills items if PearlKernel.tool_target == "true" || item.scope == 7 || item.scope == 9 load_target_selection(item) return end else # apply target parsing the invoked skill to weapons and armors invoke = PearlKernel.tool_invoke if invoke != nil && invoke > 0 && invoke != 1 && invoke != 2 invokeskill = $data_skills[invoke] if PearlKernel.tool_target == "true" || invokeskill.scope == 7 || invokeskill.scope == 9 load_target_selection(item) return end # apply target to normal weapon and armor without invoking else if PearlKernel.tool_target == "true" load_target_selection(item) return end end end end if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item) battler.use_item(item) else if PearlKernel.tool_invoke != 0 battler.use_item($data_skills[PearlKernel.tool_invoke]) end end # if the tool has data continue if PearlKernel.has_data? consume_ammo_item(item) if battler.is_a?(Game_Actor) and PearlKernel.tool_itemcost != 0 @anime_speed = PearlKernel.user_animespeed battler.apply_cooldown(item, PearlKernel.tool_cooldown) end create_projectile_object(item) create_anime_sprite_object(item) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadAbs _args\n \"loadAbs _args;\" \n end", "def command_rel(elts)\n\n load(__FILE__)\n end", "def toys_load_tool(cmd, cli: nil, &block)\n cli ||= toys_cli\n cmd = ::Shellwords.split(cmd) if cmd.is_a?(::String)\n cli.load_tool(*cmd, &block)\n end", "def load_tool(relative_pa...
[ "0.66374034", "0.6256616", "0.6100031", "0.5788482", "0.5771815", "0.5605136", "0.5578961", "0.55543673", "0.5532871", "0.5493828", "0.54401565", "0.54016304", "0.5396659", "0.5376449", "0.536308", "0.52692825", "0.52663344", "0.52656895", "0.5250877", "0.52222157", "0.520724...
0.572897
5
User anime sprite creation
def create_anime_sprite_object(item) $game_player.anime_action.each {|i| if i.user == self if i.custom_graphic @transparent = false i.user.using_custom_g = false end $game_player.anime_action.delete(i) end} if PearlKernel.user_graphic != "nil" return if PearlKernel.user_graphic.nil? $game_player.anime_action.push(Anime_Obj.new(self, item)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_sprite ; end", "def create_oneanim_sprite\n @one_anim = Sprite_OneAnim.new(@viewport1)\n end", "def call_idle(sprite, anime)\n $game_player.set_step_anime(anime)\n $game_player.set_graphic(sprite)\n end", "def call_idle(sprite, anime)\n $game_player.set_step_anime(anime)\n $game...
[ "0.6765057", "0.6732406", "0.6731488", "0.6675855", "0.6648297", "0.64864844", "0.6442998", "0.6386315", "0.638057", "0.6354336", "0.6308734", "0.6243068", "0.62347287", "0.62156254", "0.6199578", "0.6186388", "0.6129895", "0.61244035", "0.61062926", "0.6093964", "0.6084211",...
0.79256856
0
Falcao pearl abs main update
def update_falcao_pearl_abs if @user_move_distance[0] > 0 and not moving? move_forward ; @user_move_distance[0] -= 1 end return if battler.nil? update_pearlabs_timing update_followers_attack if self.is_a?(Game_Follower) && self.visible? if @targeting[2] != nil load_abs_tool(@targeting[1]) if battler.is_a?(Game_Actor) @targeting = [false, item=nil, char=nil] end update_battler_collapse update_state_effects @combodata.each {|combo| if combo[3] > 0 combo[3] -= 1 if combo[3] == 0 perform_combo(combo[0], combo[1], combo[2]) @combodata.delete(combo) end break end} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update() end", "def update ; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update\n \n end", "def update\n \t\n end", "def update\n \t\n end", "def update...
[ "0.7496783", "0.7321052", "0.70610684", "0.70610684", "0.70610684", "0.70610684", "0.70610684", "0.70610684", "0.70610684", "0.70610684", "0.69224954", "0.6892194", "0.6892194", "0.6832148", "0.6830373", "0.6825163", "0.68197507", "0.6816905", "0.6767827", "0.6682031", "0.666...
0.64179426
39
======================================================================== followers attacks engine
def fo_tool return actor.equips[0] if actor.primary_use == 1 return actor.equips[1] if actor.primary_use == 2 return actor.assigned_item if actor.primary_use == 3 return actor.assigned_item2 if actor.primary_use == 4 return actor.assigned_item3 if actor.primary_use == 5 return actor.assigned_item4 if actor.primary_use == 6 return actor.assigned_skill if actor.primary_use == 7 return actor.assigned_skill2 if actor.primary_use == 8 return actor.assigned_skill3 if actor.primary_use == 9 return actor.assigned_skill4 if actor.primary_use == 10 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ygg_attacker() ; return nil ; end", "def follow_steve\n return if username == \"steve\"\n steve = Hacker.first(:username => 'steve')\n return if steve.nil?\n\n follow! steve\n steve.follow! self\n end", "def spam_my_followers(message)\n followers_list.each {|follower|\n dm(follower,...
[ "0.62837034", "0.61277694", "0.57517105", "0.57078433", "0.567871", "0.5663807", "0.5632203", "0.56276125", "0.5564676", "0.5562084", "0.5558963", "0.5549383", "0.5549383", "0.5530228", "0.5513008", "0.5503921", "0.55034167", "0.5496588", "0.54303735", "0.537202", "0.5351675"...
0.0
-1
prepare the tool usage
def setup_followertool_usage @range_view = 2 @range_view = 6 if fo_tool.tool_data("Tool Target = ", false) == "true" || fo_tool.tool_data("Tool Special = ", false) == "autotarget" if fo_tool.is_a?(RPG::Skill) || fo_tool.is_a?(RPG::Item) if fo_tool.scope.between?(1, 6) setup_target else ; @targeted_character = $game_player @range_view = 6 end # prepare tool for invoke follower elsif fo_tool.is_a?(RPG::Weapon) || fo_tool.is_a?(RPG::Armor) invoke = fo_tool.tool_data("Tool Invoke Skill = ") if invoke > 0 if $data_skills[invoke].scope.between?(1, 6) setup_target else ; @targeted_character = $game_player @range_view = 6 end else # no invoke skill just set up an enemy target setup_target end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usage; end", "def usage; end", "def print_usage; end", "def docopt_usage \n doc = [\"\\nUsage:\"];\n @actions.each do |_name, action|\n doc << \" run #{action.usage}\" unless action.usage == false\n end\n basic_flags = @version ? \"(-h|--help|--version)\" : \"(-h|--help)\"\n ...
[ "0.72261894", "0.72261894", "0.69315183", "0.6552333", "0.64111054", "0.6339504", "0.631724", "0.6307036", "0.62923574", "0.62124646", "0.6148943", "0.6136199", "0.61300725", "0.6074172", "0.6071554", "0.6062508", "0.6061421", "0.6055343", "0.6014008", "0.600889", "0.5987295"...
0.6295407
8
use the predifined tool
def use_predefined_tool update_follower_movement return if @targeted_character.nil? if obj_size?(@targeted_character, @range_view) && @follower_attacktimer == 0 turn_toward_character(@targeted_character) use_weapon(fo_tool.id) if actor.primary_use == 1 use_armor(fo_tool.id) if actor.primary_use == 2 use_item(fo_tool.id) if actor.primary_use == 3 || actor.primary_use == 4 || actor.primary_use == 5 || actor.primary_use == 6 use_skill(fo_tool.id) if actor.primary_use==7 || actor.primary_use==8 || actor.primary_use == 9 || actor.primary_use == 10 if fo_tool.tool_data("User Graphic = ", false).nil? @targeted_character = nil turn_toward_player end @follower_attacktimer = 60 end delete_targetf if self.actor.dead? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preproc; end", "def pre_process\n end", "def precheck\n end", "def run\n Precheck.config.load_configuration_file(Precheck.precheckfile_name)\n\n FastlaneCore::PrintTable.print_values(config: Precheck.config,\n hide_keys: [:output_path],\n ...
[ "0.60483307", "0.58145833", "0.5748056", "0.561266", "0.545542", "0.54459786", "0.52700865", "0.5259711", "0.52223444", "0.514519", "0.5120802", "0.50494546", "0.50381017", "0.5030715", "0.5011104", "0.49953666", "0.49747074", "0.49723038", "0.49680787", "0.49250948", "0.4910...
0.0
-1
konck down engine update
def update_knockdown if @knockdown_data[0] > 0 @knockdown_data[0] -= 1 @knockdown_data[0] == 0 ? knowdown_effect(2) : knowdown_effect(1) if @knockdown_data[1] != nil @pattern = @knockdown_data[2] @direction = @knockdown_data[3] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def down; end", "def down \r\n end", "def down\n\n end", "def down\n end", "def down\n end", "def down\n end", "def down\n end", "def down\n end", "def down\n end", "def turn_off_engine\n fail 'No Driver Error' if driver.nil?\n\n @engine_on = false\n end", "def forceupdate()\...
[ "0.6723354", "0.6650317", "0.65179706", "0.64323753", "0.64323753", "0.64323753", "0.64323753", "0.64323753", "0.6220887", "0.610488", "0.5925929", "0.5800222", "0.5726913", "0.56949836", "0.56949836", "0.56949836", "0.56949836", "0.56949836", "0.56949836", "0.56949836", "0.5...
0.0
-1
higer priority state animation displayed
def update_state_effects @state_poptimer[0] += 1 unless primary_state_ani.nil? if @state_poptimer[0] == 30 @animation_id = primary_state_ani @animation_id = 0 if @animation_id.nil? elsif @state_poptimer[0] == 180 @state_poptimer[0] = 0 end update_state_action_steps end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_collapse_opacity\n self.opacity = 256 - (48 - @effect_duration) * 6\n end", "def setup_anim_top\n $game_temp.anim_top = (@acts[1] == true || @acts[1].nil? ? 1 : 0)\n end", "def animationState _args\n \"animationState _args;\" \n end", "def state_anim\n states.each do |state|\n ...
[ "0.5742974", "0.57253325", "0.5711466", "0.5669448", "0.5612531", "0.55577976", "0.55549616", "0.55260813", "0.54716116", "0.5442008", "0.54149485", "0.53197724", "0.52732515", "0.5239045", "0.5223098", "0.5187175", "0.5166612", "0.5166532", "0.51636696", "0.5132976", "0.5126...
0.5411273
11
apply regen for hp, mp and tp
def apply_regen_state(state, type) random = state.tool_data("State Effect Rand Rate = ") random = 120 if random.nil? if rand(random) == 1 battler.regenerate_hp if type == 7 battler.regenerate_mp if type == 8 battler.regenerate_tp if type == 9 if type == 7 and battler.result.hp_damage == 0 @colapse_time = 80 battler.add_state(1) return end type == 9 ? pop_damage("Tp Up!") : pop_damage end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regress(x,y)\n weights = Array.new(x.length)\n for f in 0..(x.length - 1)\n weights[f] = WeightedFeature.new(x[f].name,0.0)\n end\n w0 = 0.0\n weight_magnitude = 0\n old_gradient = 0\n gradient = 0\n begin\n weight_magnitude = 0\n old_gradient = gradient\n gr...
[ "0.56285113", "0.5601044", "0.5025252", "0.50018895", "0.49947754", "0.4821832", "0.46376982", "0.46023622", "0.45960048", "0.45843697", "0.45605835", "0.45557746", "0.4529371", "0.4515465", "0.44964015", "0.44812858", "0.4472999", "0.4460732", "0.44563693", "0.4443876", "0.4...
0.41284293
93
============================================================================= Reset Pearl ABS System reset from game player call
def reset_knockdown_actors # reset knock down if @knockdown_data[1] != nil @knockdown_data[0] = 0 knowdown_effect(2) end # force clear knock down $game_player.followers.each do |follower| if follower.knockdown_data[1] != nil follower.knockdown_data[0] = 0 follower.knowdown_effect(2) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n\t\tdo_send('ARST 2')\n\tend", "def reset_game\n @cur_board.clear_board\n @cur_board.setup_board\n @turn = 1\n @player_to_move = \"w\"\n end", "def reset\n info \"\\n\\n------------ RESET ------------\\n\"\n # ExecApp.killAll ## NOTE: do we want to kill of the ...
[ "0.74536294", "0.68683934", "0.68308806", "0.6788325", "0.67348224", "0.6731317", "0.6666529", "0.6616354", "0.65939915", "0.65845", "0.65845", "0.65744513", "0.6566991", "0.6558563", "0.6545683", "0.6452776", "0.6444787", "0.64390045", "0.64270735", "0.64103353", "0.6376449"...
0.0
-1
reset knockdown enemies game player call
def reset_knockdown_enemies $game_map.events.values.each do |event| if event.knockdown_data[1] != nil event.knockdown_data[0] = 0 event.knowdown_effect(2) end if event.deadposee and event.killed $game_self_switches[[$game_map.map_id, event.id, PearlKernel::KnockdownSelfW]] = false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_knockdown_actors\n # reset knock down\n if @knockdown_data[1] != nil\n @knockdown_data[0] = 0\n knowdown_effect(2)\n end\n # force clear knock down\n $game_player.followers.each do |follower|\n if follower.knockdown_data[1] != nil\n follower.knockdown_data[0] = 0\n ...
[ "0.735721", "0.731591", "0.731591", "0.7201511", "0.7006652", "0.6916159", "0.6873152", "0.6828643", "0.6814836", "0.68051904", "0.6728379", "0.66886264", "0.66626406", "0.6618975", "0.65896195", "0.6569383", "0.6563998", "0.65541506", "0.6540335", "0.6425402", "0.6383882", ...
0.7789281
0
on battle pixel, take a lot of time procesing, but it is very exact
def on_battle_pixel?(out=0) w = Graphics.width + out; h = Graphics.height + out return true if screen_x.between?(0 - out,w) and screen_y.between?(0 - out,h) return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pbCaveEntranceEx(exiting)\n sprite = BitmapSprite.new(Graphics.width,Graphics.height)\n sprite.z = 100000\n totalBands = 15\n totalFrames = 15\n bandheight = ((Graphics.height/2)-10).to_f/totalBands\n bandwidth = ((Graphics.width/2)-12).to_f/totalBands\n grays = []\n tbm1 = totalBands-1\n for i in 0....
[ "0.61465895", "0.6119586", "0.605402", "0.58886", "0.58870775", "0.58777004", "0.58508474", "0.58148277", "0.57994837", "0.5793204", "0.5745979", "0.5740726", "0.5725224", "0.5679319", "0.56778574", "0.56752545", "0.56665915", "0.5665107", "0.56640065", "0.5637669", "0.563296...
0.5436239
48
pirates_say_arrrrrrrrr("are you really learning Ruby?") => "eenu" pirates_say_arrrrrrrrr("Katy Perry is on the radio!") => "rya" pirates_say_arrrrrrrrr("Pirates say arrrrrrrrr") => "arrrrrrrr"
def pirates_say_arrrrrrrrr(string) chars = string.split(//) returnString = '' chars.each_with_index do |c,i| returnString << chars[i+1].to_s if c == 'r' || c == 'R' end returnString end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pirates_say_arrrrrrrrr(string)\n\nend", "def offer_rose (string)\r\n \"Would you take this rose, #{string}, in exchange for giving an old beggar woman shelter from the bitter cold?\" \r\nend", "def pirates_say_arrrrrrrrr(string)\n\nstring.downcase!\nsplitsplat = string.split(//)\nresult = \"\"\n\nspl...
[ "0.75821483", "0.7221926", "0.71657366", "0.6999752", "0.6917939", "0.69009924", "0.6895923", "0.687935", "0.68625355", "0.68538857", "0.6851091", "0.6847885", "0.6801473", "0.6779048", "0.6728998", "0.67267555", "0.6720555", "0.66928905", "0.6689606", "0.66892254", "0.668251...
0.6488467
48
Write a badge_maker method that, when provided a person's name, will create and return this message.
def badge_maker(name) "Hello, my name is #{name}." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge_maker(name)\n return \"Hello, my name is #{name}.\"\n end", "def badge_maker(name)\n\treturn \"Hello, my name is #{name}.\" \nend", "def badge_maker( name )\n return \"Hello, my name is #{name}.\"\nend", "def badge_maker(name)\n return \"Hello, my name is #{name}.\"\nend", "def badge_make...
[ "0.79946536", "0.7830102", "0.76600623", "0.7556247", "0.7550127", "0.7550127", "0.7550127", "0.7550127", "0.7550127", "0.7550127", "0.7550127", "0.7550127", "0.75444037", "0.75444037", "0.7386049", "0.73029023", "0.72884995", "0.72884995", "0.72884995", "0.72884995", "0.7288...
0.73395985
17
takes an array of names as an argument and returns an array of badge messages. how can I push each string to the array of badge_methods
def batch_badge_creator(speakers) #empty array that needs strings pushed in badge_messages = [] #iteration of speakers array to grab each name speakers.each do |guest| badge_messages.push("Hello, my name is #{guest}.") # once a name is grabbed it creates a string using that name end badge_messages end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_badge_creator(array_of_names)\n badge_messages = []\n\n array_of_names.each do |name|\n badge_messages << badge_maker(name)\n end\n\n return badge_messages\nend", "def batch_badge_creator(names)\n names.collect { |array_value| badge_maker(array_value) }\nend", "def batch_badge_cre...
[ "0.7528532", "0.7428488", "0.7384178", "0.7364546", "0.7361583", "0.7300315", "0.7287902", "0.7224635", "0.7204755", "0.7159929", "0.71437186", "0.7088279", "0.7050833", "0.7007234", "0.6985455", "0.6956322", "0.6938327", "0.6930886", "0.69211257", "0.688571", "0.6877331", ...
0.73640054
4
output first the results of the batch_badge_creator method and then of the assign_rooms method to the screen.
def printer(attendees) room_assignments = [] rooms = 1 attendees.each do |guest| puts "Hello, my name is #{guest}." rooms += 1 end room_assignments = [] rooms = 1 attendees.each do |guest| puts "Hello, #{guest}! You'll be assigned to room #{rooms}!" rooms += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printer(attendees)\n batch_badge_creator(attendees)\n assign_rooms(attendees)\n\n batch_badge_creator(attendees).each do |badge|\n puts badge\n end\n\n assign_rooms(attendees).each do |room_assignment|\n puts room_assignment\n end\nend", "def printer(attendees)\n\n batch_badg...
[ "0.766134", "0.7566433", "0.7514717", "0.7482323", "0.7447791", "0.7406282", "0.7401359", "0.73805666", "0.73527", "0.7314961", "0.7273109", "0.7245728", "0.7208953", "0.7207674", "0.7200175", "0.7171834", "0.7171834", "0.7171834", "0.7144609", "0.7144609", "0.7132256", "0....
0.56724775
43
Use callbacks to share common setup or constraints between actions.
def set_user_housework @user_housework = UserHousework.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Only allow a trusted parameter "white list" through.
def user_housework_params params.require(:user_housework).permit(:housework_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Prints the supplied message to the socket.
def print_raw(msg = '') @sock.write(msg) @sock.flush msg end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def puts(message)\n\t\t@socket.puts(message)\n\tend", "def send(msg)\n @socket.puts msg\n puts '<< ' << msg\n end", "def send(message)\n puts prefix + message\n end", "def say(string)\n @socket.puts string\n end", "def print(message)\n output.print(message)\n end", "def sen...
[ "0.8073091", "0.7744468", "0.73710304", "0.71799856", "0.7156388", "0.7147595", "0.713827", "0.70731854", "0.70153785", "0.69717157", "0.6969954", "0.69104356", "0.6861471", "0.68448496", "0.6813168", "0.67955124", "0.67862856", "0.6758694", "0.6730025", "0.66705555", "0.6662...
0.78019667
1
GET /credit_point_packs GET /credit_point_packs.json
def index @credit_point_packs = CreditPointPack.order_by_price end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @credit_point_pack = CreditPointPack.new(credit_point_pack_params)\n\n respond_to do |format|\n if @credit_point_pack.save\n format.html { redirect_to @credit_point_pack, notice: 'Credit point pack was successfully created.' }\n format.json { render :show, status: :created, lo...
[ "0.69023854", "0.6467619", "0.6414127", "0.62306315", "0.6175926", "0.59596044", "0.594749", "0.5926122", "0.57959676", "0.56767106", "0.5656793", "0.5647559", "0.56451315", "0.5626509", "0.5554531", "0.55371195", "0.55223006", "0.54787344", "0.54723185", "0.5454747", "0.5438...
0.6833062
1
GET /credit_point_packs/1 GET /credit_point_packs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @credit_point_pack = CreditPointPack.new(credit_point_pack_params)\n\n respond_to do |format|\n if @credit_point_pack.save\n format.html { redirect_to @credit_point_pack, notice: 'Credit point pack was successfully created.' }\n format.json { render :show, status: :created, lo...
[ "0.68940365", "0.6628313", "0.6601933", "0.6461426", "0.6242014", "0.6150657", "0.61481786", "0.61032146", "0.6048096", "0.5986784", "0.5936113", "0.59107715", "0.5869599", "0.5864776", "0.5749899", "0.57445186", "0.57216", "0.57216", "0.5662348", "0.5662333", "0.564899", "...
0.0
-1
POST /credit_point_packs POST /credit_point_packs.json
def create @credit_point_pack = CreditPointPack.new(credit_point_pack_params) respond_to do |format| if @credit_point_pack.save format.html { redirect_to @credit_point_pack, notice: 'Credit point pack was successfully created.' } format.json { render :show, status: :created, location: @credit_point_pack } else format.html { render :new } format.json { render json: @credit_point_pack.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credit_point_pack_params\n params.require(:credit_point_pack).permit(:name, :number_of_points, :price, :available)\n end", "def set_credit_point_pack\n @credit_point_pack = CreditPointPack.find(params[:id])\n end", "def update\n respond_to do |format|\n if @credit_point_pack.update(...
[ "0.6830603", "0.64698017", "0.61246294", "0.5901423", "0.5814124", "0.58043295", "0.5740566", "0.57147807", "0.57138926", "0.5712787", "0.571232", "0.5711936", "0.5686819", "0.5673943", "0.5668886", "0.56241727", "0.55962145", "0.5557745", "0.55378014", "0.5536556", "0.552861...
0.7847959
0
PATCH/PUT /credit_point_packs/1 PATCH/PUT /credit_point_packs/1.json
def update respond_to do |format| if @credit_point_pack.update(credit_point_pack_params) format.html { redirect_to @credit_point_pack, notice: 'Credit point pack was successfully updated.' } format.json { render :show, status: :ok, location: @credit_point_pack } else format.html { render :edit } format.json { render json: @credit_point_pack.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_credit_point_pack\n @credit_point_pack = CreditPointPack.find(params[:id])\n end", "def update\n @bundlesticker = Bundlesticker.find(params[:id])\n\n respond_to do |format|\n if @bundlesticker.update_attributes(params[:bundlesticker])\n format.html { redirect_to @bundlesticker, ...
[ "0.65346515", "0.6236466", "0.6234161", "0.6153591", "0.6115034", "0.60719955", "0.60673", "0.6046007", "0.59513086", "0.59331775", "0.58997893", "0.58946025", "0.58605856", "0.5855198", "0.58446693", "0.58408546", "0.58351654", "0.581373", "0.58112025", "0.580933", "0.580471...
0.74985576
0
DELETE /credit_point_packs/1 DELETE /credit_point_packs/1.json
def destroy @credit_point_pack.destroy respond_to do |format| format.html { redirect_to credit_point_packs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def destroy\n @bill_point = BillPoint.find(params[:id])\n @bill_point.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_po...
[ "0.7190704", "0.68271494", "0.68006396", "0.66729957", "0.66162777", "0.6608651", "0.6576276", "0.6576276", "0.6576276", "0.65756583", "0.65636003", "0.6559614", "0.6551069", "0.6550039", "0.6541549", "0.6535688", "0.65291417", "0.6523564", "0.6518564", "0.6498263", "0.648256...
0.8009552
0
Use callbacks to share common setup or constraints between actions.
def set_credit_point_pack @credit_point_pack = CreditPointPack.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def credit_point_pack_params params.require(:credit_point_pack).permit(:name, :number_of_points, :price, :available) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
redefine the logger methods TODO define the color method for the log output
def colorNormal puts "\033[0m" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colorize_logging; end", "def colorize_logging=(_arg0); end", "def log_formatter; end", "def log_formatter; end", "def yellow_log_formatter()\n orig_formatter = ::Logger::Formatter.new\n\n proc do |s,dt,pn,msg|\n \"#{CLEAR}#{YELLOW}#{orig_formatter.call(s,dt,pn,msg)}#{CLEAR}\"\n end\n end...
[ "0.8288321", "0.7910469", "0.70870256", "0.70870256", "0.70870084", "0.70330685", "0.67263854", "0.6686834", "0.6686834", "0.6686834", "0.6686834", "0.6686834", "0.6686834", "0.6686834", "0.6686834", "0.6686834", "0.6686834", "0.6686834", "0.6686834", "0.6686834", "0.6686834"...
0.0
-1
Did the test fail?
def failed? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fail\n @failed = true\n end", "def do_failure; end", "def fail!\n @failed = true\n end", "def failed?\n not @ok\n end", "def fail_now\n fail\n raise TestFail\n end", "def failures; end", "def failures; end", "def failures; end", "def failed?\n @pass...
[ "0.79837626", "0.79184306", "0.7826763", "0.78253907", "0.77599335", "0.7736524", "0.7736524", "0.7736524", "0.7693688", "0.7629173", "0.76107556", "0.76107556", "0.7585485", "0.7585485", "0.75701475", "0.7563943", "0.7536096", "0.7533097", "0.7518108", "0.75051725", "0.74948...
0.77322763
8
The state of failure.
def failure? !error? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def failed?; state == 'failed'; end", "def failed?; state == 'failed'; end", "def failed?\n @state == :failed\n end", "def failure\n @status = FAILURE_FLAG if @status == SUCCESS_FLAG\n end", "def failed?\n state == :failed\n end", "def is_failed\n @status == Status::FAILURE\n ...
[ "0.7987854", "0.7987854", "0.78561056", "0.78510875", "0.7772478", "0.7645547", "0.75872576", "0.74112505", "0.7375813", "0.73214597", "0.7253933", "0.72346395", "0.7166648", "0.71471286", "0.70911276", "0.70648557", "0.7037098", "0.70321816", "0.70321816", "0.6999888", "0.69...
0.68276757
49
The state of info.
def info? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state\n info[:state]\n end", "def state()\n info[:state]\n end", "def state\n data.state\n end", "def state\n data.state\n end", "def state\n data[:state]\n end", "def state\n @state\n end", "def state\n @state\n end", "def state\n ...
[ "0.83906037", "0.8283509", "0.7691582", "0.7691582", "0.756544", "0.75104743", "0.74951816", "0.74447316", "0.74422675", "0.74422675", "0.74422675", "0.74422675", "0.74422675", "0.74422675", "0.74422675", "0.74422675", "0.7418427", "0.7324045", "0.7299862", "0.7292927", "0.72...
0.0
-1
The state of warning.
def warning? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning\n state(\"warning\")\n end", "def warning_state\n super\n end", "def warning\n return @warning\n end", "def warning?\n @result.retval == 1\n end", "def warning?\n severity == :WARNING\n end", "def warning?; end", "def war...
[ "0.86985016", "0.81261516", "0.79118145", "0.7138577", "0.70305127", "0.69969875", "0.69969875", "0.69969875", "0.6976206", "0.6946073", "0.6807661", "0.6730061", "0.6714083", "0.6683828", "0.6682847", "0.6670867", "0.6664882", "0.6601548", "0.65990347", "0.65777373", "0.6533...
0.7083545
4
Identify the state of the result.
def to_sym if failure? :failure else :error end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_or_state\n if result == 'none'\n state\n else\n result\n end\n end", "def state()\n info[:state]\n end", "def results_state results\n if results.respond_to?(:errored?) && results.errored?\n 'Errored'\n elsif results.failing?\n 'Failing'...
[ "0.7502195", "0.706037", "0.70238507", "0.6932412", "0.68746054", "0.68746054", "0.68746054", "0.68746054", "0.68746054", "0.68746054", "0.68746054", "0.68746054", "0.68746054", "0.68746054", "0.68685377", "0.6866516", "0.6863048", "0.6837415", "0.6826547", "0.68091995", "0.6...
0.0
-1
Express the result with one char.
def char if failure? FAILURE_CHAR else ERROR_CHAR end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def char\n code ? [code].pack('U') : ' '\n end", "def char\n\t\t\t\t@char\n\t\t\tend", "def value_with (char)\n temp_val = @value\n \n if @cursor_location == @value.length\n temp_val = @value + char\n else\n temp_val = @value.slice(0..@cursor_location-1) + char + @va...
[ "0.7049575", "0.6660167", "0.6654559", "0.6539349", "0.6539349", "0.6539349", "0.6539349", "0.64538205", "0.6308461", "0.628841", "0.6196055", "0.6128248", "0.60535544", "0.60362804", "0.6022957", "0.6022957", "0.6022957", "0.6022957", "0.6022957", "0.6022957", "0.6022957", ...
0.6018681
34
Express the result with one emoji.
def emoji if failure? FAILURE_EMOJI else ERROR_EMOJI end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emoji; end", "def postprocess(text)\n inline_emoji(text)\n end", "def farewell_message\n puts \"\"\n puts \"Cheers! \\u{1f37b}\" # beer emoji 🍻\n end", "def render(text, emojis)\n emoji_index_cycle = (0...emojis.size).cycle\n\n char_maps = text.split('')\n .map { |cha...
[ "0.7086658", "0.6013211", "0.5942271", "0.59170234", "0.58520955", "0.5789691", "0.57489485", "0.56702167", "0.56276166", "0.5481399", "0.5461501", "0.54057574", "0.5359345", "0.5331856", "0.53045225", "0.52942723", "0.5279001", "0.5276611", "0.52535856", "0.5245185", "0.5238...
0.6381777
1
Collect all distinct tire model / tire category combinations for this brand Tire models are allowed to appear under more than one category
def get_all_tire_categories cats = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id', 'INNER JOIN tire_categories ON tire_models.tire_category_id = tire_categories.id') .where(tire_manufacturer_id: self.id) .select('DISTINCT tire_model_infos.id, tire_model_infos.tire_model_name, tire_categories.id AS "category_id", tire_categories.category_name AS "category_name"') .order('tire_categories.id ASC, tire_model_infos.tire_model_name ASC') result = Hash.new cats.each do |c| cat_id = c[:category_id] result[cat_id] = {:category_name => c[:category_name], :models => []} if result[cat_id].nil? result[cat_id][:models] << {:id => c.id, :name => c.tire_model_name} end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_tgp_tire_categories\n models = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id')\n .where(tire_manufacturer_id: self.id).where('tgp_category_id IS NOT NULL')\n .select('DISTINCT tire_model_infos.id,...
[ "0.7014927", "0.6648356", "0.6133134", "0.6118905", "0.6111475", "0.60105354", "0.5930659", "0.59269226", "0.59262073", "0.58913136", "0.5886169", "0.5849953", "0.5843857", "0.58431584", "0.58404857", "0.5815513", "0.57914346", "0.57116693", "0.57049423", "0.56540936", "0.564...
0.6868425
1
Collect all distinct tire model / TGP category combinations for this brand Tire models are allowed to appear under more than one category
def get_all_tgp_tire_categories models = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id') .where(tire_manufacturer_id: self.id).where('tgp_category_id IS NOT NULL') .select('DISTINCT tire_model_infos.id, tire_model_infos.tire_model_name, tire_models.tgp_category_id AS "category_id"') .order('tire_model_infos.tire_model_name ASC') names = TireModel.tgp_categories result = Hash.new models.each do |m| cat_id = m[:category_id].to_i if cat_id != 0 && names[cat_id] result[cat_id] = {:category_name => names[cat_id], :models => []} if result[cat_id].nil? result[cat_id][:models] << {:id => m.id, :name => m.tire_model_name} end end result.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_tire_categories\n cats = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id',\n 'INNER JOIN tire_categories ON tire_models.tire_category_id = tire_categories.id')\n .where(tire_manufacturer_id: self...
[ "0.65831774", "0.6457169", "0.6087188", "0.6050091", "0.60227567", "0.59662926", "0.59370995", "0.59357786", "0.5825724", "0.58216643", "0.57676286", "0.5759138", "0.5734927", "0.57027525", "0.56972903", "0.56753653", "0.5655451", "0.5648612", "0.5637516", "0.56079876", "0.56...
0.71169597
0
Collect all distinct tire model / car type combinations for this brand
def get_all_car_types models = TireModelInfo.joins('INNER JOIN tire_models ON tire_models.tire_model_info_id = tire_model_infos.id') .select('tire_model_infos.*, tire_models.tire_code AS "tire_code", MIN(tire_models.orig_cost) AS "starting_cost"') .where(tire_manufacturer_id: self.id) .group('tire_code, tire_model_infos.id') .order('tire_model_infos.tire_model_name ASC') #Also combine passenger and performance tires into a sorted list so the controller doesn't have to result = {'P-Z' => []} models.each do |m| type = (m.tire_code.blank? ? 'P' : m.tire_code) #Missing tire_code is allowed: default to P m.starting_cost = (m.starting_cost.to_f / 100).to_money if m.starting_cost result[type] = [] if result[type].nil? result[type] << m result['P-Z'] << m if (type == 'P' || type == 'Z') end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def products_brands(products)\n products.map{|product| product['brand']}.uniq\nend", "def brands_array\n ($products_hash['items'].map { |toy| toy['brand'] }).uniq\nend", "def cars\n return cars_by_license_plate unless @license_plate.empty?\n cars_by_color\n end", "def brands\n beers...
[ "0.64856875", "0.6158809", "0.6057597", "0.5898414", "0.57761735", "0.57627577", "0.57495594", "0.56794167", "0.5621073", "0.5608803", "0.5587764", "0.55733275", "0.5571617", "0.5567967", "0.5563719", "0.5539419", "0.55317026", "0.55138755", "0.55098176", "0.54869604", "0.547...
0.7143937
0
this one is unconditional
def tire_manufacturer_id_conditions ["tire_models.tire_manufacturer_id = ?", self.id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conditionally(*) end", "def conditionally(*) end", "def semact?; false; end", "def placebo?; false end", "def cond; end", "def cond; end", "def cond; end", "def condition; end", "def isolated?; end", "def isolated?; end", "def flag; end", "def used?; end", "def probers; end", "def pri...
[ "0.6713588", "0.6713588", "0.64486593", "0.6368151", "0.630702", "0.630702", "0.630702", "0.62282485", "0.6166548", "0.6166548", "0.61031383", "0.609271", "0.60590976", "0.6051147", "0.588692", "0.58427906", "0.5804803", "0.5804803", "0.57561255", "0.57552147", "0.5723503", ...
0.0
-1
=> 5.0 THIS CODE IS A METHOD THAT ADDS EVERY ELEMENT OF AN ARRAY AND DIVIDES IT BY THE LENGTH OF ARRAY
def average_array(arr) i = 0 sum = 0 avg = 0.0 while i < arr.length old = arr[i] sum += old i += 1 end avg = sum / arr.length.to_f return avg end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basic_6 (array_iterate)\n sum = 0\n array_iterate.each { |n| sum = sum + n }\n return sum / array_iterate.length\nend", "def something\n max = self.max_size\n arrays = self.lifts_array\n arrays.each do |array|\n if array.size < max \n difference1 = max - array.size\n difference...
[ "0.7625995", "0.70095193", "0.6979388", "0.695513", "0.6934555", "0.69127506", "0.6875492", "0.6868498", "0.68496513", "0.68473977", "0.6840082", "0.6838491", "0.683573", "0.6832777", "0.6827437", "0.6808132", "0.6800658", "0.6797144", "0.67863864", "0.6776517", "0.67641115",...
0.0
-1
GET /cards/1 GET /cards/1.xml
def show respond_to do |format| format.html # show.html.erb format.xml { render :xml => @card } format.pdf { @page_size=params["page_size"] @page_layout = params["page_layout"] prawnto :prawn => { :left_margin=>0,:right_margin=>0,:bottom_margin=>0,:top_margin=>0,:page_size=>params["page_size"],:page_layout=>params["layout"].to_sym } # @iconv = Iconv.new('acsii', 'utf-8') # @desc =@iconv.iconv(@card.desc) @desc = @card.desc @font_size = params["font_size"].to_i render :layout => false } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @collection_card = CollectionCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @collection_card }\n end\n end", "def index\n @expansion_of_cards = ExpansionOfCard.find(:all)\n\n respond_to do |format|\n format....
[ "0.70024145", "0.69735205", "0.69309866", "0.69046885", "0.6866563", "0.68277824", "0.6766952", "0.6765576", "0.6698586", "0.6686479", "0.6647306", "0.6638022", "0.6638022", "0.6638022", "0.6638022", "0.6638022", "0.6524756", "0.65227306", "0.6509622", "0.6469394", "0.6451103...
0.0
-1
GET /cards/new GET /cards/new.xml
def new @card = Card.new @card.category_id=params[:category_id] respond_to do |format| format.html # new.html.erb format.xml { render :xml => @card } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @old_card = OldCard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_card }\n end\n end", "def new\n @card = @deck.cards.new\n @decks = Deck.all(:order => 'title')\n\n respond_to do |format|\n format.html # new.html.erb\n ...
[ "0.7685707", "0.755102", "0.7398026", "0.7338191", "0.7297257", "0.7297257", "0.7297257", "0.7297257", "0.7297257", "0.7189703", "0.7143595", "0.7115405", "0.7087821", "0.704481", "0.704481", "0.70246446", "0.694757", "0.68466556", "0.68294567", "0.68086743", "0.6775708", "...
0.6714986
27
POST /cards POST /cards.xml
def create @card = Card.new(params[:card]) @card.user_id = current_user.id respond_to do |format| if @card.save flash[:notice] = 'Card was successfully created.' format.html { redirect_to(@card.category) } format.xml { render :xml => @card, :status => :created, :location => @card } else format.html { render :action => "new" } format.xml { render :xml => @card.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n flash[:notice] = 'Card was successfully created.'\n format.html { redirect_to(deck_card_path(@deck, @card)) }\n format.xml { render :xml => @card, :status => :created, :location => @card }\n ...
[ "0.66286236", "0.64144975", "0.6391199", "0.6329236", "0.62321126", "0.62181884", "0.6198717", "0.6197103", "0.6192009", "0.6150703", "0.61479205", "0.614452", "0.614452", "0.614452", "0.614452", "0.6092645", "0.6021786", "0.5975484", "0.59512806", "0.5946162", "0.59432894", ...
0.6068049
16
PUT /cards/1 PUT /cards/1.xml
def update # @card = Card.find(params[:id]) respond_to do |format| if @card.update_attributes(params[:card]) flash[:notice] = 'Card was successfully updated.' format.html { redirect_to(@card) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xmll => @card.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @card = Card.find(params[:id])\n respond_to do |format|\n if @card.update_attributes(params[:card])\n flash[:notice] = 'Card was successfully updated.'\n format.html { redirect_to(deck_card_url(@deck, @card)) }\n format.xml { head :ok }\n else\n @decks = De...
[ "0.6589716", "0.65789574", "0.6406034", "0.63808924", "0.63539326", "0.63539326", "0.63539326", "0.63418454", "0.6318522", "0.6305802", "0.6300466", "0.629058", "0.62860274", "0.61777765", "0.61374116", "0.61374116", "0.61374116", "0.61374116", "0.61374116", "0.61374116", "0....
0.6795415
0
DELETE /cards/1 DELETE /cards/1.xml
def destroy # @card = Card.find(params[:id]) @card.destroy respond_to do |format| format.html { redirect_to(:back) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to(deck_cards_url(@deck)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @five_card = FiveCard.find(params[:id])\n @five_card.destroy\n\n respond_to do |form...
[ "0.7198513", "0.70586306", "0.7013227", "0.6997778", "0.69684434", "0.6935861", "0.6913809", "0.68681854", "0.6815935", "0.6802931", "0.6791042", "0.6787548", "0.67659336", "0.67659336", "0.67659336", "0.67377", "0.67159986", "0.6696428", "0.66957396", "0.6688146", "0.666909"...
0.72129923
0