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
shows win or remaining turns
def check_win if win puts "\n You win!" else # shows how many turns remain puts "\n You have #{TURNS - @turns} turns left" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_current_turn\n puts \"Turn #{@turn + 1}, Player #{(@turn % 2) + 1}\"\n end", "def turn\n puts \"Turn #{@board.count_turn + 1}, player #{get_current_player.name} choose:\"\n @board.play_turn\n end", "def game_over\n print_board\n if victor?\n puts \"#{self.victor?} is the v...
[ "0.72572136", "0.70798755", "0.70409554", "0.7037158", "0.702491", "0.69814044", "0.69770944", "0.6973264", "0.69639254", "0.6942884", "0.6899964", "0.6872847", "0.6869406", "0.685956", "0.6855578", "0.6855283", "0.6837401", "0.68186736", "0.6803984", "0.678885", "0.67547196"...
0.79604405
0
asks user if rematch desired
def play_again puts "\n Would you like to play again? y/n" answer = gets.chomp.downcase if answer == ("y" || "yes") Game.new.play else puts "\n Thank you for playing!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(input); end", "def match(input)\n input \n end", "def post_match() end", "def match\n true\n end", "def match; end", "def match; end", "def do_match(input)\n @matched = input.match(@on)\n end", "def match?(name); end", "def match_query(query); end", "def is_correct?\n ...
[ "0.7011139", "0.67534256", "0.67057437", "0.67008364", "0.66900986", "0.66900986", "0.66409534", "0.6579448", "0.6474582", "0.6447216", "0.6431372", "0.64192677", "0.641826", "0.64103645", "0.64096105", "0.6364916", "0.63455373", "0.6317084", "0.6205512", "0.6171907", "0.6171...
0.0
-1
I think the answer to this is creating a new tag named [youtube] but that captures specifically the .be or .com and treats them differently...
def test_youtubes_via_there_url_shortener url_from_shortener = 'http://youtu.be/E4Fbk52Mk1w' expected_output = 'E4Fbk52Mk1w' mock_regex_matches = @@tags[:youtube][:url_matches] RubyBBCode::TagSifter.publicize_methods do ts = RubyBBCode::TagSifter.new '', '' # this test is now hopelessly br...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def markdown_extention_youtube_links(html)\n html = html.gsub /<a\\shref=\"http:\\/\\/www\\.youtube\\.com\\/watch\\?v=(.*).*\".*>.*<\\/a>/o, \n \"<p><iframe class=\\\"youtube-player\\\" src=\\\"http://www.youtube.com/embed/\\\\1\\\"></iframe></p>\"\n return html\n end", "def youtube_tag(url, opts = {...
[ "0.65621305", "0.6414589", "0.63338876", "0.63235843", "0.600453", "0.599909", "0.599909", "0.5985747", "0.5940273", "0.59085023", "0.58426166", "0.5777521", "0.57654804", "0.5755335", "0.5746571", "0.5734595", "0.57175404", "0.57151335", "0.56865245", "0.56723386", "0.563342...
0.56155217
22
I worked on this challenge by myself psuedocode input: integer output: factorial of that interger establish a loop to keep subracting one and only work when number is bigger than 0 have the number multiplied by the next iteration of it or the one less by one. have a conditional for factorial 0 to be 1 return the result...
def factorial(number) if (number >= 2) result.each do |number| number * (number -1) number -= end return result else number == 0 || number == 1 return 1 end end #This is as close as i got to getting factorial to work without using refactoring, per instructions. #Couldnt really get t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial(number)\n counter = number.to_i - 1\n if number.to_i == 0\n return 1\n else\n while counter > 0\n number = number * counter\n counter = counter - 1\n end\nend\nreturn number\nend", "def factorial(number)\n result=1\n #if number == 0\n # return 1\n else\n while (number>0)\n ...
[ "0.8708291", "0.8556082", "0.8511055", "0.85107446", "0.84791315", "0.8438253", "0.8427472", "0.8422243", "0.84174275", "0.8413844", "0.8413844", "0.8394853", "0.83772993", "0.8375461", "0.83621186", "0.83244276", "0.83084905", "0.82917434", "0.82899195", "0.8286861", "0.8278...
0.8114296
47
It also uses `map/projects_statistics.csv` file to get a list of projects that needs to be included in rank statistics. Output rank statistics file is `projects/project_ranks.txt`
def analysis(fin, fout, fhint, furls, fdefmaps, fskip, franges) sort_col = 'authors' forks = ENV.has_key? 'INCLUDE_FORKS' unless forks require 'json' require 'octokit' require './ghapi' gcs = octokit_init() hint = rate_limit(gcs)[0] fork_data = {} $g_forks_file = ENV['FORKS_FILE'] if E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_ranking(title, table:, column:, scope: Project.for_display, direction: \"DESC\", description: nil)\n projects = scope.order(\"#{table}.#{column} #{direction} NULLS LAST\").limit(100)\n metrics = if table == :github_repos\n [\"github_repo_stargazers_count\", \"github_repo_#{column}\...
[ "0.6478451", "0.6241944", "0.6022876", "0.59988904", "0.5971307", "0.5965575", "0.58914155", "0.58002204", "0.57502145", "0.5690036", "0.56312954", "0.5549773", "0.5471608", "0.5464966", "0.54321057", "0.5429995", "0.53910595", "0.5384678", "0.5332854", "0.532973", "0.5312444...
0.5451367
14
GET /signups or /signups.json
def index @signups = Signup.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sign_ups = SignUp.all\n end", "def index\n @sign_ups = SignUp.all\n end", "def index\n @signups = Signup.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def show\n @signup = Signup.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.6651045", "0.6651045", "0.6468852", "0.636792", "0.636792", "0.6310774", "0.62832594", "0.6161588", "0.6028819", "0.5953405", "0.5953405", "0.57892996", "0.5715291", "0.56986594", "0.5680118", "0.5674533", "0.5659528", "0.56394285", "0.56082237", "0.5571724", "0.5571724", ...
0.66947293
0
GET /signups/1 or /signups/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @signup = Signup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @signup }\n end\n end", "def show\n @signup = Signup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { r...
[ "0.65736485", "0.65736485", "0.62666714", "0.62138575", "0.6173711", "0.6173711", "0.60778487", "0.59562844", "0.59562844", "0.5882267", "0.587573", "0.5834907", "0.58272254", "0.57885784", "0.5779647", "0.57508653", "0.57333124", "0.5655631", "0.5640743", "0.56247514", "0.55...
0.0
-1
POST /signups or /signups.json
def create @seminar = Seminar.find(params[:seminar_id]) @signup = Signup.new(signup_params) respond_to do |format| if @signup.save format.html { redirect_to @seminar, notice: "Signup was successfully created." } format.json { render :show, status: :created, location: @seminar } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signup\n client.signup(\n params[:user],\n params[:password]\n )\n end", "def signup(params={})\n begin\n JSON.parse(RestClient.put construct_url(\"user\"), params)\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n f...
[ "0.70315504", "0.6896562", "0.67104113", "0.66593105", "0.66593105", "0.6553446", "0.65303165", "0.6527882", "0.64776725", "0.64760554", "0.6454336", "0.63894475", "0.63790274", "0.6377886", "0.6359349", "0.63152695", "0.63019764", "0.6294313", "0.62606186", "0.62086684", "0....
0.6213503
19
PATCH/PUT /signups/1 or /signups/1.json
def update respond_to do |format| if @signup.update(signup_params) format.html { redirect_to @signup, notice: "Signup was successfully updated." } format.json { render :show, status: :ok, location: @signup } else format.html { render :edit, status: :unprocessable_entity } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @sign_up.update(sign_up_params)\n format.html { redirect_to @sign_up, notice: 'Sign up was successfully updated.' }\n format.json { render :show, status: :ok, location: @sign_up }\n else\n format.html { render :edit }\n format.json {...
[ "0.66260946", "0.662606", "0.6609775", "0.65706855", "0.6546377", "0.6132547", "0.6102531", "0.5985001", "0.5929003", "0.5896646", "0.5845322", "0.58392084", "0.58246666", "0.5795066", "0.57819253", "0.57819253", "0.5735923", "0.5735923", "0.57344526", "0.56969714", "0.568054...
0.65493196
4
DELETE /signups/1 or /signups/1.json
def destroy @signup.destroy respond_to do |format| format.html { redirect_to root_path, notice: "Signup was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @signup = Signup.find(params[:id])\n @signup.destroy\n\n respond_to do |format|\n format.html { redirect_to signups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @signup = Signup.find(params[:id])\n @signup.destroy\n\n respond_to do |format|\n fo...
[ "0.7457604", "0.7437474", "0.722599", "0.7177149", "0.7177149", "0.7158465", "0.70819557", "0.7056483", "0.68797505", "0.6826592", "0.6817438", "0.6816306", "0.65423644", "0.6530778", "0.64965177", "0.64820826", "0.6431135", "0.6400997", "0.6389141", "0.6359121", "0.6353047",...
0.6995956
8
Use callbacks to share common setup or constraints between actions.
def set_signup @signup = Signup.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 signup_params params.require(:signup).permit(:full_name, :attending, :user_id, :seminar_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
Normally we wouldn't nilhandle something whose presence we validate, but this accommodates stock new objects.
def time start.try(:to_time).try(:strftime, '%-l:%M %P') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validated?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?\n super && !object.nil?\n end", "def validated; end", "def validate_object(object)\n raise ActiveRecordObjectInvalid.new(\"The object is nil\") if object...
[ "0.68968624", "0.67601454", "0.67601454", "0.67601454", "0.67601454", "0.67601454", "0.6530996", "0.6457986", "0.64341193", "0.6405989", "0.63484585", "0.6201515", "0.61801004", "0.6134039", "0.609381", "0.60596055", "0.60596055", "0.60596055", "0.6030323", "0.5997557", "0.59...
0.0
-1
The row iterator. Calling this kicks off the actual query to the database server. Before triggering the enumerator, it rebuilds the dataset with the default traversal configured by the relation DSL.
def each(&iter) # Configure the default traversal unless @configured @configured = true self.class.traversal.each do |query_method, conditions| @dataset = @dataset.send(query_method.to_sym, *conditions) if conditions end end @dataset.each(&iter)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterator\n @table.iterator\n end", "def each_row\n @rows.each { |row| yield(row) }\n self\n end", "def each_record\n return to_enum(:each_record) unless block_given?\n\n @relation.to_enum(:in_batches, of: @of, start: @start, finish: @finish, load: true).each do |relat...
[ "0.65767694", "0.6419182", "0.6391642", "0.6381724", "0.62319404", "0.62319404", "0.6208178", "0.6168283", "0.6147538", "0.612838", "0.60992587", "0.60447806", "0.6028038", "0.6013364", "0.6000629", "0.59815854", "0.5946532", "0.59307265", "0.59281605", "0.59254444", "0.59133...
0.6954137
0
can add a word with or without definition
def add(word) if word.class == String word = {word => nil} end word.each do |key, value| @entries[key] = value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_word(word)\n \n end", "def add_word(word)\r\n \r\n end", "def add(word)\n end", "def add_word(word, definition)\r\n @word << {Word: word, Definition: definition}\r\n # puts \"This is @word: #{@word}\"\r\n end", "def add(word, w)\n if word != \"\" \...
[ "0.8024392", "0.7796861", "0.77204514", "0.75243646", "0.70271903", "0.70127594", "0.6995674", "0.68465865", "0.67729914", "0.67504036", "0.6656995", "0.66289157", "0.65388024", "0.6534243", "0.651296", "0.6467197", "0.64447165", "0.6439278", "0.6414103", "0.6411269", "0.6333...
0.6455136
16
checks if keywords exist
def include?(key) self.keywords.include?(key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyword_check(kw)\n unless (@keywords || %w(a is of has)).include?(kw)\n raise RDF::ReaderError, \"unqualified keyword '#{kw}' used without @keyword directive\" if validate?\n end\n end", "def keyword_check(kw)\n unless (@keywords || %w(a is of has)).include?(kw)\n raise RDF::...
[ "0.7603658", "0.75643045", "0.7351358", "0.73298955", "0.7328528", "0.7276235", "0.71234167", "0.7060567", "0.7060567", "0.7042437", "0.70071614", "0.6941253", "0.69023347", "0.678858", "0.67314994", "0.6715291", "0.67134595", "0.66937906", "0.66928196", "0.6659602", "0.66582...
0.7393272
2
finds using key prefix
def find(prefix) found_entries = entries.select do |key, value| key[0...prefix.length] == prefix end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(prefix)\n prefix.downcase!\n @base.each_key do |name|\n if name.start_with? prefix\n puts base[name].to_s()\n end\n end\n end", "def prefix_match(prefix)\n val = []\n database.each do |k, v|\n if k.downcase.start_with?(prefix)\n val.push(v)\n end\n en...
[ "0.81436497", "0.77072823", "0.74979776", "0.7311308", "0.6933936", "0.6881843", "0.68211997", "0.6606908", "0.6540081", "0.65253985", "0.6512746", "0.64167684", "0.6393237", "0.6360908", "0.6309606", "0.63069755", "0.62874556", "0.6274689", "0.6263691", "0.62215537", "0.6196...
0.7978737
1
creates printable version of itself in AZ order
def printable @entries.sort.map do |key, value| "[#{key}] \"#{value}\"" end.join("\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n output_string = String.new\n letter_array = @spaces\n 4.times do\n output_string << letter_array.shift(4).join('') + \"\\n\"\n end\n output_string\n end", "def to_s\n \t#Create an empty string\n \tletter_array = @spaces\n \t# puts letter_array.to_s\n \tletter_array.map!{|char| ch...
[ "0.6221788", "0.60997695", "0.60689783", "0.60689783", "0.6025666", "0.6018155", "0.5987579", "0.5916537", "0.5901646", "0.5813651", "0.57914144", "0.57899845", "0.57139903", "0.5708603", "0.5686002", "0.56750643", "0.56637937", "0.5653396", "0.56453377", "0.56354696", "0.561...
0.5403132
51
this is private because user shouldnt be able to edit this method
def song_params #these are the parameters for someone inputting a new song params.require(:song).permit( :title, :release_year, :released, :genre, :artist_name ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def private_method\n end", "def schubert; end", "def suivre; end", "def refutal()\n end", "def who_we_are\r\n end", "def probers; end", "def custom; end", "def custom; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def imple...
[ "0.80276555", "0.7234487", "0.7095275", "0.70866865", "0.6873054", "0.6859121", "0.6844074", "0.6787706", "0.6787706", "0.67614853", "0.67614853", "0.67614853", "0.67614853", "0.67595816", "0.67595816", "0.67260146", "0.6709329", "0.6709329", "0.6709329", "0.6709329", "0.6709...
0.0
-1
GET /load_balancer_checks/1 GET /load_balancer_checks/1.json
def show @load_balancer_check = LoadBalancerCheck.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @load_balancer_check } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loadbalancer }\n end\n end", "def new\n @load_balancer_check = LoadBalancerCheck.new\n\n...
[ "0.71646255", "0.68079233", "0.67725056", "0.6420092", "0.6412188", "0.6412188", "0.6312722", "0.62754285", "0.62632596", "0.62456673", "0.6081912", "0.60807294", "0.60510445", "0.60004306", "0.5926501", "0.5926501", "0.59098774", "0.5882282", "0.5882282", "0.5876644", "0.584...
0.7221235
0
GET /load_balancer_checks/new GET /load_balancer_checks/new.json
def new @load_balancer_check = LoadBalancerCheck.new respond_to do |format| format.html # new.html.erb format.json { render json: @load_balancer_check } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @loadbalancer = Loadbalancer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loadbalancer }\n end\n end", "def create\n @operations_check = OperationsCheck.find(params[:operations_check_id])\n @load_balancer_check = @operations_check.l...
[ "0.7520849", "0.73086697", "0.68148506", "0.67844677", "0.64767087", "0.6375883", "0.63088936", "0.6306586", "0.6220491", "0.619944", "0.60924894", "0.60647595", "0.60516846", "0.6038595", "0.5984123", "0.59838283", "0.5957461", "0.59230953", "0.59172744", "0.59041506", "0.58...
0.8255936
0
POST /load_balancer_checks POST /load_balancer_checks.json
def create @operations_check = OperationsCheck.find(params[:operations_check_id]) @load_balancer_check = @operations_check.load_balancer_checks.create(load_balancer_check_params) respond_to do |format| if @load_balancer_check.save format.html { redirect_to operations_check_path(@operations_ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_balancer_check_params\n params.require(:load_balancer_check).permit(:name, :passed, :ticket)\n end", "def load_balancer_data(balancer = nil)\n params = Smash.new(\"Action\" => \"DescribeLoadBalancers\")\n if balancer\n params[\"LoadBalancerNames.member.1\"] = balance...
[ "0.674266", "0.6562776", "0.65213484", "0.6448973", "0.63173854", "0.6277968", "0.60634625", "0.6028632", "0.60100573", "0.60007507", "0.5907815", "0.575417", "0.5738855", "0.5731341", "0.558941", "0.55869645", "0.55778813", "0.5568571", "0.5565897", "0.55491614", "0.55328256...
0.726488
0
PATCH/PUT /load_balancer_checks/1 PATCH/PUT /load_balancer_checks/1.json
def update @operations_check = OperationsCheck.find(params[:operations_check_id]) @load_balancer_check = @operations_check.load_balancer_checks.find(params[:id]) respond_to do |format| if @load_balancer_check.update_attributes(load_balancer_check_params) format.html { redirect_to @load_balanc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n respond_to do |format|\n if @loadbalancer.update_attributes(params[:loadbalancer])\n format.html { redirect_to @loadbalancer, notice: 'Loadbalancer was successfully updated.' }\n...
[ "0.7207094", "0.61534846", "0.60832393", "0.60768056", "0.5960794", "0.59251094", "0.59202045", "0.5920056", "0.59112555", "0.58173275", "0.5802535", "0.5709812", "0.56990373", "0.56607133", "0.56578153", "0.5647831", "0.561444", "0.5515305", "0.5464066", "0.5414386", "0.5402...
0.7341003
0
DELETE /load_balancer_checks/1 DELETE /load_balancer_checks/1.json
def destroy operations_check = OperationsCheck.find(params[:operations_check_id]) @load_balancer_check = LoadBalancerCheck.find(params[:id]) @load_balancer_check.destroy respond_to do |format| format.html { redirect_to operations_check_path(operations_check, tab: "load_balancers") } format....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end", "def delete\n client....
[ "0.7664263", "0.7411966", "0.68069565", "0.65915287", "0.6584081", "0.65492326", "0.6354962", "0.63073826", "0.6193936", "0.61193025", "0.60942787", "0.60919434", "0.6067865", "0.6040419", "0.6016091", "0.60158134", "0.6002823", "0.596039", "0.59472096", "0.5921339", "0.58963...
0.75157773
1
Use this method to whitelist the permissible parameters. Example: params.require(:person).permit(:name, :age) Also, you can specialize this method with peruser checking of permissible attributes.
def load_balancer_check_params params.require(:load_balancer_check).permit(:name, :passed, :ticket) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def strong_params\n params.require(:user).pe...
[ "0.7718344", "0.7674626", "0.75207216", "0.7155158", "0.7142339", "0.7117573", "0.7103159", "0.70793116", "0.7039148", "0.70069605", "0.70030576", "0.7001473", "0.7001473", "0.69552064", "0.69362193", "0.6936087", "0.6934291", "0.6881009", "0.6797773", "0.6735618", "0.6702711...
0.0
-1
New accounts created with an ID and an initial balance
def initialize(balance,account_open_date = Time.now) @id = Random.rand(100000..999999) @balance @account_open_date = account_open_date @minimum_balance = 0 @withdraw_fee = 0 check_opening_balance(balance) show_current_balance return @balance end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_balance\n if account_balance_id == nil\n account_amount = (self.net_price * self.quantity) * -1\n create_balance = AccountBalance.new(date: self.purchase.date, gl_account_id: self.gl_account_id, amount: account_amount, user_id: self.user_id)\n create_balance.save!\n self.account_balan...
[ "0.7519356", "0.7374455", "0.7374455", "0.7132365", "0.7060767", "0.6981907", "0.6882533", "0.6877194", "0.6775613", "0.6754077", "0.66658235", "0.66397524", "0.66285336", "0.6621808", "0.66155034", "0.66155034", "0.659763", "0.6597454", "0.65649205", "0.65240085", "0.6518498...
0.64526534
25
deposit method accepts a single parameter: amount deposited method calls show_current_balance method, which returns updated account balance
def deposit(deposit_amount) if deposit_amount <= 0 puts "dummy." else @balance += deposit_amount end show_current_balance end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deposit(deposit_amt = 0)\n @balance = @balance + deposit_amt\n return @balance\n end", "def deposit(amount)\n @balance += amount\n puts \"Deposit #{amount}. New Balance: $#{@balance}\"\n returned\n end", "def deposit(amount)\n @balance = @balance + amount\n end", ...
[ "0.83388793", "0.8306262", "0.82660514", "0.8248467", "0.8209155", "0.8209122", "0.8201388", "0.8199799", "0.8167533", "0.8155764", "0.8155764", "0.8148469", "0.8148469", "0.8148373", "0.8138851", "0.81044495", "0.81044495", "0.81044495", "0.81028414", "0.8087366", "0.8065709...
0.83516705
0
withdraw method accepts a single parameter: money withdrawn method calls show_current_balance method, which returns updated account balance
def withdraw(withdraw_amount) transaction = withdraw_amount + @withdraw_fee if withdraw_amount <= 0 puts "dummy." elsif @minimum_balance == (@balance - transaction) # withdraw method does not allow account to be < minimum balance - Will output a warning message and return the original un...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def withdraw(amount_to_withdraw)\n @balance -= amount_to_withdraw\n end", "def withdraw (amount, account)\n if account == \"checking\"\n @checking_account_balance -= amount\n elsif account == \"saving\"\n @saving_account_balance -= amount\n else\n puts \"No account was selected\"\n ...
[ "0.856358", "0.82668024", "0.8230991", "0.8230991", "0.8210265", "0.8159266", "0.81582826", "0.8090796", "0.80457574", "0.80227363", "0.79714507", "0.79708123", "0.7939538", "0.7936278", "0.78906214", "0.7881213", "0.7867185", "0.7832754", "0.77853453", "0.7778172", "0.775741...
0.7782479
19
returns the account balance
def show_current_balance return "Balance: $#{sprintf "%.2f", @balance}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_balance\n response = execute_command('getbalance')\n parse_response(response)['Credit'].to_f\n end", "def get_balance\n return balance\n end", "def account_balance\n @account_balance\n end", "def balance\n # accounts.reduce(0) {|sum, account| sum + account.balance}...
[ "0.9074151", "0.8855496", "0.8724153", "0.85222673", "0.85143226", "0.8385574", "0.8364143", "0.8344455", "0.82798964", "0.82787615", "0.827613", "0.8254708", "0.82247514", "0.82092476", "0.81868446", "0.81751883", "0.8172659", "0.8154553", "0.81530666", "0.8129133", "0.81192...
0.0
-1
Method is different than just withdrawing because it allows for an overdraft of $10, but still calls to the withdraw method
def withdraw_using_check(amount) @minimum_balance = -10 if (@balance - amount - @withdraw_fee) >= @minimum_balance @checks_used += 1 # user is allowed 3 free checks in a month; any subsequent use adds $2 fee if @checks_used < 4 @withdraw_fee = 0 else @wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def withdraw\n raise\n end", "def withdraw(amount_to_withdraw)\n @balance -= amount_to_withdraw\n end", "def draw; end", "def draw; end", "def draw\n raise \"Not implemented\"\n end", "def withdraw\n copy self.class.withdraw(@id)\n true\n end", "def withdraw\n cop...
[ "0.6936464", "0.6554781", "0.6396015", "0.6396015", "0.63607174", "0.63334703", "0.63334703", "0.6326743", "0.62702024", "0.6225647", "0.6225647", "0.6225647", "0.62072235", "0.61878306", "0.6187364", "0.6153727", "0.61461794", "0.61461794", "0.61456925", "0.6114765", "0.6108...
0.0
-1
resets number of checks used to 0 (at end of the month)
def reset_checks @checks_used = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_checks\n @free_checks_available = FREE_CHECKS_PER_MONTH\n end", "def reset_checks\n @check_count = 0\n end", "def reset_checks\n @counter = 0\n end", "def reset_checks\n @checks = 0\n end", "def reset_checks\n @checks_remaining = 3\n end", "def reset_checks\n...
[ "0.8185185", "0.78533834", "0.7710335", "0.76588285", "0.7296187", "0.70789236", "0.69958717", "0.6554045", "0.64842725", "0.63339007", "0.6280216", "0.6119078", "0.6046315", "0.600885", "0.5958528", "0.5955705", "0.5938101", "0.5928935", "0.5826641", "0.580292", "0.5775691",...
0.75376445
4
Este es un setter
def instance_var=(value) @instance_var = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set; end", "def set; end", "def __setter__\n \"#{self}=\"\n end", "def setter\r\n @setter ||= Field.setter(@name)\r\n end", "def attribute_to_set; end", "def setter_method\n :\"#{self[:name]}=\"\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n en...
[ "0.7835655", "0.7835655", "0.78239405", "0.75580305", "0.74708915", "0.74625117", "0.74247646", "0.73103386", "0.7281559", "0.7257858", "0.70558745", "0.69903", "0.6958582", "0.6937948", "0.67910373", "0.6767614", "0.6714145", "0.6688443", "0.6669991", "0.6660556", "0.6644587...
0.0
-1
Simulation Display line = hash of line names to array of stops stations = hash of station names => hashes for each line => hash of trains at station OR hash for "passenger" => hash of passengers at station trains = hash of train names => hash of passengers
def displayState(lines,stations,trains) lines.keys.sort.each { |color| stops = lines[color] puts color stops.each { |stop| pStr = "" tStr = "" stations[stop]["passenger"].keys.sort.each { |passenger| pStr << passenger << " " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_stations_en_route\n\n start_station_sym = @start_station.gsub(\" \", \"_\").to_sym\n\n end_station_sym = @end_station.gsub(\" \", \"_\").to_sym\n\n start_line_sym = @start_line.to_sym\n\n end_line_sym = @end_line.to_sym\n \n if start_line_sym == :victoria\n start_line_sym_index = 0...
[ "0.70313203", "0.70137686", "0.68277156", "0.6757647", "0.6544579", "0.6474797", "0.6450042", "0.6395969", "0.63517505", "0.6284855", "0.62557924", "0.62157595", "0.6213245", "0.6207116", "0.61979896", "0.6152699", "0.6141164", "0.61239606", "0.60356426", "0.6031895", "0.6013...
0.6936268
2
Example of how to use displayState
def displayExample lines = { } lines["Black"] = ["S1","S2"] stations = {} stations["S1"] = { } stations["S2"] = { } stations["S1"]["Black"] = { } stations["S2"]["Black"] = { } stations["S1"]["passenger"] = { } stations["S2"]["passenger"] = { } stations["S1"]["passenger"]["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_state\n puts \"#{name} a #{life_points} points de vie !!\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie.\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie\"\n end", "def show_state\n puts \"#{name} a #{life_points} points ...
[ "0.6797787", "0.6792553", "0.67549497", "0.67539966", "0.6750916", "0.6743899", "0.6730727", "0.6728846", "0.6710674", "0.6701738", "0.66994715", "0.6686237", "0.66603553", "0.66438335", "0.6637641", "0.66361624", "0.6601976", "0.6586674", "0.65197384", "0.6457579", "0.638038...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_model_asset @model_asset = ModelAsset.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 model_asset_params params.require(:model_asset).permit(:model_asset_name, type_asset_ids: []) 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
GET /positions/new GET /positions/new.xml
def new @user = User.find(params[:user_id]) @position = @user.positions.build @committees = Committee.all(:order => :code) @roles = @committees.size > 0 ? @committees[0].roles : [] respond_to do |format| format.html # new.html.erb format.xml { render :xml => @position } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @position = Position.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end", "def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @p...
[ "0.77458495", "0.7739099", "0.73096436", "0.73096436", "0.73096436", "0.7039403", "0.69023687", "0.6855853", "0.68451124", "0.67869174", "0.67222494", "0.6680468", "0.6677375", "0.6644027", "0.6632762", "0.6602995", "0.65693116", "0.65235496", "0.64933926", "0.645674", "0.645...
0.60470575
56
POST /positions POST /positions.xml
def create @user = User.find(params[:user_id]) @position = @user.positions.build(params[:position]) respond_to do |format| if @position.save flash[:notice] = 'Position was successfully created.' format.html { redirect_to(@user) } format.xml { render :xml => @position, :s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n respond_to do |format|\n if position.save\n format.html { redirect_to( position, flash: { success: 'Position created.' } ) }\n format.xml { render xml: position, status: :created, location: position }\n else\n format.html { render action: \"new\" }\n format.xm...
[ "0.69860995", "0.6968086", "0.6844047", "0.66578025", "0.66483974", "0.6642075", "0.66412973", "0.66412973", "0.6587157", "0.6512084", "0.6322979", "0.63059", "0.625105", "0.6223546", "0.61890554", "0.6164848", "0.61175", "0.6078293", "0.60696125", "0.60637444", "0.6058795", ...
0.6184882
15
PUT /positions/1 PUT /positions/1.xml
def update @position = Position.find(params[:id]) user = @position.user respond_to do |format| if @position.update_attributes(params[:position]) flash[:notice] = 'Position was successfully updated.' format.html { redirect_to(user_path(user)) } format.xml { head :ok } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if position.save\n format.html { redirect_to( position, flash: { success: 'Position updated.' } ) }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: position.errors, status: :unproc...
[ "0.6906585", "0.6825522", "0.6659861", "0.6654162", "0.65643275", "0.6448095", "0.6448095", "0.6448095", "0.636476", "0.62846386", "0.6237874", "0.6171852", "0.6140559", "0.61304057", "0.6073988", "0.60664445", "0.60014963", "0.5947573", "0.5942109", "0.59374857", "0.59246236...
0.58526707
22
DELETE /positions/1 DELETE /positions/1.xml
def destroy @position = Position.find(params[:id]) user = @position.user @position.destroy respond_to do |format| format.html { redirect_to(user) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n \n respond_to do |format|\n format.html { redirect_to(positions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do...
[ "0.7353485", "0.7325413", "0.72275925", "0.71173704", "0.6888883", "0.6859223", "0.68506724", "0.68235254", "0.6811209", "0.67841226", "0.67627645", "0.6712049", "0.66962945", "0.6673704", "0.6535062", "0.65343904", "0.65343904", "0.65343904", "0.6495198", "0.6487152", "0.644...
0.68318945
7
Returns an array of users instead of an Active Record relation
def all_friends requested_friends + accepted_friends end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users\n users_array = []\n if serialization_options[:include_users] == true\n # NOTE: object here refers to the ActiveRecord model object. self refers to the serializer object itself.\n object.users.each do |user|\n # NOTE: You can pass serialization_options t...
[ "0.79115945", "0.7900494", "0.7863669", "0.76767874", "0.7646934", "0.7632329", "0.75888306", "0.7563246", "0.7452662", "0.7431003", "0.7416045", "0.74054694", "0.73961896", "0.73956007", "0.7395328", "0.7375119", "0.736307", "0.73128444", "0.7296126", "0.72954965", "0.726519...
0.0
-1
GET /refunds/1 GET /refunds/1.json
def show @refund = Refund.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @refund } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refunds\n RefundRepository.new(api).all(token)\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refunds }\n end\n end", "def refund(tid, refund)\n begin\n #creating url\n url = \"#{@s...
[ "0.7300918", "0.7189426", "0.71389496", "0.71285766", "0.7020494", "0.7020494", "0.6980948", "0.69571817", "0.69209987", "0.6905681", "0.6871181", "0.6856648", "0.6736021", "0.66914386", "0.6665205", "0.66562665", "0.66281515", "0.66123986", "0.6606755", "0.6595409", "0.65936...
0.7494874
0
GET /refunds/new GET /refunds/new.json
def new @refund = Refund.new respond_to do |format| format.html # new.html.erb format.json { render json: @refund } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { r...
[ "0.7760759", "0.7684975", "0.74572015", "0.744348", "0.6885683", "0.6806962", "0.6689645", "0.66887814", "0.6637615", "0.65879345", "0.6569617", "0.6530977", "0.65274894", "0.65274894", "0.65236926", "0.6481491", "0.64791125", "0.64791125", "0.6474597", "0.6473745", "0.646988...
0.847749
0
POST /refunds POST /refunds.json
def create @refund = Refund.new(params[:refund]) respond_to do |format| if @refund.save format.html { redirect_to @refund, notice: 'Refund was successfully created.' } format.json { render json: @refund, status: :created, location: @refund } else format.html { render action:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refund(tid, refund)\n begin\n #creating url\n url = \"#{@security.environment}/transactions/#{tid}/refunds\"\n\n # make the request.\n json_response = Rede::CommonRequest::post(url, refund, @security)\n\n # mapping the result...
[ "0.72928524", "0.72220093", "0.7141533", "0.7139806", "0.70534503", "0.6982286", "0.69706225", "0.6958251", "0.6841389", "0.6834011", "0.6833234", "0.68022853", "0.68022853", "0.677015", "0.66018367", "0.6594192", "0.65577936", "0.6523444", "0.65152913", "0.65089875", "0.6508...
0.7411639
0
PUT /refunds/1 PUT /refunds/1.json
def update @refund = Refund.find(params[:id]) respond_to do |format| if @refund.update_attributes(params[:refund]) format.html { redirect_to @refund, notice: 'Refund was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ...
[ "0.75599337", "0.7290829", "0.70791286", "0.70637393", "0.6838148", "0.68328863", "0.68274236", "0.6785931", "0.6768365", "0.6754151", "0.6727216", "0.6710479", "0.66524756", "0.662985", "0.65941256", "0.65941256", "0.6587663", "0.6534057", "0.65168035", "0.65012044", "0.6469...
0.75930625
0
DELETE /refunds/1 DELETE /refunds/1.json
def destroy @refund = Refund.find(params[:id]) @refund.destroy respond_to do |format| format.html { redirect_to refunds_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n r...
[ "0.81307006", "0.79905313", "0.747926", "0.71469235", "0.6928885", "0.67540485", "0.6580265", "0.6577861", "0.6566604", "0.65602875", "0.65319526", "0.6528937", "0.64694643", "0.6468193", "0.6433934", "0.6402421", "0.63959885", "0.63959885", "0.639443", "0.63930553", "0.63847...
0.8167571
0
ComparableVersion components comparison method. Uses Comparable to assess whether this ComparableVersion's component value or the other ComparableVersion's component value is greater or lesser. The first value to be found as greater or lesser determines which ComparableVersion object is greater or lesser. Missing Compa...
def <=>(other) NAMES.each do |name| result = send(name).to_i <=> other.send(name).to_i return result unless result.zero? end 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_compare(a, b)\n make_comparable(a) <=> make_comparable(b)\n end", "def <=>(other) \n\n versionComparison = Substring.new(get_version_string) <=> Substring.new(other.get_version_string)\n (return versionComparison) if versionComparison != 0\n\n other_pre = other.instance_var...
[ "0.75370085", "0.73479027", "0.7164859", "0.70479125", "0.69974416", "0.69930375", "0.6991202", "0.6941551", "0.68825054", "0.68564", "0.6855895", "0.6848834", "0.68362707", "0.6833278", "0.6831976", "0.67892045", "0.6777473", "0.67425483", "0.6643239", "0.6628137", "0.662465...
0.0
-1
For optional hooks and common install code see source_install cookbook
def config_creates_file(_new_resource) return 'Makefile' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_install; end", "def post_install; end", "def install\n end", "def install\n end", "def prepare_for_installation; end", "def install\n \n end", "def install\n end", "def post_install\n end", "def install_pre_hook\n end", "def install\n # nothing to do\n end", "def instal...
[ "0.806294", "0.7675991", "0.7613143", "0.7613143", "0.7577597", "0.7533398", "0.750301", "0.7425259", "0.7402049", "0.7346697", "0.7257728", "0.7233837", "0.7192863", "0.7093575", "0.7091394", "0.7048891", "0.704553", "0.7033889", "0.69562143", "0.69073236", "0.6856169", "0...
0.0
-1
any key added gets this default value
def initialize(a_hash) from_h(a_hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default(key) end", "def default key\n @defaults[String(key).to_sym]\n end", "def default(key)\n @defaults[key]\n end", "def default(key = nil) \n if key.is_a?(Symbol) && key?(key) \n self[key] \n else \n key ? super : super()\n end \n end", "def defaul...
[ "0.8159272", "0.75074995", "0.7230401", "0.72295016", "0.72011006", "0.70727634", "0.70615983", "0.6971565", "0.69139403", "0.69073707", "0.6852512", "0.68378747", "0.68378747", "0.68296564", "0.67670673", "0.67443347", "0.6737938", "0.67296857", "0.65913683", "0.6587792", "0...
0.0
-1
Does this options instance have a specific key?
def has?(key) respond_to? key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options_set?(key)\n @options.key? key\n end", "def vash_valid_key?(x); self.class.option_name?(x); end", "def option?(key)\n key = key&.to_sym\n @value.key?(key) || option_method(key).present?\n end", "def has_key? k\n host_hash.has_key?(k) || options.has_key?(k)\n end...
[ "0.8427883", "0.790109", "0.78820586", "0.77710575", "0.7723696", "0.76246333", "0.7521684", "0.75033665", "0.7458805", "0.7453645", "0.74020773", "0.7355702", "0.73130935", "0.7304248", "0.73022795", "0.72628987", "0.72331744", "0.71972287", "0.7106662", "0.7070685", "0.7070...
0.66688186
60
add some keys to this options instance uses instance_eval to define getter and setter for each key just like the attr_accessor does.
def add(*array_of_string_or_sym) Array(array_of_string_or_sym).reject{|key| has?(key.to_s)}.each do |key| instance_eval <<~EOM def #{key} @#{key} end def #{key}=(a_value) @#{key} = a_value end EOM send "#{key}=", DEFAULT # NOTE: instance varible...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_options! options = {}\n options.each_pair do |key, value| \n send(\"#{key}=\", value) if self.respond_to?(:\"#{key}=\")\n end \n end", "def with(options)\n options.each do |key, value|\n begin\n send \"#{key}=\", value\n rescue NoMethodError\n ...
[ "0.66568255", "0.6588515", "0.6565643", "0.65508395", "0.64684343", "0.64501137", "0.63711125", "0.63601774", "0.6340328", "0.6338312", "0.626974", "0.6268775", "0.6257237", "0.6252424", "0.62206924", "0.62024474", "0.61933213", "0.61906356", "0.61779857", "0.6162435", "0.615...
0.5726851
89
From an existing hash, add its keys and values to this options instance.
def from_h(a_hash) a_hash.each_pair do |k, v| add k send("#{k}=", v) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options(hash)\n @options.merge! hash\n end", "def options_from_hash(options_hash)\n options_hash.each do |name, definition|\n option = Option.new\n definition.each do |key, value|\n Array(value).each { |hit| option.send(key, hit) }\n end\n @@options << [name.to_s, option...
[ "0.74037474", "0.73104227", "0.71983457", "0.7097878", "0.68340844", "0.665873", "0.659494", "0.65827876", "0.6356206", "0.63547957", "0.6305396", "0.6282437", "0.6272234", "0.62683105", "0.6246634", "0.61868995", "0.61797696", "0.6166319", "0.6135071", "0.6089134", "0.608525...
0.57319254
64
convert this options instance into a hash
def to_h a_hash = Hash.new keys = instance_variables.map{|var| var.to_s.gsub('@','')} keys.each do |key| a_hash[key] = send key end return a_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n { @key => @options }\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n ...
[ "0.8403168", "0.81027806", "0.81027806", "0.81027806", "0.81027806", "0.81027806", "0.80515385", "0.79956055", "0.7946878", "0.7946878", "0.7922137", "0.7832527", "0.7832527", "0.7832527", "0.7832527", "0.7607712", "0.75960374", "0.7520624", "0.72703254", "0.7230186", "0.7177...
0.0
-1
Chapter 12 : New Classes of Objects Paty like it's roman_to_integer
def roman_to_integer(roman_value) digital_vals = {'i'=> 1, 'v'=> 5, 'x'=> 10, 'l'=> 50, 'c'=> 100, 'd'=> 500, 'm'=> 1000,} roman_value.each_char do |char| if digital_vals.has_key?(char) == false return "Invalid Entry!" end end reversed_roman_value = roman_value.reverse t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_roman(num)\nend", "def to_roman(num)\nend", "def to_roman\n\n roman = ''\n\n roman = roman + 'M' * (self / 1000)\n roman = roman + 'D' * (self % 1000 / 500)\n roman = roman + 'C' * (self % 500 / 100)\n roman = roman + 'L' * (self % 100 / 50)\n roman = roman + 'X' * (self % 50 / 10)\n roman...
[ "0.77335984", "0.77335984", "0.73116595", "0.7248213", "0.7162003", "0.71503675", "0.7093005", "0.7023124", "0.7015381", "0.70124257", "0.6987278", "0.6984734", "0.6979771", "0.69697434", "0.6966342", "0.69109327", "0.69091445", "0.68902487", "0.6883052", "0.6845945", "0.6800...
0.62525624
88
Execute a GraphQL query against the current schema.
def execute render json: Schema.instance.execute( params[:query], variables: to_hash(params[:variables]), context: context ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_query(query)\n post_graphql(query, current_user: current_user)\n expect(graphql_errors).not_to be_present\n end", "def execute(query)\n if validate_query\n validation = schema.validate(query)\n fail validation_error_message(validation) unless validation.valid?\n end\n\n ...
[ "0.6841076", "0.6727782", "0.65088147", "0.6467917", "0.64569646", "0.64232177", "0.62614805", "0.62561643", "0.6231172", "0.6207018", "0.61230594", "0.59668523", "0.59447813", "0.5944272", "0.592624", "0.59181696", "0.5894975", "0.58848375", "0.5872657", "0.58332056", "0.581...
0.7178593
0
Public Method current_ballot Returns the last entered Ballot object, with associated Nominations and Voting Period included. Params: none Returns: The Member's last Ballot object. State Changes: none
def current_ballot self.ballots.includes(:nominations, :voting_period).order(:created_at).last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_bid\r\n self.get_current_ranking\r\n if self.bid.empty?\r\n return 0\r\n else\r\n return bid.last.value\r\n end\r\n end", "def current_budget\n Budget.where(user_id: current_user.id).sort_by(&:created_at).last\n end", "def current_wallet\n # currency_...
[ "0.64466846", "0.64337814", "0.6287035", "0.60638887", "0.60304683", "0.59815466", "0.59167403", "0.57930803", "0.57761276", "0.5706055", "0.5683411", "0.56265193", "0.56242883", "0.5623599", "0.55644333", "0.5554674", "0.55306304", "0.55306304", "0.5512453", "0.54998565", "0...
0.8227299
0
action about GET /about/me
def about_me @breadcrumbs << [I18n.t('pages.about.breadcrumb'), about_path] @breadcrumbs << [I18n.t('pages.about.me.breadcrumb')] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_about_me\n @about_me = AboutMe.find(params[:id])\n end", "def about\n\n end", "def me\n get(\"/me\")\n end", "def about\n\n end", "def about\n\n end", "def about\n\n end", "def about\r\n end", "def about\n\t\t@user = current_user\n\tend", "def about\n end", "def ...
[ "0.73857296", "0.72190195", "0.71985734", "0.7183703", "0.7183703", "0.7183703", "0.7177676", "0.7174927", "0.71555734", "0.7132817", "0.7132817", "0.7132817", "0.7132817", "0.7132817", "0.7132817", "0.7132817", "0.7132817", "0.7132817", "0.7132817", "0.7132817", "0.7132817",...
0.6503356
57
action about_me GET /
def index @breadcrumbs = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def me\n get(\"/me\")\n end", "def about; render; end", "def about_me\n\tend", "def about\r\n end", "def about\n\tend", "def about\n\tend", "def about\n\n end", "def about\n end", "def about\n\n end", "def about\n\n end", "def about\n\n end", "def about\n end", "def about...
[ "0.73576516", "0.73196125", "0.7315253", "0.72971904", "0.7225918", "0.7225918", "0.72192425", "0.721177", "0.7176801", "0.7176801", "0.7176801", "0.71749026", "0.71749026", "0.71749026", "0.71749026", "0.71749026", "0.71749026", "0.71749026", "0.71749026", "0.71749026", "0.7...
0.0
-1
It will print nothing. It returned a proc object. 3. Exception handling allows you to continue processing a block of code even though you may get an error. 4.
def execute(&block) block.call end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proc_return\n my_proc = Proc.new { return }\n my_proc.call\n puts \"This will not be printed\"\nend", "def test1\n p = Proc.new { return }\n p.call\n puts “This line can’t display”\nend", "def proc_demo_method\n proc_demo = Proc.new { return \"Only I print!\" }\n proc_demo.call\n \"But what ...
[ "0.71510273", "0.70634013", "0.70488673", "0.67264813", "0.6707662", "0.66209525", "0.65946037", "0.65925366", "0.6588825", "0.6583525", "0.65781486", "0.65026164", "0.649107", "0.6457364", "0.63953876", "0.63888377", "0.63551354", "0.6349233", "0.633998", "0.6305974", "0.628...
0.0
-1
I needed a way to pass resume items to the view if and only if that resume item applied to that particular user. So only show advanced_degree_uni for users w/ advanced degrees. I got impatient and wrote code that repeated a lot :( Just wanted to hurry and get it done. options method is intended to produce matches in th...
def options @my_career_id = current_user.career_id @match = [] @peers = [] @same_career = User.where(:career_id => @my_career_id) @same_career.each do |match| #This can be written with match.expertise != current_user.expertise but I'm anticipating adding more expertise options so I wrote it in a way...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resumes_offered\n\t @resumes = ReqMatch.where(:status => \"OFFERED\")\n\t\trender \"resumes/offered\"\n\tend", "def index\n @resume_recomendations = ResumeRecomendation.where(resume: params[:resume]).first\n end", "def show\n if User.find(session[:user_id]).access == \"teacher\"\n redirect_to ...
[ "0.59650975", "0.59599316", "0.5911656", "0.58913064", "0.5830602", "0.5791131", "0.57712024", "0.57487434", "0.5707192", "0.57059234", "0.56891465", "0.56610155", "0.56574833", "0.5653824", "0.5635772", "0.5633876", "0.5613858", "0.5592393", "0.5581049", "0.55447894", "0.554...
0.65157384
0
The choosen method checks to see if anyone else has choosen you as a potential mentor/mentee
def choosen @pair = [] for pair in @pair_collection do if pair.mentee_id == current_user.id @pair.push(pair.user_id) end end return @pair end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chosen(already, owner, other)\n\t\tif already && already.owner_id == owner.id && current_user\n\t\t\t\"chosen\"\n\t\telse\n\t\t\tother\n\t\tend\n\tend", "def agreed\n @choosen = []\n @my_mentees = Pair.find_by_user_id(current_user.id).mentee_id\n if @my_mentees.is_a?(Integer)\n if Pair.find_by_...
[ "0.7301292", "0.7024099", "0.63019735", "0.6154381", "0.613826", "0.6008028", "0.59964246", "0.5967801", "0.59605116", "0.59596354", "0.5880842", "0.58175373", "0.5804123", "0.5726095", "0.5720973", "0.5720038", "0.5718505", "0.5703853", "0.56959254", "0.56904674", "0.5673616...
0.5918908
10
This method finds users who have agreed upon a mentor mentee relationship
def agreed @choosen = [] @my_mentees = Pair.find_by_user_id(current_user.id).mentee_id if @my_mentees.is_a?(Integer) if Pair.find_by_user_id(@my_mentees) != nil @my_mentees_choice = Pair.find_by_user_id(@my_mentees).mentee_id if @my_mentees_choice == current_user.id @choosen....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutual_mentions\n mentions.select do |mentioned_user|\n mentioned_user.mentioned?(self)\n end\n end", "def followee?(other_user)\n followee_relationships.include?(other_user)\n end", "def owner_as_well_as_all_mentioned_users_and_artists_except(user_or_artist_id, user = true)\n pa...
[ "0.65056205", "0.61970526", "0.612537", "0.60936016", "0.5927651", "0.5911463", "0.58934766", "0.58827215", "0.5870918", "0.58705455", "0.5860973", "0.5821312", "0.5821084", "0.5777066", "0.57762784", "0.57731783", "0.57656527", "0.57648414", "0.5762694", "0.5753903", "0.5752...
0.54840004
61
Return the total number of characters Use recursion
def character_count(array) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_chars (foo)\n foo.length\n end", "def count_chars (string)\n string.length\nend", "def number_of_characters\n @text.length\n end", "def number_of_chars\n text.to_s.number_of_chars\n end", "def count_chars(word)\n word.length\nend", "def count_chars(word)\n word.length...
[ "0.764118", "0.76155484", "0.73002905", "0.72907305", "0.7285102", "0.7285102", "0.7285102", "0.7285102", "0.7277611", "0.7277611", "0.7277611", "0.7277611", "0.72259545", "0.72018945", "0.71919966", "0.6982294", "0.68677896", "0.682319", "0.6798771", "0.6749782", "0.6714177"...
0.69057226
16
GET /bookings GET /bookings.json
def index tour_creator = Tour.find_by(tourname: session[:tourname]) #Agent who created the tour if session[:role]==2 and session[:username] == tour_creator.username @bookings=Booking.where(tourname: session[:tourname]) #Customer elsif session[:role]==1 @bookings=Booking.where(username...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n ...
[ "0.8231102", "0.80365145", "0.80220497", "0.80220497", "0.80220497", "0.7619097", "0.7607287", "0.7501954", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071",...
0.0
-1
GET /bookings/1 GET /bookings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |f...
[ "0.7793375", "0.76496434", "0.76496434", "0.76496434", "0.76409495", "0.76042414", "0.75729305", "0.73645985", "0.73645985", "0.73645985", "0.73645985", "0.7241474", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.720...
0.0
-1
POST /bookings POST /bookings.json
def create option=booking_params[:mode_of_booking].to_i @booking = Booking.new(booking_params.except(:mode_of_booking).merge(:username => session[:username], :tourname => session[:tourname], :user_id => session[:user_id], :tour_id => session[:tour_id])) if session[:role] != 2 respond_to do |format| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n booking = Booking.create(booking_params)\n render json: booking\n end", "def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_i...
[ "0.7353111", "0.7228384", "0.68615675", "0.6782987", "0.6782987", "0.67671645", "0.6642527", "0.66402507", "0.6624695", "0.65151906", "0.6509862", "0.6509862", "0.6509862", "0.64893967", "0.6432859", "0.6378296", "0.634707", "0.63245595", "0.6297444", "0.62888706", "0.6278033...
0.0
-1
PATCH/PUT /bookings/1 PATCH/PUT /bookings/1.json
def update respond_to do |format| if @booking.update(booking_params.except(:mode_of_booking)) format.html { redirect_to @booking, notice: 'Booking was successfully updated.' } format.json { render :show, status: :ok, location: @booking } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @booking = Booking.find(params[:id])\n\n if @booking.update(booking_params)\n head :no_content\n else\n render json: @booking.errors, status: :unprocessable_entity\n end\n end", "def update\n @booking = Booking.find(params[:id])\n @booking.update_attributes(params[:booki...
[ "0.70660025", "0.7035505", "0.6951961", "0.69296867", "0.69296867", "0.69296867", "0.6925516", "0.68727815", "0.67891777", "0.6737531", "0.67097384", "0.66938263", "0.66938263", "0.66938263", "0.66782904", "0.66559863", "0.66393423", "0.66337067", "0.6626812", "0.6624749", "0...
0.64761007
58
DELETE /bookings/1 DELETE /bookings/1.json
def destroy booking_creator = Booking.find_by(id: params[:id]) if session[:role] == 3 or booking_creator.user_id == session[:user_id] @booking.cancelBooking(session) @booking.destroy respond_to do |format| format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |fo...
[ "0.7660707", "0.7660707", "0.7660707", "0.7660707", "0.7657568", "0.7565737", "0.75498253", "0.75498253", "0.739592", "0.7359668", "0.7359668", "0.729106", "0.72711414", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.72486...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_booking @booking = Booking.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 booking_params params.require(:booking).permit(:status, :seatsToBook, :username, :tourname, :user_id, :tour_id, :mode_of_booking) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Check that a tableless VALUES(xxx) query (like SELECT works.
def test_values value = nil assert_nothing_raised do value = ActiveRecord::Base.connection.send(:select_rows, "VALUES('ur', 'doin', 'it', 'right')") end assert_equal [['ur', 'doin', 'it', 'right']], value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_values_sql(sql)\n sql << \"VALUES \"\n expression_list_append(sql, opts[:values])\n end", "def check_duplicate_item(db, tbl,field_name,value)\r\n check_command = \"Select * from ? where ? = ?\",[tbl, field_name,value]\r\n if db.execute(check_command).length > 0\r\n return true\...
[ "0.59113854", "0.56363773", "0.557994", "0.5515803", "0.54231274", "0.5422416", "0.5396056", "0.5377148", "0.53701967", "0.5317282", "0.5289754", "0.5259012", "0.52416015", "0.52325904", "0.5231039", "0.52114344", "0.52033466", "0.5185567", "0.51726", "0.5171867", "0.5171867"...
0.7062435
0
Modify methods, public_methods and respond_to?, because method_missing allows methods from the analyser
def methods(*args) (super + analyser.delegatable_methods).uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def respond_to_missing?(_method, _include_private = false)\n true\n end", "def respond_to_missing?(_method_name, _include_private = T.unsafe(nil)); end", "def respond_to_missing?( method, include_private = false )\n super || (method.to_s =~ METHOD_NAME_REGEXP ) || true\n end", "def respon...
[ "0.7390575", "0.7309343", "0.7299983", "0.72948635", "0.7293679", "0.72893405", "0.72817755", "0.72817755", "0.72638476", "0.7233463", "0.7205749", "0.72008175", "0.7133208", "0.710953", "0.7047295", "0.70109755", "0.7007806", "0.6992882", "0.698629", "0.69750893", "0.6969794...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_post @post = Post.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 post_params params.require(:post).permit(:title, :body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_returnbook @returnbook = Returnbook.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 returnbook_params params.require(:returnbook).permit(:name) 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
GET /kinships GET /kinships.json
def index @kinships = Kinship.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @clientships = current_user.clientships.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientships }\n end\n end", "def show\n @clientship = current_user.clientships.find(params[:id]) \n\n respond_to do |format|\n form...
[ "0.6735714", "0.6403946", "0.6397765", "0.6390696", "0.6390696", "0.62893146", "0.623615", "0.60142434", "0.59776074", "0.5894923", "0.58757216", "0.5874103", "0.5869684", "0.5861144", "0.58589584", "0.58061296", "0.5777648", "0.57583886", "0.5751566", "0.57497543", "0.573626...
0.7663257
0
GET /kinships/1 GET /kinships/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @kinships = Kinship.all\n end", "def show\n @clientship = current_user.clientships.find(params[:id]) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientship }\n end\n end", "def index\n @clientships = current_user.clientships....
[ "0.7289876", "0.6744972", "0.6678824", "0.65339464", "0.65339464", "0.640773", "0.6334629", "0.63059735", "0.62979287", "0.6200103", "0.6185519", "0.6098511", "0.607606", "0.60554427", "0.60470307", "0.60356027", "0.6019189", "0.60183597", "0.6000798", "0.5885728", "0.5881674...
0.0
-1
POST /kinships POST /kinships.json
def create @kinship = Kinship.new(kinship_params) @article = @kinship.article respond_to do |format| if @kinship.save format.html { redirect_to @kinship, notice: 'Kinship was successfully created.' } format.json { render :show, status: :created, location: @kinship } format.js ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kinship_params\n params.require(:kinship).permit(:user_id, :kin_id, :article_relation_type_id, :article_id)\n end", "def set_kinship\n @kinship = Kinship.find(params[:id])\n end", "def index\n @kinships = Kinship.all\n end", "def ship_params\n params.require(:ship).permit(:name, ...
[ "0.65937465", "0.63844264", "0.63649267", "0.60543674", "0.595679", "0.5896836", "0.5855277", "0.5842842", "0.58414316", "0.58269876", "0.5818037", "0.5805796", "0.5780632", "0.573651", "0.5689578", "0.5613494", "0.56023616", "0.55910724", "0.5566083", "0.5525964", "0.5525392...
0.61184555
3
PATCH/PUT /kinships/1 PATCH/PUT /kinships/1.json
def update respond_to do |format| if @kinship.update(kinship_params) format.html { redirect_to @kinship, notice: 'Kinship was successfully updated.' } format.json { render :show, status: :ok, location: @kinship } else format.html { render :edit } format.json { render json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @clientship = current_user.clientships.find(params[:id])\n\n respond_to do |format|\n if @clientship.update_attributes(params[:clientship])\n format.html { redirect_to @clientship, notice: 'Clientship was successfully updated.' }\n format.json { head :ok }\n else\n ...
[ "0.68124956", "0.66144836", "0.66109496", "0.65965223", "0.6299792", "0.6238834", "0.6238834", "0.6215682", "0.6210581", "0.6191905", "0.6191905", "0.6190379", "0.61720306", "0.61492085", "0.6111567", "0.6107306", "0.6105675", "0.60923207", "0.60282284", "0.599477", "0.599073...
0.6711181
1
DELETE /kinships/1 DELETE /kinships/1.json
def destroy @article = @kinship.article @kinship.destroy respond_to do |format| format.html { redirect_to kinships_url, notice: 'Kinship was successfully destroyed.' } format.json { head :no_content } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @clientship = current_user.clientships.find(params[:id])\n @clientship.destroy\n\n respond_to do |format|\n format.html { redirect_to clientships_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_...
[ "0.73626494", "0.7163296", "0.7163296", "0.7141485", "0.7096264", "0.7091834", "0.6990462", "0.6990462", "0.6990462", "0.69900554", "0.6959339", "0.6896366", "0.6892532", "0.6762323", "0.67380893", "0.6725611", "0.67218405", "0.67100304", "0.669493", "0.66756713", "0.6675378"...
0.6220584
56
Use callbacks to share common setup or constraints between actions.
def set_kinship @kinship = Kinship.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 kinship_params params.require(:kinship).permit(:user_id, :kin_id, :article_relation_type_id, :article_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Initialize a new VersionCheck instance
def initialize(version, constraint) @version = Gem::Version.new(version) @match = PATTERN.match(constraint.to_s) raise ArgumentError, "A version (eg. 5.0) is required to compare against" unless @version raise ArgumentError, "At least one operator and version is required (eg. >= 5.1)" unle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(version_requirement:)\n self.version_verifier_strategy_factory = ::Kitchen::Terraform::VersionVerifierStrategyFactory.new(\n version_requirement: version_requirement,\n )\n end", "def initialize(check, severity, message)\n @check = check\n @severity = severity\n ...
[ "0.68008065", "0.67218333", "0.66921747", "0.6563834", "0.65204185", "0.6504364", "0.6421279", "0.6311321", "0.62593997", "0.6244521", "0.61982346", "0.61332285", "0.6089926", "0.60759676", "0.60759676", "0.60730106", "0.6072783", "0.5982927", "0.5966857", "0.5959745", "0.595...
0.55825365
65
Checks if all constraints were met
def satisfied? constraints.all? do |expected, operator| compare(expected, operator) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_valid\n # Check the vertical\n @size.times { |i|\n if !valid_column(i)\n return false\n end\n }\n\n # Check the diagonal\n @size.times { |i|\n if !valid_diagonal(true, true, i)\n return false\n end\n if !valid_diagonal(true, false, i)\n return fa...
[ "0.68792605", "0.67158866", "0.66993773", "0.63204634", "0.62517905", "0.6230455", "0.6210362", "0.61854947", "0.61657786", "0.61072147", "0.6080147", "0.60613644", "0.6042034", "0.60166115", "0.59950644", "0.5951607", "0.59254044", "0.59219205", "0.5920516", "0.5920516", "0....
0.66374356
3
account list table view
def numberOfRowsInTableView(sender) accounts.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_account_table(accounts, options={})\r\n opts = {show_checkbox_for_row: true}.merge(options)\r\n\r\n if session[:display_all]\r\n # custom text renderer for the password.\r\n opts.merge!({custom_text_renderers: {password: lambda(&method(:decrypt_password))}})\r\n\r\n # Alternatively,...
[ "0.7055214", "0.7002373", "0.6853729", "0.68044156", "0.68044156", "0.68044156", "0.68044156", "0.68044156", "0.68044156", "0.68044156", "0.68044156", "0.68044156", "0.68044156", "0.68042314", "0.6799865", "0.67894", "0.67537266", "0.6740288", "0.67249024", "0.67249024", "0.6...
0.6471737
31
Beats per minute. Function: Code block that accomplishes a specific task. Descriptive name! Longer names (_ instead of spaces). 4/4 rhythm.
def four_four sample :drum_heavy_kick sleep 1 sample :drum_snare_hard sleep 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_duration_of(task) ; 5 ; end", "def tempo(beats_per_second)\n\t\tbeats_per_minute = beats_per_second * 60 \n\tend", "def tock\n @minute += 1\n end", "def bake(minutes)\n \"Baking the cookie in #{minutes} mins.\"\n end", "def work(interval = 5.0)\n end", "def test_120_tasks_every_s...
[ "0.6548734", "0.64426374", "0.63719594", "0.6168533", "0.6072929", "0.6061085", "0.5943128", "0.5899494", "0.5788908", "0.5749816", "0.5727428", "0.57154983", "0.57017165", "0.57017165", "0.5696604", "0.5695753", "0.56887335", "0.5684847", "0.56658494", "0.5659759", "0.565673...
0.0
-1
CITE : DESC : Showed a better way of organizing the melody!
def alejandro1 # Variable creation. # Data structure (way of storing data): List notes = [:b4, :b4, :b4, :d4, :e4, :fs4, :fs4, :e4, :fs4, :fs4, :fs4, :c4, :c4, :c4, :c4] # :r is rest. durations = [0.5, 0.25, 0.25, 0.5, 0.5, 0.5, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5] play_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sonic_play\n melody = melody()\n if melody.respond_to?(:key)\n melody.values().each do |m|\n play_melody(m)\n end\n elsif melody.respond_to?(:length)\n play_melody(melody)\n end\nend", "def melody scales\n oct = rand(4) + 2\n scales.scale.map {|note|\n MidiCalc.new(Pitch.new(note, oct)...
[ "0.5689487", "0.5610979", "0.5496072", "0.53168225", "0.53168225", "0.53135484", "0.525182", "0.523211", "0.52100754", "0.51611793", "0.51607376", "0.5160605", "0.5135828", "0.51087326", "0.5060653", "0.50372255", "0.50335836", "0.5019475", "0.5014859", "0.5014116", "0.500622...
0.49607924
33
=== GET /users/sign_in Prompt the user for login credentials.
def new __log_activity __debug_route opt = request_parameters mode = opt.delete(:mode)&.to_sym if mode == :local redirect_to **opt.merge(action: :sign_in_local) else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_in(user)\n post sessions_path, params: { email: user.email, password: 'mypass' }\n end", "def sign_in(user:, password:)\n post user_session_path \\\n \"user[email]\" => user.email,\n \"user[password]\" => password\n end", "def sign_in\n user = User.where(email: params[:email])....
[ "0.72909904", "0.7264092", "0.72614306", "0.71818787", "0.71812695", "0.7152444", "0.712056", "0.7087793", "0.7067224", "0.70407426", "0.7010011", "0.6999425", "0.6976138", "0.6962721", "0.6926929", "0.69196165", "0.69195765", "0.69116277", "0.68751633", "0.68626416", "0.6826...
0.0
-1
=== POST /users/sign_in Begin login session.
def create __debug_route __debug_request self.resource = warden.authenticate!(auth_options) __log_activity("LOGIN #{resource}") remember_dev(resource) set_flash_notice sign_in_and_redirect(resource) rescue => error auth_failure_redirect(message: error) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_in(user, password)\n post login_path, params: {session: {email: user.email, password: password}}\n end", "def sign_in(user)\n post sessions_path, params: { email: user.email, password: 'mypass' }\n end", "def sign_in\n request.session = { authorized: true }\n end", "def sign_in(user:, pa...
[ "0.79274213", "0.78600895", "0.763764", "0.75835574", "0.75568265", "0.74268603", "0.7421098", "0.74129903", "0.73515636", "0.72604233", "0.7215557", "0.7187516", "0.7175545", "0.71361595", "0.713236", "0.713236", "0.713236", "0.713236", "0.7127812", "0.7116439", "0.7054774",...
0.0
-1
=== DELETE /users/sign_out[?revoke=(true|false)] End login session. If the "no_revoke" parameter is missing or "false" then the local session if BS_AUTH is ended _and_ its associated OAuth2 token is revoked. If "no_revoke" is "true" then only the local session is ended.
def destroy __log_activity("LOGOUT #{current_user}") __debug_route __debug_request user = current_user&.account&.dup opt = BS_AUTH ? { no_revoke: true?(params[:no_revoke]) } : {} delete_auth_data(**opt) super api_clear(user: user) set_flash_notice(user: user, clear: true) rescue =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_out\n @logout = true\n authenticate_api_user\n @logout = false\n revoke_access if @current_user\n head :no_content\n end", "def logout\n RefreshTokenOperation::RevokeRefreshToken.execute(current_user.id)\n\n # rubocop:disable Lint/UselessAssignment\n current_user = nil\n # ru...
[ "0.7238157", "0.7094469", "0.7006225", "0.6948742", "0.68873465", "0.6828326", "0.67722076", "0.6764159", "0.6737947", "0.67361444", "0.6691414", "0.6674359", "0.6651446", "0.66227126", "0.661193", "0.65775186", "0.65605307", "0.65486467", "0.65355927", "0.652321", "0.6521243...
0.6580087
15
=== GET /users/sign_in_local Sign in with an EMMA user account encrypted password.
def sign_in_local __log_activity __debug_route end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_in\n user = User.where(email: params[:email]).first\n return render_invalid_auth unless user && user.valid_password?(params[:password])\n @current_user = user\n render json: slice_token(valid_token), status: :ok\n end", "def authentication_local_params\n params.require(:authentication_...
[ "0.63777214", "0.62652266", "0.61141634", "0.6089693", "0.60635245", "0.59999186", "0.59986657", "0.59849536", "0.5982441", "0.59782016", "0.59101385", "0.59056103", "0.59056103", "0.58835596", "0.5883545", "0.5882973", "0.58626485", "0.58592206", "0.583684", "0.5811934", "0....
0.57075334
37
=== GET /users/sign_in_as?uid=NAME&token=AUTH_TOKEN === GET /users/sign_in_as?auth=(OmniAuth::AuthHash) Sign in using information supplied outside of the OAuth2 flow.
def sign_in_as __debug_route __debug_request local_sign_in __log_activity("LOGIN #{resource}") set_flash_notice(action: :create) auth_success_redirect rescue => error auth_failure_redirect(message: error) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_sign_in\n user = users(:one)\n post '/auth/sign_in', params: { email: user.uid, password: \"secret123\" }\n\n return { \n \"uid\" => response.headers[\"uid\"],\n \"access-token\" => response.headers[\"access-token\"],\n \"client\" => response.headers[\"client\"] }\n end", "def si...
[ "0.6602352", "0.6598152", "0.6483034", "0.6409714", "0.6385592", "0.636376", "0.63550264", "0.6329455", "0.6293483", "0.62052214", "0.61323065", "0.6119411", "0.60984284", "0.60722965", "0.6063199", "0.6053339", "0.60436136", "0.6036415", "0.60356295", "0.6032847", "0.6005331...
0.6240235
9
Called to avoid timingout waiting for credentials.
def no_devise_timeout request.env['devise.skip_timeout'] = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credentials; end", "def credentials; end", "def credentials; end", "def credentials; end", "def credentials; end", "def credentials\n @lock.synchronize do\n @credentials\n end\n end", "def check_new_credentials(state, context)\n put(:sync, @lock_data)\n ...
[ "0.64727473", "0.64727473", "0.64727473", "0.64727473", "0.64727473", "0.6297684", "0.62911344", "0.6118305", "0.60891014", "0.60891014", "0.60341734", "0.60341734", "0.5935881", "0.59266216", "0.59127474", "0.5888399", "0.58535355", "0.5849027", "0.5801665", "0.5747542", "0....
0.0
-1
=== Delete user folder. Delete an user folder. ==== Parameters id:: (Integer) User folder id. ==== Example
def delete_user_folder(id) @client.raw('delete', "/helpers/folders/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_folder(folder_id)\n perform_post_with_unparsed_response('/api/1.1/folders/delete', folder_id: folder_id)\n true\n end", "def delete_folder folder_id\n delete(\"/projects/#{folder_id}\", code: 204)\n end", "def delete(conn_id, path, *args)\n options = args.extr...
[ "0.7411968", "0.73367524", "0.6637779", "0.6517919", "0.6500957", "0.6489535", "0.6480606", "0.6428332", "0.6427941", "0.63929373", "0.63716435", "0.6371543", "0.6360025", "0.6360025", "0.6345639", "0.634207", "0.63361686", "0.62695694", "0.6268153", "0.6222434", "0.6220549",...
0.8935011
0
method: select of main items from navbar by swipe
def select_menu_item(value) #checking for reach end of list( get_source is current screen id) current_screen = get_source previous_screen = "" until (exists {find_element(id:"design_navigation_view").find_element(xpath:"//android.widget.CheckedTextView[@text='#{value}']")}) || (current_screen == previous_scree...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_menu_nav(main_menu_item)\n main_menu_items.each do |item|\n if item.text == main_menu_item\n item.click\n break\n end\n end\n end", "def select_item\n @selected = @current\n\n items\n end", "def scroll_unselected\n return_scene\n...
[ "0.6125035", "0.6038753", "0.59857714", "0.57989955", "0.5779028", "0.5702883", "0.55541325", "0.5528191", "0.5503844", "0.5492701", "0.54924935", "0.54562044", "0.53895134", "0.5377706", "0.5371623", "0.5352227", "0.53499633", "0.53451324", "0.53328437", "0.5324717", "0.5311...
0.58910626
3
Identifiant path de l'article C'est le chemin relatif dans ./public/page/article, sans l'extension Par exemple : 'theme/contre/lire_en_jouant'
def idpath; @idpath ||= define_idpath end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def article_path(article)\r\n article.id + \".html\"\r\n end", "def folder\n @folder ||= File.join('.', 'public', 'page', 'article')\n end", "def relative_path\n @rel_path ||= begin \n date_array = id.split(\"-\")[0..2]\n date_path = date_array.join(\"/\")\n article_id...
[ "0.7478039", "0.68389994", "0.64164335", "0.6415891", "0.641388", "0.6324397", "0.63165057", "0.6256284", "0.62467015", "0.62446445", "0.62171227", "0.6180002", "0.6177298", "0.61214834", "0.6070719", "0.607036", "0.6051955", "0.60434127", "0.6033942", "0.5991667", "0.5982649...
0.0
-1
ex input: a = 14 b = 5 c = 0 def find_middle(a, b, c) arr = [a, b, c] sorted_array = arr.sort sorted_array[1] end
def find_middle(a,b,c) # 1. declare variable middle # 2. loop through and check if middle is greater than one and less than the other middle = a if (b > a && b < c) || (b < a && b > cc) middle = b elsif (c > a && c < b) || (c < a && c > b) middle = c end middle end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_middle(high_idx, low_idx)\n return (high_idx + low_idx) / 2\nend", "def find_middle_array_element(array)\n\n return 0 if array.size == 1 \n if array.size.odd?\n array.size/2\n elsif array.size.even? \n (array.size/2) - 1\n end\n\nend", "def find_middle_value\r\n middle_index = sel...
[ "0.71131504", "0.7105942", "0.6869463", "0.6817721", "0.6817251", "0.6810298", "0.67987335", "0.6786141", "0.67343956", "0.67343956", "0.6720159", "0.6719669", "0.67164534", "0.66803724", "0.66761994", "0.66695404", "0.6661487", "0.6616747", "0.6566202", "0.6556854", "0.65071...
0.8443515
0
string outputs: string reqs: return the input string with all chars dbld rules: none datastruct: array (access to 'map' method) algo: split the input str into chars for each char in the array map the char 2 times back into the array join the array chars into a new str output the new str
def repeater(str) str.chars.map { |char| char * 2 }.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress_str(str)\n compress = str.gsub(/(.)\\1*/).to_a\n hash = Hash.new(0)\n arr = []\n compress.each do |len|\n if len.length < 2\n arr << len\n else\n arr << len.length\n arr << len\n end\n end\n\n new_arr = arr.map {|a| a.to_s}\n\n new_arr.each_with_index do |compact, i|\n ...
[ "0.69384617", "0.68537015", "0.67426854", "0.67331374", "0.6674006", "0.66736305", "0.6561284", "0.6531847", "0.65160406", "0.65157795", "0.65023214", "0.64807236", "0.6457886", "0.6447938", "0.643079", "0.6423801", "0.6396762", "0.63862896", "0.63719046", "0.63653135", "0.63...
0.6030293
72
def current_player(board) if turn_count(board) % 2 == 0 return "X" else return "O" end end
def current_player(board) turn_count(board) % 2 == 0 ? "X" : "O" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_player(board)\n if turn_count(board) == 0\n return \"X\"\n elsif\n turn_count(board) % 2 == 0 \n return \"X\"\n else\n return \"O\"\n end \n end", "def current_player(board)\n if turn_count(board) == 0\n return \"X\"\n elsif\n turn_count(board) % 2 == ...
[ "0.9867085", "0.9867085", "0.9805003", "0.97861916", "0.97775525", "0.977015", "0.9765446", "0.9752696", "0.9745607", "0.9745607", "0.9745607", "0.9745607", "0.9745607", "0.9745607", "0.9745607", "0.9744297", "0.9733366", "0.9730234", "0.97253656", "0.9722825", "0.9693018", ...
0.97210616
23