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
sums the series: basem, base(m+1)...base(n1), base(n) Assumes exponents are positive integers, and first_exp 2^0 + 2^1 + 2^2 + 2^3 Returns base^exp, if first_exp = second_exp (trivial case) Returns 'nil' if first_exp > second_exp, or exponents not positivbe integers
def sum_base_to_exponent_series(base, first_exp, second_exp) sum = 0 if (first_exp.is_a?(Integer) && second_exp.is_a?(Integer) && first_exp <= second_exp && first_exp >= 0 && second_exp >= 0) if first_exp == second_exp sum = base**first_exp else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_base_2_number(pow = 1)\n (2**pow).to_s.split('').map(&:to_i).inject(:+)\nend", "def rec_exp_1(base, power)\nend", "def rec_exp_2(base, power)\nend", "def power_digit_sum(base, exponent)\n\t(2 ** 1000).to_s.split(\"\").inject(0) {|sum, n| sum + n.to_i}\nend", "def exp1(base, n)\n return 1 if n =...
[ "0.6745065", "0.6632199", "0.66135454", "0.6524792", "0.6473241", "0.64234036", "0.63033384", "0.62924904", "0.6276634", "0.62561995", "0.6239749", "0.6203269", "0.6167198", "0.6165442", "0.6144075", "0.61336285", "0.61278594", "0.6127639", "0.61219263", "0.6108432", "0.61023...
0.8149083
0
p "Hello World" end say_hello def sayHello(greeting) p greeting end sayHello("Good evening") def add(num01, num02) p num01 + num02 end add(6, 2) def add(num01, num02) return num01 + num02 end add_result = add(6, 2) p add_result
def average(num01, num02, num03) return (num01 + num02 + num03) / 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add (a, b)\n puts \"Adding #{a} + #{b}\"\n return a+b\nend", "def add(a, b)\n puts \"Add #{a} + #{b}\"\n return a + b\nend", "def add(a, b)\n puts \"addng #{a} + #{b}\"\n return a + b\nend", "def add(a, b)\n\tputs \"Adding #{a} + #{b}\\n\"\n\treturn a + b\n\nend", "def add(a,b)\n puts \"Adding #...
[ "0.8245984", "0.81725264", "0.8168753", "0.81513226", "0.8099404", "0.8098024", "0.8079049", "0.80449384", "0.80449384", "0.8017992", "0.800409", "0.800409", "0.800409", "0.7993886", "0.79398483", "0.793644", "0.7926613", "0.79179037", "0.79147065", "0.7898445", "0.78460443",...
0.0
-1
Available metadata are : url, label, nbhomograph, score, nature
def metadatas(response:) if response_ok?(response: response) parse_result(body: response.body) else Rails.logger.warn 'Dictionnaire-Academie failed in ' \ "its seach for #{word}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata\n {\n title: flickr_title,\n description: description\n }\n end", "def metadata\n @meta_data\n end", "def meta\n...
[ "0.71635", "0.71635", "0.71635", "0.71635", "0.71635", "0.71635", "0.71635", "0.7005023", "0.67693895", "0.6684788", "0.6489462", "0.64442337", "0.64356923", "0.63780254", "0.6355773", "0.6252556", "0.6252556", "0.6245898", "0.62441194", "0.6228329", "0.6228329", "0.6227448...
0.0
-1
Example: Input: [2, 1, 3, 4, 1, 2, 1, 5, 4] Output: 6 Explanation: [4,1,2,1] has the largest sum = 6. Follow up: If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle.
def max_sub_array(numbers) max = numbers[0] (1...numbers.size).each do |idx| current_sum = numbers[idx] + numbers[idx - 1] numbers[idx] = current_sum if current_sum > numbers[idx] max = numbers[idx] if numbers[idx] > max end max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimized_largest_subsum(arr)\n max = arr.first\n sum = arr.first \n arr.shift\n arr.each do |el|\n sum += el\n if el > max && el > sum \n max = el \n sum = el \n elsif sum > max\n max = sum\n end \n end \n max\nend", "def largest_sum_arr_n2(arr)\n list = []\n i = 0\n whil...
[ "0.77887315", "0.7764424", "0.769981", "0.763341", "0.7622439", "0.7581459", "0.7525786", "0.7488166", "0.7477562", "0.7471363", "0.7465058", "0.7457307", "0.7452194", "0.74472725", "0.7442229", "0.74417573", "0.7439776", "0.7425036", "0.742079", "0.7418939", "0.7398655", "...
0.0
-1
call from unauthenticated actions that want current_user if available
def set_current_user # for access to authenticate method t = ActionController::HttpAuthentication::Token @current_user = t.authenticate(self, &AUTH_PROC) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_current_user\n current_user\n authorize\n end", "def current_user\n\t\t@current_user ||= authorize_request\n\tend", "def current_user\n @current_user ||= authorize_request\n end", "def current_user\n @current_user ||= authorize_request\n end", "def current_user\n nil\n...
[ "0.7672984", "0.76452863", "0.7631483", "0.7631483", "0.7595083", "0.75813127", "0.74963737", "0.7456062", "0.74307525", "0.74307525", "0.739522", "0.7351485", "0.73496693", "0.7346652", "0.7345665", "0.73454344", "0.7335022", "0.73241764", "0.732219", "0.7305931", "0.7304497...
0.0
-1
This method is based on the implementation in twitterbootstraprails. It has been slightly edited. See
def bootstrap_flash messages = flash.flat_map do |type, message| next if message.blank? type = type.to_sym type = :success if type == :notice type = :danger if type == :alert type = :danger if type == :error next unless ALERT_TYPES.include?(type) options = { class...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_bootstrap; end", "def before_bootstrap\n end", "def private; end", "def after_bootstrap\n end", "def html_classes; end", "def bootstrap_init\n end", "def after_view_setup\n end", "def input_html_classes; end", "def initialize_html_tags; end", "def pagination_links(obj...
[ "0.59120595", "0.57880944", "0.55023664", "0.5421375", "0.52382725", "0.5178643", "0.5030141", "0.49202925", "0.48784065", "0.48398462", "0.4801357", "0.47817773", "0.47817773", "0.47817773", "0.4726089", "0.47239262", "0.47233304", "0.47056603", "0.4699905", "0.46969587", "0...
0.0
-1
Plus initializer... this will likely be fixed later ... DEFINITELY gonna be fixed soon, this is so ugly
def initialize network: super network[:type], network[:struct], act_fn: network[:act_fn] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize() end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def ...
[ "0.7433664", "0.7433664", "0.7433664", "0.7433664", "0.7433664", "0.7410543", "0.7281168", "0.7281168", "0.7281168", "0.7281168", "0.7281168", "0.7281168", "0.7281168", "0.7281168", "0.7281168", "0.7281168", "0.7281168", "0.7270239", "0.7270239", "0.7270239", "0.7270239", "...
0.0
-1
We reimplement created_at but leave updated_at unimplemented so that we can set it ourselves.
def set_timestamps self.created_at = Time.now #Set updated_at initially before manually setting because column cannot be null. self.updated_at = Time.now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_at; super; end", "def created_at; end", "def created_at=(_arg0); end", "def set_created_at\n if !timeless? && !created_at\n time = Time.configured.now\n self.updated_at = time if is_a?(Updated) && !updated_at_changed?\n self.created_at = time\n end\n ...
[ "0.82227004", "0.7883998", "0.788314", "0.7670101", "0.76289743", "0.7537689", "0.75163126", "0.74530387", "0.72943956", "0.7282098", "0.72775656", "0.72767836", "0.7252003", "0.72140354", "0.716192", "0.716192", "0.716192", "0.71449715", "0.7098751", "0.7077208", "0.7074179"...
0.7057025
21
iterate over and find ... if found... select and put into an array counting how many items in the array
def get_occupation(data, hometown) # code here occupation = nil data.each do |key1, value1| value1.each do |key_value_pair| if key_value_pair["hometown"] == hometown occupation = key_value_pair["occupation"] break end end end occupation end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_count\n array = self.my_select {|item| yield item}\n array.length\n end", "def count_elements(array)\n new_array = []\n\n array.each do |original_array_element|\n\n #now inside the array looking at each indv hash\n \tif new_array.empty?\n\n \t\tfirst_new_element = {name: original_array_element...
[ "0.66130316", "0.6239821", "0.6126654", "0.61057043", "0.60812604", "0.60614747", "0.6009859", "0.5978063", "0.5955366", "0.59545875", "0.5944068", "0.5937777", "0.5913292", "0.58522654", "0.58372915", "0.581719", "0.5797452", "0.57965857", "0.57927793", "0.57775444", "0.5775...
0.0
-1
GET /projects GET /projects.json
def index @projects = Project.all if params[:filtered] @custom_search = true end if params[:search] @projects = Project.search(params[:search]).order("created_at DESC") else @projects = Project.all.order("created_at DESC") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listprojects\n get('listprojects.json')['projects']\n end", "def list\n get 'projects'\n end", "def projects\n request(method: 'getAllProjects')\n end", "def projects\n resource 'projects'\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n e...
[ "0.8574897", "0.8386689", "0.8355737", "0.8062607", "0.80368364", "0.8002139", "0.78593457", "0.7834634", "0.78324", "0.7799698", "0.77792805", "0.7748103", "0.77139485", "0.7700251", "0.7696023", "0.7695487", "0.7695487", "0.7695487", "0.7695487", "0.7695487", "0.7695487", ...
0.0
-1
GET /projects/1 GET /projects/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def projects\n...
[ "0.7868971", "0.76979554", "0.7680216", "0.7611453", "0.75334454", "0.75258976", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74924207", "0.7484109", "0.7479275", "0.7444873", "0.74294627", "0.74224764", "0.7414947", "0....
0.0
-1
POST /projects POST /projects.json
def create @project = Project.new(project_params) @project.user_id = current_user.id respond_to do |format| if @project.save format.html { redirect_to @project, success: 'Project was successfully created.' } format.json { render :show, status: :created, location: @project } el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new...
[ "0.7338293", "0.73130125", "0.7307476", "0.7298852", "0.7226645", "0.7225086", "0.71968895", "0.7115993", "0.7104099", "0.70948637", "0.7070004", "0.7039725", "0.7034717", "0.70244694", "0.7018911", "0.7008889", "0.6983907", "0.6974434", "0.6963028", "0.69624406", "0.6948445"...
0.6648931
89
PATCH/PUT /projects/1 PATCH/PUT /projects/1.json
def update respond_to do |format| if @project.update(project_params) format.html { redirect_to @project, info: 'Project was successfully updated.' } format.json { render :show, status: :ok, location: @project } else format.html { render :edit } format.json { render json: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end", "def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\...
[ "0.70004326", "0.69119745", "0.6911138", "0.6889052", "0.6888448", "0.6878091", "0.68675476", "0.6857582", "0.685334", "0.685334", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68...
0.0
-1
DELETE /projects/1 DELETE /projects/1.json
def destroy if @project.user_id != current_user.id and current_user.admin == false return redirect_to root_path, danger: "Only admin user can delete this project" end @project.destroy respond_to do |format| format.html { redirect_to projects_url, success: 'Project was successfully destroyed....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pr...
[ "0.78951", "0.78593713", "0.7778056", "0.7771693", "0.77585995", "0.7730887", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77244985", "0.7718401", "0.7718401", "0.7718401", "0.7718401", "0.7704753", "0.7704753", "0.7704753", "0.7704753", "0.7704753...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_project @project = Project.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def project_params params.require(:project).permit(:title, :description, :goal, :duration, :markdown, :outstanding, :main_image, category_ids: []) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
string.split(" ") = ["Hello", "there,", "and", "how", "are", "you?"] array = ["Hello", "there,", "and", "how", "are", "you?"] array.reverse_each = ["olleH", "ereht,", "dna", "woh", "era", "?uoy"
def reverse_each_word(string) array = string.split new_array = [] array.collect do |string| new_array.push(string.reverse) end new_array.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_each_word_with_each(string)\n original_array = string.split(\" \")\n return_array = []\n original_array.each do |string|\n return_array << string.reverse\n end\n return_array.join(\" \")\n\nend", "def reverse_each_word(string)\n split_array = string.split(' ')\n reversed = []\n split_array.ea...
[ "0.80633825", "0.78274935", "0.7817646", "0.781217", "0.7809727", "0.77886355", "0.7777532", "0.77596", "0.7757672", "0.77559143", "0.77505636", "0.77380085", "0.7734981", "0.7732814", "0.7699341", "0.76940763", "0.7664423", "0.7663534", "0.7662147", "0.7662048", "0.765288", ...
0.74773896
60
NO VIEW TEMPLATE Linked from account/preferences/_privacy bulk_filename_purge
def update Image.where(user_id: User.current_id).update_all(original_name: "") flash_notice(:prefs_bulk_filename_purge_success.t) redirect_to(edit_account_preferences_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_name\n 'unused'\n end", "def delete_fragments\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/browse/category_id/' + self.id.to_s )\n\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/shared_symbiont/symbiote_wrapper_container/symbiote_item_category_id/' + self.id.to_s )\n\...
[ "0.5718153", "0.55457807", "0.5495424", "0.540882", "0.53963405", "0.52423024", "0.5186017", "0.51778716", "0.51776326", "0.51735777", "0.5148203", "0.51074004", "0.5094198", "0.5092664", "0.5091207", "0.5089462", "0.5087719", "0.5080943", "0.5072686", "0.50652784", "0.506052...
0.49025226
40
returns the array with error letters
def errors @user_guesses - normalized_letters end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(name)\n array name, required: false do |s|\n s.string\n end\n end", "def error\n []\n end", "def loose_errors\n err = []\n err << title\n err << authors\n err << s3_error_uploads\n err << url_error_validating\n\n err.flatten\n ...
[ "0.6885124", "0.68481314", "0.65918285", "0.6453857", "0.639925", "0.6332116", "0.6296849", "0.629186", "0.6241251", "0.6221037", "0.61755127", "0.6170697", "0.6170697", "0.6121758", "0.6120652", "0.61092466", "0.60883766", "0.60883766", "0.60802764", "0.6075781", "0.6071082"...
0.66634756
2
returns number of errors
def errors_made errors.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_count\n return @error_count\n end", "def count\n errors.count\n end", "def NumErrors\n Builtins.size(@errors)\n end", "def errors_count\n @error_rows_codes.count\n end", "def errors_count\n @error_rows_codes.count\n end", "def errors_count\n...
[ "0.8684961", "0.836196", "0.83341783", "0.82288563", "0.82288563", "0.82288563", "0.80139995", "0.8004782", "0.79705036", "0.7631777", "0.7490927", "0.74772096", "0.74536073", "0.74502033", "0.74251884", "0.7306997", "0.7266018", "0.724427", "0.724427", "0.7221631", "0.719594...
0.8205057
6
returns the number of errors lest
def errors_allowed TOTAL_ERRORS_ALLOWED - errors_made end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_count\n return @error_count\n end", "def error_count\n peek(\"#{testbench_top}.debug.errors\").to_i\n end", "def NumErrors\n Builtins.size(@errors)\n end", "def errors_made\n errors.length\n end", "def error_count\n peek('origen.debug.errors').to...
[ "0.8013918", "0.7972357", "0.77702326", "0.76749706", "0.7481861", "0.7373196", "0.7317007", "0.7317007", "0.7317007", "0.7215685", "0.7215685", "0.7204756", "0.71702707", "0.7082253", "0.7001549", "0.69353104", "0.6934013", "0.69311494", "0.68705237", "0.6817181", "0.6742872...
0.7257373
9
returns the array of letters, which are left to guess
def letters_to_guess @letters.map do |letter| if @user_guesses.include?(normalize_letter(letter)) letter else nil end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_letters\n guess_array = []\n @current_word.each do\n guess_array << \"_\"\n end\n return guess_array\n end", "def guessed_letters()\n guessed = $bucket.join(\" \") # return a string of guessed letters\nend", "def check_guess(letter)\n\t\tret = []\n\t\tif(@secret_word.include?(lett...
[ "0.83717734", "0.76092356", "0.7403644", "0.73906", "0.7341107", "0.7259141", "0.7250252", "0.71186", "0.7107187", "0.69222337", "0.6911611", "0.6904964", "0.6879654", "0.68753994", "0.6873055", "0.68552655", "0.6841495", "0.6822786", "0.68145984", "0.68145984", "0.67986995",...
0.79954636
1
the next three methods check whether the game is won, lost or is already over the game is lost if there are no errors left
def lost? errors_allowed == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_lost\n\t\tif @guess_count == @number_guess + 1\n\t\t\t@game_over = 2\n\t\tend\n\t\t@game_over\n\tend", "def check_win\n if @game_board.return_count == 5 and @timer.return_time >= 0\n @win = true\n end\n if @game_board.return_count < 5 and @timer.return_time == 0\n @lose = true\n ...
[ "0.80396205", "0.76528126", "0.7486093", "0.7463803", "0.73961127", "0.7348537", "0.73139834", "0.72851336", "0.7265934", "0.72365624", "0.7236358", "0.71909916", "0.7185107", "0.7182554", "0.7171043", "0.7162245", "0.7141368", "0.7125404", "0.71241695", "0.71201646", "0.7101...
0.7018597
32
method plays the letter, chosen by user it puts the letter into the array of user guesses
def play!(letter) if !over? && !@user_guesses.include?(letter) @user_guesses << normalize_letter(letter) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_players_letter()\n letter= @player1.give_letter()\n if @hiddenword1.determine_if_correct_letter_given(letter)\n p @hiddenword1.obscured_word\n @guessed_letters.push(letter)\n else\n @player1.lives-=1\n p \"Please try again\"\n p @guessed_letters\n p @hiddenword1....
[ "0.7819657", "0.74802244", "0.74758935", "0.7473382", "0.7470513", "0.7463379", "0.7428028", "0.74274343", "0.742174", "0.7416329", "0.7352845", "0.73427355", "0.7332662", "0.73032117", "0.7283592", "0.72802657", "0.72511613", "0.7247099", "0.72414386", "0.7233034", "0.722753...
0.81299454
0
the method merges the letters to the word
def word @letters.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertions\n new_words = []\n @words.each do |word|\n @word = word || '' \n (length + 1).times do |i|\n ('a'..'z').each { |c| new_words << \"#{@word[0...i]}#{c}#{@word[i..-1]}\" }\n end\n end\n new_words\n end", "def ordered_letters\n @word.chars.s...
[ "0.6957881", "0.6812398", "0.6796432", "0.6794042", "0.6770985", "0.67527235", "0.67447853", "0.6704794", "0.66879094", "0.6662192", "0.65762955", "0.6547677", "0.65325296", "0.648715", "0.64836806", "0.6450129", "0.6446887", "0.64426637", "0.64330477", "0.643056", "0.6428144...
0.72019935
0
Task body for the :docs_debug task
def do_docs_debug( task, args ) self.prompt.say( "Docs are published to:", color: :bright_green ) if ( publish_url = self.publish_to ) self.prompt.say( self.indent(publish_url, 4) ) else self.prompt.say( self.indent("n/a"), color: :bright_yellow ) end self.prompt.say( "\n" ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc_task; end", "def define_debug_tasks\n\t\ttask( :base_debug ) do\n\t\t\tself.output_documentation_debugging\n\t\t\tself.output_project_files_debugging\n\t\t\tself.output_dependency_debugging\n\t\tend\n\n\t\ttask :debug => :base_debug\n\tend", "def rdoc_task_description\n 'Build RDoc HTML files'\n en...
[ "0.70848274", "0.65630335", "0.6512884", "0.640787", "0.6406908", "0.6014486", "0.59714633", "0.59714633", "0.5910287", "0.5891495", "0.5885187", "0.5845575", "0.58450913", "0.5750026", "0.57377464", "0.571465", "0.57077557", "0.5703094", "0.5573421", "0.5564845", "0.55494595...
0.6979061
1
Gets the IP and port from the peer that just sent data.
def peer_info peer_bytes = get_peername[2, 6].unpack("nC4") port = peer_bytes.first.to_i ip = peer_bytes[1, 4].join(".") [ip, port] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peeraddr\n @socket.peeraddr\n end", "def peer_info; socket.peer_info if socket end", "def peer_info\n peer_bytes = get_peername[2, 6].unpack(\"nC4\")\n port = peer_bytes.first.to_i\n ip = peer_bytes[1, 4].join(\".\")\n\n [ip, port]\n end", "def peer_ip\n ...
[ "0.7378519", "0.72397065", "0.68629676", "0.6758083", "0.67207116", "0.67115855", "0.6645313", "0.6644321", "0.6608145", "0.6522396", "0.6482173", "0.64643216", "0.64508176", "0.64470255", "0.6435942", "0.64194494", "0.63981515", "0.63876337", "0.6315403", "0.6253722", "0.619...
0.68744177
2
Sets Socket options to allow for multicasting. If ENV["RUBY_TESTING_ENV"] is equal to "testing", then it doesn't turn off multicast looping.
def setup_multicast_socket set_membership(IPAddr.new(MULTICAST_IP).hton + IPAddr.new('0.0.0.0').hton) set_multicast_ttl(@ttl) set_ttl(@ttl) unless ENV["RUBY_TESTING_ENV"] == "testing" switch_multicast_loop :off end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def socket\n @socket ||= UDPSocket.new.tap do |socket|\n socket.setsockopt Socket::IPPROTO_IP,\n Socket::IP_ADD_MEMBERSHIP,\n multicast_group\n socket.setsockopt Socket::IPPROTO_IP,\n Socket::IP_MULTICAST_TTL,\n ...
[ "0.6720747", "0.6434258", "0.6337197", "0.6265162", "0.61841965", "0.5984235", "0.5704508", "0.5697548", "0.566056", "0.5625054", "0.5582187", "0.55817896", "0.55669034", "0.54880464", "0.5358894", "0.5306145", "0.5298759", "0.5297812", "0.5286206", "0.5280641", "0.5195248", ...
0.75971866
0
Element reference. Retrieves the value object corresponding to the key object. Returns nil if the key is not found. Raises an exception if the stored item raised an exception when the block was evaluated.
def [](key) delay = data[key] delay ? delay.value! : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end", "def [](key)\n current_node = @buckets[index(key, size)].head\n if !current_node\n #raise InvalidKeyError \"Cannot retrieve that item - not instantiated\"\n return nil\n...
[ "0.70766985", "0.6943284", "0.6816638", "0.68031996", "0.6793584", "0.6784317", "0.6691365", "0.6625085", "0.6609999", "0.65925", "0.6563788", "0.6562033", "0.65612924", "0.6545681", "0.6545519", "0.6540545", "0.65398395", "0.6539139", "0.65385807", "0.65362763", "0.6536076",...
0.0
-1
Returns true if the given key is present.
def registered?(key) data.key?(key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_key?( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && contains_key( key )\n end", "def has_key?(key)\n return self.fetch(key) ? true : false\n end", "def has_key?(key)\n @hash.has_key?(key)\n end", "def has_key?(key)\n return to_h().has_key?...
[ "0.85122937", "0.8415955", "0.8389183", "0.83463675", "0.833241", "0.8325622", "0.8322745", "0.8322745", "0.8290243", "0.8290243", "0.820581", "0.8097412", "0.8043171", "0.7971588", "0.7964369", "0.7960991", "0.7942686", "0.78635514", "0.7856147", "0.78196037", "0.78140944", ...
0.0
-1
Element assignment. Associates the value given by value with the key given by key.
def register(key, &block) delay = Delay.new(executor: :immediate, &block) update_data { |h| h.merge(key => delay) } self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign(key, value)\n if lookup(key)\n @holder.each { |pair| pair[1] = value if pair[0] == key}\n else\n @holder << [key, value]\n end\n end", "def assign(key, value)\n @map.each do |pair|\n k, _ = pair\n pair[1] = value if key == k\n return\n end\n\n @map << [key, ...
[ "0.7496545", "0.73874396", "0.7198734", "0.71013874", "0.70804554", "0.70544505", "0.70484823", "0.6979971", "0.6978227", "0.6965613", "0.6951254", "0.69112104", "0.6888057", "0.6871567", "0.6871567", "0.6861345", "0.6861345", "0.68330187", "0.68330187", "0.68330187", "0.6833...
0.0
-1
Unregisters the object under key, realized or not.
def unregister(key) update_data { |h| h.dup.tap { |j| j.delete(key) } } self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unregister(key_or_instance)\n proxy_across_keytypes(:delete, key_or_instance)\n end", "def unregister(object)\n\t\t\t@registered.delete(object)\n\t\tend", "def unregister(key)\n @data.update { |h| h.dup.tap { |j| j.delete(key) } }\n self\n end", "def registry_unloadkey(key)\n if s...
[ "0.75273377", "0.688", "0.67075807", "0.67073613", "0.66049284", "0.65348727", "0.6510028", "0.63441205", "0.61552733", "0.6116446", "0.6116446", "0.60843295", "0.6047581", "0.60379755", "0.6036565", "0.59676427", "0.59286934", "0.58996606", "0.58973217", "0.5876665", "0.5863...
0.67400557
2
prevents a `stack level too deep`
def as_json(options = {}) super(options.merge(except: %w[association_class unfiltered_collection collection])) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack_trace; end", "def stacktrace; end", "def skip_backtrace; end", "def backtrace_ignores; end", "def stack; end", "def stack; end", "def error_yes_stack_trace!\n @@_error_stack_trace = true\n end", "def full_backtrace; end", "def backtrace; end", "def backtrace_cleaner; end...
[ "0.66754025", "0.6542896", "0.6515862", "0.6381898", "0.62401146", "0.62401146", "0.6207577", "0.6176437", "0.61463374", "0.6115131", "0.6037843", "0.6009631", "0.59651744", "0.5954186", "0.5944497", "0.58898026", "0.58525807", "0.5849964", "0.58479804", "0.58305657", "0.5815...
0.0
-1
here we pull the realtime info from SWAPI.COM, and put it in a hash. Copy and paste the URL and get familiar with what data is in there.
def planets data = JSON.parse(open("http://swapi.co/api/planets").read) @results = data["results"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_api(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n file = File.open('bin/key.rb')\n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-host\"] = 'skyscanner-skyscanner-flight-search-v1.p.rapidapi.com'\n ...
[ "0.63253504", "0.62649316", "0.6195579", "0.61649805", "0.60211533", "0.60126346", "0.5942441", "0.58907443", "0.58907175", "0.58199507", "0.5797443", "0.57724017", "0.5756063", "0.574664", "0.57190275", "0.5710476", "0.5671327", "0.5658173", "0.5651654", "0.5606332", "0.5600...
0.0
-1
human readable description of modeling approach
def modeler_description return 'Thermal zones will be named after the spac with a prefix added' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end", "def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end", "def m...
[ "0.7710149", "0.76145315", "0.75934714", "0.74018747", "0.7299891", "0.7296635", "0.727943", "0.71912926", "0.71912926", "0.7191264", "0.7100944", "0.70977926", "0.70629936", "0.7045383", "0.7044268", "0.70413125", "0.7040473", "0.7032938", "0.70267737", "0.70182866", "0.6987...
0.64074343
96
define the arguments that the user will input
def arguments(model) args = OpenStudio::Measure::OSArgumentVector.new return args end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arguments; end", "def arguments; end", "def arguments; end", "def arguments\n \"\"\n end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end...
[ "0.73748195", "0.73748195", "0.73748195", "0.7087363", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", "0.7008232", ...
0.0
-1
define what happens when the measure is run
def run(model, runner, user_arguments) super(model, runner, user_arguments) # use the built-in error checking if !runner.validateUserArguments(arguments(model), user_arguments) return false end # report initial condition of model runner.registerInitialCondition("The building started with...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure; end", "def measure=(_arg0); end", "def measure\n\t\t1\n\tend", "def measure(*args, &b)\n end", "def communicate_measure_result(_ = nil, _ = nil); end", "def communicate_measure_result(_ = nil, _ = nil); end", "def called\n self.measurement.called\n end", "def measure\n ...
[ "0.79848564", "0.7639647", "0.76355976", "0.7170129", "0.66926914", "0.66926914", "0.66718984", "0.66311747", "0.6599127", "0.65870225", "0.65324444", "0.6481582", "0.6405596", "0.64028287", "0.6333309", "0.6283632", "0.6283632", "0.6283632", "0.6281165", "0.6269874", "0.6242...
0.0
-1
The size of the response body in bytes
def length return unless headers['Content-Length'] headers['Content-Length'].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n return self.body_data.size\n end", "def size\n headers[:content_length].to_i\n end", "def size\n headers[\"content-length\"].to_i\n end", "def content_length\n @content_length ||= @response_impl.entity.content_length\n end", "def size\n @content.b...
[ "0.8582555", "0.81752867", "0.8123521", "0.7706874", "0.7686452", "0.75658625", "0.7531498", "0.75173146", "0.75173146", "0.75173146", "0.75098795", "0.74790996", "0.7388736", "0.7364366", "0.7336657", "0.7324811", "0.7273663", "0.7240597", "0.7214723", "0.72112787", "0.71985...
0.7821559
3
The MD5 digest of the response body
def md5 headers['Content-MD5'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def md5\n return self.body_data.md5\n end", "def md5_of_body\n data[:md5_of_body]\n end", "def digest\n Digest::MD5.digest(blob)\n end", "def md5\n render :json => { :hash => Digest::MD5.hexdigest(md5_query.to_s) }\n end", "def md5\n @gapi[\"md5Hash\"]\n end"...
[ "0.84057665", "0.8236111", "0.74144596", "0.72782755", "0.7249975", "0.71416867", "0.70871454", "0.70627", "0.7057871", "0.6931921", "0.6869169", "0.6869169", "0.6836221", "0.6742051", "0.67413205", "0.6737911", "0.6641898", "0.6584662", "0.65782964", "0.6554568", "0.6496937"...
0.83577657
1
The MIME type of the response
def media_type return unless headers['Content-Type'] headers['Content-Type'].split(';').first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_type\n response.content_type\n end", "def content_type\n @response_headers[\"Content-Type\"]\n end", "def response_content_type\n @response_headers[\"Content-Type\"]\n end", "def content_type\n @mime_type\n end", "def content_type\n response_headers[\"Content-Type...
[ "0.85328937", "0.8530683", "0.8527007", "0.84796184", "0.8414669", "0.8400441", "0.8399341", "0.83585346", "0.8248843", "0.8213644", "0.81921834", "0.81689763", "0.8116436", "0.80897486", "0.80897486", "0.80897486", "0.80897486", "0.8055202", "0.80551565", "0.80487496", "0.80...
0.7698632
57
The general category into which the MIME type falls
def type return unless media_type media_type.split('/').first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_category_string\n result = \"Manifestation\"\n result = \"Score\" if is_a_score?\n result = \"Recording\" if is_a_recording?\n result = \"Media on Demand\" if is_a_sounzmedia?\n result\n end", "def mime_type; end", "def mime_type; end", "def mime_type; end", "def mime_t...
[ "0.68141365", "0.66218483", "0.66218483", "0.66218483", "0.66218483", "0.66038316", "0.6594756", "0.656431", "0.65294015", "0.650641", "0.650118", "0.64929205", "0.648406", "0.645441", "0.64491236", "0.6405136", "0.6386552", "0.6379003", "0.6378147", "0.6361696", "0.6330671",...
0.0
-1
The exact kind of data of the specified type the MIME type represents
def subtype return unless media_type media_type.split('/').last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_content_type\n if data_content_type == \"application/octet-stream\" && !data_file_name.blank?\n content_types = MIME::Types.type_for(data_file_name)\n self.data_content_type = content_types.first.to_s unless content_types.empty?\n end\n end", "def mime_type(type)\n ...
[ "0.7473459", "0.7402594", "0.7338831", "0.7336066", "0.73270863", "0.7318867", "0.7314381", "0.73021454", "0.730134", "0.7298241", "0.72869664", "0.7284201", "0.71382654", "0.7135286", "0.7133062", "0.7126309", "0.71207136", "0.70700234", "0.705728", "0.70209634", "0.7016326"...
0.0
-1
The character encoding of the response
def charset match_data = headers['Content-Type']&.match(/charset=(.*);?/) return unless match_data Encoding.find(match_data[1]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_encoding\n\t\treturn self.headers.content_encoding\n\tend", "def content_encoding\n\t\treturn self.headers.content_encoding\n\tend", "def encoding\n @connection.encoding.to_s\n end", "def encoding\n Encoding::UTF_8\n end", "def encoding\n Encoding::UTF_8\n end", ...
[ "0.8135081", "0.8135081", "0.7707479", "0.7593639", "0.7593639", "0.7574285", "0.741583", "0.7388208", "0.72833616", "0.72833616", "0.72833616", "0.72833616", "0.72833616", "0.72833616", "0.72833616", "0.72833616", "0.72833616", "0.72833616", "0.72833616", "0.72833616", "0.72...
0.7280665
23
Whether the response is an XML document
def xml? return unless subtype subtype == 'xml' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_xml?\n not (@headers['Content-Type'] =~ /^application\\/xml.*/).nil?\n end", "def xml?\n type == DOCUMENT_NODE\n end", "def is_xml_request? \n request.env['CONTENT_TYPE'] =~ %r[(application|text)/xml] \n end", "def document?\n is_a? XML::Document\n end", "def asse...
[ "0.779974", "0.76472497", "0.74811816", "0.74184513", "0.68413216", "0.67371863", "0.6736005", "0.6677461", "0.6604043", "0.65645057", "0.65518534", "0.64771414", "0.6455537", "0.6412899", "0.63359034", "0.6292246", "0.6279942", "0.62735593", "0.62465644", "0.6230246", "0.616...
0.72053057
4
puts "this is a debug message"
def solution(a, b, k) # write your code in Ruby 2.2 e = b / k s = (a-1) / k e - s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(msg)\n #puts msg\n end", "def debug(s)\n\t#puts \"DEBUG: #{s}\"\nend", "def print_debug(msg)\n puts msg if (@debug) \n STDOUT.flush\n end", "def debug(message)\n puts message if debug?\n end", "def debug(s) if $DEBUG then $stderr.print(\"#{s}\\n\") end end", "def debug_ms...
[ "0.8406359", "0.8268479", "0.8211071", "0.8138492", "0.8107914", "0.80671936", "0.8004696", "0.79987866", "0.7975501", "0.7975501", "0.7975501", "0.79284", "0.78572273", "0.78488684", "0.7837523", "0.7821288", "0.7821288", "0.7792199", "0.7773948", "0.7743215", "0.7739327", ...
0.0
-1
Find all existing volumes that belong to this cluster and cram their metadata into the existing logical volume
def adopt_existing_volumes! Volume.all.each do |ec2_vol| next if ec2_vol.deleted? || ec2_vol.deleting? instance = Instance.find(ec2_vol.attached_instance_id) ; p instance ; next unless instance cluster_node_id = instance.get_cluster_node_id(self.name) ; next unless cluster_node_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_volumes\n volumes = get(\"cloud-instances/#{guid}/volumes\")[\"volumes\"] || []\n\n volumes.map do |volume|\n get_volume(volume[\"volumeID\"])\n end\n end", "def retrieve_volumes\n dbg { \"retrieving #{pool_info}, #{hv_info}\" }\n\n volumes = pool.list_a...
[ "0.6234512", "0.61205035", "0.59852165", "0.5910362", "0.58662003", "0.58459437", "0.5731675", "0.57041305", "0.5700364", "0.5600427", "0.5520195", "0.5516698", "0.5514974", "0.54641396", "0.54414856", "0.544014", "0.5434479", "0.54320407", "0.5425922", "0.5424895", "0.541379...
0.73872954
0
Recursively converts CamelCase and camelBack JSONstyle hash keys to Rubyish snake_case, suitable for use during instantiation of Ruby model attributes.
def snakecase_keys(value) case value when(Array) value.map { |v| snakecase_keys(v) } when(::Hash) snake_hash(value) else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_camelize_keys!(first_letter = :upper)\n deep_transform_keys! { |key| key.to_s.camelize(first_letter) rescue key }\n end", "def deep_camelize_keys\n deep_transform_keys { |key| key.to_s.camelize(:lower) }\n end", "def keys_to_snake_case(hash)\n hash.transform_keys do |key|\n key.gsub(%r...
[ "0.806826", "0.7979336", "0.7728809", "0.7555193", "0.75383025", "0.75021225", "0.7479797", "0.7421893", "0.73681736", "0.7238859", "0.72013855", "0.71686465", "0.7094905", "0.70542264", "0.6968482", "0.69405615", "0.69333124", "0.69333124", "0.6917206", "0.6794908", "0.67814...
0.6553973
28
Returns an unobtrusive link (with html5 data attributes) that lets you bring up an RPXNow Dialog.
def rpxnow_link(text, url, opts = {}) has_rpxnow options = options_with_class_merged(opts, :class => 'rpxnow') rpx_opts = options.delete(:rpx) || {} auth_token_params = [Rack::Utils.escape(request_forgery_protection_token.to_s), Rack::Utils.escape(form_authenticity_token.to_s)] * "=" token_url = "#{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_to_dialog(text, options, html_options = {})\n link_to(\n text,\n options.reverse_merge(:width => 650, :height => 500, \"TB_iframe\" => \"true\"),\n html_options.reverse_merge(:class => \"thickbox\", :title => text)\n )\n end", "def auto_pop_up_link(text, target, options...
[ "0.63450676", "0.6184522", "0.611959", "0.61178905", "0.5927624", "0.59202397", "0.5888056", "0.5853935", "0.58501714", "0.5845583", "0.5833852", "0.57989335", "0.57746035", "0.57730514", "0.5762895", "0.5762895", "0.57399845", "0.57364225", "0.57300436", "0.572508", "0.57194...
0.5593136
44
Automatically embeds the RPXNow Javascript once.
def has_rpxnow return if defined?(@has_rpxnow) && @has_rpxnow rpxnow_js = "#{request.ssl? ? 'https://' : 'http://static.'}rpxnow.com/js/lib/rpx.js" has_js rpxnow_js @has_rpxnow = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def js_reload\n riak_admin 'js_reload'\n end", "def inject_js; end", "def google_ajax_slideshow_scripts\n return '' if defined?(@google_ajax_slideshow_scripts_included)\n @google_ajax_slideshow_scripts_included = true\n '<script src=\"http://www.google.com/uds/solutions/slideshow/gfslideshow.j...
[ "0.63585854", "0.6316609", "0.62955207", "0.6079166", "0.6002843", "0.59913486", "0.58566576", "0.58550465", "0.5832863", "0.5830729", "0.58221483", "0.5816108", "0.575655", "0.57521373", "0.57018924", "0.56737095", "0.5645401", "0.56193215", "0.5561888", "0.55011255", "0.549...
0.6403021
0
Finds the factorial of a number
def factorial(num) product = 1 while num > 1 product = product*num num -= 1 end product end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial(number)\n\tresult = 1\n\twhile number > 0\n\t\tresult *= number\n\t\tnumber -= 1\n\tend\n\treturn result\nend", "def factorial(number)\n if number == 0\n \treturn 1\n elsif number == 1\n \treturn 1\n end\n i=number-1\n f=number*i\n while i > 1\n \ti=i-1\n \tf=f*i\n end\n return f\nend",...
[ "0.8251041", "0.8245552", "0.82094663", "0.8151356", "0.8148111", "0.8144532", "0.81378406", "0.81378406", "0.8133121", "0.8131653", "0.8125608", "0.8110506", "0.81100917", "0.8106182", "0.80919045", "0.8084357", "0.80768204", "0.8070229", "0.80630404", "0.8048175", "0.803180...
0.78369
67
Verifies that product is a common multiple of every number up to num
def check_number(num, product) result = true (1..num).each do |number| if product % number != 0 result = false break end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_perfect(num)\n multiples_sum = 0\n\n (1..num / 2).each do |i|\n multiples_sum += i if (num % i).zero?\n break false if multiples_sum > num # for performance issues\n end\n\n multiples_sum == num\nend", "def multiple_of(n, x)\n x.modulo(n).zero?\n end", "def multiple?(num, bas...
[ "0.7245897", "0.7108705", "0.6874142", "0.68720376", "0.6817972", "0.6805568", "0.6805244", "0.67951924", "0.67475176", "0.6743969", "0.67405343", "0.67225254", "0.6716327", "0.67162025", "0.67034566", "0.6678607", "0.66688037", "0.6667505", "0.6648071", "0.6639418", "0.66376...
0.7446986
0
Returns a list of primes under num
def find_primes_under(num) primes = [2] counter = 3 while primes[-1] < num counter2 = 2 while counter2 <= counter if counter % counter2 == 0 break elsif counter2 * counter2 > counter primes << counter break end counter2 += 1 end counter += 1 end primes[0..-2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes_less_than(num)\n\toutput = []\n\t(2...num).each do |n|\n\t\toutput << n if is_prime?(n)\n\tend\n\toutput\nend", "def primes_less_than(num)\n require 'prime'\n arr = []\n Prime.each(num) do |prime| arr.push(prime)\n end\n num.prime? ? arr.pop : arr\n return arr\n end", "def primes_...
[ "0.814804", "0.786815", "0.786023", "0.7813643", "0.76659495", "0.7612166", "0.75990015", "0.75051516", "0.7378593", "0.7349403", "0.72536623", "0.7174526", "0.712673", "0.70949775", "0.7086163", "0.70852816", "0.70645124", "0.70575565", "0.70417", "0.70211303", "0.7012214", ...
0.7223245
11
Returns the smallest common multiple of all numbers 1num
def find_smallest_common_multiple(num) primes = find_primes_under(num) product = factorial(num) counter = 0 while counter < primes.size while check_number(num, product) product = product / primes[counter] end product = product * primes[counter] counter += 1 end product end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smallest_multiple(num)\n\t(2..num).inject(1) do |mul, i|\n\t\tif mul%i == 0\n\t\t\tmul\n\t\telse\n\t\t\t(i-1).downto(2) do |j| \n\t\t\t\tif i%j == 0\n\t\t\t\t\ti /= j\n\t\t\t\t\tbreak \n\t\t\t\tend\n\t\t\tend\n\t\t\tmul *= i\n\t\tend\n\tend\nend", "def smallest_common_multiple(n)\n\n\treturn 0\nend", "def ...
[ "0.8038764", "0.8010712", "0.79202425", "0.7871839", "0.7845951", "0.77993315", "0.77966326", "0.7774211", "0.77692664", "0.7746873", "0.77313554", "0.77013797", "0.7685281", "0.7672937", "0.76618665", "0.7654444", "0.76053", "0.7604434", "0.7579523", "0.75754476", "0.7559644...
0.8328037
0
Determine how much money was gained in one year
def grow_one_year(starting_balance, growth_rate) starting_balance * (1.0 + growth_rate) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def years_needed\n 30\n end", "def required_annual_savings\n needed_amount_less_savings / years_to_retirement\n end", "def calculate_years(principal, interest, tax, desired)\n# principal amount\n year = 0\n while principal < desired\n year += 1\n income = principal * interest\n principal...
[ "0.7728491", "0.7486112", "0.7358475", "0.72229135", "0.7221456", "0.7133883", "0.70664215", "0.70331794", "0.7014857", "0.6978319", "0.6974331", "0.6954624", "0.6954624", "0.69497335", "0.6942155", "0.6935395", "0.6931724", "0.68987465", "0.6813294", "0.68056893", "0.6786911...
0.6900323
17
Open the TDB file. Accepts a URI and list of open modes: db = TokyoModel::Adapters::File.new("file:///tmp/database.tdb", :read, :write, :create, :trunc)
def initialize(uri, *args) @db = TokyoCabinet::TDB::new @db.open(uri.path, args.empty? ? File.default_open_mode : File.open_mode(*args)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open\n close\n @db = SQLite3::Database.new(@options[:filename])\n self\n end", "def open(options)\n @db ||= options[:connection]\n return @db if @db\n\n if options[:path] && !File.exist?(options[:path])\n @db = SQLite3::Database.new(options[:path])\n setup\n ...
[ "0.6886159", "0.6755556", "0.66981125", "0.6550848", "0.6532551", "0.6516999", "0.64219695", "0.6117631", "0.6093412", "0.6080202", "0.60689014", "0.60628444", "0.60472375", "0.6038953", "0.6009289", "0.5993715", "0.5974676", "0.59687597", "0.5957488", "0.5949796", "0.5936086...
0.76090646
0
Takes an array of open mode symbols and returns the mode number: open_mode(:read, :write, :sync) 3 open_mode(:read, :write, :sync) 67
def open_mode(*modes) modes.inject(0) { |memo, obj| memo | OPEN_MODES[obj.to_sym].to_i } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modes\n mode_codes.keys\n end", "def modes\n fix_mode.modes\n end", "def get_modes\n @_modes\n end", "def mode\n \"%o\" % (self.stat(:mode) & 007777)\n end", "def mode(io) \n readable, writable = try_handle(io, \"mode\")\n\n case\n when readable && writabl...
[ "0.7007333", "0.63937294", "0.63889694", "0.62738407", "0.62436235", "0.61912835", "0.61912835", "0.6170272", "0.60947335", "0.6063899", "0.605558", "0.6018973", "0.59452987", "0.59145707", "0.58938867", "0.58720183", "0.58720183", "0.58720183", "0.58720183", "0.5861154", "0....
0.81249195
0
Use callbacks to share common setup or constraints between actions.
def set_order @order = Order.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 list of trusted parameters through.
def order_params params.require(:order).permit(:date, :status, :tracking_number, :shipping_address, :billing_address, :customer_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
send a pdu, receives a pdu
def send(pdu) log { "sending request..." } log(level: 2) { pdu.to_hex } encoded_request = pdu.to_der log { Hexdump.dump(encoded_request) } encoded_response = @transport.send(encoded_request) log { "received response" } log { Hexdump.dump(encoded_response) } response_pdu =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_pdu(pdu)\n case pdu\n when Pdu::DeliverSm\n write_pdu(Pdu::DeliverSmResponse.new(pdu.sequence_number))\n logger.debug \"ESM CLASS #{pdu.esm_class}\"\n if pdu.esm_class != 4\n # MO message; invoke MO proc\n @mo_proc.call(pdu.source_addr, pdu.destination_addr, pdu.short...
[ "0.62173456", "0.5727398", "0.5652252", "0.556148", "0.55610675", "0.5502294", "0.5496475", "0.54655826", "0.5443902", "0.54054236", "0.53878194", "0.5355966", "0.53243285", "0.5301934", "0.52953327", "0.5294901", "0.52764934", "0.52762645", "0.5273468", "0.5272399", "0.52670...
0.65175533
0
TODO escollir un dels metodes per la instancia d'usuari actual
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_usuario\n \n end", "def usuario_actual\n \t#se guarda al usuario actual que esta loggeado por cuestion de eficiencia\n \t#para no accesar a la base de datos todo el tiempo\n \t@usuario_actual ||= Alumno.find(session[:alumno_id]) if session[:alumno_id]\n end", "def creador\n\t\tusuario\n\tend",...
[ "0.7111474", "0.69214624", "0.66324705", "0.66009986", "0.65543723", "0.6552042", "0.65221125", "0.65024304", "0.6491112", "0.648705", "0.6483188", "0.64307773", "0.63644356", "0.6316527", "0.62829286", "0.6266864", "0.6185615", "0.6170581", "0.6170501", "0.61475515", "0.6136...
0.0
-1
Deploys the given app_id on the given instance_id in the given stack_id Blocks until AWS confirms that the deploy was successful Returns a Aws::OpsWorks::Types::CreateDeploymentResult
def deploy(stack_id:, app_id:, instance_id:, revision:, deploy_timeout: 1800) # App IDs can be passed as a CSV to deploy multiple apps in the same stack app_ids = app_id.split(",") deploy_id = [] app_ids.each do |id| # Update the branch/revision to the given parameter, if any. unless revisi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_application(app_id, options = {:comment => nil, :migrate => false})\n json_command = JSON.dump(:command => 'deploy', \n :comment => options[:comment], \n :migrate => options[:migrate])\n http_post_request(Scalarium.applications_url+\"...
[ "0.6109779", "0.60810125", "0.60790414", "0.5944442", "0.5917404", "0.57502055", "0.56585085", "0.56419224", "0.5638102", "0.56327844", "0.5585359", "0.55598646", "0.5558177", "0.5551345", "0.549737", "0.5492338", "0.5491895", "0.54425794", "0.5421702", "0.54156965", "0.53469...
0.7538104
0
Loop through all instances in layer Deregister from ELB (elastic load balancer) Wait connection draining timeout (default up to maximum of 300s) Initiate deploy and run migrations Register instance back to ELB Wait for AWS to confirm the instance as registered and healthy Once complete, move onto the next instance and ...
def regional_rolling_deploy(stack_id:, layer_id:, app_id:, revision: '') log("Starting opsworks deploy for app #{app_id}\n\n") instances = @opsworks_client.describe_instances(layer_id: layer_id)[:instances] instances_by_group = instances.map {|v| v.to_h}.group_by { |d| d[:availability_zone] } instanc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(vpc_id, client, asg, elbv1, elbv2, region)\n begin\n response = client.describe_vpcs(vpc_ids: [vpc_id])\n rescue Aws::EC2::Errors::InvalidVpcIDNotFound => e\n puts \"Error: vpc_id [#{vpc_id}] does not exist... exiting.\"\n puts \"Make sure you passed the correct region on the command-line if i...
[ "0.6748874", "0.6607542", "0.647271", "0.6321144", "0.6321144", "0.614825", "0.6131076", "0.6112433", "0.60040367", "0.5997861", "0.59794253", "0.59636694", "0.5842088", "0.5836976", "0.5833665", "0.5812568", "0.57130706", "0.5691821", "0.5683815", "0.5674697", "0.5658734", ...
0.6166761
5
Polls Opsworks for timeout seconds until deployment_id has completed
def wait_until_deploy_completion(deployment_id, timeout) started_at = Time.now Timeout::timeout(timeout) do @opsworks_client.wait_until( :deployment_successful, deployment_ids: [deployment_id] ) do |w| # disable max attempts w.max_attempts = nil end end en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wait_until_deployed(deployment_id, timeout)\n opsworks_client.wait_until(:deployment_successful, deployment_ids: [deployment_id]) do |w|\n w.before_attempt do |attempt|\n puts \"Attempt #{attempt} to check deployment status\".light_black\n end\n w.interval = 10\n w.ma...
[ "0.74300927", "0.69848865", "0.6737966", "0.6208974", "0.612199", "0.60591793", "0.5990514", "0.58479667", "0.58325887", "0.57840073", "0.57760847", "0.5765682", "0.57396877", "0.57095104", "0.5659073", "0.56037563", "0.55957127", "0.55913246", "0.5573044", "0.5542815", "0.55...
0.7276278
1
Takes a Aws::OpsWorks::Types::Instance Detaches the provided instance from all of its load balancers Returns the detached load balancers as an array of Aws::ElasticLoadBalancing::Types::LoadBalancerDescription Blocks until AWS confirms that all instances successfully detached before returning Does not wait and instead ...
def detach_from_elbs(instance:) unless instance.is_a?(Aws::OpsWorks::Types::Instance) fail(ArgumentError, "instance must be a Aws::OpsWorks::Types::Instance struct") end all_load_balancers = @elb_client.describe_load_balancers .load_balancer_descriptions load_balancers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detach_from(load_balancers, instance)\n check_arguments(instance: instance, load_balancers: load_balancers)\n\n load_balancers.select do |lb|\n matched_instance = lb.instances.any? do |lb_instance|\n instance.ec2_instance_id == lb_instance.instance_id\n end\n\n if matched_instance &...
[ "0.7349848", "0.64322937", "0.5938487", "0.55990577", "0.55990577", "0.55371326", "0.5396752", "0.5392787", "0.5200122", "0.5149061", "0.51062137", "0.50860155", "0.50319856", "0.5029228", "0.5029228", "0.5000057", "0.4997184", "0.49925008", "0.4931991", "0.48914087", "0.4886...
0.8192437
0
Accepts load_balancers as array of Aws::ElasticLoadBalancing::Types::LoadBalancerDescription and instances as a Aws::OpsWorks::Types::Instance Returns only the LoadBalancerDescription objects that have the instance attached and should be detached from Will not include a load balancer in the returned collection if the s...
def detach_from(load_balancers, instance) check_arguments(instance: instance, load_balancers: load_balancers) load_balancers.select do |lb| matched_instance = lb.instances.any? do |lb_instance| instance.ec2_instance_id == lb_instance.instance_id end if matched_instance && lb.instance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detach_from_elbs(instance:)\n unless instance.is_a?(Aws::OpsWorks::Types::Instance)\n fail(ArgumentError, \"instance must be a Aws::OpsWorks::Types::Instance struct\")\n end\n\n all_load_balancers = @elb_client.describe_load_balancers\n .load_balancer_descriptions\n\n ...
[ "0.7493718", "0.6402033", "0.6297438", "0.60137606", "0.57810754", "0.56451625", "0.5547521", "0.5476744", "0.54553556", "0.54553556", "0.5338663", "0.53209645", "0.5208643", "0.50709707", "0.50377965", "0.502718", "0.4977642", "0.49732804", "0.4951387", "0.49166682", "0.4907...
0.7582588
0
Takes an instance as a Aws::OpsWorks::Types::Instance and load balancers as an array of Aws::ElasticLoadBalancing::Types::LoadBalancerDescription Attaches the provided instance to the supplied load balancers and blocks until AWS confirms that the instance is attached to all load balancers before returning Does nothing ...
def attach_to_elbs(instance:, load_balancers:) check_arguments(instance: instance, load_balancers: load_balancers) if load_balancers.empty? log("No load balancers to attach to") return {} end @lb_wait_params = [] registered_instances = {} # return this load_balancers.each do |lb| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach_to_elb(instance, elb_name, subnet = nil)\n begin\n @log.info \"\"\n @log.info \"Adding to ELB: #{elb_name}\"\n elb = AWS::ELB.new\n AWS.memoize do\n unless subnet\n # Build list of availability zones for any existing instances\n zones = { }...
[ "0.66799253", "0.6596726", "0.6403054", "0.6080672", "0.59530383", "0.59022284", "0.5899842", "0.5899842", "0.5851962", "0.5830692", "0.5830109", "0.5732898", "0.56988794", "0.5676722", "0.5660909", "0.56561345", "0.5622698", "0.5528505", "0.5520164", "0.5405592", "0.53571993...
0.82129145
0
Fails unless arguments are of the expected types
def check_arguments(instance:, load_balancers:) unless instance.is_a?(Aws::OpsWorks::Types::Instance) fail(ArgumentError, ":instance must be a Aws::OpsWorks::Types::Instance struct") end unless load_balancers.respond_to?(:each) && load_balancers.all? do |lb| lb.is_a?...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def argument_types?(*value)\n true\n end", "def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.cl...
[ "0.7070914", "0.6953345", "0.6953345", "0.6942009", "0.67836994", "0.67483", "0.67483", "0.6734856", "0.6729577", "0.67290545", "0.66863996", "0.6598557", "0.6515751", "0.65025824", "0.64909416", "0.6477315", "0.6471459", "0.6467003", "0.64620125", "0.64360017", "0.6430408", ...
0.0
-1
Could use Rails logger here instead if you wanted to
def log(message) puts message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "...
[ "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.7967993", "0.78018904", "0.78018904", ...
0.0
-1
This should return the minimal set of values that should be in the session in order to pass any filters (e.g. authentication) defined in RondasController. Be sure to keep this updated too.
def valid_session {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session_variables_from_authenticated_system\n @return_to_query = session[:return_to_query] || params[:return_to_query]\n @return_to = session[:return_to] || params[:return_to]\n @previous_protocol = session[:previous_protocol] || params[:previous_protocol]\n session[:return_to_query] = session[...
[ "0.63934624", "0.63851434", "0.6296908", "0.62675595", "0.6119653", "0.6057895" ]
0.0
-1
rollback: it's a select, nothing to rollback, blank override
def rollback true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollback\n query 'rollback'\n self\n end", "def rollback; end", "def rollback; end", "def rollback; end", "def rollback; end", "def rollback; end", "def rollback_db_transaction\n execute(\"ROLLBACK\")\n end", "def rollback_db_transaction\n execute(\"ROLLBACK\")\n ...
[ "0.8083688", "0.7993103", "0.7993103", "0.7993103", "0.7993103", "0.7993103", "0.7931139", "0.7931139", "0.78960973", "0.78960973", "0.7890218", "0.78374106", "0.7815932", "0.780877", "0.77449536", "0.77449536", "0.7737373", "0.7704847", "0.7653238", "0.75757515", "0.7551363"...
0.6803823
44
input array find the maximum number in the array build an array of fibonacci numbers up to the max numbers iterate over the original array slect see if current item is included in the fibonacci array output array 1 1 2 3 5 8 13
def fibonacci_index(array) fibonacci_sequence = create_fibonacci(array.size) new_array = array.select { |num| fibonacci_sequence.include?(array.index(num)) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci_array(max_num)\n while @fibon_array[-1] < max_num do\n new_num = @fibon_array[-2] + @fibon_array[-1]\n @fibon_array.push new_num\n end\n # Deletes last element if loop's new element exceeds max_num\n if @fibon_array[-1] > max_num\n @fibon_array.delete_at(-1)\n end\n @...
[ "0.7869513", "0.762418", "0.74886507", "0.74170476", "0.7282167", "0.72431725", "0.7222658", "0.72156733", "0.7176839", "0.7012384", "0.6919703", "0.6915713", "0.6906009", "0.69046134", "0.6883087", "0.6873593", "0.68718475", "0.6855647", "0.68548", "0.68377537", "0.6798123",...
0.7086137
9
def skills user_skills = object.skills.collect do |skill| user_skill = skill end end
def liked_users users = object.liked_users.collect do |liked_user| # user = User.find_by(id: liked_user.liked_user_id) # user.attributes.except!("created_at", :updated_at, :email) user = User.select(:id, :name, :gender, :age, :bio).find_by(id: liked_user.liked_user_id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skills\n\t\t[]\n\tend", "def set_user\n @user = User.find(params[:id])\n @skills = Skill.all\n @my_skills = @user.skills.all.map { |k| k[:name] }\n end", "def find_skills\n @user = User.find(params[:id])\n @user_skill = UserSkill.where(\"user_id = @user.id\")\n end", "def get_actor...
[ "0.78938305", "0.78287256", "0.7669298", "0.73693365", "0.7175361", "0.71368074", "0.7071474", "0.70691925", "0.6984617", "0.68977475", "0.6890607", "0.6882244", "0.6812113", "0.6764663", "0.67484546", "0.6596831", "0.65946275", "0.6462516", "0.6448141", "0.6298137", "0.62864...
0.0
-1
=begin :type x: Integer :rtype: Void =end
def push(x) @stack.push(x) @min_stack.push(x) if @min_stack.empty? || @min_stack[-1] >= x end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x\n 0\n end", "def x(n)\n end", "def x\n end", "def x\n end", "def x\n end", "def return_value(x)\n\tif x > 1\n\t\treturn x\n\telse\n\tend\nend", "def x; 1; end", "def x; end", "def x; end", "def x; end", "def x; end", "def x; end", "def cnt; xparam(6); end", "def ge...
[ "0.6999597", "0.6869975", "0.6671123", "0.66127646", "0.66127646", "0.6536892", "0.6503381", "0.64305717", "0.64305717", "0.64305717", "0.64305717", "0.64305717", "0.64080566", "0.6362651", "0.62267184", "0.6217009", "0.61672753", "0.61467487", "0.61237484", "0.61100554", "0....
0.0
-1
=begin :rtype: Void =end
def pop() @min_stack.pop() if @min_stack[-1] == @stack[-1] @stack.pop() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end; end", "def end; end", "def end; end", "def void\n \"Void\"\n end", "def incomplete\r\n\r\n end", "def begin; end", "def void()\n nil\n end", "def complete?; end", "def handle; end", "def begin() end", "def done; end", "def suivre; end", "def end() end", ...
[ "0.7076286", "0.7076286", "0.7076286", "0.7042917", "0.7006871", "0.6946303", "0.6753771", "0.6736687", "0.6684566", "0.66822404", "0.66349524", "0.66205233", "0.6619803", "0.65918946", "0.65669674", "0.65669674", "0.6561827", "0.6561827", "0.65405864", "0.6527296", "0.650094...
0.0
-1
=begin :rtype: Integer =end
def top() @stack[-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def range; end", "def range; end", "def range; end", "def length\n @end - @start + 1\n end", "def length\n @end - @start\n end", "def start_num\n return @start_num\n end", "def length\r\n return self.st...
[ "0.68839365", "0.68839365", "0.68839365", "0.6832226", "0.6770915", "0.65820575", "0.6458765", "0.64062536", "0.64062536", "0.6389018", "0.6268534", "0.62334067", "0.61995095", "0.61995095", "0.61995095", "0.6191786", "0.6191786", "0.6191563", "0.6190707", "0.61641645", "0.61...
0.0
-1
=begin :rtype: Integer =end
def get_min() @min_stack[-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def range; end", "def range; end", "def range; end", "def length\n @end - @start + 1\n end", "def length\n @end - @start\n end", "def start_num\n return @start_num\n end", "def length\r\n return self.st...
[ "0.6883764", "0.6883764", "0.6883764", "0.68318415", "0.67707014", "0.6582689", "0.645833", "0.64058447", "0.64058447", "0.6388362", "0.6267844", "0.62336147", "0.6198298", "0.6198298", "0.6198298", "0.6191344", "0.6191187", "0.6190641", "0.6190641", "0.6163565", "0.61551654"...
0.0
-1
reset the Sequence to its initial state
def reset @index = -1 @element = nil @value = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n set InitialPosition\n end", "def reset\n\t\tself.rs \t= 0\n\t\tself.ps \t= 0\n\t\tself.ss \t= 0\n\t\tself.gen\t= Random.new(SEED)\n\tend", "def reset_state\n @state = nil\n end", "def reset\n @current = nil\n @pos = 0\n end", "def reset\n @position = 0\n ...
[ "0.74213105", "0.74012727", "0.7366204", "0.73131", "0.72967213", "0.7280663", "0.7239951", "0.7237613", "0.7237613", "0.7229263", "0.7212357", "0.7146484", "0.7146484", "0.7146484", "0.7146484", "0.711822", "0.7105732", "0.707575", "0.7070327", "0.7061152", "0.704653", "0....
0.0
-1
The value of the next element in the Sequence. The sequence goes back to the first element if there are no more elements.
def next if @elements and not @elements.empty? @index = (@index + 1) % @elements.length element = @elements[@index] value = value_of(element) @element, @value = element, value end @value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next\r\n next_values[0]\r\n end", "def next\n next? ? @current + 1 : nil\n end", "def next\n @next && @next.value\n end", "def next()\n result = current\n @index += 1\n @got_next_element = false\n @next_element = nil\n result\n end", "def ...
[ "0.78649074", "0.7677277", "0.7610153", "0.7523153", "0.74460936", "0.74261945", "0.7173325", "0.7046524", "0.7042904", "0.70228416", "0.6932574", "0.6907588", "0.690667", "0.6889075", "0.68485904", "0.6822495", "0.6812803", "0.680058", "0.6792862", "0.67672247", "0.67133975"...
0.8077969
0
def set_variant return unless params[:variant].in?(%w(phone tablet desktop)) request.variant = params[:variant].to_sym end o tambien se puede por medio del user_agent:
def set_variant # request.variant = :phone if request.user_agent.include?('iPhone') # o con la gema browser request.variant = :phone if browser.device.mobile? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_request_variant\n request.variant = :mobile if request.user_agent =~ /android|Android|blackberry|iphone|ipod|iemobile|mobile|webos/\n request.variant = :android_app if request.user_agent =~ /AndroidApp/\n puts \"--------------\"+request.variant.to_s+\"--------------\"\n end", "def set_variant\n...
[ "0.8481653", "0.83958817", "0.7845817", "0.6666438", "0.645645", "0.645645", "0.645645", "0.645645", "0.6431474", "0.6211851", "0.6140318", "0.6060406", "0.6022627", "0.59794176", "0.5893816", "0.58839273", "0.58839273", "0.5853466", "0.58247656", "0.5782216", "0.5780708", ...
0.8770161
0
definimos el 404 que se esta pasando en el rescue_from
def render_404 render 'web/404', status: 404 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rescue_not_found\n render nothing: true, status: 404\n end", "def error_rescue(exception = nil)\n return render_error_status(404, exception.message)\n end", "def rescue404\n render 'public/404'\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n rescue\n re...
[ "0.77110696", "0.77004844", "0.7574277", "0.7554923", "0.7553312", "0.75440806", "0.75062716", "0.7448863", "0.73879445", "0.73638684", "0.7361964", "0.7356699", "0.7356699", "0.73452425", "0.7318466", "0.7318195", "0.73162687", "0.7300782", "0.7261687", "0.7255709", "0.72557...
0.6971189
54
Replace this with your real tests.
def test_truth assert true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing\n # ...\n end", "def __dummy_test__\n end", "def tests; end", "def tests; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def test \n end", "def test_0_dummy\n\t\tend", "def test\n\n end", "def test\n end", "def test\n end"...
[ "0.7446459", "0.6956364", "0.69155836", "0.69155836", "0.6864151", "0.6864151", "0.66406286", "0.66406286", "0.66253287", "0.6547665", "0.6524571", "0.6484549", "0.6484549", "0.6484549", "0.6403847", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188"...
0.0
-1
Reschedules appointment (only if patient already has one scheduled)
def index appointment_can_cancel_and_reschedule # If patient already had a dose, keep it in the same UBS. # This is an optimized query, hence a little odd using +pick+s. ubs_id = Appointment.where(id: current_patient.doses.pick(:appointment_id)).pick(:ubs_id) # Otherwise limit to where t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reschedule_appointment\n if @patient.appointments.length < 1\n puts \"You currently have no appointments\"\n sleep(2)\n else\n @prompt.select \"Which appointment would you like to Reschedule?\" do |menu|\n @patient.appointments.each do |appt|\n menu.choice appt.time...
[ "0.7332421", "0.68552125", "0.662466", "0.66214067", "0.6618574", "0.63865274", "0.6362172", "0.62956506", "0.62207866", "0.60593146", "0.6054434", "0.5986129", "0.5941495", "0.59408975", "0.5926577", "0.5901622", "0.58974963", "0.5870843", "0.58073866", "0.58059263", "0.5803...
0.5329317
68
rubocop:enable Metrics/AbcSize NOTE: we are ignoring params[:id] in here
def destroy @appointment = appointment_can_cancel_and_reschedule scheduler.cancel_schedule(appointment: @appointment) redirect_to home_community_appointments_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_param\n params[:id]\n end", "def id\n @params[\"id\"]\n end", "def id\n params[:id] \n end", "def id\n params[:id]\n end", "def params\n { id: 3 }\n end", "def get_id\n params[:id]\n end", "def paramsid\n @order = Order.find_by(params[:id])\n par...
[ "0.7004771", "0.68418974", "0.6832365", "0.6828235", "0.6719394", "0.67067164", "0.63821185", "0.6354838", "0.6291008", "0.6250319", "0.61564755", "0.6141194", "0.6127795", "0.61110264", "0.60916585", "0.60757804", "0.60621786", "0.6051046", "0.60508794", "0.6040015", "0.6028...
0.0
-1
Loads pages for the Index, between 0 and max possible allowed
def parse_days [ [ 0, params[:page].presence&.to_i || scheduler.days_ahead_with_open_slot ].compact.max, Rails.configuration.x.schedule_up_to_days ].min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n get_own_documents\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_documents\n end\n render_js_or_html_index\n end", "def max_pages() 1 end", "def pages; end", "def index\n get_own_lessons\n if @page > @pages_amount && @pages_amount !...
[ "0.7411076", "0.68576556", "0.6827612", "0.67234236", "0.66899747", "0.6652818", "0.6623177", "0.6610252", "0.65775007", "0.657468", "0.65723723", "0.65657055", "0.6531315", "0.6527085", "0.65252155", "0.64960486", "0.643862", "0.6435568", "0.6403065", "0.6403065", "0.6403065...
0.0
-1
Returns a Hash for the given Recipe id ID of the recipe Returns a Hash
def show(id) response = request(:get, "/recipes/#{id}.json") response.first[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipe (recipe_id, name)\n if recipe_id\n this_recipe = Recipe.find(recipe_id.to_i)\n else\n this_recipe = Recipe.find_by(name)\n end\n\n creation = {\n :name => this_recipe[:name],\n :instructions => this_recipe.instructions.all,\n :ingredients => thi...
[ "0.697261", "0.66720676", "0.66711473", "0.66711473", "0.66711473", "0.66711473", "0.66711473", "0.66711473", "0.66711473", "0.66711473", "0.66711473", "0.6671053", "0.6624796", "0.6614309", "0.65846837", "0.65411645", "0.65411645", "0.6519106", "0.64956707", "0.645004", "0.6...
0.5676232
44
Add a new Recipe options Params for creating the recipe label label for the recipe description description for the recipe compatible_with recipe compatiblity (windows or unix) script_type specify script type for windows compatible (bat, vps, powershell) Returns a hash
def create(options = {}) optional = [:description, :compatible_with, :script_type ] params.required(:label).accepts(optional).validate!(options) response = request(:post, "/recipes.json", default_params(options)) response['recipe'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_params\n params.require(:script).permit(:id, :name, :description, :definition, :long_text, :platform, :industry, :solution_type_id, :script_file, :pdf_file, :complexity, :status_id, requirements_attributes: [:id, :script_id, :requirement])\n end", "def script_type\n case @script.type\n ...
[ "0.5260635", "0.5225325", "0.5150821", "0.5094689", "0.49993294", "0.49987155", "0.49897885", "0.49472606", "0.4925912", "0.4893017", "0.4848319", "0.48476556", "0.48109058", "0.47579283", "0.47567686", "0.4753889", "0.4753889", "0.47527644", "0.47507527", "0.4748219", "0.473...
0.54346275
0
Edit a Recipe id ID of the recipe options Params for creating recipe, see 'create' method Returns a Hash.
def edit(id, options = {}) optional = [:label, :description, :compatible_with, :script_type ] params.accepts(optional).validate! options request(:put, "/recipes/#{id}.json", default_params(options)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\t@recipe = Recipe.find(params[:id])\n\tend", "def set_recipe\n @recipe = Recipe.find params[:id]\n end", "def edit\n #@recipe = Recipe.find(params[:id])\n \n \n end", "def edit\n @recipe = Recipe.find(params[:id])\n end", "def edit\n @page_title = \"Edit Recipe\"\n ...
[ "0.6942881", "0.6904631", "0.69043124", "0.687355", "0.67433167", "0.67433167", "0.67359465", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", "0.6735113", ...
0.8046158
0
Delete a Recipe id ID of the recipe Returns a Hash.
def delete(id) request(:delete, "/recipes/#{id}.json") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end", "def destroy\n\t\t\t\trecipe = get_recipe_by_id(params[:id])\n\t\t\t\trecipe.destroy\n\t\t\t\trender json: {status: 'SUCCESS', message: 'Deleted recipe', data: recipe}, statu...
[ "0.7345936", "0.7117749", "0.70913756", "0.7004412", "0.69768625", "0.6968033", "0.6870223", "0.6793253", "0.66248935", "0.6618518", "0.6546741", "0.6417568", "0.63943815", "0.63507", "0.63507", "0.63507", "0.63507", "0.63507", "0.6343963", "0.6295678", "0.62717605", "0.626...
0.78809714
0
Clue: In Ruby, you can concat a string like this: str = "hello" str += " " str += "world" will return "hello world"
def create_sentence(words) str="" for i in 0..words.size-1 do str+=words[i] str+=" " end puts str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat(string); end", "def concat(str)\n @string.concat str\n end", "def concat_str(str1, str2)\n p str1 + str2\nend", "def concatenator(string1, string2)\n \"#{string1} #{string2}\"\nend", "def concat(str1, str2)\n str1 + str2\nend", "def hello(name)\n str1 = name\n str2 = \"Hello, \"\n st...
[ "0.8252408", "0.7929529", "0.7795399", "0.77736443", "0.77202874", "0.75329596", "0.74591875", "0.7412948", "0.7401336", "0.73880273", "0.72768456", "0.71471024", "0.714494", "0.714494", "0.71446234", "0.71238106", "0.71074027", "0.7069266", "0.70354444", "0.6990124", "0.6977...
0.0
-1
The changing password and condition checking Functionality
def refresh_password @user = User.find(session[:user]) @success = false if (!params[:user].blank? && params[:user][:terms_of_service]!="0") or @user.terms_of_service @flag = User.check_old_password(params[:old_password], @user.password) if @flag if (params[:old_password] != params[:new_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_password\r\n \r\n end", "def change_password\n #check if user is new or being updated\n if self.encrypted_password.present?\n #verifies password\n if self.password_check\n self.encrypt_password\n else\n raise \"error\"\n ...
[ "0.79569876", "0.7859544", "0.7709374", "0.75946057", "0.757565", "0.7538257", "0.7515478", "0.75051314", "0.74864113", "0.74533826", "0.74109906", "0.7392846", "0.7386748", "0.73720753", "0.7349812", "0.73483235", "0.7314962", "0.73023295", "0.72956926", "0.7286257", "0.7281...
0.70792675
40
(This method is generated in Translator_defaultbuildImpl)
def get_id return @m_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_target\n super\n end", "def build; end", "def translations; end", "def init_translations; end", "def build=(_arg0); end", "def build\r\n raise \"Not implemented\"\r\n end", "def build\r\n end", "def build\r\n end", "def build\n end", "def label_translation; end", ...
[ "0.6882901", "0.653592", "0.63217664", "0.6284657", "0.61551243", "0.61091876", "0.605949", "0.605949", "0.60470265", "0.59335953", "0.5844821", "0.5795114", "0.5761158", "0.56754434", "0.56447375", "0.5643845", "0.5639414", "0.5635945", "0.5635945", "0.5635945", "0.5635945",...
0.0
-1
(This method is generated in Translator_defaultbuildImpl)
def get_name return @m_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_target\n super\n end", "def build; end", "def translations; end", "def init_translations; end", "def build=(_arg0); end", "def build\r\n raise \"Not implemented\"\r\n end", "def build\r\n end", "def build\r\n end", "def build\n end", "def label_translation; end", ...
[ "0.6883647", "0.6533848", "0.63228124", "0.6285692", "0.61541957", "0.6106972", "0.60572135", "0.60572135", "0.6044818", "0.5934256", "0.58429533", "0.57962584", "0.57621515", "0.56773853", "0.56450874", "0.5641148", "0.56402266", "0.56377953", "0.56377953", "0.56377953", "0....
0.0
-1
(This method is generated in Translator_defaultbuildImpl)
def set_name(v) Saklient::Util::validate_type(v, 'String') @m_name = v @n_name = true return @m_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_target\n super\n end", "def build; end", "def translations; end", "def init_translations; end", "def build=(_arg0); end", "def build\r\n raise \"Not implemented\"\r\n end", "def build\r\n end", "def build\r\n end", "def build\n end", "def label_translation; end", ...
[ "0.6882901", "0.653592", "0.63217664", "0.6284657", "0.61551243", "0.61091876", "0.605949", "0.605949", "0.60470265", "0.59335953", "0.5844821", "0.5795114", "0.5761158", "0.56754434", "0.56447375", "0.5643845", "0.5639414", "0.5635945", "0.5635945", "0.5635945", "0.5635945",...
0.0
-1
(This method is generated in Translator_defaultbuildImpl)
def get_description return @m_description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_target\n super\n end", "def build; end", "def translations; end", "def init_translations; end", "def build=(_arg0); end", "def build\r\n raise \"Not implemented\"\r\n end", "def build\r\n end", "def build\r\n end", "def build\n end", "def label_translation; end", ...
[ "0.6882901", "0.653592", "0.63217664", "0.6284657", "0.61551243", "0.61091876", "0.605949", "0.605949", "0.60470265", "0.59335953", "0.5844821", "0.5795114", "0.5761158", "0.56754434", "0.56447375", "0.5643845", "0.5639414", "0.5635945", "0.5635945", "0.5635945", "0.5635945",...
0.0
-1
(This method is generated in Translator_defaultbuildImpl)
def set_description(v) Saklient::Util::validate_type(v, 'String') @m_description = v @n_description = true return @m_description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_target\n super\n end", "def build; end", "def translations; end", "def init_translations; end", "def build=(_arg0); end", "def build\r\n raise \"Not implemented\"\r\n end", "def build\r\n end", "def build\r\n end", "def build\n end", "def label_translation; end", ...
[ "0.6882901", "0.653592", "0.63217664", "0.6284657", "0.61551243", "0.61091876", "0.605949", "0.605949", "0.60470265", "0.59335953", "0.5844821", "0.5795114", "0.5761158", "0.56754434", "0.56447375", "0.5643845", "0.5639414", "0.5635945", "0.5635945", "0.5635945", "0.5635945",...
0.0
-1
(This method is generated in Translator_defaultbuildImpl)
def get_region return @m_region end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_target\n super\n end", "def build; end", "def translations; end", "def init_translations; end", "def build=(_arg0); end", "def build\r\n raise \"Not implemented\"\r\n end", "def build\r\n end", "def build\r\n end", "def build\n end", "def label_translation; end", ...
[ "0.6883647", "0.6533848", "0.63228124", "0.6285692", "0.61541957", "0.6106972", "0.60572135", "0.60572135", "0.6044818", "0.5934256", "0.58429533", "0.57962584", "0.57621515", "0.56773853", "0.56450874", "0.5641148", "0.56402266", "0.56377953", "0.56377953", "0.56377953", "0....
0.0
-1
(This method is generated in Translator_defaultbuildImpl)
def set_region(v) Saklient::Util::validate_type(v, 'Saklient::Cloud::Resources::Region') raise Saklient::Errors::SaklientException.new('immutable_field', 'Immutable fields cannot be modified after the resource creation: ' + 'Saklient::Cloud::Resources::Bridge#region') if !@is_new @m_region...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_target\n super\n end", "def build; end", "def translations; end", "def init_translations; end", "def build=(_arg0); end", "def build\r\n raise \"Not implemented\"\r\n end", "def build\r\n end", "def build\r\n end", "def build\n end", "def label_translation; end", ...
[ "0.6882901", "0.653592", "0.63217664", "0.6284657", "0.61551243", "0.61091876", "0.605949", "0.605949", "0.60470265", "0.59335953", "0.5844821", "0.5795114", "0.5761158", "0.56754434", "0.56447375", "0.5643845", "0.5639414", "0.5635945", "0.5635945", "0.5635945", "0.5635945",...
0.0
-1
(This method is generated in Translator_defaultbuildImpl)
def api_deserialize_impl(r) @is_new = (r).nil? r = {} if @is_new @is_incomplete = false if Saklient::Util::exists_path(r, 'ID') @m_id = (Saklient::Util::get_by_path(r, 'ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'ID').to_s else @m_id = nil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_target\n super\n end", "def build; end", "def translations; end", "def init_translations; end", "def build=(_arg0); end", "def build\r\n raise \"Not implemented\"\r\n end", "def build\r\n end", "def build\r\n end", "def build\n end", "def label_translation; end", ...
[ "0.6882901", "0.653592", "0.63217664", "0.6284657", "0.61551243", "0.61091876", "0.605949", "0.605949", "0.60470265", "0.59335953", "0.5844821", "0.5795114", "0.5761158", "0.56754434", "0.56447375", "0.5643845", "0.5639414", "0.5635945", "0.5635945", "0.5635945", "0.5635945",...
0.0
-1
Consumes char and produces all valid states. What about free moves? We need to consume free moves
def follow_rules_for(state, char) rules_for(state, char).map(&:follow) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def progress_input(ch)\n #puts \"At position #{@pos}\"\n success = @dfa[@state].success\n if !success.empty?\n @last_success = success\n @last_str = @str\n @last_pos = @pos\n end\n next_state = @dfa[@state].lookup[ch]\n if next_state.nil?\n...
[ "0.61441314", "0.59424835", "0.59123296", "0.5880086", "0.58797586", "0.58199096", "0.5812115", "0.5761823", "0.5670031", "0.56590533", "0.5644181", "0.56257427", "0.5615889", "0.561159", "0.55772066", "0.55520207", "0.55369925", "0.55336136", "0.5531898", "0.5525613", "0.552...
0.0
-1
Gets all rules that respond to a char in a given state.
def rules_for(state, char) rules.select { |rule| rule.applies_to?(state, char) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule_for(state, character)\n self.rules.detect{ |rule| rule.applies_to?(state, character) } #detect == find\n end", "def follow_rules_for(state, char)\n rules_for(state, char).map(&:follow)\n end", "def rules_for(configuration, character)\n # note that it is select (filter), not detect (fi...
[ "0.7075871", "0.6970317", "0.6756823", "0.6713443", "0.59350425", "0.57529193", "0.55863184", "0.55824673", "0.5424139", "0.5417562", "0.5357804", "0.53440744", "0.5255588", "0.52198327", "0.51960623", "0.51960623", "0.5167096", "0.51596755", "0.5098893", "0.5073545", "0.5064...
0.8715351
0