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
This method is called when a user could not be authenticated, and authentication was required for the current request. This gives you the opportunity to set authentication headers. The 401 status code will already be set. In this case of Bearer Auth, this would for example mean that the following header needs to be set: response.add_header('WWWAuthenticate', 'Bearer realm=SabreDAV') Keep in mind that in the case of multiple authentication backends, other WWWAuthenticate headers may already have been set, and you'll want to append your own WWWAuthenticate header instead of overwriting the existing one.
def challenge(request, response) auth = Http::Auth::Bearer.new( @realm, request, response ) auth.require_login end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_unauthorized\n logger.debug \" *** UNAUTHORIZED REQUEST: '#{request.env['HTTP_AUTHORIZATION']}' ***\"\n self.headers['WWW-Authenticate'] = 'Token realm=\"Application\"'\n render json: {error: \"Bad credentials\"}, status: 401\n end", "def allow_client_to_handle_unauthorized_status\n ...
[ "0.73715603", "0.73640174", "0.7307718", "0.7093545", "0.70165753", "0.6907455", "0.68854606", "0.6808644", "0.6771975", "0.6744876", "0.66454315", "0.66207826", "0.6587354", "0.65800947", "0.65752923", "0.6570332", "0.6560365", "0.6552027", "0.65426284", "0.65103966", "0.650...
0.0
-1
boostrap keys for registering the scraper
def initialize(sunlight_key, bioguide_id) @api_key = sunlight_key @bioguide_id = bioguide_id = bioguide_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_taxi_app\n set_keys(DRIVER_APP_KEY,DRIVER_MASTER_KEY)\n end", "def bootstrap_init\n end", "def scrape\n end", "def scrape_it\n \n end", "def scrapes(domain)\n @@scraper_registry ||= {}\n @@scraper_registry[domain] = self\n end", "def load_keys\n @@keys =...
[ "0.56327623", "0.5553527", "0.5307545", "0.53032607", "0.530025", "0.52973783", "0.5287012", "0.5286882", "0.5267681", "0.5263625", "0.5209684", "0.520634", "0.5190302", "0.51784515", "0.5162405", "0.5155353", "0.5145179", "0.51341313", "0.5098937", "0.5074224", "0.5009994", ...
0.0
-1
GET /orders GET /orders.json
def index @orders = Order.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n ...
[ "0.83267236", "0.815406", "0.80041754", "0.7947603", "0.7846487", "0.7823147", "0.78028905", "0.76992875", "0.76980406", "0.7682792", "0.7682792", "0.7682792", "0.7682792", "0.76827645", "0.75880665", "0.7574349", "0.756171", "0.7531827", "0.74860185", "0.7432208", "0.7369724...
0.70640796
72
GET /orders/1 GET /orders/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def index\n @orders = Order.order(\"id\").all\n\n resp...
[ "0.7554187", "0.7488565", "0.7475228", "0.73777765", "0.73714006", "0.7341344", "0.73384553", "0.73168725", "0.73018956", "0.7291244", "0.7291244", "0.7291244", "0.7291244", "0.72911215", "0.7281374", "0.7266143", "0.72498786", "0.7228276", "0.7213504", "0.71842283", "0.71261...
0.0
-1
POST /orders POST /orders.json
def create params = order_params.merge(cart_items: @cart.cart_items) @order = Order.new(params) respond_to do |format| if @order.save session[:order] = @order.id @cart.destroy format.html { redirect_to active_order_path, notice: 'Order was successfully created.' } format.json { render :show, status: :created, location: @order } else format.html { render 'carts/show' } format.json { render json: @order.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders\n authenticated_post(\"orders\").body\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def create\n order = Order.create(order_params)\n render json: order\nend", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = ...
[ "0.75886714", "0.7490972", "0.7488501", "0.74664384", "0.72739846", "0.7195349", "0.7063682", "0.69745994", "0.6910657", "0.68880194", "0.68747663", "0.685004", "0.6840204", "0.6838178", "0.6838178", "0.6838178", "0.6838178", "0.682244", "0.6790037", "0.67793274", "0.6779247"...
0.0
-1
PATCH/PUT /orders/1 PATCH/PUT /orders/1.json
def update respond_to do |format| if @order.update(order_params) format.html { redirect_to @order, notice: 'Order was successfully updated.' } format.json { render :show, status: :ok, location: @order } else format.html { render :edit } format.json { render json: @order.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_conte...
[ "0.6803119", "0.6803119", "0.67749745", "0.6743427", "0.67353284", "0.6726928", "0.6723453", "0.6719653", "0.67047364", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", ...
0.0
-1
DELETE /orders/1 DELETE /orders/1.json
def destroy @order.destroy respond_to do |format| if admin_signed_in? format.html { redirect_to orders_path, notice: 'Order was successfully destroyed.' } else format.html { redirect_to store_path, notice: 'Order was successfully destroyed.' } end format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end", "def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\...
[ "0.7592003", "0.7475092", "0.74298924", "0.7371978", "0.7371411", "0.7371187", "0.7357556", "0.7357556", "0.7357556", "0.7357556", "0.7357556", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", ...
0.0
-1
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
Never trust parameters from the scary internet, only allow the white list through.
def order_params params.require(:order).permit(:comment, :email, :name, :country, :state, :city, :address_line_1, :address_line_2, :postal_code, :phone) 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
Public Will show the particular QA Signoff selected Returns the specific details of the QA Signoff
def show @repo = Hubstats::Repo.where(id: params[:repo_id]).first @pull_request = Hubstats::PullRequest.where(id: params[:pull_request_id]).first @user = Hubstats::User.where(id: params[:user_id]).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @paid_offday = PaidOffday.find(params[:id])\n end", "def show\n\t\t_get_current_question_and_choices(params[:id])\n\tend", "def show_ticket\n end", "def show\n if current_user.has_role? :admin\n else\n @quiz = Quiz.find(session[:quiz_id])\n @cardbox = Cardbox.find(session[:car...
[ "0.581412", "0.569842", "0.5695438", "0.5689326", "0.56190324", "0.5588265", "0.5579999", "0.5579398", "0.5509029", "0.5508537", "0.5490561", "0.5482174", "0.54725707", "0.54069924", "0.5396875", "0.5386023", "0.5379143", "0.53602386", "0.53594327", "0.5348629", "0.53483003",...
0.0
-1
Create a function called DrEvil. It should take a single argument, an amount, and return ' dollars', except it will add '(pinky)' at the end if the amount is 1 million. For example: ``` DrEvil(10): 10 dollars DrEvil(1000000): 1000000 dollars (pinky) ``` ANSWER
def dr_evil(amount) unless amount == 1000000 puts "#{amount} dollars" else puts "#{amount} dollars (pinky)" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dollars; end", "def afford_horse(money)\n horse_cost = 20000\n if money < horse_cost\n return 'Keep saving!'\n end\n\n remaining = money - horse_cost\n return \"You bought a horse and have $#{remaining} left.\"\nend", "def dollar amt\n #TOOD: need commas in the right places\n sprintf \"$%0.02...
[ "0.60809857", "0.585317", "0.5788409", "0.5764214", "0.5729902", "0.5720826", "0.5701735", "0.5672291", "0.56377083", "0.562904", "0.5615074", "0.5592052", "0.5546534", "0.5546036", "0.55008656", "0.5490897", "0.54881823", "0.5478382", "0.5473203", "0.5466427", "0.54486936", ...
0.74945325
0
MixUp Create a function called mixUp. It should take in two strings, and return the concatenation of the two strings (separated by a space) slicing out and swapping the first 2 characters of each. You can assume that the strings are at least 2 characters long. For example: ``` mixUp('mix', 'pod'): 'pox mid' mixUp('dog', 'dinner'): 'dig donner' Look up the JavaScript string reference to find methods which may be useful! ``` ANSWER
def mix_up(str1, str2) str1_initial = str1[0,2] str1_end = str1[2, str1.length - 1] str2_initial = str2[0,2] str2_end = str2[2, str2.length - 1] puts "#{str2_initial + str1_end} #{str1_initial + str2_end}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mix(s1, s2)\n # s1とs2から2文字以上含まれる文字を抽出\n selection = (\"a\"..\"z\").to_a.select { |letter| s1.count(letter) > 1 || s2.count(letter) > 1 }\n # s1とs2の出現回数を比較し、プレフィックスを付与した配列を作成する\n selection.map! do |selection|\n if s1.count(selection) > s2.count(selection)\n \"1:#{selection * s1.count(selection)}\"\n...
[ "0.69220686", "0.6402589", "0.6379069", "0.62774545", "0.618938", "0.61189127", "0.59195435", "0.58533853", "0.58182555", "0.5664685", "0.56592983", "0.5635039", "0.55657375", "0.555905", "0.5557698", "0.5552197", "0.55460167", "0.5498703", "0.5496295", "0.5462853", "0.544788...
0.72497857
0
FixStart Create a function called fixStart. It should take a single argument, a string, and return a version where all occurences of its first character have been replaced with '', except for the first character itself. You can assume that the string is at least one character long. For example: ``` fixStart('babble'): 'bale' ``` ANSWER
def fix_start(string) char_array = string.split("") first_char = string[0] new_array = Array.new char_array.each do |i| if i == "b" new_array.push("*") else new_array.push(i) end end new_array[0] = first_char puts new_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_first(input, string); end", "def replace_first(input, string, replacement = T.unsafe(nil)); end", "def starts_with_cons (str)\n return str + str.slice!(0,1) + 'ay'\nend", "def substrings_at_start(str)\r\n chars = str.chars\r\n chars.each_with_object([]).with_index { |(el,memo), idx| memo << c...
[ "0.66988057", "0.5943807", "0.5900158", "0.5707575", "0.56269884", "0.5566933", "0.5498107", "0.5435016", "0.54106605", "0.54105633", "0.5382313", "0.5380353", "0.535383", "0.53283453", "0.5326631", "0.5316739", "0.52895224", "0.5284559", "0.52801704", "0.52788836", "0.527536...
0.54587
7
Verbing Create a function called verbing. It should take a single argument, a string. If its length is at least 3, it should add 'ing' to its end, unless it already ends in 'ing', in which case it should add 'ly' instead. If the string length is less than 3, it should leave it unchanged. For example: ``` verbing('swim'): 'swimming' verbing('swimming'): 'swimmingly' verbing('go'): 'go' ``` ANSWER
def verbing(string) end_chars = string[string.length - 3, string.length - 1] if end_chars != "ing" && string.length > 3 puts string + "ing" elsif end_chars == "ing" puts string + "ly" else puts string end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speak_to_grandma(takes_string_arguement)\n\n if takes_string_arguement == takes_string_arguement.upcase\n return \"NO, NOT SINCE 1938!\"\n else\n return \"HUH?! SPEAK UP, SONNY!\"\n end\n \nend", "def shout(words)\n words.upcase if words.length > 10\nend", "def selective_tweet_sh...
[ "0.5834264", "0.5749516", "0.5723344", "0.5689658", "0.56814367", "0.56814367", "0.5671531", "0.5624438", "0.5600746", "0.5560466", "0.5554687", "0.55463386", "0.55161244", "0.5509831", "0.55033356", "0.54991084", "0.5497633", "0.5496702", "0.5493334", "0.54879844", "0.548368...
0.66097045
0
Not Bad Create a function called notBad that takes a single argument, a string. It should find the first appearance of the substring 'not' and 'bad'. If the 'bad' follows the 'not', then it should replace the whole 'not'...'bad' substring with 'good' and return the result. If it doesn't find 'not' and 'bad' in the right sequence (or at all), just return the original sentence. For example: ``` notBad('This dinner is not that bad!'): 'This dinner is good!' notBad('This movie is not so bad!'): 'This movie is good!' notBad('This dinner is bad!'): 'This dinner is bad!' ``` def not_bad(string) index_of_not = string.index("not") index_of_bad = string.index("bad") if index_of_not < index_of_bad return string[0, index_of_not] + "good" else return string end end not_bad('This dinner is not that bad!') not_bad('This movie is not so bad!') not_bad('This dinner is bad!') ANSWER
def not_bad(string) index_of_not = string.index("not") index_of_bad = string.index("bad") if index_of_not != nil && index_of_bad != nil && index_of_not < index_of_bad puts string[0, index_of_not] + "good!" else puts string end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_bad?(str)\n # rubocop:enable Naming/PredicateName\n str[0...3].eql?('bad') || str[1...4].eql?('bad')\n end", "def not_string(string)\n string_array = string.split(\" \")\n\n if string_array[0] != \"not\"\n string_array.insert(0, \"not\")\n puts string_array.join(\" \")\n ...
[ "0.6314438", "0.5879692", "0.55050087", "0.54768175", "0.54768175", "0.54768175", "0.5456379", "0.53414387", "0.53374344", "0.53222394", "0.5290186", "0.5281485", "0.52730536", "0.52434355", "0.52406585", "0.522195", "0.5211931", "0.51783675", "0.51764643", "0.5172111", "0.51...
0.7481181
0
Download the given version of the seleniumserver jar and return location
def download(required_version = :latest) required_version = latest if required_version == :latest download_file_name = "selenium-server-#{required_version}.jar" return download_file_name if File.exist? download_file_name begin download_location = available_assets[download_file_name]['browser_download_url'] released = Net::HTTP.get_response(URI.parse(download_location)) redirected = URI.parse released.header['location'] File.open(download_file_name, 'wb') do |destination| download_server(redirected, destination) end rescue StandardError FileUtils.rm_rf download_file_name raise end download_file_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if correct_binary?\n msg = required_version != EMPTY_VERSION ? 'The required webdriver version' : 'A working webdriver version'\n Webdrivers.logger.debug \"#{msg} is already on the system\"\n return driver_path\n end\n\n remove\n System.download(...
[ "0.6705436", "0.64281225", "0.62391967", "0.6152021", "0.6136425", "0.60357916", "0.59827805", "0.5915514", "0.5907136", "0.58683395", "0.58243465", "0.58243465", "0.5758019", "0.57374257", "0.5736392", "0.56847364", "0.5639556", "0.5618813", "0.56141555", "0.5599668", "0.557...
0.8334378
0
Ask GitHub what the latest seleniumserver version is.
def latest @latest ||= begin available = available_assets.keys.map { |key| key[/selenium-server-(\d+\.\d+\.\d+)\.jar/, 1] } available.map { |asset| Gem::Version.new(asset) }.max.to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote_version\n rubygem_api = JSON.parse open(\"https://rubygems.org/api/v1/versions/osa.json\").read\n rubygem_api.first[\"number\"]\n rescue Exception => e\n puts \"[!] \".yellow + \" Couldn't check the latest version, please check internet connectivity.\"\n exit!\n end", "def s...
[ "0.6092795", "0.57420415", "0.57390803", "0.573075", "0.56547356", "0.5646179", "0.5617629", "0.5606858", "0.5600813", "0.5580684", "0.55577", "0.55502814", "0.55401117", "0.5521112", "0.55139726", "0.54849553", "0.5457237", "0.54541194", "0.5446913", "0.5430341", "0.54056114...
0.60097456
1
input: string of items from user separated by spaces (example: "carrots apples cereal pizza") steps: initialize hash set grocery list equal to the hash take each item from the list and break into indiviudal items set default quantity to 1 for each item on list print the list to the console [can you use one of your other methods here?] output: hash
def groceries(list) grocery_list = Hash.new each_item = list.split(' ') each_item.each {|item|grocery_list[item] = 1} grocery_list # Maria we did figured, we returned grocery_list so we could have a hash back on again! #line 3 did split so giving array, so line 4 giving that key a value and finaly returning #on line 5 as a hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_grocery_list(shopping_items)\n # steps:\n # create an empty hash\n grocery_list = {}\n # add items\n # convert input into separate items\n shopping_items = shopping_items.split\n # add items to hash and set default quantity\n shopping_items.each do |item_name|\n grocery_list[item_name.to_...
[ "0.79230636", "0.78056103", "0.7713106", "0.763902", "0.75987077", "0.7533807", "0.7503641", "0.75022095", "0.74949896", "0.7488772", "0.7470942", "0.73842114", "0.7369008", "0.7333076", "0.7324287", "0.73236036", "0.7323095", "0.7316133", "0.7293524", "0.72729516", "0.726622...
0.0
-1
Method to add an item to a list input: list, item name, and optional quantity steps: create method that takes list items set and option quantity output: print of the hash of the new items
def add_groceries(list, item, qty = 1) #list.store(item, quantity) list[item] = qty p list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(list_name, item, quantity=1)\r\n# input: list, item name, and optional quantity\r\n# steps: add item and its quantity to the hash\r\n list_name.store(item, quantity)\r\n# output: hash with new item\r\n p list_name\r\nend", "def add_item(list, add_item, add_quantity=1)\n# steps:\n # Add item as ke...
[ "0.86216915", "0.837455", "0.8360912", "0.8218278", "0.8205314", "0.817452", "0.8166174", "0.8166174", "0.813106", "0.8130996", "0.8130996", "0.8113626", "0.80987227", "0.8045793", "0.8029322", "0.801237", "0.7989597", "0.79693776", "0.79644483", "0.79525113", "0.7936929", ...
0.0
-1
Method to remove an item from the list input: delete item from the given list steps: create a method that will simple delete a specific item output: print of the hash updated
def remove_groceries(list, item) list.delete (item) p list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item(my_list, item)\r\n# input: an item (something already in the list)\r\n# steps:\r\n my_list.delete(item)\r\n \r\n my_list\r\n# declare hash\r\n# delete method for item\r\n# output: hash with removed item\r\nend", "def remove_item(input_hash, item)\n# input: list, item name, and optional quantit...
[ "0.83356464", "0.8172678", "0.8090428", "0.8015422", "0.8014583", "0.78962815", "0.7880607", "0.7871484", "0.75737435", "0.7568367", "0.75399643", "0.7516659", "0.74457765", "0.74103194", "0.737715", "0.73695403", "0.73636365", "0.7363556", "0.7360274", "0.7360274", "0.735989...
0.0
-1
Method to update the quantity of an item input: update item and quantity steps: create a method that will update the item and quantity output: print a updated hash list
def update_groceries(list, item, qty) list[item] = qty p list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_quantity(list_name, item, value)\r\n# input: list, item name, new quantity\r\n# steps: find item in the hash and change quantity to new quantity\r\n list_name[item] = value\r\n# output: updated hash with new value for item key\r\n p list_name\r\nend", "def update_item_quantity(hash_of_items, item, q...
[ "0.82140875", "0.8210736", "0.8188023", "0.8124499", "0.8110608", "0.80806214", "0.8028928", "0.80232495", "0.80119485", "0.7954246", "0.79481524", "0.79405797", "0.7924662", "0.7919116", "0.7894403", "0.7891734", "0.78861773", "0.78743994", "0.7869173", "0.78573114", "0.7840...
0.0
-1
Method to print a list and make it look pretty input: iterate the list item and quantity steps: create a method that will iterate printing the list with items and quantity output: neat print of items and quantity
def print_out(list) list.each {|item, qty| puts "#{item}; #{qty}"} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_in_print(list)\n puts \"---------------------------------------\"\n puts \"These are the items we are gonna buy\"\n list.each {|item, qty| puts \"#{qty} pieces of #{item}\" }\nend", "def pretty_list(list)\n list.each do |item,quantity|\n p \"#{item}! You have #{quantity}.\"\n end\nend", ...
[ "0.8596757", "0.84788114", "0.84788114", "0.84553266", "0.8386032", "0.83011794", "0.8263955", "0.82512945", "0.82506675", "0.823385", "0.8205684", "0.81961584", "0.8194064", "0.81708544", "0.812087", "0.812087", "0.81096256", "0.80945885", "0.80945885", "0.8081948", "0.80415...
0.7826576
46
Create a new list Add the following items to your list Lemonade, qty: 2 Tomatoes, qty: 3 Onions, qty: 1 Ice Cream, qty: 4 Remove the Lemonade from your list Update the Ice Cream quantity to 1 Print out your list (Is this readable and nice looking)?
def groceries(list) grocery_list = Hash.new() each_item = list.split(' ') each_item.each {|item|grocery_list[item] = 1} grocery_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_list(list)\n grocery_list = \"Grocery List\" + \"\\n\"\n\n list.each do |item, qty|\n grocery_list += \"#{item} : #{qty}\" + \"\\n\"\n end\n\n puts grocery_list\nend", "def final(list)\n\tputs \"Grocery List\"\n\tputs \"*\"*12\n\tlist.each {|item_name, quantity| puts \"#{item_name}: #{quantity}...
[ "0.74125177", "0.7311446", "0.7205244", "0.71699864", "0.71277595", "0.7079954", "0.7066014", "0.7036599", "0.7009264", "0.7009235", "0.70042735", "0.69890004", "0.6954832", "0.69410926", "0.6905279", "0.6902172", "0.6902172", "0.6898843", "0.68981904", "0.6894848", "0.688801...
0.0
-1
GET /service_statuses GET /service_statuses.json
def index @service_statuses = ServiceStatus.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end", "def statuses\n api.get('status')\n end", "def statuses\n request(:get, \"applicant_tracking/statuses\")\n end", "def list_statuses(user, list)\n get(\"/#{user}/lists/#{list}/status...
[ "0.7702813", "0.69559026", "0.6832701", "0.6815723", "0.6728671", "0.66612", "0.661858", "0.6602475", "0.6597044", "0.65900457", "0.6514686", "0.6483487", "0.6454371", "0.6435953", "0.6435953", "0.6390527", "0.6389473", "0.6388092", "0.6384199", "0.6375487", "0.6375487", "0...
0.71515954
1
GET /service_statuses/1 GET /service_statuses/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end", "def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end", "def status(status_id)\n response = @client.get(\"/api/v1/statuses/#{status_id}\")\n return JSON.parse(response.body)\n ...
[ "0.7060589", "0.6961108", "0.6538538", "0.6481069", "0.64782554", "0.64076275", "0.63807714", "0.6341865", "0.6307057", "0.62910795", "0.62176585", "0.6193346", "0.61880076", "0.6187873", "0.61762935", "0.6176163", "0.6161106", "0.6161106", "0.6132256", "0.6125135", "0.612123...
0.0
-1
POST /service_statuses POST /service_statuses.json
def create @service_status = ServiceStatus.new(service_status_params) respond_to do |format| if @service_status.save format.html { redirect_to @service_status, notice: 'Service status was successfully created.' } format.json { render :show, status: :created, location: @service_status } else format.html { render :new } format.json { render json: @service_status.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_statuses\n end", "def create_statuses\n end", "def postTweet(status)\n\t\t\t@client.update(status)\n\t\tend", "def add_statuses(service_statuses = {})\n @status_mutex.synchronize do\n service_statuses.each_pair { |service, status| @statuses[\"#{service}\"] = status }\n end...
[ "0.6979849", "0.6979849", "0.68882203", "0.66694236", "0.65871423", "0.62700176", "0.61675483", "0.61675483", "0.6156117", "0.6148682", "0.6119491", "0.6116168", "0.6009549", "0.5998984", "0.5964613", "0.59471816", "0.58911633", "0.5874432", "0.58627397", "0.58611536", "0.585...
0.64391524
5
PATCH/PUT /service_statuses/1 PATCH/PUT /service_statuses/1.json
def update respond_to do |format| if @service_status.update(service_status_params) format.html { redirect_to @service_status, notice: 'Service status was successfully updated.' } format.json { render :show, status: :ok, location: @service_status } else format.html { render :edit } format.json { render json: @service_status.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_status(status)\n post \"statuses/update\", :post => {:status => status}\n end", "def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n ...
[ "0.66282517", "0.64876896", "0.6366546", "0.6365721", "0.6352127", "0.6295093", "0.6262832", "0.6208245", "0.620582", "0.61906207", "0.61282617", "0.61015475", "0.6067463", "0.60609263", "0.5984834", "0.59822935", "0.59822935", "0.5977598", "0.5976353", "0.5965911", "0.595497...
0.654652
1
DELETE /service_statuses/1 DELETE /service_statuses/1.json
def destroy @service_status.destroy respond_to do |format| format.html { redirect_to service_statuses_url, notice: 'Service status was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_status(id)\n delete(\"/statuses/#{id}\")\n end", "def destroy_status(status_id)\n delete \"statuses/destroy/#{status_id}\"\n end", "def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url }\n format.json { head :no_content }\n ...
[ "0.746351", "0.73637897", "0.71703726", "0.71602386", "0.70801246", "0.7045609", "0.69746935", "0.6968814", "0.6931153", "0.6928545", "0.6928545", "0.6920634", "0.6920634", "0.6920634", "0.6917007", "0.6907957", "0.68826604", "0.6881244", "0.68662", "0.6844613", "0.6828277", ...
0.7539378
0
Use callbacks to share common setup or constraints between actions.
def set_service_status @service_status = ServiceStatus.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def service_status_params params.require(:service_status).permit(:name) 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
Words consist of any string of characters that do not include a space. input: string of words output: hash that is number of letters => how many words with that many letters take the string, separate it into each word in an array using split. From that array, count each word using size, creating a new array just of the word counts. count number of times each number occurs in the new array. Loop through starting with counting the number of times that 1 occurs up to the number of times that the greatest number occurs.
def word_sizes(string) size = [] string.split(' ').each{|word| size << word.size} biggest = size.max if biggest == nil biggest = 0 end output = {} i = 1 loop do output[i] = size.count(i) i+=1 if i>biggest break end end output.delete_if {|k, v| v<= 0} output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LetterCount(str)\n\n \n words = str.split(\" \")\n most = \"\"\n count = 0\n \n words.each do |word|\n hash = Hash.new(0)\n word.split(\"\").each {|letter| hash[letter] += 1} #must split word\n repeats = hash.select {|letter, count| count >= 2}.size\n if repeats > co...
[ "0.83753693", "0.8075262", "0.8054561", "0.80315685", "0.80193233", "0.7968477", "0.7965643", "0.79610944", "0.79411083", "0.7924062", "0.7915426", "0.78968406", "0.78690255", "0.7861201", "0.7826637", "0.78088945", "0.78067744", "0.7797954", "0.7794822", "0.77927625", "0.778...
0.7459794
58
here we end or close our method
def greeting(name) p "hello " +""+ name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end() end", "def end\n end", "def close() end", "def close() end", "def close() end", "def close() end", "def close() end", "def end\n end", "def end; end", "def end; end", "def end; end", "def finish()\n #This is a stub, used for indexing\n end", "def closin...
[ "0.8340501", "0.81645656", "0.79135656", "0.79135656", "0.79135656", "0.79135656", "0.79131883", "0.7859643", "0.78446174", "0.78446174", "0.78446174", "0.783117", "0.7791439", "0.77692235", "0.77692235", "0.7743977", "0.7737086", "0.7737086", "0.7737086", "0.7737086", "0.767...
0.0
-1
Checks if the email is not already used by a dance studio
def email_not_taken DanceStudio.all.each do |studio| errors.add(:email, 'is taken') if studio.email.downcase == email.downcase end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_taken?\n @email_credential and @email_credential.errors.added?(:email, :taken)\n end", "def duplicate_email\n\t\tif Student.find_by email: email or TeachingAssistant.find_by email: email\n\t\t\terrors.add(:email, \"has already been taken\")\n\t\tend\n\tend", "def check_email\r\n \temail = Re...
[ "0.66950554", "0.662062", "0.66205096", "0.65735584", "0.648761", "0.6451759", "0.640915", "0.638501", "0.6382498", "0.6376272", "0.6365173", "0.62905174", "0.6240668", "0.6237109", "0.6233032", "0.62121975", "0.6205179", "0.6189565", "0.6160556", "0.6145884", "0.6145884", ...
0.7484695
0
GET /snippets GET /snippets.json
def index @parent = params[:user_id] ? User.find(params[:user_id]).snippets : Snippet @snippets = @parent.search(params[:q]).recent.page(params[:page]).per(per_page) respond_with(@snippets) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @snippets = Snippet.order(\"updated_at DESC\").where(private: false).paginate(page: params[:page], per_page: 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snippets }\n end\n end", "def user_snippet(id)\n get(\"/snippets/#{id}\")\n...
[ "0.72613597", "0.72204113", "0.7178603", "0.70363384", "0.7033408", "0.6909092", "0.6678817", "0.6621841", "0.6613638", "0.648529", "0.64781415", "0.6462943", "0.6370774", "0.63657516", "0.63654315", "0.63608074", "0.6253452", "0.6250735", "0.6239355", "0.62358963", "0.623589...
0.6767607
6
GET /snippets/1 GET /snippets/1.json
def show @snippet = Snippet.find(params[:id]) respond_with @snippet end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_snippet(id)\n get(\"/snippets/#{id}\")\n end", "def index\n @snippets = Snippet.all\n end", "def show\n @languages = [\"c\", \"python\", \"css\", \"html\", \"javascript\", \"php\", \"lua\", \"ruby\", \"scheme\"]\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.7624053", "0.71972865", "0.71605635", "0.704423", "0.6973245", "0.69198", "0.6913218", "0.68074346", "0.68061316", "0.68000245", "0.6793062", "0.6734082", "0.67250687", "0.67250687", "0.66636693", "0.66171056", "0.65710974", "0.65613496", "0.65466505", "0.6521602", "0.6475...
0.7094661
3
GET /snippets/new GET /snippets/new.json
def new @snippet = current_user.snippets.build respond_with @snippet end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snippet }\n end\n end", "def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snippet }\n ...
[ "0.79511833", "0.79511833", "0.7708881", "0.7249622", "0.7113599", "0.7109814", "0.7097264", "0.70880044", "0.69802547", "0.68527526", "0.6837875", "0.6801932", "0.6766472", "0.67552394", "0.6737312", "0.6691194", "0.6678711", "0.665753", "0.6652794", "0.6554499", "0.6552004"...
0.73607606
3
POST /snippets POST /snippets.json
def create @snippet = current_user.snippets.build(params[:snippet]) @snippet.save respond_with(@snippet) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n logger.debug \"CREATE\"\n @snippet = Snippet.new(snippet_params)\n\n respond_to do |format|\n if @snippet.save\n format.html { redirect_to @snippet, notice: 'Snippet was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @snippet }\...
[ "0.70353276", "0.70090836", "0.69713295", "0.6942022", "0.6912884", "0.68663275", "0.6808542", "0.6749843", "0.665129", "0.6498034", "0.6487717", "0.6427092", "0.6427092", "0.64109164", "0.63830125", "0.63016415", "0.62278193", "0.6221088", "0.61397886", "0.6034209", "0.60105...
0.72675306
0
PUT /snippets/1 PUT /snippets/1.json
def update @snippet = current_user.snippets.find(params[:id]) @snippet.update_attributes(params[:snippet]) respond_with(@snippet) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n if @snippet.update_attributes(params[:snippet])\n format.html { redirect_to @snippet, notice: 'Snippet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render ac...
[ "0.70095015", "0.6956096", "0.6819856", "0.6743535", "0.6743535", "0.6743535", "0.66943586", "0.66697997", "0.6661744", "0.66605526", "0.63586825", "0.63075906", "0.6299047", "0.62099224", "0.6192674", "0.6192674", "0.6192674", "0.6192674", "0.6046452", "0.604631", "0.5999142...
0.7333745
0
DELETE /snippets/1 DELETE /snippets/1.json
def destroy @snippet = current_user.snippets.find(params[:id]) @snippet.destroy respond_with(@snippet) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @snippet = current_user.company.snippets.find(params[:id])\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to snippets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @snippet = Snippet.find(params[:id])\n @snippet.destroy\n\n res...
[ "0.7887805", "0.78813475", "0.78813475", "0.7792205", "0.7755409", "0.77431065", "0.77129465", "0.7660568", "0.7660568", "0.75818", "0.75818", "0.75818", "0.7305312", "0.7253005", "0.717185", "0.6979206", "0.6813255", "0.65294623", "0.63972384", "0.6358274", "0.6346551", "0...
0.7726474
6
possible cruft to be reviewed during refactor has_many :parts , inverse_of: :machine accepts_nested_attributes_for :parts accepts_nested_attributes_for :photos, :milestones, allow_destroy: true has_many :users, through: :messages acts_as_messageable mount_uploader :image, ImageUploader
def name "#{self.first_name} #{self.last_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n\t @photo = @photoable.photos.build\n\tend", "def create\n @truck = Truck.new(truck_params)\n\n if @truck.images.count>0\n @truck.images.attach(params[:truck][:images])\n end\n\n respond_to do |format|\n if @truck.save\n format.html { redirect_to @truck, notice: 'Truck was s...
[ "0.5659884", "0.5619423", "0.55406", "0.54586345", "0.5433044", "0.53660375", "0.5328257", "0.5320572", "0.531948", "0.52830476", "0.52790767", "0.52787656", "0.52470356", "0.52369064", "0.5235878", "0.52218574", "0.51880634", "0.5185353", "0.5176411", "0.5165123", "0.5164657...
0.0
-1
returns metrics of a post that contain the given unit
def metric_with_unit(unit) metrics.select {|m| Unit.new(m) <=> Unit.new(unit)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metric?\n unit and self.class.rules[unit][:metric] || false\n end", "def metric_ton? = unit == 'metric-ton'", "def get_metric_statistics (measure_name, stats, start_time, end_time, unit, options={})\n\n period = options[:period] || 60\n dimensions = options[:dime...
[ "0.5836647", "0.5803598", "0.5635677", "0.56341046", "0.5593514", "0.5556731", "0.55275", "0.5489169", "0.5392879", "0.52963233", "0.52651024", "0.52505976", "0.52505976", "0.5201385", "0.5185966", "0.51634246", "0.5156764", "0.5135545", "0.51203984", "0.5115472", "0.5108829"...
0.6831348
0
Excerpted from "Programming Ruby", published by The Pragmatic Bookshelf. Copyrights apply to this code. It may not be used to create training material, courses, books, articles, and the like. Contact us if you are in doubt. We make no guarantees that this code is fit for any purpose. Visit for more book information.
def routine(n) print n, ' ' throw :done if n <= 0 routine(n-1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def herald; end", "def jack_handey; end", "def p15\n\t\nend", "def how_it_works\r\n end", "def king_richard_iii; end", "def probers; end", "def who_we_are\r\n end", "def r; end", "def r; end", "def hello_world # \"def\" is short for \"defining a method\" and we are\n ...
[ "0.6628697", "0.6487587", "0.620194", "0.61839956", "0.6167453", "0.6148501", "0.61191034", "0.60848826", "0.60848826", "0.5992845", "0.5986014", "0.5986014", "0.59205097", "0.58780783", "0.58673745", "0.58243334", "0.58227295", "0.58109325", "0.57956594", "0.57912844", "0.57...
0.0
-1
Connects to the environment's virtual machine, replacing the ruby process with an SSH process. This method optionally takes a hash of options which override the configuration values.
def connect(opts={}) if Mario::Platform.windows? raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path, :ssh_port => port(opts) end raise Errors::SSHUnavailable if !Kernel.system("which ssh > /dev/null 2>&1") options = {} options[:port] = port(opts) [:host, :username, :private_key_path].each do |param| options[param] = opts[param] || env.config.ssh.send(param) end check_key_permissions(options[:private_key_path]) # Command line options command_options = ["-p #{options[:port]}", "-o UserKnownHostsFile=/dev/null", "-o StrictHostKeyChecking=no", "-o IdentitiesOnly=yes", "-i #{options[:private_key_path]}"] command_options << "-o ForwardAgent=yes" if env.config.ssh.forward_agent if env.config.ssh.forward_x11 # Both are required so that no warnings are shown regarding X11 command_options << "-o ForwardX11=yes" command_options << "-o ForwardX11Trusted=yes" end # Some hackery going on here. On Mac OS X Leopard (10.5), exec fails # (GH-51). As a workaround, we fork and wait. On all other platforms, # we simply exec. pid = nil pid = fork if Util::Platform.leopard? || Util::Platform.tiger? Kernel.exec "ssh #{command_options.join(" ")} #{options[:username]}@#{options[:host]}".strip if pid.nil? Process.wait(pid) if pid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_ssh(username, host, options = nil)\n @ssh = SSH.new(username, host, options)\n end", "def ssh\n @_ssh ||= Net::SSH.start(host, user, options)\n end", "def exec(opts={})\n # Get the SSH information and cache it here\n ssh_info = info\n\n if Util::Platform.windows?\n ...
[ "0.65252405", "0.6423687", "0.6293401", "0.62915546", "0.62894577", "0.62330353", "0.62178224", "0.620046", "0.61557764", "0.6073394", "0.60102594", "0.60061204", "0.6004078", "0.59613514", "0.59494746", "0.58989495", "0.5862469", "0.58485144", "0.5846644", "0.5831257", "0.57...
0.6386342
2
Opens an SSH connection to this environment's virtual machine and yields a Net::SSH object which can be used to execute remote commands.
def execute(opts={}) # Check the key permissions to avoid SSH hangs check_key_permissions(env.config.ssh.private_key_path) # Merge in any additional options opts = opts.dup opts[:forward_agent] = true if env.config.ssh.forward_agent opts[:port] ||= port retryable(:tries => 5, :on => Errno::ECONNREFUSED) do Net::SSH.start(env.config.ssh.host, env.config.ssh.username, opts.merge( :keys => [env.config.ssh.private_key_path], :keys_only => true, :user_known_hosts_file => [], :paranoid => false, :config => false)) do |ssh| yield SSH::Session.new(ssh, env) end end rescue Errno::ECONNREFUSED raise Errors::SSHConnectionRefused end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh\n @ssh ||= @remote.connect\n @remote\n end", "def ssh\n @_ssh ||= Net::SSH.start(host, user, options)\n end", "def connection\n Net::SSH.start(\n ip, username, :password => password, :port => port\n ) {|ssh| yield ssh }\n end", "def ssh_connectio...
[ "0.73653454", "0.7228437", "0.72016037", "0.6999774", "0.686853", "0.684589", "0.68435067", "0.68420035", "0.6778798", "0.6649585", "0.6622916", "0.6612508", "0.6575621", "0.6570492", "0.6559006", "0.6528409", "0.64899206", "0.6485021", "0.64757514", "0.6430456", "0.6395197",...
0.61971223
32
Uploads a file from `from` to `to`. `from` is expected to be a filename or StringIO, and `to` is expected to be a path. This method simply forwards the arguments to `Net::SCPupload!` so view that for more information.
def upload!(from, to) retryable(:tries => 5, :on => IOError) do execute do |ssh| scp = Net::SCP.new(ssh.session) scp.upload!(from, to) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(from, to)\n end", "def upload from_path, to_path, options={}, &block\n to_path = \"#{@host}:#{to_path}\"\n Sunshine.logger.info @host, \"Uploading #{from_path} -> #{to_path}\" do\n execute rsync_cmd(from_path, to_path, options), &block\n end\n end", "def upload(from, to...
[ "0.7665594", "0.71082795", "0.71079326", "0.70745265", "0.6728423", "0.6679802", "0.661887", "0.63660276", "0.6364081", "0.63631964", "0.626452", "0.6214401", "0.6212986", "0.61991173", "0.6193159", "0.6188286", "0.60895807", "0.60556847", "0.6048329", "0.60365283", "0.594588...
0.78838885
0
Checks if this environment's machine is up (i.e. responding to SSH).
def up? # We have to determine the port outside of the block since it uses # API calls which can only be used from the main thread in JRuby on # Windows ssh_port = port Timeout.timeout(env.config.ssh.timeout) do execute(:timeout => env.config.ssh.timeout, :port => ssh_port) { |ssh| } end true rescue Net::SSH::AuthenticationFailed raise Errors::SSHAuthenticationFailed rescue Timeout::Error, Errno::ECONNREFUSED, Net::SSH::Disconnect, Errors::SSHConnectionRefused, Net::SSH::AuthenticationFailed return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def up?\n instance.up?('eth1')\n end", "def up?\n check = Net::Ping::WMI.new(@ip) if OS.windows?\n check = Net::Ping::TCP.new(@ip) if OS.linux? || OS.mac?\n check.ping?\n end", "def up?(host)\n check = Net::Ping::External.new(host)\n check.ping?\nend", "def booted?\n IO.popen([\"syst...
[ "0.7033464", "0.6727651", "0.6674773", "0.64538413", "0.6363689", "0.6319261", "0.62557054", "0.6235804", "0.62324107", "0.61631745", "0.6162895", "0.6107818", "0.60945535", "0.60774547", "0.6040764", "0.60399497", "0.60163736", "0.5995819", "0.5995819", "0.5995819", "0.59810...
0.6874945
1
Checks the file permissions for the private key, resetting them if needed, or on failure erroring.
def check_key_permissions(key_path) # Windows systems don't have this issue return if Mario::Platform.windows? stat = File.stat(key_path) if stat.owned? && file_perms(key_path) != "600" File.chmod(0600, key_path) raise Errors::SSHKeyBadPermissions, :key_path => key_path if file_perms(key_path) != "600" end rescue Errno::EPERM # This shouldn't happen since we verify we own the file, but just # in case. raise Errors::SSHKeyBadPermissions, :key_path => key_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_key_permissions(key_path)\n # Windows systems don't have this issue\n return if Util::Platform.windows?\n\n @logger.debug(\"Checking key permissions: #{key_path}\")\n stat = File.stat(key_path)\n\n if stat.owned? && Util::FileMode.from_octal(stat.mode) != \"600\"\n @logger...
[ "0.71307766", "0.67817545", "0.6287953", "0.62236744", "0.5873362", "0.58660966", "0.5702043", "0.56392413", "0.56373507", "0.5628957", "0.55826426", "0.55801696", "0.54928577", "0.5472697", "0.5439887", "0.5417556", "0.5391713", "0.5386573", "0.5386024", "0.52850014", "0.528...
0.70531154
1
Returns the file permissions of a given file. This is fairly unix specific and probably doesn't belong in this class. Will be refactored out later.
def file_perms(path) perms = sprintf("%o", File.stat(path).mode) perms.reverse[0..2].reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updatedb_file_permissions(file)\n meta = updatedb_file_ls(file)\n if meta\n permissions = meta.split(\" \")[0]\n permissions\n else\n nil\n end\n end", "def filemode(file)\n File.stat(file).mode & 007777\n end", "def unix_perms; end", "def f...
[ "0.70614535", "0.63727325", "0.6070174", "0.56584805", "0.5602898", "0.5523562", "0.5480172", "0.52376777", "0.5234479", "0.5222385", "0.5212967", "0.51848245", "0.5170324", "0.50732094", "0.50382507", "0.5003506", "0.49916247", "0.49684387", "0.49594903", "0.49526027", "0.49...
0.6834385
1
Returns the port which is either given in the options hash or taken from the config by finding it in the forwarded ports hash based on the `config.ssh.forwarded_port_key`.
def port(opts={}) # Check if port was specified in options hash pnum = opts[:port] return pnum if pnum # Check if we have an SSH forwarded port pnum = nil env.vm.vm.network_adapters.each do |na| pnum = na.nat_driver.forwarded_ports.detect do |fp| fp.name == env.config.ssh.forwarded_port_key end break if pnum end return pnum.hostport if pnum # This should NEVER happen. raise Errors::SSHPortNotDetected end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port\n return @forwarded_port || @port\n end", "def ssh_port\n max_adapters = machine.parent.system_properties.get_max_network_adapters(machine.chipset_type)\n\n max_adapters.times do |i|\n adapter = machine.get_network_adapter(i)\n\n port_details = adapter.nat...
[ "0.7124535", "0.67444086", "0.6464224", "0.6412038", "0.6335653", "0.6324497", "0.6305705", "0.6212251", "0.618944", "0.61699444", "0.6137931", "0.6072555", "0.6067815", "0.6064623", "0.6045388", "0.6023752", "0.6006229", "0.600259", "0.5966593", "0.59526855", "0.59274626", ...
0.77394974
0
I worked on this challenge Jon Schwartz. I spent 2 hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? An array, a minimum size (nonnegative integer) for the array, and an optional argument of what the array should be "padded" with What is the output? (i.e. What should the code return?) An array up to the minimum size + the padded value if it goes over the minimum size. What are the steps needed to solve the problem? Define method pad! or pad Set array less than or equal to min_size Return array ELSE return array + padded value (padded value is min_size array_size 1. Initial Solution def pad!(array, min_size, value = nil) if array.length >= min_size return array else x = array.length until x == min_size array.push value x += 1 end p array end end pad!([1, 2, 3, 4], 6, value='nil') def pad(array, min_size, value = nil) nondestructive new_array = [] array.each do |item| new_array.push item end if new_array.length >= min_size return new_array else x = new_array.length until x == min_size new_array << value x += 1 end p new_array end end 3. Refactored Solution
def pad!(array, min_size, value = nil) if array.length >= min_size return array else x = array.length until x == min_size; array.push value; x += 1 end p array end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad!(array, min_size, value = nil) #destructive\n solution_array = []\n if min_size <= array.length\n #p array\n return array\n elsif min_size > array.length\n solution_array = array\n times_to_pad = min_size - array.length\n #p times_to_pad\n times_to_pad.times do\n solution_array <<...
[ "0.84484303", "0.84414023", "0.8405439", "0.83642066", "0.8361691", "0.83117044", "0.82905245", "0.82861656", "0.82465583", "0.82327837", "0.82233685", "0.8218809", "0.8217922", "0.8213378", "0.8211348", "0.8200587", "0.8199781", "0.81960446", "0.8189233", "0.81649166", "0.81...
0.8240976
9
Click a link(inside a frame), after clicking it a popup will come.
def click_link_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, link_prop, link_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).link(link_prop.intern, /#{link_prop_val}/).click_no_wait end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(link); end", "def click_web_link(text)\n\t\t@log.debug(\"Clicking web link #{text}\")\n\t\t\n\t\t@main_window.click(text)\n\tend", "def click\n @mech.click self\n end", "def click_button_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser...
[ "0.7657831", "0.7133269", "0.7030516", "0.69615704", "0.6804535", "0.6691861", "0.6531382", "0.652245", "0.65168744", "0.65157324", "0.6474009", "0.6454909", "0.64190996", "0.6342302", "0.6340488", "0.63090247", "0.62907296", "0.6190296", "0.61614555", "0.6161293", "0.6157828...
0.82948905
0
Highlight or Flash a link inside a frame.
def flash_link_inside_frame(browser_handle, frame_prop, frame_prop_val, link_prop, link_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).link(link_prop.intern, /#{link_prop_val}/).flash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(link); end", "def click_link_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, link_prop, link_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).link(link_prop.intern, /#{link_prop_val}/).click_no_wait\nend", "def clickLinkWithText (text , frameName = \"\" , ...
[ "0.60781807", "0.59404945", "0.5774925", "0.57676667", "0.55843914", "0.55330867", "0.55185777", "0.54971474", "0.5423515", "0.53995216", "0.5384754", "0.5378514", "0.5327517", "0.5177894", "0.517201", "0.51012063", "0.5096374", "0.5088961", "0.5071653", "0.505882", "0.505836...
0.69725025
0
Link exists inside a frame.
def link_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, link_prop, link_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).link(link_prop.intern, /#{link_prop_val}/).exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_frame?(frame_name)\n frame_text = self.redirect {$ie.show_frames}\n !frame_text.match(\"#{frame_name}\").nil?\n end", "def has_frame?(frame_name)\n frame_text = self.redirect {$ie.show_frames}\n !frame_text.match(\"#{frame_name}\").nil?\n end", "def button_exists_inside_frame?(browser_han...
[ "0.6993044", "0.6993044", "0.668487", "0.6508236", "0.6480089", "0.6300279", "0.62712944", "0.6263377", "0.6219201", "0.62068313", "0.62068313", "0.61492485", "0.61198497", "0.61097366", "0.6094247", "0.6059284", "0.60479367", "0.60397494", "0.60193086", "0.59844375", "0.5957...
0.85071737
0
Click a button inside a frame.
def click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_button_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).click_no_wait\nend", "def click_on_a_button(selector)\n\n click_button(selector)\n...
[ "0.75528586", "0.7270939", "0.71276987", "0.70921797", "0.7085302", "0.7075805", "0.705867", "0.7042076", "0.702378", "0.6973684", "0.6936171", "0.6915106", "0.6904289", "0.68221325", "0.68037266", "0.68037266", "0.68037266", "0.67656845", "0.6740396", "0.67332083", "0.673037...
0.8059233
0
Click a button(inside a frame), after clicking it a popup will come.
def click_button_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).click_no_wait end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).click\nend", "def click_popup_button(id, button)\r\n popupElement = find_by_id_and_class(id, ...
[ "0.7435191", "0.7406198", "0.73961014", "0.6977917", "0.69656384", "0.69457084", "0.6927818", "0.69137645", "0.69072634", "0.6889231", "0.6874837", "0.6829592", "0.6820084", "0.67886513", "0.67098427", "0.6709294", "0.6709294", "0.6709294", "0.6675545", "0.6622947", "0.659087...
0.80435485
0
Double Click a button.
def double_click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).fire_event("ondblclick") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doubleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end", "def double_click(name, *args)\n widget(name, *args).double_click\n end", "def tripleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end", "def doubleclick(btn)\n not_supported \"anything othe...
[ "0.82846534", "0.78612965", "0.7667162", "0.75403297", "0.7522484", "0.7518893", "0.7415503", "0.72161233", "0.7185607", "0.7161401", "0.71502167", "0.71458733", "0.7118388", "0.70804536", "0.7049315", "0.7007109", "0.69171965", "0.68598175", "0.6762456", "0.6674672", "0.6631...
0.69770056
16
Double Click a button(inside a frame), after clicking it a popup will come.
def double_click_button_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).fire_event_no_wait("ondblclick") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).fire_event(\"ondblclick\")\nend", "def doubleclick(btn = 'left')\n compatible_call :...
[ "0.7703348", "0.7386616", "0.7161255", "0.70561594", "0.70543456", "0.6979376", "0.6884844", "0.68585783", "0.6846798", "0.6781745", "0.6765375", "0.66997516", "0.66344726", "0.6634271", "0.6633564", "0.660066", "0.6507892", "0.64212537", "0.63876337", "0.63209414", "0.631704...
0.819352
0
Highlight or Flash a button inside a frame.
def flash_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).flash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).click\nend", "def tick_button_prefab button\n outputs.labels << button.label # outputs button...
[ "0.60853976", "0.6039672", "0.57951", "0.57931715", "0.5765476", "0.57450646", "0.56813484", "0.56471103", "0.55309004", "0.5516447", "0.5510671", "0.54853606", "0.5466837", "0.54642045", "0.5433543", "0.54165745", "0.5408803", "0.5403403", "0.5394967", "0.539401", "0.5348797...
0.6999679
0
Button exists inside a frame.
def button_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isButtonOnPage_Caption (caption , frameName = \"\" )\n\n fname = getFunctionName()\n log fname + ' Starting. Trying to find button with caption: ' + caption if $debuglevel >=0\n buttonToUse = nil\n #begin\n \n # we have to find the button\n container = get...
[ "0.7185962", "0.71744806", "0.7035408", "0.68311936", "0.67885864", "0.6772696", "0.6739226", "0.6633085", "0.65696776", "0.6460505", "0.6345942", "0.62987584", "0.6252004", "0.61355746", "0.61355746", "0.6135449", "0.61073136", "0.6092134", "0.6066657", "0.59999305", "0.5964...
0.825252
0
Click an image inside a frame.
def click_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_image_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).click_no_wait\nend", "def double_click_image_inside_frame(browser_handle, frame_prop, frame...
[ "0.78821677", "0.745381", "0.7158889", "0.7126191", "0.6810152", "0.6600182", "0.655376", "0.6428422", "0.63644254", "0.63072187", "0.6253419", "0.62526774", "0.62526774", "0.62526774", "0.6237772", "0.62160367", "0.620466", "0.6194303", "0.61083657", "0.609311", "0.6064406",...
0.8282933
0
Click an image(inside a frame), after clicking it a popup will come.
def click_image_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).click_no_wait end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).click\nend", "def double_click_image_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_va...
[ "0.78708756", "0.7825678", "0.7360072", "0.7061654", "0.67171156", "0.6577811", "0.6562029", "0.6457914", "0.6391082", "0.6345421", "0.6345421", "0.6345421", "0.628557", "0.6284531", "0.6284531", "0.62764823", "0.62567735", "0.6212065", "0.62107307", "0.6201002", "0.6171317",...
0.84202415
0
Double Click an image inside a frame.
def double_click_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).fire_event("ondblclick") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_click_image_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).fire_event_no_wait(\"ondblclick\")\nend", "def click_image(filename, is_double = fal...
[ "0.77475744", "0.72680014", "0.71099734", "0.6817514", "0.67388254", "0.67336553", "0.6582617", "0.6499378", "0.6480878", "0.64613783", "0.6415938", "0.63845485", "0.6150616", "0.6123389", "0.61115897", "0.61074793", "0.6007026", "0.5997821", "0.59889936", "0.5919282", "0.590...
0.82588
0
Double Click an image(inside a frame), after clicking it a popup will come.
def double_click_image_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).fire_event_no_wait("ondblclick") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_click_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).fire_event(\"ondblclick\")\nend", "def click_image_with_popup_inside_frame(browser_handle, fram...
[ "0.82187825", "0.74004436", "0.7305351", "0.69863504", "0.694412", "0.69037914", "0.68049884", "0.6767657", "0.66949904", "0.66337204", "0.6616166", "0.6527621", "0.6483607", "0.63168675", "0.6180453", "0.617528", "0.6173129", "0.61513036", "0.60829306", "0.60520077", "0.5988...
0.8483445
0
Highlight or Flash an image inside a frame.
def flash_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).flash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlight(img=@image.constitute)\n to_boxes.each do |box|\n box.highlight(img)\n end\n img\n end", "def click_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.in...
[ "0.65839005", "0.618935", "0.5950284", "0.5658026", "0.5658014", "0.56347644", "0.560652", "0.55895567", "0.5387906", "0.5211161", "0.52024364", "0.5173159", "0.5170307", "0.51624113", "0.5155775", "0.5065518", "0.5063139", "0.5043094", "0.502323", "0.50119", "0.501018", "0...
0.68064344
0
Image exists inside a frame.
def image_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_image?(image)\n # FIXME\n true\n end", "def has_image?\n \t# self.image.file?\n true\n end", "def has_image?\n\t\treturn File.exists? image_filename\n\tend", "def has_image?\n !image.nil?\n end", "def has_image?\n File.exists? image_filename\n end", "def has_image?\n return...
[ "0.74063814", "0.72310567", "0.7126769", "0.7125085", "0.7069616", "0.70635253", "0.70635253", "0.7046778", "0.6901028", "0.68804026", "0.683327", "0.6690703", "0.6690703", "0.6653894", "0.6650523", "0.6650104", "0.65970945", "0.6544468", "0.6537794", "0.65089256", "0.6502731...
0.854695
0
Click a checkbox inside a frame.
def click_checkbox_inside_frame(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkbox_checked_inside_frame?(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).checked?\nend", "def click_checkbox(button, value)\n append_to_script \"click_...
[ "0.7134116", "0.70229787", "0.68655914", "0.6774171", "0.6738857", "0.6583801", "0.65452963", "0.64719844", "0.62994677", "0.6236804", "0.6225396", "0.6202051", "0.616626", "0.61661744", "0.6165996", "0.611886", "0.6087685", "0.6069378", "0.60392845", "0.60226965", "0.5975494...
0.8479914
0
Clear a checkbox inside a frame.
def clear_checkbox_inside_frame(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).clear end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear\r\n assert_exists\r\n assert_enabled\r\n highlight( :set)\r\n if @o.checked == true\r\n set_clear_item( false )\r\n end\r\n highlight( :clear)\r\n end", "def clear_radio_button_inside_frame(browser_handle, frame_prop, frame_prop_val, radio_prop, r...
[ "0.7015243", "0.69378763", "0.666117", "0.6509715", "0.64807117", "0.6471035", "0.63993496", "0.63714516", "0.6354952", "0.6354952", "0.6322208", "0.63176304", "0.62275994", "0.61322564", "0.6038926", "0.58884645", "0.5872717", "0.5852034", "0.5842187", "0.57820743", "0.57655...
0.83930105
0
Highlight or Flash a checkbox inside a frame.
def flash_checkbox_inside_frame(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).flash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_checkbox_inside_frame(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).click\nend", "def checkbox_checked_inside_frame?(browser_handle, frame_prop, frame_p...
[ "0.6852966", "0.6643297", "0.6362677", "0.6296457", "0.6082257", "0.6041808", "0.5981956", "0.5947699", "0.5910567", "0.5856745", "0.5810561", "0.5772761", "0.5769368", "0.57282865", "0.57091725", "0.57006174", "0.5698969", "0.5669076", "0.56567055", "0.5624198", "0.55899787"...
0.7664642
0
Checkbox exists inside a frame.
def checkbox_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkbox_checked_inside_frame?(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).checked?\nend", "def doesCheckBoxExist( name , value , formName = \"\" , frameNam...
[ "0.8086911", "0.72344506", "0.70771927", "0.7045317", "0.69073254", "0.68108314", "0.67078066", "0.65458405", "0.64532197", "0.6405245", "0.6392159", "0.6357346", "0.6315312", "0.6314357", "0.6234471", "0.6206405", "0.61150324", "0.6062207", "0.59951156", "0.59845144", "0.594...
0.83542085
0
Check whether a checkbox is checked/set or not inside a frame.
def checkbox_checked_inside_frame?(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).checked? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkbox_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).exists?\nend", "def radio_button_checked_inside_frame?(browser_handle, frame_prop,...
[ "0.7618383", "0.71577805", "0.70333827", "0.6763438", "0.6676771", "0.649742", "0.6491949", "0.6488625", "0.64660025", "0.6457987", "0.6394482", "0.6339934", "0.633898", "0.6321332", "0.63117933", "0.6274417", "0.62124467", "0.61603224", "0.61491305", "0.6142388", "0.61264133...
0.8150026
0
Click a radio button inside a frame.
def click_radio_button_inside_frame(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_radio_button(button)\n append_to_script \"click_radio_button \\\"#{button}\\\"\"\n end", "def click_radiobutton(element)\n element = element.downcase.gsub(' ', '_')\n wait_until{send(\"#{element}?\")}\n\n button = send(\"#{element}_element\")\n wait_until{button.enabled?}\n wait_unti...
[ "0.75011677", "0.7124158", "0.70846283", "0.6915262", "0.69127166", "0.689103", "0.68835264", "0.6667671", "0.66304696", "0.6468589", "0.6386369", "0.6317735", "0.6267367", "0.6266807", "0.62518704", "0.62044615", "0.6195675", "0.6179917", "0.6176441", "0.6172207", "0.6137377...
0.8497923
0
Clear a radio button inside a frame.
def clear_radio_button_inside_frame(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).clear end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearRadio \n \"clearRadio\" \n end", "def clear_radio_option(radio_group, radio_option)\r\n the_radio_button = find_element(:xpath, \"//input[@type='radio' and @name='#{radio_group}' and @value='#{radio_option}']\")\r\n the_radio_button.clear\r\n end", "def clear_checkbox_inside...
[ "0.73060817", "0.7152507", "0.6398277", "0.61028606", "0.6094776", "0.6032802", "0.57896584", "0.57698727", "0.57298726", "0.5706718", "0.5690929", "0.56866664", "0.5666641", "0.56633395", "0.5556232", "0.54946756", "0.5474744", "0.54374796", "0.53648424", "0.5355875", "0.534...
0.8636461
0
Highlight or Flash a radio button inside a frame.
def flash_radio_button_inside_frame(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).flash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_radio_button_inside_frame(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).click\nend", "def setRadioButton( name, value , formName=\"\" , frameName = \"\" )\n fna...
[ "0.6801921", "0.6483529", "0.6481198", "0.6435294", "0.62401444", "0.6143045", "0.6111794", "0.60593754", "0.5986911", "0.5936587", "0.58958644", "0.58738005", "0.5769636", "0.570086", "0.56820637", "0.56610674", "0.5658223", "0.5610401", "0.5561396", "0.5554747", "0.5525566"...
0.7660707
0
Radio button exists inside a frame.
def radio_button_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radio_button_checked_inside_frame?(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).checked?\nend", "def radio_button; end", "def click_radio_button_inside_frame(browser_hand...
[ "0.7938019", "0.73869604", "0.7311361", "0.7005784", "0.68730444", "0.68005687", "0.66396725", "0.66315407", "0.6626591", "0.65993637", "0.6564883", "0.651307", "0.6281056", "0.6249867", "0.62095237", "0.61529446", "0.61371535", "0.61363345", "0.61237174", "0.6097959", "0.606...
0.8154516
0
Check whether a radio button is checked or not inside a frame.
def radio_button_checked_inside_frame?(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).checked? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radio_button_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).exists?\nend", "def checkbox_checked_inside_frame?(browser_handle, frame_prop, frame_prop_val...
[ "0.7732969", "0.71018434", "0.66072357", "0.64559674", "0.6406987", "0.6270216", "0.62304825", "0.6019002", "0.601899", "0.60168654", "0.5965977", "0.59491926", "0.59487957", "0.59216654", "0.5904011", "0.5859173", "0.58161646", "0.57614213", "0.57416946", "0.57258564", "0.56...
0.8323924
0
Select from a select list inside a frame.
def select_from_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val, select_value) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).select(select_value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flash_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).flash\nend", "def get_all_contents_of_select_list_inside_frame(bro...
[ "0.7350321", "0.72895885", "0.7092898", "0.6917149", "0.68741095", "0.67300403", "0.67108893", "0.6704544", "0.6677219", "0.65110195", "0.65034455", "0.64527655", "0.6417726", "0.6386537", "0.6386537", "0.634613", "0.6315259", "0.63017833", "0.6262786", "0.622828", "0.6197876...
0.8454492
0
Clear selection from a Select list inside a frame.
def clear_selection_from_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).clearSelection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearSelection\r\n assert_exists\r\n #highlight( :set)\r\n wait = false\r\n @o.each do |selectBoxItem|\r\n if selectBoxItem.selected\r\n selectBoxItem.selected = false\r\n wait = true\r\n end\r\n end\r\n @o.wait if wa...
[ "0.745365", "0.7394068", "0.73224765", "0.71741754", "0.68723625", "0.6846587", "0.68287295", "0.68217206", "0.67421764", "0.6474969", "0.6426559", "0.6423456", "0.62521183", "0.6245062", "0.6159711", "0.6159711", "0.6067093", "0.60604995", "0.60593516", "0.6033011", "0.59857...
0.8486079
0
Get all contents of a Select list inside a frame.
def get_all_contents_of_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).getAllContents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_from_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val, select_value)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).select(select_value)\nend", "def getAllSelectB...
[ "0.7474522", "0.68253547", "0.6670435", "0.6493891", "0.6452656", "0.6273124", "0.62244755", "0.61855316", "0.61512315", "0.6123229", "0.60230786", "0.59979117", "0.59208864", "0.5829935", "0.5784943", "0.573023", "0.5712541", "0.5703413", "0.56986177", "0.56791514", "0.56446...
0.8420451
0
Highlight or Flash a select list inside a frame.
def flash_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).flash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_from_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val, select_value)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).select(select_value)\nend", "def clear_selecti...
[ "0.7209025", "0.6559488", "0.62926334", "0.6063846", "0.6014517", "0.5877755", "0.5811125", "0.5774044", "0.57710737", "0.57451683", "0.5701339", "0.56957376", "0.5637134", "0.5620191", "0.5580001", "0.5575895", "0.55737305", "0.5545146", "0.5462593", "0.5462332", "0.5409525"...
0.7760327
0
Check whether a Select list exists or not inside a frame.
def select_list_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_value_selected_from_select_list_inside_frame?(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val, selected_value)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).selected?(selected_value)\nend", ...
[ "0.74935293", "0.7419483", "0.73597246", "0.6615006", "0.6606669", "0.6591189", "0.62205595", "0.61045223", "0.61045223", "0.6091746", "0.60821825", "0.60006446", "0.59034973", "0.5899232", "0.57844096", "0.57637435", "0.57272345", "0.5674715", "0.56545514", "0.56277084", "0....
0.85211885
0
Check whether a particular value is selected from a Select list or not inside a frame.
def is_value_selected_from_select_list_inside_frame?(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val, selected_value) browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).selected?(selected_value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_list_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).exists?\nend", "def doesSelectListContain ( name , value , frame...
[ "0.7395048", "0.7140836", "0.66844344", "0.65061015", "0.6463254", "0.64379466", "0.63596916", "0.635194", "0.6189344", "0.6143482", "0.61290485", "0.6062372", "0.6059173", "0.6058569", "0.6046796", "0.60310745", "0.60005045", "0.60005045", "0.59805655", "0.59676504", "0.5946...
0.8312767
0
Function: initialize Sets the instance variables star_size, star_location, and star_id to the appropriate function parameters. Parameters: size the size of the star location the distance from Earth to the star id the unique id of the star
def initialize(size, distance, id) @star_size = size @star_location = distance @star_id = id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(size, distance, id)\n @singularity_mass = size\n @singularity_location = distance\n @singularity_id = id\n end", "def initialize(size, distance, id)\n @singularity_mass = size\n @singularity_location = distance\n @singularity_id = id\n end", "def i...
[ "0.74708325", "0.74708325", "0.6644258", "0.65982354", "0.6361406", "0.6242244", "0.61383224", "0.60986227", "0.598828", "0.5964587", "0.59455615", "0.59310555", "0.5921091", "0.59175825", "0.59045213", "0.5867826", "0.58153063", "0.5795189", "0.5795189", "0.5795189", "0.5795...
0.8682079
0
Function: print_C Simply prints out the value of the global variable C to show that it is the same across two classes.
def print_C puts "Global variable C in Exoplanet class has value #$C" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_C\n puts \"Global variable C in Singularity class has value #$C\"\n end", "def print_C\n puts \"Global variable C in Singularity class has value #$C\"\n end", "def getc() end", "def getc() end", "def getc() end", "def c\n end", "def print_constant(*) end", "def getc\n...
[ "0.8367168", "0.8367168", "0.5695808", "0.5695808", "0.5695808", "0.56937575", "0.5665718", "0.541242", "0.541242", "0.53734624", "0.5366377", "0.5284729", "0.5282141", "0.526845", "0.5235227", "0.517564", "0.51261985", "0.5092708", "0.5075254", "0.5072902", "0.5041749", "0...
0.8592865
0
Function: add_star Increments the number of stars for the Exoplanet class. Used in a demonstration of a class variable.
def add_star @@number_of_stars += 1 puts "Afer adding one, Exoplanet class variable number_of_stars has value #@@number_of_stars" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addStars(num)\n self.stars += num\n end", "def star\n end", "def star; end", "def stars\n puts \"*\" * 99\nend", "def set_star\n @star = Star.find(params[:id])\n end", "def set_star\n @star = Star.find(params[:id])\n end", "def set_star\n @star = Star.find(params[:id])\n ...
[ "0.7920924", "0.68797976", "0.6637302", "0.64804846", "0.64467865", "0.64467865", "0.64467865", "0.64467865", "0.64467865", "0.61577725", "0.6153643", "0.612713", "0.6092016", "0.6075006", "0.6054424", "0.6047195", "0.6005505", "0.5964896", "0.593579", "0.5910172", "0.5882011...
0.90542203
0
Function: initialize Sets the instance variables singularity_mass, singularity_location, and singularity_id to the appropriate function parameters. Parameters: size the size of the black hole location the distance from Earth to the singularity id the unique id of the singularity
def initialize(size, distance, id) @singularity_mass = size @singularity_location = distance @singularity_id = id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(size, distance, id)\n @star_size = size\n @star_location = distance\n @star_id = id\n end", "def initialize(size, distance, id)\n @star_size = size\n @star_location = distance\n @star_id = id\n end", "def initialize size\n raise \"Size must be o...
[ "0.65626043", "0.65626043", "0.61316144", "0.59050024", "0.57536244", "0.5724422", "0.564467", "0.5530804", "0.5492333", "0.54914474", "0.54854274", "0.54598194", "0.54126185", "0.53913087", "0.53839636", "0.53839636", "0.5358396", "0.5357508", "0.5357508", "0.5357508", "0.53...
0.76022846
0
Function: print_C Simply prints out the value of the global variable C to show that it is the same across two classes.
def print_C puts "Global variable C in Singularity class has value #$C" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_C\n puts \"Global variable C in Exoplanet class has value #$C\"\n end", "def print_C\n puts \"Global variable C in Exoplanet class has value #$C\"\n end", "def getc() end", "def getc() end", "def getc() end", "def c\n end", "def print_constant(*) end", "def getc\n en...
[ "0.8592865", "0.8592865", "0.5695808", "0.5695808", "0.5695808", "0.56937575", "0.5665718", "0.541242", "0.541242", "0.53734624", "0.5366377", "0.5284729", "0.5282141", "0.526845", "0.5235227", "0.517564", "0.51261985", "0.5092708", "0.5075254", "0.5072902", "0.5041749", "0...
0.8367168
3
Includes a javascript tag that will load a javascript snippet generated by the RolesController. This snippet will contain roles data for the current user and toggle visibility for authorized elements.
def authorize_elements(object = nil) object_path = object ? "/#{object.class.name.downcase.pluralize}/#{object.id}" : '' javascript_tag <<-js var uid = Cookie.get('uid'); if(uid) { $.ajax({ url: '/users/' + uid + '/roles#{object_path}.js', type: 'get', async: false, dataType: 'script' }); } var aid = Cookie.get('aid'); if(aid) { $(document).ready(function() { authorize_elements(['anonymous-' + aid]); }); } js end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user = User.find( params[:user_id] )\n @roles = Role.all\n\n respond_to do |format|\n format.js { render :roles }\n end\n end", "def display_roles\n \n @active_roles = Role.find_all_active\n \n render(:layout => false)\n \n end", "def setUse...
[ "0.62584585", "0.61186665", "0.60423577", "0.59931606", "0.594645", "0.58583564", "0.567383", "0.565213", "0.56452954", "0.5636258", "0.56237435", "0.5551071", "0.5535463", "0.5533099", "0.5511359", "0.55085546", "0.5505495", "0.55009264", "0.55009264", "0.54776573", "0.54735...
0.69437903
0
Adds the css class requiredroles as well as a couple of css classes that can be matched with the current user's roles in order to toggle the visibility of an element
def add_authorizing_css_classes!(options, action, object) action = :"#{action} #{object.class.name.underscore.downcase}" roles = object.role_authorizing(action).expand(object) options[:class] ||= '' options[:class] = options[:class].split(/ /) options[:class] << 'visible_for' << roles.map { |role| role_to_css_class(role) }.join(' ') options[:class] = options[:class].flatten.uniq.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_authorizing_css_classes!(options, action, object)\r\n roles = object.role_authorizing(action).expand\r\n \r\n options[:class] ||= ''\r\n options[:class] = options[:class].split(/ /)\r\n options[:class] << 'visible-for' << roles.map(&:to_css_class).join(' ')\r\n options[:class] = options[:...
[ "0.6536246", "0.6155175", "0.6032729", "0.60020125", "0.59576166", "0.5948923", "0.5862464", "0.5795779", "0.5699851", "0.5663804", "0.56453687", "0.56191224", "0.56185806", "0.5581238", "0.55582017", "0.5548565", "0.5545302", "0.5528952", "0.5502474", "0.54923433", "0.549111...
0.6364134
1
oddities(['abc', 'def']) == ['abc'] oddities([123]) == [123] oddities([]) == [] Two additional ways
def oddities(arr) new_arr = [] arr.each.with_index do |item, idx| new_arr << item if idx == 0 || idx.even? end new_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oddities(list)\n new_list = []\n list.each_index do |ind|\n new_list << list[ind] if (ind + 1).odd?\n end\n new_list\nend", "def oddities(init_array)\n odd_bods = []\n init_array.each_with_index do |element, index|\n odd_bods << element if index.odd?\n end\n odd_bods\nend", "def oddies(numera...
[ "0.708416", "0.69742805", "0.6845273", "0.67636603", "0.674573", "0.6736028", "0.6729808", "0.6729401", "0.6710591", "0.66843545", "0.6681349", "0.6659959", "0.6657952", "0.6647149", "0.6644795", "0.6632039", "0.6625323", "0.6625029", "0.6621249", "0.66179305", "0.6605923", ...
0.6498702
35
Payment profile and payment could use this
def example_credit_card_params( params = {}) default = { :first_name => 'First Name', :last_name => 'Last Name', :brand => 'visa', :number => '4111111111111111', :month => '10', :year => '2012', :verification_value => '999' }.merge( params ) specific = case gateway_name #SubscriptionConfig.gateway_name when 'authorize_net_cim' { :brand => 'visa', :number => '4007000000027', } # 370000000000002 American Express Test Card # 6011000000000012 Discover Test Card # 4007000000027 Visa Test Card # 4012888818888 second Visa Test Card # 3088000000000017 JCB # 38000000000006 Diners Club/ Carte Blanche when 'bogus' { :brand => 'bogus', :number => '1', } else {} end default.merge(specific).merge(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payee\n profile\n end", "def associate_payment_profile\n order = Spree::Order.where(\"email = ?\", @user.email).order(\"created_at\").last\n if order.try(:payments).present?\n payment_source = order.payments.last.source\n payment_source.update_attributes(user_id: @user.id)\n end\n end...
[ "0.6968349", "0.6965564", "0.6820232", "0.672812", "0.65497136", "0.65155774", "0.65155774", "0.6510538", "0.6442687", "0.6414297", "0.63926256", "0.6389222", "0.63836145", "0.6379256", "0.63770443", "0.63770443", "0.6315686", "0.6315686", "0.6315686", "0.6315686", "0.6315686...
0.0
-1
If an RSpec Matcher is defined
def matcher_defined?(matcher) RSpec::Matchers.method_defined?(matcher) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rspec_matcher?(target)\n target.respond_to?(:matches?)\n end", "def rspec?\n @rspec ||= @gems.include?(:rspec)\n end", "def matcher; end", "def matcher; end", "def should(matcher=nil)\n if matcher\n subject.should(matcher)\n else\n subject.should\n ...
[ "0.75964695", "0.66632044", "0.6548277", "0.6548277", "0.63710314", "0.6370252", "0.6244445", "0.6242493", "0.61851954", "0.6145097", "0.6145097", "0.60756063", "0.60492635", "0.60173666", "0.5960285", "0.59280044", "0.59098095", "0.58888125", "0.58888125", "0.5874618", "0.58...
0.79323727
1
Public: The formatted name of the User. Returns a String.
def full_name "#{firstname} #{lastname}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n \"#{user_name.titleize}\"\n end", "def user_name\n decode_string_member(:user_name)\n end", "def to_s\n return user.name\n end", "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.siz...
[ "0.79187334", "0.7810544", "0.7758195", "0.7743269", "0.771848", "0.76654464", "0.7640585", "0.7633109", "0.7617231", "0.75045025", "0.75045025", "0.74998385", "0.7492128", "0.7459223", "0.74487424", "0.74268377", "0.7381893", "0.737692", "0.7375385", "0.735316", "0.735316", ...
0.0
-1
Public: The UserImage of the user selected for its profile picture or a default placeholder image. Returns a HTML img tag String.
def profile_image_thumbnail image_path = profile_user_image.present? ? profile_user_image.image.url(:thumbnail) : DEFAULT_USER_PROFILE_IMAGE_NAME h.image_tag image_path, class: 'img-thumbnail', alt: full_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_profile_img(user)\n if user.avatar?\n return image_tag(user.avatar, alt: user.name, size: \"60x60\")\n else\n img_url = 'no_image.png'\n end\n image_tag(img_url, alt: user.name, size: \"60x60\")\n end", "def profile_picture_for(user)\n if user.picture?\n image_tag(user.pic...
[ "0.8456255", "0.7916389", "0.7655367", "0.7528255", "0.73831946", "0.73401624", "0.7297232", "0.72947496", "0.72829825", "0.72734505", "0.7267636", "0.72291964", "0.72291964", "0.7201206", "0.71521384", "0.7151866", "0.71445245", "0.71423894", "0.7055393", "0.7047959", "0.704...
0.6885657
33
Public: The UserImage of the user selected for its profile picture miniature or a default placeholder image. Returns a HTML img tag String.
def profile_image_miniature image_path = profile_user_image.present? ? profile_user_image.image.url(:miniature) : DEFAULT_USER_PROFILE_IMAGE_NAME h.image_tag image_path, class: 'img-thumbnail', alt: full_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_profile_img(user)\n if user.avatar?\n return image_tag(user.avatar, alt: user.name, size: \"60x60\")\n else\n img_url = 'no_image.png'\n end\n image_tag(img_url, alt: user.name, size: \"60x60\")\n end", "def profile_picture_for(user)\n if user.picture?\n image_tag(user.pic...
[ "0.83953226", "0.79237723", "0.7711201", "0.7466391", "0.74531275", "0.73291355", "0.73080397", "0.72874296", "0.72874296", "0.72795373", "0.7243662", "0.72082824", "0.719463", "0.71522033", "0.71410465", "0.71336496", "0.7133035", "0.70930743", "0.70912904", "0.7075561", "0....
0.76888824
3
Public: The decorated current active SubscriptionPlan for the user. Returns a SubscriptionPlanDecorator object or nil.
def current_subscription_plan return @current_subscription_plan if @current_subscription_plan if @current_subscription_plan = current_subscription.try(:subscription_plan) @current_subscription_plan = SubscriptionPlanDecorator.decorate(@current_subscription_plan) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_plan\n self\n end", "def plan\n @plan ||= Plan.new(stripe_plan_id: stripe_plan_id)\n end", "def subscribe_to_plan(subscription_plan)\n @new_subscription = Subscription.create(plan: subscription_plan)\n @old_subscription = self.current_subscription\n\n if @old_subscription\...
[ "0.5906104", "0.58525246", "0.5816543", "0.5742977", "0.5602553", "0.55963135", "0.5580418", "0.5580418", "0.5564208", "0.554921", "0.5541309", "0.55401444", "0.55382997", "0.54709977", "0.5468366", "0.54213834", "0.5333854", "0.5333854", "0.5323715", "0.52517056", "0.5206716...
0.81805116
0
Public: A collection of SubscriptionPlan that can be chosen when replacing the user subscription. Returns a collection of SubscriptionPlan records.
def updatable_subscription_plans subscription_plans = SubscriptionPlan.where(disabled: false).order(:name) if current_subscription_plan.present? subscription_plans.where('id != ?', current_subscription_plan.id) else subscription_plans end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plans\n\t @plans = Plan.all\n\t current_user.clean_subscriptions if current_user\n\tend", "def plans\n subscriptions.map(&:plan)\n end", "def index\n @admin_subscription_plans = Admin::SubscriptionPlan.all\n end", "def form_plans\n return @_plans if @_plans.present?\n @_plans = all_pl...
[ "0.6845247", "0.6527282", "0.6228754", "0.61823845", "0.61736256", "0.61197776", "0.6045956", "0.58853155", "0.5838806", "0.5815263", "0.58004", "0.57098067", "0.5676571", "0.5576254", "0.5471358", "0.54674095", "0.5403871", "0.5376821", "0.5356834", "0.53507966", "0.53400236...
0.7355298
0
Public: A limited, decorated collection of decorated Order records for the user created in the current month. Returns a collection of OrderDecorator objects.
def current_orders @current_orders ||= OrderDecorator.decorate_collection( object. orders. includes(:order_items). from_current_month. limit(CURRENT_ORDERS_LIMIT). order(:created_at)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_orders\n @latest_orders ||= OrderDecorator.decorate_collection(\n object.\n orders.\n includes(:order_items).\n order('created_at DESC').\n limit(3))\n end", "def in...
[ "0.6350242", "0.6011584", "0.586907", "0.578678", "0.57594717", "0.57522875", "0.57467574", "0.573374", "0.5565682", "0.5497264", "0.5447533", "0.5440582", "0.5436715", "0.54106927", "0.5408839", "0.5380435", "0.5372516", "0.53643554", "0.5316049", "0.5315121", "0.530548", ...
0.6439708
0
Public: The total count of the orders created this month for the user. Returns an Integer.
def current_month_orders_count @current_month_orders_count ||= object.orders.from_current_month.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders_number_current_month\n Order.where('extract(year from date) = ?', year_now).where('extract(month from date) = ?', month_now).count\n end", "def index\n @total_orders = Order.count\n end", "def total_users_count\n return @total_users_count\n end", "def order_count\...
[ "0.6785289", "0.61274344", "0.59553427", "0.59346914", "0.58932126", "0.5849638", "0.5829594", "0.58036375", "0.569103", "0.5660315", "0.56598973", "0.565238", "0.56518024", "0.5639556", "0.5639556", "0.5588382", "0.5564947", "0.5564947", "0.5548399", "0.55215126", "0.5500080...
0.7424475
0
Public: A limited, decorated collection of the latest Order records for the user. Records are ordered by their creation date with the last order being first. Returns a collection of OrderDecorator objects.
def latest_orders @latest_orders ||= OrderDecorator.decorate_collection( object. orders. includes(:order_items). order('created_at DESC'). limit(3)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recent_orders(user, from)\n\t\tif from.nil?\n\t\t\tstart = 0\n\t\telse\n\t\t\tstart = from\n\t\tend\n\t\t\t\n\t\tif user.nil?\n\t\t\torders = Order.where(created_at: (Time.current.midnight - start.day)..Time.current)\n\t\telse\n\t\t\torders = user.orders.where(created_at: (Time.current.midnight - start.day)..T...
[ "0.5967312", "0.59619915", "0.592851", "0.58751863", "0.57776666", "0.57536066", "0.56717783", "0.5662668", "0.560051", "0.5565937", "0.54496765", "0.5443372", "0.5375836", "0.53688496", "0.53560454", "0.53290635", "0.5276141", "0.5260071", "0.5255312", "0.5253721", "0.525167...
0.75843865
0
Public: The last Payment record linked to the User. Returns a Payment object or nil.
def last_payment @last_payment ||= payments.order(:created_at).last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_payment\n payment_intent = as_stripe_subscription(['latest_invoice.payment_intent'])\n .latest_invoice\n .payment_intent\n\n payment_intent ? Payment.new(payment_intent) : nil\n end", "def payment\n @payment ||= user.try(:payment_method).try(:to_payment)\n end", "def l...
[ "0.74305624", "0.65597147", "0.6551661", "0.59612", "0.5731835", "0.57039815", "0.56509703", "0.5644357", "0.5611672", "0.55124646", "0.5486486", "0.54835075", "0.5481388", "0.54613084", "0.54126596", "0.54126596", "0.5407428", "0.5360215", "0.53387773", "0.5336187", "0.53314...
0.76920336
0