query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
GET /moresmalltrials/new GET /moresmalltrials/new.json | def new
@moresmalltrial = Moresmalltrial.new
max_id = Moresmalltrial.maximum(:id)
max_id = 1 if max_id.nil?
next_id = max_id + 1
@moresmallmaps = Moresmallmap.where('start_trial_id <= ?', next_id).where('end_trial_id >= ?', next_id)
respond_to do |format|
format.html # new.html.erb
format.json { render json: @moresmalltrial }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end",
"def create\n @moresmalltrial = Moresmalltrial.new(params[:moresmalltrial])\n\n respond_to do |format|\n if @moresmalltrial.save\n format.... | [
"0.8111692",
"0.76569766",
"0.75826657",
"0.74594134",
"0.71292454",
"0.697623",
"0.6968015",
"0.6959363",
"0.6907986",
"0.6904861",
"0.6903871",
"0.6878174",
"0.6877298",
"0.6865072",
"0.6802715",
"0.6802715",
"0.6802715",
"0.6800956",
"0.67997634",
"0.67997634",
"0.67756337... | 0.7570346 | 3 |
POST /moresmalltrials POST /moresmalltrials.json | def create
@moresmalltrial = Moresmalltrial.new(params[:moresmalltrial])
respond_to do |format|
if @moresmalltrial.save
format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully created.' }
format.json { render json: @moresmalltrial, status: :created, location: @moresmalltrial }
else
format.html { render action: "new" }
format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @moresmalltrial = Moresmalltrial.new\n max_id = Moresmalltrial.maximum(:id)\n max_id = 1 if max_id.nil?\n next_id = max_id + 1\n @moresmallmaps = Moresmallmap.where('start_trial_id <= ?', next_id).where('end_trial_id >= ?', next_id)\n\n respond_to do |format|\n format.html # new.ht... | [
"0.6589716",
"0.6442382",
"0.643282",
"0.64206207",
"0.63953453",
"0.6309926",
"0.6182574",
"0.60563034",
"0.6003",
"0.5991035",
"0.5976615",
"0.5943033",
"0.5859429",
"0.5814396",
"0.5762834",
"0.5760689",
"0.5749525",
"0.57071453",
"0.56892467",
"0.5636526",
"0.55937165",
... | 0.76854515 | 0 |
PUT /moresmalltrials/1 PUT /moresmalltrials/1.json | def update
@moresmalltrial = Moresmalltrial.find(params[:id])
respond_to do |format|
if @moresmalltrial.update_attributes(params[:moresmalltrial])
format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @moresmalltrial = Moresmalltrial.new(params[:moresmalltrial])\n\n respond_to do |format|\n if @moresmalltrial.save\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully created.' }\n format.json { render json: @moresmalltrial, status: :created, ... | [
"0.66722953",
"0.6413313",
"0.64067096",
"0.63649887",
"0.62892205",
"0.6211682",
"0.61859596",
"0.60644203",
"0.6031823",
"0.6013322",
"0.60030776",
"0.6000524",
"0.5951241",
"0.5942575",
"0.59059215",
"0.580721",
"0.58007234",
"0.5777142",
"0.5735435",
"0.5735435",
"0.57354... | 0.75724864 | 0 |
DELETE /moresmalltrials/1 DELETE /moresmalltrials/1.json | def destroy
@moresmalltrial = Moresmalltrial.find(params[:id])
@moresmalltrial.destroy
respond_to do |format|
format.html { redirect_to moresmalltrials_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mosttinytrial = Mosttinytrial.find(params[:id])\n @mosttinytrial.destroy\n\n respond_to do |format|\n format.html { redirect_to mosttinytrials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trial.destroy\n respond_to do |format|\n format.ht... | [
"0.7178326",
"0.7156257",
"0.7130006",
"0.70846915",
"0.68739235",
"0.68045586",
"0.6801004",
"0.6801004",
"0.6749269",
"0.67466396",
"0.671006",
"0.66621035",
"0.6648582",
"0.6600067",
"0.6546773",
"0.6546406",
"0.6543899",
"0.6535698",
"0.65352637",
"0.6507185",
"0.65015906... | 0.79821914 | 0 |
GET /moresmalltrials/select_mobunits GET /moresmalltrials/1/select_mobunits | def select_mobunits
@def_unit_data = Moresmallmobunit.where('cur_map_id = ?', params[:map_id]).where('tgt_map_id = ?', params[:map_id]).where('is_prepared = "t"').collect{|m| [m.name, m.id]}
@atk_unit_data = Moresmallmobunit.where('cur_map_id != ?', params[:map_id]).where('tgt_map_id = ?', params[:map_id]).where('is_prepared = "t"').collect{|m| [m.name, m.id]}
render
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_mob_and_unit\n @mobs = Moresmallmob.find_all_by_moresmalluser_id(params[:user_id]).collect{|m| [m.name, m.id]}\n @selected_mob = Moresmallmobsquad.find(params[:id]).mob_ids unless Moresmallmobsquad.find_by_moresmalluser_id(params[:user_id]).nil?\n @units = Moresmallmobunit.find_all_by_moresmall... | [
"0.7767612",
"0.67045027",
"0.6238261",
"0.6097225",
"0.60156",
"0.5676386",
"0.5630235",
"0.55827385",
"0.5499818",
"0.549147",
"0.54616195",
"0.54372257",
"0.536816",
"0.53639144",
"0.5348078",
"0.5348078",
"0.5346673",
"0.5336801",
"0.5318684",
"0.5304373",
"0.5261055",
... | 0.767579 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_account_transaction
@account_transaction = AccountTransaction.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.6163927",
"0.6046165",
"0.59465253",
"0.59167755",
"0.58904207",
"0.58346355",
"0.577713",
"0.5703502",
"0.5703502",
"0.56531286",
"0.56215113",
"0.54224145",
"0.5410795",
"0.5410795",
"0.5410795",
"0.53924775",
"0.5379919",
"0.53580743",
"0.53401667",
"0.53397506",
"0.533... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def account_transaction_params
params.require(:account_transaction).permit(:transaction_id, :amount, :transaction_type, :date, :pending, :pending_transaction_id, :address, :city, :state, :zip, :lat, :lon, :name, :category_id, :account_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 |
This scripts checks the group membership of each user on the machine to to see if they are in the local admin group | def local_admins
list_of_users_tocheck = []
for x in Dir.entries("/Users")
if !x.start_with?(".")
list_of_users_tocheck.push(x)
end
end
localadmins = []
for x in list_of_users_tocheck
if `dsmemberutil checkmembership -U #{x} -G admin 2>/dev/null`.chomp == "user is a member of the group"
localadmins.push(x)
end
end
puts "Local Admins:"
return localadmins
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_in_admin_group?\r\n cmd_exec(\"groups `whoami`\").split(/\\s+/).include?(SUDOER_GROUP)\r\n end",
"def admin_of?(group)\n memberships.exists?(group_id: group.id, admin: true)\n end",
"def is_admin?\n cmd_exec('groups | grep -wq admin && echo true').eql? 'true'\n end",
"def user_is_admin?\... | [
"0.7384816",
"0.7222062",
"0.7219268",
"0.70986426",
"0.70076305",
"0.69900006",
"0.6904335",
"0.68876874",
"0.68767476",
"0.6792933",
"0.67712164",
"0.67275745",
"0.66510236",
"0.664713",
"0.6566432",
"0.6557021",
"0.6555653",
"0.6534765",
"0.65182966",
"0.65170693",
"0.6408... | 0.7812426 | 0 |
returns the list of available page layouts | def list_page_layouts(layouts=[])
if layouts.empty?
layouts_path = Rails.root + "app/views/layouts"
if Dir.exists? layouts_path
Dir.foreach(layouts_path) do |file_name|
if file_name.include? '.html.haml'
layouts << File.basename(file_name,'.html.haml')
elsif file_name.include? '.html.erb'
layouts << File.basename(file_name,'.html.erb')
end
end
end
layouts << 'application' if layouts.empty?
end
layouts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_layouts\n layouts = Array.new\n extension_dirs.each do |ext|\n Dir.entries(\"#{RAILS_ROOT}/vendor/extensions/#{ext}/app/views/layouts\").only_files.collect{ |e| layouts << e.scan(/\\w+/).first } if File.exist?(\"#{RAILS_ROOT}/vendor/extensions/#{ext}/app/views/layouts\")\n end\n\n la... | [
"0.71930134",
"0.7095451",
"0.6915558",
"0.6800581",
"0.6614504",
"0.6593947",
"0.6593947",
"0.6562008",
"0.6546522",
"0.6284322",
"0.6284322",
"0.62566537",
"0.61939174",
"0.6190009",
"0.6176771",
"0.6161486",
"0.61513245",
"0.6150834",
"0.6150793",
"0.61333925",
"0.61264974... | 0.74132097 | 0 |
Compares two die values from AllowedDice, useable for +sort+ _if_ you use it with a block. i.e.: [:d6, :d10, :d8].sort do |d1, d2| compare_dice(d1, d2) end => [:d6, :d8, :d10] | def compare_dice(die1, die2)
idx1 = AllowedDiceOrder.index(die1)
idx2 = AllowedDiceOrder.index(die2)
# This handles values -not- in AllowedDice
idx1 = -1 if idx1.nil?
idx2 = -1 if idx2.nil?
return idx1 <=> idx2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_dice(dice=[])\n return [] if not dice.is_a?(Array)\n return dice.sort {|d1, d2| compare_dice(d1, d2) }\n end",
"def score_dice(dice)\n score(dice_values(dice))\n end",
"def scorelist(roll)\n #return a hash that shows all the possible scores for these dice, sorted\n categories = ['yahtzee'... | [
"0.7356072",
"0.52847916",
"0.5277148",
"0.52326214",
"0.521826",
"0.5194588",
"0.51915973",
"0.5120726",
"0.5078136",
"0.50256276",
"0.499052",
"0.49794155",
"0.49698907",
"0.49549085",
"0.4946462",
"0.48435494",
"0.48420608",
"0.48389658",
"0.4830706",
"0.48208693",
"0.4819... | 0.77219313 | 0 |
Used to sort an array of dice. NOTE: Values not in AllowedDice end up at the front of the array. | def sort_dice(dice=[])
return [] if not dice.is_a?(Array)
return dice.sort {|d1, d2| compare_dice(d1, d2) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_dice(die1, die2)\n idx1 = AllowedDiceOrder.index(die1)\n idx2 = AllowedDiceOrder.index(die2)\n\n # This handles values -not- in AllowedDice\n idx1 = -1 if idx1.nil?\n idx2 = -1 if idx2.nil?\n\n return idx1 <=> idx2\n end",
"def sort\n sorted = []\n\n # Iterate Over Array Leng... | [
"0.62039465",
"0.593092",
"0.5883547",
"0.5554808",
"0.5543136",
"0.5527346",
"0.55195254",
"0.55148035",
"0.5514463",
"0.5506463",
"0.54830354",
"0.545409",
"0.54452163",
"0.5436267",
"0.54168856",
"0.5409858",
"0.54074436",
"0.5392816",
"0.5392816",
"0.5383297",
"0.5368558"... | 0.76090306 | 0 |
before_action :authenticate_coach!, only: [:index] | def index
@players = Player.all
@coachplayers = CoachPlayer.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized\n redirect_to :controller => 'home', :action => 'index' unless logged_in?\n end",
"def index\n redirect_to current_user\n end",
"def index\n redirect_to(:action => 'login') unless logged_in? \n end",
"def index\n redirect_to(:action => 'login') and return unless logged_in?\n ... | [
"0.71549875",
"0.69425726",
"0.69250274",
"0.68490267",
"0.68470484",
"0.6843138",
"0.677879",
"0.67738414",
"0.67673504",
"0.6763529",
"0.6763529",
"0.6733842",
"0.6733842",
"0.67153317",
"0.67111766",
"0.6686565",
"0.66669947",
"0.6665994",
"0.6665994",
"0.6665994",
"0.6665... | 0.0 | -1 |
GET /authors/1 GET /authors/1.xml | def show
@author = Author.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @author }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @author_repository = AuthorRepository.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @author_repository }\n end\n end",
"def show_authors\n tag = params['query']\n\n @article = Article.where('arxiv_id = ?', tag).first... | [
"0.68134266",
"0.6810114",
"0.6691908",
"0.65655464",
"0.65010214",
"0.65010214",
"0.65010214",
"0.65010214",
"0.649269",
"0.64491683",
"0.63969254",
"0.63959527",
"0.63925344",
"0.6384979",
"0.63823915",
"0.63539195",
"0.63266855",
"0.63105977",
"0.62936586",
"0.62145835",
"... | 0.70273745 | 0 |
this is for escaping in sql | def clean_text(input)
output = input.gsub(/'/) { |x| "\'#{x}" }
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape(s)\n dummy_conn.escape(s)\n end",
"def to_escaped_for_sql_like\n gsub(/[\\\\%_]/) { |x| '\\\\' + x }.gsub(\"*\", \"%\")\n end",
"def generate_sql_escape(token)\n escaped_token = token.gsub(/\\\\|'/, '\\0\\0\\0\\0').gsub(\"?\", \"\\\\\\\\77\")\n \"'\" + escaped_token + \"'\"... | [
"0.78345376",
"0.76842344",
"0.76347286",
"0.74052525",
"0.73874944",
"0.7350359",
"0.7333641",
"0.7262449",
"0.72495884",
"0.72454137",
"0.72427595",
"0.72328216",
"0.71821284",
"0.7135403",
"0.7124588",
"0.7121587",
"0.708996",
"0.7032694",
"0.7024474",
"0.7009703",
"0.6981... | 0.0 | -1 |
Returns a scope for this object by its identifier | def get_scope_by_id(id)
id = id.to_s
scopes.find{|s| s.id == id }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope\n read_attr :scope, :to_sym\n end",
"def scope\n @scope\n end",
"def scope\n @scope\n end",
"def scope\n return @scope\n end",
"def scope\n return @scope\n end",
"def scope\n return @scope\n ... | [
"0.6986587",
"0.69153583",
"0.69153583",
"0.6775095",
"0.6775095",
"0.6775095",
"0.6775095",
"0.6775095",
"0.6775095",
"0.67681456",
"0.6573853",
"0.6573853",
"0.6544657",
"0.6534917",
"0.6349983",
"0.6338787",
"0.6282708",
"0.6270241",
"0.6237588",
"0.6230415",
"0.6224204",
... | 0.7012059 | 0 |
problem input: sentence output: sentence, with word reversed if it is of length 5 or greater. examples given already algorithm Split string with space as a seperator Map over resulting Array, reversing word if length is greater than 5 Join the contents of the array back to a sentence with space as a seperator. | def reverse_words(string)
words = string.split(' ')
words = words.map do |word|
if word.length >= 5
word.reverse
else
word
end
end
words.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_sentence(str)\n str.split.map { | word | word.length > 5 ? word.reverse : word }.join(\" \")\nend",
"def reverse_sentence(str)\n word_array = str.split(\" \")\n word_array.each do |item| \n item.reverse! if item.size >= 5\n end\n word_array.join(\" \")\nend",
"def reverse_words(sentence)\n ... | [
"0.8737681",
"0.8442387",
"0.8397807",
"0.8379236",
"0.8329726",
"0.82612985",
"0.82593143",
"0.82581896",
"0.82462627",
"0.82462585",
"0.82446265",
"0.82241976",
"0.82220244",
"0.8189794",
"0.8175875",
"0.8171706",
"0.81656456",
"0.8164751",
"0.8164259",
"0.81511635",
"0.814... | 0.8187845 | 14 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.reset_password_email.subject | def reset_password_email(user)
@user = user
@url = edit_forgot_password_url(user.reset_password_token)
mail(to: user.email,
subject: "Your ClosetGroupie password has been reset")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject\n @mail.subject\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",... | [
"0.6753835",
"0.6676887",
"0.66758966",
"0.66571647",
"0.66553485",
"0.6648849",
"0.6644893",
"0.66416764",
"0.6640451",
"0.6615871",
"0.65731955",
"0.6564822",
"0.6562829",
"0.6503226",
"0.64942807",
"0.6487838",
"0.64407206",
"0.6436815",
"0.64235705",
"0.6387818",
"0.63772... | 0.6087296 | 55 |
collective setters & getters | def set_up_readers can_walk
@walk = can_walk
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getters; end",
"def attribute_to_set; end",
"def set; end",
"def set; end",
"def name\n return @name\nend\ndef age\n return @age\nend\n#setters, allows you to change or set something\ndef name=(name)\n @name = name\nend",
"def setter\r\n @setter ||= Field.setter(@name)\r\n end",
"def method_... | [
"0.75267607",
"0.72674066",
"0.7120496",
"0.7120496",
"0.6949387",
"0.685067",
"0.67682636",
"0.6683524",
"0.6683524",
"0.6667603",
"0.66647977",
"0.6606873",
"0.65469044",
"0.6507976",
"0.6489649",
"0.6478666",
"0.64632004",
"0.64498717",
"0.64422643",
"0.6437255",
"0.642932... | 0.0 | -1 |
isAlt("amazon") // true isAlt("apple") // false isAlt("banana") // true Arguments consist of only lowercase letters. | def is_alt(s)
staging_area = []
staging_area << s[0]
consonants = "bcdfghjklmnpqrstvwxyz"
vowels = "aeiou"
s.chars[1..-1].each do |letter|
if consonants.include?(letter)
staging_area << letter unless consonants.include?(staging_area.last)
end
if vowels.include?(letter)
staging_area << letter unless vowels.include?(staging_area.last)
end
end
staging_area.join == s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uppercase_alt?(str)\n str == str.upcase\nend",
"def is_alt(s)\n vowels = %w(a e i o u)\n test = s.chars.map { |letter| vowels.include?(letter) ? 1 : 0 }\n test.each_with_index { |char, index| return false if char == test[index+1] }\n true\nend",
"def is_uppercase?(word)\nend",
"def not_in_alphabet?(... | [
"0.7200832",
"0.7196417",
"0.6402511",
"0.6397173",
"0.63875604",
"0.6314357",
"0.6312497",
"0.6300727",
"0.62596756",
"0.6240101",
"0.6208027",
"0.6168394",
"0.6158213",
"0.6148368",
"0.6148368",
"0.6148368",
"0.6147766",
"0.61189866",
"0.6118201",
"0.61177754",
"0.61121714"... | 0.6500952 | 2 |
This function imports the JASON file and stores it into a hash table | def read_jason(file_path)
json_file = File.read(file_path)
data_hash = JSON.parse(json_file)
return data_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import\n Map.import(params[:file])\n end",
"def jload(fname)\n return j2h(loadfile(fname)) unless (res = @preload)\n verbose { 'Loading from Preloading' }\n @preload = nil\n res\n rescue InvalidData\n show_err\n Hashx.new\n end",
"def importFromFile(type, json_hash)\... | [
"0.5931426",
"0.5915452",
"0.58235085",
"0.57677865",
"0.57677865",
"0.57223034",
"0.56863755",
"0.5564768",
"0.5520754",
"0.54119825",
"0.5411914",
"0.53963196",
"0.53963196",
"0.53963196",
"0.53963196",
"0.5351877",
"0.52670175",
"0.5264046",
"0.52624375",
"0.5262029",
"0.5... | 0.5917401 | 1 |
This procedure increments the score of the player | def update_score()
@score += GAME_PRESET["score_increment"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_player_score (player)\r\n\tplayer.player_wins += 1\r\n\t@total_number_of_plays += 1\r\n\tend",
"def score(player)\n\t$running = false\n\tplayer.score += 1\n\t$gui.show_scored(player.name)\n\t$gui.show_info()\n\t$gui.update_score($p1.score, $p2.score)\nend",
"def increment_win_score\n PlayerMode... | [
"0.8423483",
"0.8392943",
"0.81935835",
"0.8093406",
"0.7999613",
"0.7763389",
"0.76975703",
"0.76975703",
"0.7619253",
"0.7559456",
"0.7548223",
"0.75233835",
"0.75176954",
"0.74955714",
"0.7487081",
"0.73984545",
"0.73951244",
"0.73274577",
"0.73095053",
"0.728738",
"0.7281... | 0.8111573 | 3 |
Procedure to reduce the life of the player | def lose_life()
@life -= 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lose_life\n @life -= 1\n end",
"def reduce_life\n if @lives > 0\n @lives -= 1\n end\n end",
"def lose_life\n @lives -= 1\n end",
"def lose_life\n @lives -= 1\n end",
"def lose_life\n @lives -= 1\n end",
"def lose_life\n @lives -= 1\n end",
"def lose_life(player)\n p... | [
"0.7591858",
"0.75863034",
"0.7402945",
"0.7402945",
"0.7402945",
"0.7402945",
"0.73868203",
"0.73052967",
"0.72994196",
"0.72235984",
"0.71686816",
"0.70550114",
"0.7036182",
"0.6953916",
"0.6926268",
"0.68712837",
"0.6800104",
"0.6708862",
"0.66474104",
"0.6575665",
"0.6532... | 0.77073747 | 0 |
Move the Space Ship to the left | def move_left
if @x - @vel_x > GAME_PRESET["player_move_left"]
@x -= @vel_x
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_left\n # @dx = -8\n @x -= 8\n end",
"def move_left\n\t\t# if the horse isn;t yet at the left of of the screne move it left 20\n\t\tif @x > 0\n\t\t\t\t@x = @x -20\n\t\tend\n\tend",
"def move_left\n\t\tmove([-1,0])\n\tend",
"def moveLeft(dist)\n @body.p.x -= dist\n end",
"def move_lef... | [
"0.77708113",
"0.75958306",
"0.75864613",
"0.74042237",
"0.70948565",
"0.70789635",
"0.69773436",
"0.69617635",
"0.69616073",
"0.695098",
"0.6902597",
"0.6878532",
"0.6878532",
"0.6755922",
"0.66719335",
"0.66525656",
"0.662645",
"0.6607497",
"0.65876603",
"0.65876603",
"0.65... | 0.74570507 | 3 |
Move the Space Ship to the right | def move_right
if @x + @vel_x < SCREEN_WIDTH - GAME_PRESET["player_move_right"]
@x += @vel_x
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_right\n\t\tmove([1,0])\n\tend",
"def moveRight\n if (@x + @size) < 510\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, @y, @x + 1, @y + @size)\n let @x = @x + 2\n call Screen.setColor(true)\n call Screen.drawRectangle((@x + @size) - 1, @y, @x + @size, @y + @size... | [
"0.7360024",
"0.6865995",
"0.6825685",
"0.68051517",
"0.6802973",
"0.6776518",
"0.67689365",
"0.67439413",
"0.67415863",
"0.6721613",
"0.67200565",
"0.67092615",
"0.6702407",
"0.6700961",
"0.668674",
"0.65932626",
"0.6518812",
"0.6516152",
"0.64827204",
"0.6449603",
"0.644280... | 0.7194565 | 1 |
Move the Space Ship forward | def move_up
if @y + @vel_y > GAME_PRESET["player_move_up"]
@y -= @vel_y
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_forward\n\t\tnew_position = forward_position\n\t\t@x = new_position[0]\n\t\t@y = new_position[1]\n\tend",
"def forward_move\n case @facing\n when 'NORTH'\n @y += 1\n when 'SOUTH'\n @y -= 1\n when 'EAST'\n @x += 1\n when 'WEST'\n @x -= 1\n end\n self\n end",
"d... | [
"0.7481864",
"0.7349816",
"0.7052332",
"0.69652635",
"0.6963785",
"0.69612134",
"0.68935484",
"0.68801934",
"0.6859657",
"0.68236697",
"0.6786813",
"0.6786297",
"0.6720608",
"0.67092246",
"0.6695535",
"0.6695535",
"0.6674765",
"0.667008",
"0.663291",
"0.6623445",
"0.6623445",... | 0.0 | -1 |
Move the Space Ship backwards | def move_down
if @y + @vel_y < SCREEN_HEIGHT - GAME_PRESET["player_move_down"]
@y += @vel_y
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_backward\r\r\n last_direction_fix = @direction_fix\r\r\n @direction_fix = true\r\r\n @move_poll+= [[reverse_dir(@direction), false]] * (32.0 / CXJ::FREE_MOVEMENT::PIXELS_PER_STEP).ceil\r\r\n @direction_fix = last_direction_fix\r\r\n end",
"def shrink_ship\n @length -= 1\n end",
"def m... | [
"0.69868886",
"0.671078",
"0.6707044",
"0.6621565",
"0.6615811",
"0.6557973",
"0.6517314",
"0.6494956",
"0.6460636",
"0.63434106",
"0.6325666",
"0.6309632",
"0.6275839",
"0.62092525",
"0.6194765",
"0.6194765",
"0.6186067",
"0.61658204",
"0.6163308",
"0.6148122",
"0.61373687",... | 0.6055388 | 27 |
Draw procedure for the Player calss | def draw
@image_player.bmp.draw(@x, @y, ZOrder::TOP)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw\n @player.draw\n if @twoplayer\n @player2.draw\n else\n @bot.draw\n end\n @ball.draw\n @wall.draw\n @score.draw\n @help.draw\n end",
"def draw\n @headers[@game_state_model::players[@game_state_model.player_turn_state]::player_color].draw(@x, @y, 35)\n\n if @g... | [
"0.80781794",
"0.8012489",
"0.799902",
"0.7836345",
"0.77422065",
"0.7699074",
"0.761155",
"0.75536776",
"0.7488505",
"0.74707276",
"0.74707276",
"0.74707276",
"0.74707276",
"0.74156445",
"0.7412836",
"0.741004",
"0.7400605",
"0.73975027",
"0.73975027",
"0.73975027",
"0.73744... | 0.73315066 | 21 |
Moving thr bullet across the screen after being fired | def move
# Move bullet fired by the Spaceship up the screen
if @type == 'good'
@y -= @SPEED
# Move bullet fired by the Aliens down the screen
elsif @type == 'evil'
@y += @SPEED
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_bullets args\n args.state.bullets.each do |bullet| # perform action on each bullet in collection\n bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)\n\n # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out\n # of ... | [
"0.72474456",
"0.7219101",
"0.7090387",
"0.708837",
"0.70361096",
"0.70140594",
"0.6970675",
"0.69470644",
"0.69457513",
"0.69084144",
"0.68800306",
"0.67976665",
"0.66548663",
"0.6641154",
"0.6526731",
"0.6458217",
"0.6372978",
"0.63690716",
"0.634991",
"0.6325225",
"0.63155... | 0.69566894 | 7 |
Draw function for the bullet class | def draw
@image.bmp.draw(@x - @radius, @y- @radius, 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bullet\n height = @options[:height].to_f\n @graph_width = @options.has_key?(:width) ? @options[:width].to_f : 100.0\n good_color = @options.has_key?(:good_color) ? @options[:good_color] : '#eeeeee'\n satisfactory_color = @options.has_key?(:satisfactory_color) ? @options[:satisfactory_... | [
"0.7329271",
"0.6924037",
"0.69092035",
"0.6891286",
"0.6854628",
"0.67142725",
"0.67142725",
"0.67142725",
"0.6682191",
"0.6682191",
"0.6609452",
"0.6607589",
"0.6607589",
"0.6607589",
"0.6607589",
"0.6600639",
"0.6598644",
"0.6596713",
"0.657603",
"0.65740335",
"0.6545603",... | 0.0 | -1 |
Procedure to move the Alien | def move
@x += @x_direction
@y += @y_direction
# Preventing the Alien moving out of the screen
if @x > (SCREEN_WIDTH - GAME_PRESET["alien_reach"]) || @x < 0
@x_direction= -@x_direction
elsif @y > (SCREEN_HEIGHT * @height_limit)
@y_direction = 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move; end",
"def move; end",
"def move\n\n end",
"def move\n \n end",
"def move\n \n end",
"def do_the_move(argument)\r\n color, row_s, col_s, row_e, col_e = strip_pos_argument(argument)\r\n start_item = @infosquare[row_s][col_s]\r\n end_item = @infosquare[row_e][col_e]\r\n if ... | [
"0.7149363",
"0.7149363",
"0.70014113",
"0.6914599",
"0.6914599",
"0.6651767",
"0.65588886",
"0.652299",
"0.6512994",
"0.6425553",
"0.6425553",
"0.64027864",
"0.63523054",
"0.6276716",
"0.6276716",
"0.627374",
"0.62499386",
"0.6217407",
"0.6216489",
"0.6197053",
"0.6164005",
... | 0.69832593 | 3 |
Draw Aliens on the screen | def draw
@image.bmp.draw(@x, @y, ZOrder::TOP)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw! 🎮, 📺, color\n translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color]\n end",
"def draw_ambient\n \n end",
"def generate_aliens(position, height)\r\n # Looping until the number of Aliens in a fleet is reached\r\n for i i... | [
"0.6143754",
"0.6083138",
"0.6028044",
"0.5929991",
"0.5736369",
"0.57115287",
"0.5680897",
"0.5668043",
"0.5658883",
"0.56421864",
"0.56405514",
"0.56330854",
"0.5623089",
"0.55904645",
"0.5589936",
"0.55661887",
"0.5560451",
"0.55551445",
"0.5546029",
"0.5541632",
"0.553322... | 0.0 | -1 |
This procedure increases the difficulty level of the game | def level_up()
# Incrementing the level
@level += 1
# Incrasing the number of aliens in each fleet
if @alien_count <6
@alien_count += 1
end
# Reducing the random number to that the events are more likely to occur
@random -= 100
@alien_fire_rand -= 100
# Increasing the maximum number of Alien fleets
@fleet_limit += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def level_advance\n all_lvls = [$lvl_1, $lvl_2, $lvl_3]\n if $current_lvl != all_lvls.last\n puts \"You hve defeated the first wave - prepare for wave #{$level_counter + 2}!\"\n puts \"Here's a reminder of your character's stats\"\n # the hp is not correct here.\n puts $player\n ... | [
"0.7028764",
"0.6820263",
"0.66927797",
"0.6586084",
"0.64771",
"0.6422956",
"0.64000636",
"0.6358226",
"0.6346046",
"0.63272655",
"0.62809396",
"0.62729263",
"0.62316424",
"0.62168604",
"0.6187699",
"0.61872613",
"0.6145355",
"0.61216545",
"0.61120665",
"0.61010516",
"0.6084... | 0.5811577 | 47 |
Returns the score of the Game | def get_score()
return @player.score()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(game)\n if game.winner.nil?\n 0\n elsif game.winner == game.computer_player\n 1\n else\n -1\n end\n end",
"def score\n return @score\n end",
"def total_score\n sum = self.games.sum{|game|game.points}\n sum.to_i / self... | [
"0.8222461",
"0.7991709",
"0.79298407",
"0.7864132",
"0.7749373",
"0.7735888",
"0.77311563",
"0.76271975",
"0.7601157",
"0.75438535",
"0.751995",
"0.7510693",
"0.7493977",
"0.74937433",
"0.74776304",
"0.7466759",
"0.74565023",
"0.7433489",
"0.7420655",
"0.7398368",
"0.7388757... | 0.82753354 | 0 |
Returns the time of the Gameplay | def get_game_play_time()
return @game_play_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gametime\n \"#{self.gametime_maths/60} minutes\"\n end",
"def play_time\n sum = 0\n @tracks.each {|n| sum += n.total_time}\n return Time.at(sum/1000.0).strftime('%R:%S')\n end",
"def current_play_time\n time = $trainer.update_play_time\n hours = time / 3600\n minutes = (tim... | [
"0.7788315",
"0.7620484",
"0.74139893",
"0.7297721",
"0.7272682",
"0.7245473",
"0.7144879",
"0.7115967",
"0.71093667",
"0.7103704",
"0.70830953",
"0.70655817",
"0.7063819",
"0.7044452",
"0.6992768",
"0.6963224",
"0.69628036",
"0.6941735",
"0.6926208",
"0.6926208",
"0.6926208"... | 0.86502063 | 0 |
Removing the bullets which have moved pass the screen | def remove_unused_bullets()
# All the bullet objects are looped through
@bullets.dup.each { |bullet|
# Determines if a bullet is outside the screen
bullet.x > SCREEN_HEIGHT || bullet.x < 0
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_bullets_of_screen args\n args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280\nend",
"def hit_by_bullet\n $p_bullets.delete_if do |b|\n if self.bounding_box_collision?(b)\n @meter.change_width(b.dmg)\n b.destroy\n during(100) ... | [
"0.7979599",
"0.7443645",
"0.7413888",
"0.7027271",
"0.6901875",
"0.67119205",
"0.66250396",
"0.6540389",
"0.64774126",
"0.63767713",
"0.6344758",
"0.6327287",
"0.6307901",
"0.6238692",
"0.62229186",
"0.6170551",
"0.6143313",
"0.6118596",
"0.6087417",
"0.60821563",
"0.6079519... | 0.8526866 | 0 |
Procedure for the aliens to fire bullets | def alien_fire_bullet()
# The aliens will fire bullets at random,
# The randomness is controlled by @alien_fire_rand
@aliens.each { |alien|
if rand(@alien_fire_rand) == 0
@bullets.push Bullet.new(alien.x, alien.y+ 40, 'evil')
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fire \n\n # Could end up spawning a number of bullets, depending on the weapon\n bullets = []\n\n # For now, we'll just spawn a small green laser bolt!\n bullets << Laser.new( :laser_small_green, @x - 64, @y + 64, false )\n\n # And just hand back that collection of bullets\n ... | [
"0.78516734",
"0.736843",
"0.7359826",
"0.72630507",
"0.6600291",
"0.64875835",
"0.6484551",
"0.6447797",
"0.6353175",
"0.62963086",
"0.6233595",
"0.6233384",
"0.6197353",
"0.6188431",
"0.6146357",
"0.6132934",
"0.6097139",
"0.60820276",
"0.60766965",
"0.60751086",
"0.6005284... | 0.81691897 | 0 |
Procedure allows the player to fire bullets | def player_fire_bullet()
# This makes sure that bullets are fired after certain intervals
if Gosu.milliseconds > (@seconds_elapsed * COUNTER)
@seconds_elapsed = Gosu.milliseconds
@bullet_sound.bmp.play()
# Generating a bullet object
@bullets.push Bullet.new((@player.x+ 33), @player.y, 'good')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fire \n\n # Could end up spawning a number of bullets, depending on the weapon\n bullets = []\n\n # For now, we'll just spawn a small green laser bolt!\n bullets << Laser.new( :laser_small_green, @x - 64, @y + 64, false )\n\n # And just hand back that collection of bullets\n ... | [
"0.8171409",
"0.7454516",
"0.7333679",
"0.6954393",
"0.6928069",
"0.68463326",
"0.6845657",
"0.6830427",
"0.6787185",
"0.6743746",
"0.67229474",
"0.6687603",
"0.66550285",
"0.6642569",
"0.66419464",
"0.65892076",
"0.6567191",
"0.65120614",
"0.64631444",
"0.6458526",
"0.634888... | 0.83281463 | 0 |
Introcusing a new fleet of aliens in the game | def add_alien_fleet()
# Only generate new fleet of aliens if the current count of fleets is less than @fleet_limit
if rand(@random) == 0 and @fleet < @fleet_limit
@fleet +=1
position = rand(SCREEN_WIDTH/2)
@height -= GAME_PRESET["space_fleet"]
# Calling the procedure to generate aliens
generate_aliens(position, @height)
end
# If the aliens reach the top level of the screen bring then down
if @height < 0.3
@height = GAME_PRESET["initial_height"]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_aliens(position, height)\r\n # Looping until the number of Aliens in a fleet is reached\r\n for i in 0...@alien_count\r\n @aliens.push(Alien.new(i, position, height))\r\n @alien_sound.bmp.play\r\n end\r\n end",
"def eat\n inventory[:fish] -= @daily_appetite = 10\n\n if inve... | [
"0.6533823",
"0.5957225",
"0.5903877",
"0.5743698",
"0.5684314",
"0.56683844",
"0.56669354",
"0.56624097",
"0.5655215",
"0.5651407",
"0.5649855",
"0.5638109",
"0.5629744",
"0.55864453",
"0.55712163",
"0.5549444",
"0.55309695",
"0.55247116",
"0.5504321",
"0.54954064",
"0.54801... | 0.8170831 | 0 |
Procedure to generate aliens | def generate_aliens(position, height)
# Looping until the number of Aliens in a fleet is reached
for i in 0...@alien_count
@aliens.push(Alien.new(i, position, height))
@alien_sound.bmp.play
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alias_generator(agent)\n\n# changes vowels into array and uses .reverse method to account \n# for edge cases\n\tvowels = \"aeiou\"\n\tnew_vowels = \"aeiou\".split('').reverse\n\n# changes consonants into array and uses .reverse method to account\n# for edge cases\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\tne... | [
"0.67415905",
"0.67098373",
"0.6628147",
"0.65566397",
"0.6149982",
"0.61312085",
"0.6122917",
"0.6062984",
"0.6040096",
"0.59317064",
"0.5923171",
"0.5914449",
"0.5912977",
"0.58781105",
"0.5877148",
"0.581815",
"0.581815",
"0.5815876",
"0.5802117",
"0.5714952",
"0.5690303",... | 0.7044341 | 0 |
Procedure to handle collision between Alien and the bullet | def alien_hit(alien, bullet)
# Deleting the alien and the bullet object
@aliens.delete alien
@bullets.delete bullet
@explode = true
@player.update_score()
# Setting the coordinates for the explosion
@explode_x = alien.x
@explode_y = alien.y
@explosion_sound.bmp.play
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enemy_bullet_collision\n if cr.defeated == false\n $e_bullets.each do |b|\n if self.bounding_box_collision?(b)\n @life -= 1\n $hud.set_lives(life)\n clear_all_bullets\n end\n end\n end\n end",
"def check_collision()\r\n # Looping through all the a... | [
"0.77033585",
"0.754493",
"0.7323366",
"0.69026935",
"0.68877876",
"0.6863643",
"0.67645335",
"0.6682174",
"0.6529876",
"0.65003633",
"0.6456657",
"0.6448624",
"0.64131373",
"0.6374127",
"0.63211805",
"0.63211626",
"0.62875324",
"0.6274564",
"0.62529844",
"0.6244736",
"0.6224... | 0.7371643 | 2 |
Procedure to handle collision between Player and the bullet | def player_hit(bullet)
@bullets.delete bullet
@ship_hit_sound.bmp.play
# If the player has lost all the lifeline end the game
if @player.life == 0
# Ending the game
GameOverWindow.new.show
close
end
# Player lost one lifeline
@player.lose_life()
# Plaing a blank heart to represent it
@heart_list[@player.life] = @blank_heart
@heart = @blank_heart
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enemy_bullet_collision\n if cr.defeated == false\n $e_bullets.each do |b|\n if self.bounding_box_collision?(b)\n @life -= 1\n $hud.set_lives(life)\n clear_all_bullets\n end\n end\n end\n end",
"def update()\n #checks if it has hit an asteroid\n ... | [
"0.76419073",
"0.7166491",
"0.702482",
"0.691303",
"0.67995703",
"0.67876697",
"0.6663708",
"0.66525656",
"0.6638903",
"0.6630048",
"0.6535482",
"0.65276384",
"0.65263957",
"0.65241474",
"0.65043557",
"0.645825",
"0.64322376",
"0.64170486",
"0.6413933",
"0.64106196",
"0.63774... | 0.6525702 | 13 |
Precdure which takes care of the collions in the game | def check_collision()
# Looping through all the aliens in the game
@aliens.each { |alien|
# Looping through all the bulletss in the game
@bullets.each { |bullet|
# Distance between the bullet and the alien
distance = Gosu.distance(alien.x, alien.y, bullet.x, bullet.y)
# Distance between the bullet and the player
hit_distance = Gosu.distance(@player.x, @player.y, bullet.x, bullet.y)
# Bullets fired by the Player fit the Alien
if distance < alien.radius + bullet.radius and bullet.type == 'good'
alien_hit(alien, bullet)
# Bullets fired by the Alien hit the Player
elsif hit_distance < @player.radius + bullet.radius and bullet.type == 'evil'
player_hit(bullet)
end
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collisions\n [collided_bombs, collided_rubies]\n end",
"def collisions\n collider.detect(self)\n end",
"def update\n super\n\n # Cuando un pez encuentra comida\n Pez.each_collision(Comida) do |pez, comida|\n pez.comer\n comida.destroy\n end # each\n\n #Cuando se generan las... | [
"0.6228185",
"0.6215297",
"0.6119634",
"0.61191005",
"0.6048972",
"0.60473704",
"0.60404915",
"0.5999571",
"0.59610826",
"0.5938988",
"0.5888978",
"0.587969",
"0.58630925",
"0.5861626",
"0.578402",
"0.5681111",
"0.56485826",
"0.5647796",
"0.5643066",
"0.5591072",
"0.5560614",... | 0.0 | -1 |
procedure to create sound effects in the game | def play_track(path)
@song = Gosu::Song.new(path)
@song.play(false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_sound\n @effects = EffectsSystem.new(@window)\n @effects.add_effect(:thud, \"assets/sand2.ogg\")\n end",
"def sound; end",
"def setup_sound\n return unless PONY::ERRNO::check_sequence(current_act)\n name = @acts[1]\n vol = @acts[2] || 100\n pitch = @acts[3] || 100\n ... | [
"0.79877365",
"0.7642193",
"0.72487634",
"0.7248202",
"0.7104432",
"0.7094595",
"0.69634074",
"0.6949179",
"0.687545",
"0.6809261",
"0.68022484",
"0.67602926",
"0.6754538",
"0.6617844",
"0.6616225",
"0.66032827",
"0.65959567",
"0.65881276",
"0.6571879",
"0.65717506",
"0.65710... | 0.0 | -1 |
Procedure to represent the lifeline of the player | def draw_heart(heart_list)
for i in 1..heart_list.length()
heart_list[i-1].bmp.draw( SCREEN_WIDTH - (i*30), 10, ZOrder::TOP )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw \n\t\tsuper(\"Lives: #{@lives.to_s}\", X, Y, 5)\n\tend",
"def board_visualization\n @players.each do |racer|\n in_front = @length - @position[racer]\n # track = \"|\" * 30\n # p track.insert(@position[racer, racer.to_s)\n p \" |\" * @position[racer] + racer.to_s + \"|\" + \" |\" *... | [
"0.6160505",
"0.6146861",
"0.6143239",
"0.6137708",
"0.6093414",
"0.60488904",
"0.60488904",
"0.60488904",
"0.60488904",
"0.60488904",
"0.60488904",
"0.60488904",
"0.604517",
"0.6012326",
"0.5943281",
"0.5889474",
"0.5874558",
"0.5862535",
"0.58457184",
"0.581171",
"0.5806522... | 0.0 | -1 |
Procedure to add the visuals of explosion | def explode()
# drawing explosion scene
@explosion.bmp.draw(@explode_x, @explode_y, ZOrder::TOP)
# Playing the sound of an explosion
@explosion_sound.bmp.play
@count += 1
# Showing the visual for 20 update() counts
if @count == 20
@explode = false
@count = 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_explosion\n explosion = ParticleFactory.buildParticles(\"big\", 80).set! :emission_direction => Vector3f.new(0, 1, 0),\n :maximum_angle => FastMath::PI, :speed => 1, :minimum_life_time => 600, \n :start_size => 3, :end_size => 7, \n :start_color => ColorRGBA.new(1, 0.312, 0.121, 1), \n... | [
"0.668308",
"0.6274185",
"0.6200668",
"0.60736775",
"0.60326445",
"0.58870655",
"0.5825537",
"0.5759413",
"0.5726432",
"0.5726432",
"0.5723914",
"0.57106555",
"0.56994885",
"0.56796443",
"0.5664836",
"0.5664836",
"0.5603734",
"0.5565876",
"0.5558513",
"0.55577177",
"0.5539715... | 0.7037201 | 0 |
If Esc button is pressed close the game | def button_down(id)
if id == Gosu::KB_ESCAPE
close
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_game\n show\n Ncurses.mvaddstr(MAXY - 1, 0, 'Press any key to exit')\n Ncurses.getch\n Ncurses.curs_set(1)\n Ncurses.endwin\n end",
"def game_exit\n Message.game_quit\n false\n end",
"def button_up(key)\n self.close if key == Gosu::KbEscape\n end",
"def button_down(id... | [
"0.78833276",
"0.75391114",
"0.7340862",
"0.7240059",
"0.72353995",
"0.721801",
"0.72051865",
"0.7191426",
"0.7140348",
"0.7038638",
"0.69708055",
"0.69394565",
"0.6912984",
"0.69090235",
"0.6904699",
"0.68514955",
"0.68308246",
"0.67741644",
"0.6753222",
"0.67340505",
"0.673... | 0.7326926 | 3 |
Procedure to place button on the screen | def place_button(x, y, message)
Gosu.draw_rect(x, y, 70, 45, Gosu::Color::GREEN, ZOrder::MIDDLE, mode=:default)
@button_font.draw_text(message, x+5, y+10, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_the_button\n @theButton = UIButton.buttonWithType(UIButtonTypeRoundedRect)\n @theButton.setTitle('Refresh Weather!', forState:UIControlStateNormal)\n # @theButton.setTitleColor(BW.rgb_color(255, 255, 255), forState:UIControlStateNormal)\n @theButton.backgroundColor = BW.rgb_color(255, 255, 255)... | [
"0.6984616",
"0.69546276",
"0.68010515",
"0.65952176",
"0.6562371",
"0.654545",
"0.64923996",
"0.6409502",
"0.6349404",
"0.625855",
"0.6244189",
"0.6184829",
"0.61752456",
"0.6135543",
"0.61313856",
"0.6125126",
"0.61110425",
"0.6095421",
"0.6092659",
"0.60902447",
"0.6081898... | 0.7280034 | 0 |
Checks if the user hovers over the button | def mouse_over_button(mouse_x, mouse_y)
if ((mouse_x >= (SCREEN_WIDTH/3) + 100 and mouse_x <= (SCREEN_WIDTH/3) + 160) and (mouse_y >= 300 and mouse_y <= 345))
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n \n if(isOverButton)\n @hover = true\n else\n @hover = false\n end\n \n if(@clicked)\n @clicked = false\n @hover = false\n return true\n end\n \n return false\n end",
"def isHover\n return @hover\n end",
"def mouse_over_target?\n inputs.mo... | [
"0.8068117",
"0.75783557",
"0.73522335",
"0.7145684",
"0.7055907",
"0.70185745",
"0.6994087",
"0.69923925",
"0.69782305",
"0.6934289",
"0.6917678",
"0.68952733",
"0.67863935",
"0.6727239",
"0.67223144",
"0.6643505",
"0.6606747",
"0.6562269",
"0.6561966",
"0.6485825",
"0.63987... | 0.7418596 | 2 |
Providing all the instruction to the user before starting the game | def draw
@background_image.bmp.draw(0, 0, ZOrder::BACKGROUND)
@function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, "Start!")
@function_UI.big_font.draw_text("SPACE WAR", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)
@function_UI.big_font.draw_text("Instructions: ", @function_UI.pos-100, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::RED)
@function_UI.font.draw_text("# Press SPACE BAR to fire bullets", @function_UI.pos-180, 140, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)
@function_UI.font.draw_text("# Use the ARROW KEYS to navigate the Spaceship", @function_UI.pos-180, 180, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)
@function_UI.font.draw_text("# You have 3 Life Lines", @function_UI.pos-180, 220, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)
@function_UI.font.draw_text("# Press ESC to leave the Game", @function_UI.pos-180, 260, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)
draw_border((SCREEN_WIDTH/3) + 105, 305)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_initial_commands\n #in the game class\n case \n when play?\n game = Game.new(instream, outstream, display)\n game.start\n \n when instructions?\n display.game_objective1 # give the user instructions\n display.game_objective2\n\n when quit? # run the loop below un... | [
"0.7556367",
"0.74413836",
"0.7122011",
"0.71200407",
"0.7097632",
"0.7087768",
"0.7079253",
"0.7068617",
"0.6982634",
"0.69703656",
"0.69608283",
"0.693086",
"0.69282895",
"0.69154066",
"0.69058895",
"0.6900777",
"0.68729407",
"0.6870282",
"0.6855094",
"0.6850385",
"0.680683... | 0.0 | -1 |
When a user hovers over a button draw a border | def draw_border(x1, y)
if @function_UI.mouse_over_button(mouse_x, mouse_y)
draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)
draw_line(x1, y+35, Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)
draw_line(x1, y,Gosu::Color::BLUE, x1, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)
draw_line(x1+60, y,Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_border(x1, y, mouse_x, mouse_y)\r\n if @function_UI.mouse_over_button(mouse_x, mouse_y)\r\n draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y+35, Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n ... | [
"0.7456075",
"0.6786705",
"0.66233855",
"0.64731586",
"0.6234135",
"0.6140793",
"0.6121853",
"0.5982914",
"0.59605324",
"0.5950647",
"0.5891725",
"0.5875644",
"0.58139837",
"0.57779014",
"0.577331",
"0.573345",
"0.5727354",
"0.57118994",
"0.5699024",
"0.5689504",
"0.56780535"... | 0.7579696 | 0 |
Showing the information after the game has ended | def draw
@background_image.bmp.draw(0, 0, ZOrder::BACKGROUND)
@function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, "Close")
draw_border((SCREEN_WIDTH/3) + 105, 305, mouse_x, mouse_y)
@function_UI.big_font.draw_text("GAME OVER!", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)
@score_font.draw_text("Your Score: #{@score}", @function_UI.pos-100, 200, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)
@score_font.draw_text("Time of Game PLay: #{@game_play_time} Seconds", @function_UI.pos-140, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_game\n puts \"Merci, Aur revoir\"\n end",
"def finish\n\t\t@frame = @frame + 1\n\t\tdone = false\n\t\tif @frame % 120 == 0 \n\t\t\tdone = !@dialogueText.next\n\t\tend\n\t\tif done\n\t\t\t@frame = 0\n\t\t\t@nextGameState = @map\n\t\telse\n\t\t\t@dialogueText.draw\n\t\tend\n\tend",
"def displayEndgam... | [
"0.7369894",
"0.73588973",
"0.7206889",
"0.7180202",
"0.71289086",
"0.71063846",
"0.7094307",
"0.70589477",
"0.70345706",
"0.7011741",
"0.69640976",
"0.6955177",
"0.68831927",
"0.6879037",
"0.6864914",
"0.68223816",
"0.6744334",
"0.6716894",
"0.6638612",
"0.66346735",
"0.6611... | 0.0 | -1 |
When a user hovers over a button draw a border | def draw_border(x1, y, mouse_x, mouse_y)
if @function_UI.mouse_over_button(mouse_x, mouse_y)
draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)
draw_line(x1, y+35, Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)
draw_line(x1, y,Gosu::Color::BLUE, x1, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)
draw_line(x1+60, y,Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_border(x1, y)\r\n if @function_UI.mouse_over_button(mouse_x, mouse_y)\r\n draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y+35, Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw... | [
"0.7579998",
"0.6786909",
"0.66236174",
"0.64722836",
"0.6234266",
"0.61411273",
"0.61221",
"0.598452",
"0.5958936",
"0.5951008",
"0.589083",
"0.5876123",
"0.58147824",
"0.5776819",
"0.5771609",
"0.57340175",
"0.57271856",
"0.5711821",
"0.5698336",
"0.56889844",
"0.5677698",
... | 0.7456396 | 1 |
GET /principal_establecs/1 GET /principal_establecs/1.json | def show
@principal_establec = PrincipalEstablec.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @principal_establec }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @principal_establec = PrincipalEstablec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @principal_establec }\n end\n end",
"def get_principal(filter = nil, sort = nil)\n puts \"ACS: get_principal\"\n res = query(\"principal-list\", \n ... | [
"0.61725277",
"0.5739674",
"0.5683607",
"0.5643067",
"0.5642022",
"0.5622067",
"0.5571116",
"0.55657357",
"0.5544598",
"0.5529464",
"0.5519646",
"0.5506317",
"0.54886705",
"0.5472257",
"0.5470508",
"0.5462052",
"0.5455519",
"0.5450254",
"0.54342055",
"0.5429684",
"0.54123986"... | 0.72588146 | 0 |
GET /principal_establecs/new GET /principal_establecs/new.json | def new
@principal_establec = PrincipalEstablec.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @principal_establec }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @principal_establec = PrincipalEstablec.new(params[:principal_establec])\n\n respond_to do |format|\n if @principal_establec.save\n format.html { redirect_to @principal_establec, notice: 'Registro creado satisfactoriamente.' }\n format.json { render json: @principal_establec, ... | [
"0.7169801",
"0.6647806",
"0.6558073",
"0.6476157",
"0.6390883",
"0.6379562",
"0.6320748",
"0.62947965",
"0.6281423",
"0.62744516",
"0.625537",
"0.625238",
"0.62340295",
"0.6227621",
"0.62196976",
"0.6212629",
"0.62100494",
"0.6202174",
"0.6197757",
"0.61742055",
"0.61696005"... | 0.7668875 | 0 |
POST /principal_establecs POST /principal_establecs.json | def create
@principal_establec = PrincipalEstablec.new(params[:principal_establec])
respond_to do |format|
if @principal_establec.save
format.html { redirect_to @principal_establec, notice: 'Registro creado satisfactoriamente.' }
format.json { render json: @principal_establec, status: :created, location: @principal_establec }
else
format.html { render action: "new" }
format.json { render json: @principal_establec.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @principal_establec = PrincipalEstablec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @principal_establec }\n end\n end",
"def create\n @employee = Employee.new(employee_params)\n @employee.user_created_id = current_user.id\n @empl... | [
"0.580639",
"0.5567125",
"0.55025566",
"0.5423747",
"0.54208523",
"0.5352708",
"0.5235911",
"0.5227482",
"0.5182025",
"0.5147265",
"0.5127183",
"0.51191145",
"0.510934",
"0.50643814",
"0.50571424",
"0.5054124",
"0.5034288",
"0.50313413",
"0.5007421",
"0.500588",
"0.5005122",
... | 0.6686834 | 0 |
PUT /principal_establecs/1 PUT /principal_establecs/1.json | def update
@principal_establec = PrincipalEstablec.find(params[:id])
respond_to do |format|
if @principal_establec.update_attributes(params[:principal_establec])
format.html { redirect_to @principal_establec, notice: 'Registro editado satisfactoriamente.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @principal_establec.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n send(\"principals=\", client_principal.to_abbreviated)\n client.put(api_path, to_json, headers)\n true\n end",
"def create\n @principal_establec = PrincipalEstablec.new(params[:principal_establec])\n\n respond_to do |format|\n if @principal_establec.save\n format.ht... | [
"0.60064065",
"0.5844642",
"0.57739645",
"0.56477374",
"0.56174105",
"0.56026363",
"0.55793464",
"0.5578456",
"0.54674494",
"0.5463115",
"0.53614503",
"0.5341211",
"0.53187567",
"0.5277541",
"0.5269895",
"0.5243638",
"0.52420896",
"0.5210307",
"0.5192401",
"0.5192401",
"0.519... | 0.6827952 | 0 |
DELETE /principal_establecs/1 DELETE /principal_establecs/1.json | def destroy
@principal_establec = PrincipalEstablec.find(params[:id])
@principal_establec.destroy
respond_to do |format|
format.html { redirect_to principal_establecs_url, notice: 'Registro eliminado satisfactoriamente.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n ... | [
"0.7025236",
"0.68755084",
"0.6595089",
"0.65756476",
"0.6481361",
"0.64799505",
"0.64579874",
"0.6456819",
"0.6456782",
"0.6449694",
"0.64460903",
"0.64247763",
"0.64207405",
"0.64193845",
"0.6413468",
"0.6408376",
"0.6406644",
"0.64042044",
"0.6392073",
"0.63788736",
"0.637... | 0.73490435 | 0 |
returns an array of userIds of the opponents of a bet | def get_bet_opponents(bet_id)
opps = []
Bet.find(bet_id).invites.each do |i|
opps.push i.invitee if i.status == "accepted"
end
return opps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_opponents(game)\n opponents = []\n game.get_players.each do |player|\n if player.get_team(game) != self.get_team(game)\n opponents.push player\n end\n end\n opponents\n end",
"def get_past_teammate_user_ids(participant)\n past_team_associations = TeamsUser.find_all_by_use... | [
"0.67178816",
"0.66381216",
"0.6622362",
"0.6554963",
"0.65111244",
"0.65111244",
"0.65111244",
"0.64689744",
"0.6463699",
"0.6420505",
"0.638433",
"0.6377357",
"0.6377357",
"0.6317945",
"0.6317588",
"0.6302741",
"0.6298207",
"0.6297267",
"0.62927014",
"0.6287805",
"0.6216919... | 0.76749367 | 0 |
attr_accessible :authq, :start, :order, :browse_type | def heading
@heading='Browse'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_order_fields(ar_values, ar_defaults, ar_ascdesc)\n @of_options = ar_values\n @of_defaults = ar_defaults\n @of_ascdes = ar_ascdesc\n end",
"def order_params\n\t\tparams.require(:order).permit(:start_date,:end_date,:location_id, :performer_id, :duration_id, :quality_id, :delivery_time_id, :clip_category... | [
"0.57434744",
"0.56594706",
"0.5595162",
"0.5505733",
"0.5497588",
"0.54849476",
"0.5457964",
"0.5439094",
"0.5438873",
"0.5403383",
"0.5393872",
"0.5390238",
"0.5386956",
"0.53708076",
"0.53612095",
"0.5330128",
"0.5321766",
"0.5318571",
"0.5318571",
"0.5290839",
"0.52847815... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_silicon_metal_mix_bag_content
@silicon_metal_mix_bag_content = SiliconMetal::MixBagContent.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 |
Only allow a trusted parameter "white list" through. | def silicon_metal_mix_bag_content_params
params.require(:silicon_metal_mix_bag_content).permit(:mix_bag_id, :old_bag_no, :weight, :operator)
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.71207976",
"0.705222",
"0.69488335",
"0.69021654",
"0.67362636",
"0.6717561",
"0.6689192",
"0.6678948",
"0.66622657",
"0.6555007",
"0.6527569",
"0.64588845",
"0.64522904",
"0.6450812",
"0.6448551",
"0.6434285",
"0.6412147",
"0.6412147",
"0.6393719",
"0.6381976",
"0.6381976... | 0.0 | -1 |
POST /clubs POST /clubs.json | def create
@club = Club.new(params[:club])
@club.user = current_user
if @club.save
@club.memberships.create!(couple_id: current_user.activeCouple.id, verified: true)
redirect_to root_path, notice: t('club.create')
else
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @club = Club.new(params[:club])\n\n if @club.save\n render json: @club, status: :created, location: @club\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@club = Club.new(club_params)\n\n\t\tif @club.save\n\t\t \trender json: @c... | [
"0.8054806",
"0.7774694",
"0.76952463",
"0.7686164",
"0.7630623",
"0.7630623",
"0.73835504",
"0.73758984",
"0.7167092",
"0.7161889",
"0.7137184",
"0.7117601",
"0.7095895",
"0.70014334",
"0.69563246",
"0.6934114",
"0.6888747",
"0.6851928",
"0.68437815",
"0.6838768",
"0.6835147... | 0.6653323 | 28 |
PUT /clubs/1 PUT /clubs/1.json | def update
@club = Club.find(params[:id])
if @club.update_attributes(params[:club])
redirect_to root_path, notice: t('club.update')
else
render :edit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @club = Club.find(params[:id])\n\n if @club.update_attributes(params[:club])\n head :no_content\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end",
"def update\n @club = Club.find(params[:id])\n\n respond_to do |format|\n if @club.update_... | [
"0.7922199",
"0.7666208",
"0.7636222",
"0.7607505",
"0.74574715",
"0.7454791",
"0.7451092",
"0.7451092",
"0.7451092",
"0.7451092",
"0.7451092",
"0.7314734",
"0.7314734",
"0.7270194",
"0.72480816",
"0.7220248",
"0.72081",
"0.7191481",
"0.7191481",
"0.7191481",
"0.7191481",
"... | 0.70552456 | 28 |
DELETE /clubs/1 DELETE /clubs/1.json | def destroy
@club = Club.find(params[:id])
@club.destroy
respond_to do |format|
format.html { redirect_to root_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.h... | [
"0.8125921",
"0.8125921",
"0.80589193",
"0.80589193",
"0.80283463",
"0.7990399",
"0.7949108",
"0.79312074",
"0.78865546",
"0.78865546",
"0.78865546",
"0.78705937",
"0.78516614",
"0.77526957",
"0.771957",
"0.7699575",
"0.7623334",
"0.7608901",
"0.7604228",
"0.7587584",
"0.7587... | 0.81467396 | 0 |
Array of all builds for the given project that have the status `pending` | def pending_builds(project: nil)
not_implemented(__method__)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_projects\n self.projects.where(:is_canceled => false, :is_finished => false )\n end",
"def pending_refund_payments_projects\n pending_refund_payments.map(&:project)\n end",
"def pending_start_projects\n self.projects.where(:is_canceled => false, :is_started => false ).order(\"shoot_date A... | [
"0.627299",
"0.6206553",
"0.6092597",
"0.6052416",
"0.6046888",
"0.59889466",
"0.5978075",
"0.5974735",
"0.5951394",
"0.59363586",
"0.5922746",
"0.5915245",
"0.5884338",
"0.58668303",
"0.5845658",
"0.58387434",
"0.5796712",
"0.57959735",
"0.579127",
"0.5772402",
"0.5771239",
... | 0.681905 | 0 |
Add or update a build | def add_build!(project: nil, build: nil)
not_implemented(__method__)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bumpBuild()\n\t\t\t\t@build += 1\n\t\t\tend",
"def save!\n client.put_build(app_id: app_id, build_id: id, build: self)\n end",
"def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end",
"def update_buildfile\n buildfile = change_version { |vers... | [
"0.64575064",
"0.6409246",
"0.6197418",
"0.6129657",
"0.60455304",
"0.60054934",
"0.59535253",
"0.5953092",
"0.5916657",
"0.5863953",
"0.585549",
"0.585549",
"0.5829684",
"0.5796988",
"0.5760256",
"0.5744043",
"0.5732501",
"0.57074934",
"0.57074934",
"0.57074934",
"0.57074934... | 0.64793015 | 0 |
For output purposes, use "puts" instead of "print" or "p" | def meal_choice(op1, op2, op3 = "tofu")
puts"What a nutritious meal!"
meal = "A plate of #{op3} with #{op1} and #{op2}."
puts meal
meal
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def puts\n end",
"def puts(*strs); $stdout.puts(*strs) if ENV['DEBUG'] end",
"def puts( *args )\n @output.puts(*args)\n end",
"def pout(str)\n print str\n $stdout.flush\nend",
"def puts(str='')\n output(str)\n end",
"def puts *args\n @output.puts(*args)\n end",
"def print(*args)\n ... | [
"0.7546392",
"0.73657894",
"0.7291295",
"0.7291051",
"0.725948",
"0.72567075",
"0.72204983",
"0.7209738",
"0.71434444",
"0.71417135",
"0.71281224",
"0.7107793",
"0.70547396",
"0.7041029",
"0.7038998",
"0.69841146",
"0.69649035",
"0.6944776",
"0.69404733",
"0.69336826",
"0.691... | 0.0 | -1 |
returns how many courts of the sport passed as parameter the club has if no parameter is sent it passes all quantities | def court_quantity sport=nil
if @sports.blank?
@sports = self.courts.includes(:sport).map {|c| c.sport.name }
end
qty_hash = Hash.new 0
@sports.each do |sp|
qty_hash[sp.downcase] += 1
end
return qty_hash[sport.downcase] unless sport.blank?
qty_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goals_against(club)\n if finished?\n if club == local\n return guest_goals\n end\n\n if club == guest\n return local_goals\n end\n end\n\n 0\n end",
"def create_courts\n futbol = Sport.where(:name => 'futbol').first\n tenis = Sport.where(:name => 'tenis'... | [
"0.5965146",
"0.5913507",
"0.5863452",
"0.5840749",
"0.5828044",
"0.58008087",
"0.57821935",
"0.57807285",
"0.56624246",
"0.56365997",
"0.5624656",
"0.5619406",
"0.5609873",
"0.5599306",
"0.5599264",
"0.5598247",
"0.5598211",
"0.5577597",
"0.5572854",
"0.5563775",
"0.55564755... | 0.7287886 | 0 |
Creates or destroy courts to match the quantity indicated by the user Can be refactored | def create_courts
futbol = Sport.where(:name => 'futbol').first
tenis = Sport.where(:name => 'tenis').first
paddle = Sport.where(:name => 'paddle').first
# court_quantity '*' indicates how many courts already has
# @*_quantity indicates how many tha user wants
### Futbol Courts
diffFutbol = court_quantity('futbol') - @futbol_quantity.to_i
if(diffFutbol > 0)
diffFutbol.times { self.courts.delete(self.courts.where('sport_id = ?',futbol.id).last)}
end
if(diffFutbol < 0)
diffFutbol.abs.times { self.courts.build sport_id: futbol.id }
end
### Tenis Courts
diffTenis = court_quantity('tenis') - @tenis_quantity.to_i
if(diffTenis > 0)
diffTenis.times { self.courts.delete(self.courts.where('sport_id = ?',tenis.id).last)}
end
if(diffTenis < 0)
diffTenis.abs.times { self.courts.build sport_id: tenis.id }
end
### Paddle Courts
diffPaddle = court_quantity('paddle') - @paddle_quantity.to_i
if(diffPaddle > 0)
diffPaddle.times { self.courts.delete(self.courts.where('sport_id = ?',paddle.id).last)}
end
if(diffPaddle < 0)
diffPaddle.abs.times { self.courts.build sport_id: paddle.id }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \n params[:cour][:ecole_id] = ecole.id if ecole?\n\n #Ajout de la classe en groupe\n params[:cour][:classe_room_id].unshift(params[:cour][:first_classe_room_id])\n\n @creneau = params[:cour][:creneau_debut].to_i \n @nombre_heure = params[:cour][:creneau_fin].to_i - params[:co... | [
"0.5989571",
"0.5884454",
"0.58791196",
"0.5794289",
"0.5767527",
"0.5712051",
"0.56974554",
"0.56931835",
"0.56616664",
"0.5661304",
"0.56434244",
"0.5617602",
"0.56034285",
"0.56002253",
"0.5598648",
"0.55969226",
"0.55898094",
"0.5588776",
"0.5566006",
"0.5565932",
"0.5561... | 0.7393915 | 0 |
Sets the value of the property If status is not supplied, the status will default to 200 for nonnull properties, and 404 for null properties. | def set(property_name, value, status = nil)
status = value.nil? ? 404 : 200 if status.nil?
result[property_name] = [status, value]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_status_code\n if self.status_code.nil?\n self.status_code = \"200\"\n end\n end",
"def set_status(val)\n self.status = val\n self\n end",
"def status=(status)\n @_status = status\n end",
"def status=(status)\n @_status = status\n end",
"def status=(s... | [
"0.70338356",
"0.6806251",
"0.6752961",
"0.6752961",
"0.673785",
"0.663394",
"0.66199183",
"0.653434",
"0.650992",
"0.6508947",
"0.6508947",
"0.6508947",
"0.6508947",
"0.6508947",
"0.6508947",
"0.6508947",
"0.6508947",
"0.6508947",
"0.6508947",
"0.6508947",
"0.6508947",
"0.... | 0.79299617 | 0 |
Returns the current value for a property. | def get(property_name)
result.key?(property_name) ? result[property_name][1] : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value\n @property_hash[:value]\n end",
"def get_property(property)\n get_compound_value(get_value(property))\n end",
"def property\n @property\n end",
"def get_value(property)\n if @env_properties.get_value(property)\n return @env_properties.get_value(property)\n end\... | [
"0.78299403",
"0.7591512",
"0.743325",
"0.73214686",
"0.70258915",
"0.6974477",
"0.69694823",
"0.6854283",
"0.68525684",
"0.68348163",
"0.6823198",
"0.6687429",
"0.6646973",
"0.66069996",
"0.65822226",
"0.64987206",
"0.6472641",
"0.64386296",
"0.64160275",
"0.6395094",
"0.638... | 0.0 | -1 |
Returns the current status code for a property name. If the property does not appear in the list of requested properties, null will be returned. | def status(property_name)
result.key?(property_name) ? result[property_name][0] : 404
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_property( propname )\n resp = conn.get('/users/'+name+'/props/'+propname+'/')\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 404\n case resp.header['resource-type']\n when 'user'\n raise RestAuthUserNotFound.new( resp )\n when 'property... | [
"0.6135004",
"0.5816986",
"0.5801187",
"0.5748053",
"0.56408185",
"0.56390136",
"0.56014687",
"0.5557331",
"0.5550417",
"0.5525974",
"0.5520257",
"0.5497238",
"0.5403703",
"0.53703415",
"0.53535676",
"0.5329288",
"0.5230734",
"0.52157766",
"0.52098304",
"0.51871276",
"0.51759... | 0.77607304 | 0 |
Returns all propertynames that have a 404 status, and thus don't have a value yet. | def get404_properties
result = []
self.result.each do |property_name, stuff|
result << property_name if stuff[0] == 404
end
# If there's nothing in this list, we're adding one fictional item.
result << '{http://sabredav.org/ns}idk' if result.empty?
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = Array.new\n if @status.nil?\n invalid_properties.push('invalid value for \"status\", status cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n if @name.nil... | [
"0.6622768",
"0.64270794",
"0.64013624",
"0.64013624",
"0.64013624",
"0.64013624",
"0.64013624",
"0.64013624",
"0.6388563",
"0.63862526",
"0.63862526",
"0.63862526",
"0.63862526",
"0.63862526",
"0.63862526",
"0.63862526",
"0.63862526",
"0.63862526",
"0.63862526",
"0.63862526",
... | 0.78250164 | 0 |
Write a method fizz_buzz(max) that takes in a number max and returns an array containing all numbers greater than 0 and less than max that are divisible by either 4 or 6, but not both. | def fizz_buzz(max)
(1...max).select{|number| (number % 4 == 0 || number % 6 == 0) && !(number % 4 == 0 && number % 6 == 0)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fizz_buzz(max)\n array = []\n i = 1\n while i < max\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n array << i\n end\n i += 1\n end\n return array\n end",
"def fizz_buzz(max)\n\ti = 0\n\tnewArr = []\n \twhile i < max\n if (i % 4 == 0 || i % 6 == 0)... | [
"0.8941768",
"0.8832673",
"0.88196033",
"0.88171816",
"0.88147146",
"0.87851703",
"0.8775829",
"0.87595224",
"0.8743245",
"0.86732525",
"0.8660998",
"0.85907495",
"0.85907495",
"0.85907495",
"0.85394156",
"0.8534281",
"0.8470582",
"0.8429976",
"0.83160853",
"0.82990754",
"0.8... | 0.8511988 | 16 |
in a nonbooting version this should map to _add_singleton_method | def add_function function
raise "not a function #{function}" unless function.is_a? Function
raise "syserr " unless function.name.is_a? Symbol
@functions << function
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def singleton_method_added(*) end",
"def singleton_methods; end",
"def define_singleton_method(symbol, method)\n # TODO\n end",
"def singleton_method_added(meth)\n set_trace_func(nil)\n return super(meth) if meth == :initialize || @@command_options == nil\n @@command_options.merge!(:parameters=>... | [
"0.80261153",
"0.7344698",
"0.7074809",
"0.6992933",
"0.6871653",
"0.6786219",
"0.66744727",
"0.66501844",
"0.66475344",
"0.6633648",
"0.6537008",
"0.65137005",
"0.6469613",
"0.6469613",
"0.64628357",
"0.63895565",
"0.63891417",
"0.6381033",
"0.6349977",
"0.6335969",
"0.62784... | 0.0 | -1 |
Return a hash of options along with defaults and a generated signature | def normalize_options(options)
options.merge!(
:format => @format,
:api_key => @api_key,
:expire => Time.now.to_i + 600 # Grant this request 10 minutes
).merge!(:sig => Utils.generate_signature(options, @api_secret))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature\n if block_given?\n @signature = Signature.new(self, &Proc.new) \n @signature.install\n options do |opt|\n signature.fill_option_parser(opt, self)\n end\n else\n @signature ||= Signature.new(self)\n end\n end",
"def m... | [
"0.7361062",
"0.6828099",
"0.68097854",
"0.6782686",
"0.6717636",
"0.65930074",
"0.6563775",
"0.6563775",
"0.6563775",
"0.6559247",
"0.6513989",
"0.65038675",
"0.64899844",
"0.6482193",
"0.6393485",
"0.63615644",
"0.6342603",
"0.6342603",
"0.6341845",
"0.634138",
"0.63301176"... | 0.68062586 | 3 |
num The Integer from which the next number is calculated. Examples next_number(1) => 2 Returns the next number | def next_number(num)
return num + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_number(num)\n num + 1\n end",
"def next_num(num)\n return num + 1\nend",
"def next_number(num)\n return num += 1\nend",
"def next_number(number)\n number.to_i\n return number+=1\nend",
"def next_number(number)\n return number +1\nend",
"def next_number(number)\n output = nu... | [
"0.87878114",
"0.83470374",
"0.8151548",
"0.796511",
"0.7962804",
"0.7826671",
"0.7774877",
"0.76334405",
"0.74413025",
"0.7128902",
"0.7068094",
"0.70616204",
"0.6914057",
"0.6823982",
"0.6646362",
"0.66071683",
"0.6572752",
"0.65502477",
"0.649349",
"0.64560324",
"0.6418698... | 0.8238713 | 4 |
GET /c_videos/1 GET /c_videos/1.json | def show
@c_video = CVideo.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @c_video }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def list\n @videos = Video.all\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videos = Video.all\n render json: @vide... | [
"0.76379496",
"0.7344656",
"0.7323692",
"0.7167795",
"0.716704",
"0.716704",
"0.716704",
"0.716704",
"0.71265334",
"0.71194375",
"0.7093038",
"0.7083882",
"0.7078058",
"0.7075357",
"0.7067187",
"0.7053308",
"0.7053308",
"0.70165056",
"0.70165056",
"0.70165056",
"0.70165056",
... | 0.7482724 | 1 |
GET /c_videos/new GET /c_videos/new.json | def new
@c_video = CVideo.new
@client_choice = Client.find(:all, :order => "C_LName").collect do |d| [d.C_LName + ", " + d.C_FName, d.id] end
respond_to do |format|
format.html # new.html.erb
format.json { render json: @c_video }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def new\n @video = Video.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n... | [
"0.79415655",
"0.78886294",
"0.7807316",
"0.7806146",
"0.7806146",
"0.7806146",
"0.7806146",
"0.7806146",
"0.7806146",
"0.7806146",
"0.7806146",
"0.7806146",
"0.7806146",
"0.7559155",
"0.74715215",
"0.74391437",
"0.73455477",
"0.73454016",
"0.7272672",
"0.7262401",
"0.7218494... | 0.7068381 | 32 |
POST /c_videos POST /c_videos.json | def create
@c_video = CVideo.new(params[:c_video])
respond_to do |format|
if @c_video.save
format.html { redirect_to @c_video, notice: 'A new video was successfully created.' }
format.json { render json: @c_video, status: :created, location: @c_video }
else
format.html { render action: "new" }
format.json { render json: @c_video.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_videos\n end",
"def create\n @video = Video.new(video_params)\n @video.save!\n render json: @video\n end",
"def create\n @video = @room.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to upload_video_path(@video), notice: 'Vide... | [
"0.74225676",
"0.7299783",
"0.71033835",
"0.69534236",
"0.68433285",
"0.68431693",
"0.68373305",
"0.68243843",
"0.68243843",
"0.68243843",
"0.68243843",
"0.6784164",
"0.67830396",
"0.6768634",
"0.6768634",
"0.6768634",
"0.6768634",
"0.6768634",
"0.6768459",
"0.6753449",
"0.67... | 0.7073725 | 3 |
PUT /c_videos/1 PUT /c_videos/1.json | def update
@c_video = CVideo.find(params[:id])
respond_to do |format|
if @c_video.update_attributes(params[:c_video])
format.html { redirect_to @c_video, notice: 'The video was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @c_video.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @video.update(video_params)\n render json: @video\n end",
"def update\n\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.find(params[:id])\n\n if @video.update(params[:project_video])\n respond_to do |f... | [
"0.72357523",
"0.7062015",
"0.6819968",
"0.6756704",
"0.6756704",
"0.6751023",
"0.67278373",
"0.67241865",
"0.671999",
"0.6717912",
"0.6717912",
"0.6717912",
"0.6717912",
"0.6717912",
"0.6717912",
"0.6717912",
"0.66861665",
"0.663184",
"0.6599693",
"0.6599693",
"0.6599693",
... | 0.7023471 | 2 |
DELETE /c_videos/1 DELETE /c_videos/1.json | def destroy
@c_video = CVideo.find(params[:id])
@c_video.destroy
respond_to do |format|
format.html { redirect_to c_videos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n s3 = $S3\n bucket = s3.buckets['tubeyou.video']\n bucket.objects[@video.name].delete\n\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @video.destroy\n render json: ... | [
"0.74720913",
"0.73984087",
"0.73090214",
"0.73090214",
"0.72935194",
"0.7292421",
"0.7292421",
"0.7292421",
"0.7292421",
"0.7292421",
"0.7292421",
"0.7292421",
"0.7292421",
"0.7292421",
"0.7292421",
"0.7292421",
"0.7292421",
"0.7289624",
"0.72776693",
"0.72776693",
"0.727766... | 0.7571032 | 0 |
Show the main list container | def show
setup_download_list
render partial: "browse_#{view_type}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n initLists\n end",
"def show_list\n\t\t\t@my_list.show\n\t\tend",
"def show_list\n process_show_list\n end",
"def view \n puts\n puts \"VIEW LIST\"\n\n items.each_with_index do |item, index| \n puts \"#{index+1}. #{item}\"\n end\n end",
"def show_list\n... | [
"0.77565867",
"0.7183316",
"0.6863811",
"0.6838491",
"0.68163884",
"0.67006576",
"0.6496028",
"0.64407414",
"0.6431495",
"0.64216626",
"0.64216626",
"0.6394709",
"0.63712436",
"0.6295487",
"0.62670946",
"0.61754817",
"0.609477",
"0.6061161",
"0.6033677",
"0.6009429",
"0.59917... | 0.0 | -1 |
Return the file list content as JSON for rendering in the list container The actual metadata returned varies based on the view_type requested, in order to speed up large directories | def content
setup_download_list
except_list = case view_type
when 'icons'
%i[file_metadata last_process_name_run updated_at created_at user_id file_hash
content_type nfs_store_stored_file_id]
else
%i[file_metadata last_process_name_run description updated_at created_at user_id file_hash
content_type nfs_store_stored_file_id]
end
extras = {
except: except_list,
allow_show_flags: @allow_show_flags,
limited_results: true
}
tfa = @container.user_file_actions_config&.map { |a| a[:id] }
ff = NfsStore::Filter::Filter.human_filters_for(@activity_log)
dl_json = @downloads.as_json(extras)
render json: {
nfs_store_container: {
id: @container.id,
name: @container.name,
container_files: dl_json,
item_type: 'nfs_store_container',
writeable: @container.writable?,
readable: @container.readable?,
can_download_or_view: @container.can_download_or_view?,
can_download: @container.can_download?,
can_send_to_trash: @container.can_send_to_trash?,
can_move_files: @container.can_move_files?,
can_rename_files: @container.can_move_files?,
can_rename_folders: @container.can_move_files?,
can_user_file_actions: @container.can_user_file_actions?,
parent_type: @activity_log.class.to_s.ns_underscore,
parent_id: @activity_log.id,
parent_sk: @activity_log.respond_to?(:secondary_key) && @activity_log.secondary_key,
master_id: @activity_log.master_id,
trigger_file_action_ids: tfa,
directory_not_found: @directory_not_found,
filters_for: ff,
view_options: @container.view_options
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n r... | [
"0.6995037",
"0.6731227",
"0.6723786",
"0.66914433",
"0.65439194",
"0.65369254",
"0.6516771",
"0.6492961",
"0.6372714",
"0.63477516",
"0.63052166",
"0.6275796",
"0.62591004",
"0.62393045",
"0.61822623",
"0.61689866",
"0.6135253",
"0.61291194",
"0.61150324",
"0.61150324",
"0.6... | 0.7120745 | 0 |
Type of filestore browser requested | def view_type
@view_type = ValidViewTypes.find { |vt| vt == params[:view_type] } || DefaultViewType
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ftype\n :file\n end",
"def ftype() end",
"def ftype() File.ftype(path) end",
"def file_type\r\n\t\t@file_type\r\n\tend",
"def cache_store_type\n \"file\"\n end",
"def file_type\n FILE_TYPES[@file_type]\n end",
"def web_viewer_type\n # Add more conditions as and when supported\n ... | [
"0.7297137",
"0.6918949",
"0.6597207",
"0.6548214",
"0.65420896",
"0.6474147",
"0.638396",
"0.63555723",
"0.6312229",
"0.62969065",
"0.6272009",
"0.6262682",
"0.6262682",
"0.6262682",
"0.6262682",
"0.6233425",
"0.6225005",
"0.61464465",
"0.61413985",
"0.6137388",
"0.6135113",... | 0.0 | -1 |
Setup the list of download file items, handling item flags if needed. | def setup_download_list
return unless @container.readable?
# Check if we should show flags for classifications on each of the types of container file
@allow_show_flags = {}
%i[stored_file archived_file].each do |rt|
full_name = "nfs_store__manage__#{rt}"
show_flag = !!Classification::ItemFlagName.enabled_for?(full_name, current_user)
@allow_show_flags[rt] = show_flag
end
# List types should we include flags for in the queries that return the stored_files and archived_files
show_flags_for = @allow_show_flags.filter { |_k, v| v }.keys.map { |i| i.to_s.pluralize.to_sym }
@downloads = Browse.list_files_from @container, activity_log: @activity_log, include_flags: show_flags_for
# Prep a download object to allow selection of downloads in the browse list
@download = Download.new container: @container, activity_log: @activity_log
rescue FsException::NotFound
@directory_not_found = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_items(selected_items, for_action)\n # Retrieve each file's details. The container_id will be passed if this is a\n # multi container download, otherwise it will be ignored\n selected_items.each do |s|\n container = self.container || Browse.open_container(id: s[:container_id], user: ... | [
"0.7192753",
"0.5699413",
"0.5591785",
"0.5428122",
"0.53840667",
"0.53437716",
"0.53226024",
"0.5298365",
"0.5285891",
"0.52695596",
"0.52055764",
"0.5192494",
"0.5182384",
"0.5180816",
"0.5177297",
"0.517034",
"0.51582044",
"0.51190865",
"0.510657",
"0.50914764",
"0.5091476... | 0.73778343 | 0 |
return the class for the current item handles namespace if the item is like an ActivityLog:Something | def primary_model
NfsStore::Manage::Container
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_type\n self.class.name.singularize.ns_underscore\n end",
"def item_class\n item_type&.classify&.constantize\n end",
"def get_type(item)\n \t\t\treturn item.class.name.split(\":\").last\n \t\tend",
"def item_type\n name.singularize.ns_underscore\n end",
"def item_class\n ... | [
"0.72199434",
"0.7113705",
"0.68576264",
"0.6784852",
"0.67243147",
"0.6512567",
"0.6512567",
"0.65103424",
"0.64893484",
"0.64740723",
"0.64421993",
"0.64382684",
"0.6437503",
"0.62224096",
"0.61740714",
"0.61300004",
"0.60859525",
"0.60859525",
"0.607752",
"0.6059144",
"0.6... | 0.0 | -1 |
notice the double underscore for namespaced models to indicate the delimiter to remain consistent with the associations | def full_object_name
'nfs_store__manage__container'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def property_prefix\n # TODO: try to use the inverse relationship name if possible\n Extlib::Inflection.underscore(Extlib::Inflection.demodulize(parent_model.base_model.name)).to_sym\n end",
"def ar_model_symbol\n ar_model.to_s.underscore.gsub(/\\//, '_')\n end",
"def _model_full_n... | [
"0.65487075",
"0.6534474",
"0.65272534",
"0.6246373",
"0.6186009",
"0.6170175",
"0.602461",
"0.6017012",
"0.59928405",
"0.59361976",
"0.5911939",
"0.5864012",
"0.586389",
"0.5807848",
"0.58041316",
"0.5793602",
"0.57756174",
"0.57756174",
"0.57482904",
"0.5729816",
"0.5720436... | 0.0 | -1 |
the association name from master to these objects for example player_contacts or activity_log__player_contacts_phones notice the double underscore for namespaced models to indicate the delimiter | def objects_name
:nfs_store__manage__containers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_association_name\n full_implementation_class_name.pluralize.ns_underscore.to_sym\n end",
"def property_prefix\n # TODO: try to use the inverse relationship name if possible\n Extlib::Inflection.underscore(Extlib::Inflection.demodulize(parent_model.base_model.name)).to_sym\n ... | [
"0.7518692",
"0.7183457",
"0.7131547",
"0.7044796",
"0.69236636",
"0.68153536",
"0.68153536",
"0.6707378",
"0.66962796",
"0.66469634",
"0.6593404",
"0.65805036",
"0.65756255",
"0.65550715",
"0.6538172",
"0.64946586",
"0.64844793",
"0.64797634",
"0.64797634",
"0.64397645",
"0.... | 0.0 | -1 |
CONSTRUCTOR c = numerator d = denominator | def initialize(primes,c=0,d=1)
@primes = primes
@residues = []
if(c!=0)
primes.each do |p|
@residues << Padic.hensel_code(p,1,c,d)
end
else
@residues = Array.new(primes.size,0)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(n,d) #initilize is a reserved work for a constructor in ruby\n @numerator = n\n @denominator = d\n end",
"def numerator() end",
"def denominator() end",
"def numerator\n\t\tan = @a.numerator\n\t\tbn = @b.numerator\n\t\tad = @a.denominator\n\t\tbd = @b.denominator\n\t\tabd = ad... | [
"0.79395413",
"0.7437156",
"0.7402314",
"0.717763",
"0.7013709",
"0.68929815",
"0.6845381",
"0.678332",
"0.6584088",
"0.65358627",
"0.6514931",
"0.64362913",
"0.62976664",
"0.6297248",
"0.6289035",
"0.6289035",
"0.62650573",
"0.6204994",
"0.61965454",
"0.6163776",
"0.6120926"... | 0.0 | -1 |
Given: 'This is the best' Return: 'best the is This' As part of this exercise you should remove all leading and trailing whitespace. So that inputs such as: ' space here' and 'space here ' both become: 'here space' | def reversal(sentence)
sentence.split(' ').reverse.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup(str)\n str.gsub(/([^a-z])/, ' ').squeeze(' ')\nend",
"def cleanup(input)\n input.gsub(/[^a-zA-Z]/, ' ').squeeze(' ')\nend",
"def normalize_whitespace(input)\n input.to_s.gsub(%r!\\s+!, \" \").tap(&:strip!)\n end",
"def dewhitespace\n gsub(/\\s+/,' ').strip\n end",
"def cleanup(str... | [
"0.75317085",
"0.7494958",
"0.7484309",
"0.7325645",
"0.72946334",
"0.72815096",
"0.72740895",
"0.7260003",
"0.7245805",
"0.722515",
"0.72219664",
"0.72097844",
"0.7208126",
"0.71972007",
"0.7180246",
"0.7164524",
"0.7160159",
"0.7153445",
"0.7151262",
"0.7133045",
"0.7121906... | 0.0 | -1 |
A frequent practice is to place the standard CRUD actions in each controller in the following order: index, show, new, edit, create, update and destroy. index(): show a list of recipes | def index()
@recipes, @options = model_recipes({})
@title = @options[:title]
# continue to /views/recipes/index.html.erb with @recipes, @title
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n # @recipes = Recipe.all\n end",
"def index\n #We want to retrieve data from the database and pass these data to the \"INDEX VIEW\". We'll do using this variable\n #We will sort all recipes based on the thumb-up counter. We must use \"REVERSE\" method because by default sorting starts from t... | [
"0.72133416",
"0.7204634",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7106963",
"0.7057108",
"0.70115954",
"0.7006986",
"0.69713455",
... | 0.0 | -1 |
Returns the Recipe object for the recipe id specified in the url params. | def set_recipe
@recipe = Recipe.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def find_recipe\n @recipe = Recipe.find(params[:id])\n end",
"def show\n recipe_id = params[:id].to_i\n @recipe = Recipe.find(recipe_id)\n end",
"def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n... | [
"0.7689893",
"0.7534472",
"0.75137156",
"0.7370697",
"0.7344835",
"0.7227298",
"0.7195498",
"0.7134615",
"0.71146107",
"0.7011195",
"0.7011195",
"0.6993181",
"0.69713795",
"0.6968259",
"0.6967425",
"0.69656247",
"0.69656247",
"0.69656247",
"0.69656247",
"0.69656247",
"0.69656... | 0.68865424 | 63 |
Returns true/false. True = logged in user is owner/Chef of the Recipe object that is the target of this action. | def require_same_user_or_admin
# Note: set_recipe has already been executed first because of before_action above and @recipe object now exists.
if (current_user != @recipe.chef) && !current_user.admin?
flash[:danger] = "You can only edit your own recipes"
redirect_to recipes_path
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner?\n resource.user_id == current_user.id\n end",
"def authorized_to_edit?(recipe)\n current_user == recipe.user\n end",
"def owner?(current_user)\n current_user && (self.user == current_user || current_user.has_role?(:refinery))\n end",
"def user_is_owner?\n current_coo... | [
"0.7813916",
"0.7798049",
"0.7795254",
"0.7769665",
"0.766255",
"0.7643245",
"0.75947046",
"0.7588064",
"0.7587782",
"0.75078046",
"0.7507658",
"0.74990517",
"0.74274623",
"0.7421894",
"0.74191236",
"0.7410034",
"0.7325981",
"0.7325981",
"0.73257893",
"0.7314631",
"0.73024523... | 0.7265584 | 23 |
GET /spents GET /spents.json | def index
@spents = Spent.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @points_spents = PointsSpent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_spents }\n end\n end",
"def show\n @stundent = Stundent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n form... | [
"0.66863346",
"0.6218785",
"0.6188353",
"0.6137427",
"0.6125209",
"0.6122911",
"0.6090993",
"0.59377146",
"0.59064674",
"0.58739614",
"0.586759",
"0.58445305",
"0.58069",
"0.5785005",
"0.5776749",
"0.576828",
"0.5742789",
"0.5697812",
"0.56844914",
"0.5678075",
"0.56020933",
... | 0.7046632 | 0 |
GET /spents/1 GET /spents/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @spents = Spent.all\n end",
"def index\n @points_spents = PointsSpent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_spents }\n end\n end",
"def show\n @stundent = Stundent.find(params[:id])\n\n respond_to do |format|... | [
"0.6803169",
"0.66474986",
"0.6499228",
"0.62448823",
"0.6188258",
"0.60508126",
"0.6022834",
"0.6000953",
"0.59974337",
"0.59965026",
"0.599127",
"0.5971303",
"0.5963322",
"0.59544873",
"0.5903539",
"0.588983",
"0.5881748",
"0.5877707",
"0.5858243",
"0.584796",
"0.584796",
... | 0.0 | -1 |
POST /spents POST /spents.json | def create
@spent = Spent.new(spent_params)
respond_to do |format|
if @spent.save
format.html { redirect_to @spent, notice: 'Spent was successfully created.' }
format.json { render :show, status: :created, location: @spent }
else
format.html { render :new }
format.json { render json: @spent.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, ur... | [
"0.5915685",
"0.5810478",
"0.5743416",
"0.561621",
"0.5596164",
"0.5568079",
"0.5501657",
"0.54477894",
"0.5420697",
"0.5381398",
"0.5340402",
"0.5324662",
"0.5305585",
"0.5295365",
"0.52871805",
"0.52682865",
"0.5263237",
"0.5242624",
"0.52214664",
"0.5216364",
"0.5207321",
... | 0.58148843 | 1 |
PATCH/PUT /spents/1 PATCH/PUT /spents/1.json | def update
respond_to do |format|
if @spent.update(spent_params)
format.html { redirect_to @spent, notice: 'Spent was successfully updated.' }
format.json { render :show, status: :ok, location: @spent }
else
format.html { render :edit }
format.json { render json: @spent.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render ac... | [
"0.638348",
"0.6136221",
"0.6115271",
"0.60960454",
"0.60715973",
"0.60568845",
"0.60533136",
"0.60296375",
"0.5987283",
"0.5966251",
"0.59660065",
"0.59563744",
"0.59528196",
"0.5939921",
"0.5938723",
"0.5889873",
"0.5869043",
"0.58597594",
"0.58588654",
"0.5854152",
"0.5846... | 0.5598183 | 59 |
DELETE /spents/1 DELETE /spents/1.json | def destroy
@spent.destroy
respond_to do |format|
format.html { redirect_to incomes_url, notice: 'Spent was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @stundent = Stundent.find(params[:id])\n @stundent.destroy\n\n respond_to do |format|\n format.html { redirect_to stundents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do... | [
"0.7005292",
"0.67746216",
"0.67580026",
"0.66465974",
"0.66398007",
"0.66389585",
"0.66207933",
"0.6606647",
"0.65488535",
"0.65470123",
"0.65398306",
"0.65380067",
"0.65334606",
"0.6529416",
"0.6519053",
"0.65132016",
"0.65132016",
"0.65115726",
"0.6499154",
"0.64989763",
"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_spent
@spent = Spent.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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.