query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
returns an array of [year, times_played] for the year with the lowest nonzero of occurrences
def calculate_least_common_year self.calculate_plays_by_year.select{ |year,times_played| times_played > 0 }.sort_by{ |year, times_played| times_played }.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_most_common_year\n self.calculate_plays_by_year.sort_by{ |year, times_played| times_played }.last\n end", "def year_array\n return ['x'] +(@earliest_year..@latest_year).to_a\n end", "def yearly_play_chart_data\n self.yearly_play_data.map do |year, times_played|\n {name: year, play...
[ "0.6881578", "0.5795251", "0.56842947", "0.5610372", "0.554224", "0.54979396", "0.54905206", "0.5441946", "0.54223555", "0.5408078", "0.5386826", "0.5365788", "0.5328362", "0.53281355", "0.53271276", "0.52850235", "0.5254471", "0.5221472", "0.52045083", "0.51985264", "0.51767...
0.7741517
0
Don't display if the :if option passed says so Don't display if the link isn't real, we have children, and none of the children are being displayed.
def display?(context = nil) return false unless render_in_context(context, @should_display) return false if !real_url?(context) && @children.any? && !items(context).any? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_in_child_list?\n\t\t\ttrue\n\t\tend", "def is_link?\n !child_question.nil?\n end", "def visible_navigation_children\n children.select { |c| c.published? and c.display_in_navigation? }\n end", "def menu_item_display_if\n menu_options[:if] || proc { true }\n end", "def useless?\n...
[ "0.5980648", "0.5868918", "0.5747552", "0.56405133", "0.56344247", "0.5629681", "0.562275", "0.5553639", "0.5553639", "0.54415756", "0.5419465", "0.5416317", "0.5359356", "0.5351475", "0.5351475", "0.5351475", "0.5290461", "0.52603334", "0.5225555", "0.5225033", "0.52004814",...
0.6391599
0
Returns an array of the ancestry of this menu item. The first item is the immediate parent of the item.
def ancestors parent ? [parent, parent.ancestors].flatten : [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_array\n parents = []\n\n top_array = [self]\n c_arr = top_array\n\n self.class.base_class.each_with_level(descendants.includes(:link => :linkable)) do |menu, level|\n case level <=> parents.count\n when 0 # same level\n # set current array as new sibling array containing men...
[ "0.7125935", "0.7011374", "0.6952093", "0.67846286", "0.67312145", "0.6708124", "0.6677817", "0.6674809", "0.6640444", "0.66075045", "0.65922", "0.6557865", "0.6514077", "0.6510032", "0.6480869", "0.64710355", "0.6464979", "0.6457203", "0.6448548", "0.6439901", "0.64003", "...
0.6418504
20
URL is not nil, empty, or ''
def real_url?(context = nil) url = url context url.present? && url != '#' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_provided?\n @url = params[:url]\n @url.present? && @url.strip\n end", "def url_filled?\n !url.blank?\n end", "def url?\n !url.nil?\n end", "def real_url?\n url && url.present? && url != \"#\"\n end", "def url?\n !urn?\n end", "def valid_url?\n !Sail...
[ "0.8212927", "0.8135746", "0.7999424", "0.77198297", "0.76626205", "0.7600492", "0.7549009", "0.74865544", "0.7419769", "0.7349313", "0.7157547", "0.7145534", "0.71327543", "0.70180345", "0.7016414", "0.69954807", "0.69872063", "0.69795066", "0.6971648", "0.6949966", "0.69401...
0.6732138
37
Functions Library move card from deck to stack
def move_card(draw, play) if play.empty? && draw.any? play << draw.shift elsif draw.any? && (within_one?(draw[0].rank.to_i, play[-1].rank.to_i)) play << draw.shift else end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deal_into_new_stack(deck)\n deck.reverse\nend", "def take_card\n @deck.shift\n end", "def return_card( card )\n @deck.unshift( card )\n end", "def deal_card\n @deck.pop\n end", "def deal\r\n @deck_of_cards.shift\r\n end", "def push(card)\n error_unless_param_is_a_card card, \"...
[ "0.766868", "0.74520534", "0.7253454", "0.72173864", "0.7151119", "0.7108545", "0.70602274", "0.7041853", "0.70294833", "0.697316", "0.6908366", "0.69046754", "0.6884878", "0.68825686", "0.6877643", "0.68770814", "0.68652296", "0.68631244", "0.68462694", "0.68100035", "0.6803...
0.66227645
31
move card from stack to stack def move_pile(play1, play2) if play2.empty? play2.concat(play1) play1.clear elsif (within_one?(play1[0].rank.to_i, play2[1].rank.to_i) && (within_one?(play1[0].rank.to_i, play2[1].rank.to_i))) print "front or back?" side=gets.chomp if side == "front" play1.concat(play2) play2.clear elsif side == "back" play2.concat(play1) play1.clear else end elsif (within_one?(play1[0].rank.to_i, play2[1].rank.to_i)) play1.concat(play2) play1.clear elsif (within_one?(play1[0].rank.to_i, play2[0].rank.to_i)) play1.concat(play2) play1.clear else end end Move pile of cards Experimental
def move_pile(play1, play2) if play2.empty? play2.concat(play1) play1.clear elsif (within_one?(play1[0].rank.to_i, play2[-1].rank.to_i)) play2.concat(play1) play1.clear else end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_card(draw, play)\n if play.empty? && draw.any?\n play << draw.shift\n elsif draw.any? && (within_one?(draw[0].rank.to_i, play[-1].rank.to_i))\n play << draw.shift\n else\n end\nend", "def pile_cards\n if type == :basic\n @spoils_of_war << @player1.deck.cards[0]\n @spoils_of_war <<...
[ "0.7844412", "0.7539244", "0.7118394", "0.7007648", "0.6819015", "0.65942794", "0.656614", "0.6563209", "0.65028155", "0.6502068", "0.6441721", "0.64398044", "0.6428517", "0.6423562", "0.6348722", "0.6337396", "0.6307701", "0.6295659", "0.62912595", "0.62645286", "0.6261149",...
0.84700364
0
Use callbacks to share common setup or constraints between actions.
def set_posts_tag @posts_tag = PostsTag.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def posts_tag_params params.fetch(:posts_tag, {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.71213365", "0.70527846", "0.6947171", "0.6901663", "0.67342883", "0.6717481", "0.668679", "0.667654", "0.6660948", "0.655484", "0.6525947", "0.64567953", "0.64502525", "0.6450165", "0.6446098", "0.6433068", "0.64118934", "0.64118934", "0.63903046", "0.6379847", "0.6379847"...
0.0
-1
end return initialize player hands
def init_player_hands @player1_hand = [] @player2_hand = [] @player3_hand = [] @player4_hand = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(cards)\n\n\n #while start waiting to east to start\n @state = :start\n #hand for each player\n @hands = {} \n @hands[:south] = cards.slice(0,10).sort!\n @hands[:east] = cards.slice(10,10).sort!\n @hands[:west] = cards.slice(20,10).sort!\n \n \n #cards played on table\n ...
[ "0.7758745", "0.7235557", "0.7200113", "0.7123786", "0.70800775", "0.7041325", "0.704064", "0.70072865", "0.6998174", "0.68564904", "0.68395317", "0.6826799", "0.679842", "0.6769762", "0.6767948", "0.6763759", "0.67102075", "0.6707476", "0.6659009", "0.6650143", "0.66490406",...
0.8422662
0
end init_play_hand Initialize Player Hands
def init_dealer_hand @dealer_hand = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_player_hands\n\n @player1_hand = []\n @player2_hand = []\n @player3_hand = []\n @player4_hand = []\n\n end", "def show_hands_initial\n player.show_hand\n dealer.show_hand\n end", "def starting_hands\n @dealer_hand.push(random_card)\n @player_hand.push(random_card, random_card...
[ "0.80169576", "0.760556", "0.70050603", "0.69155616", "0.6876794", "0.6857762", "0.673321", "0.6671339", "0.66579527", "0.6627292", "0.6582967", "0.657855", "0.6540019", "0.6539772", "0.652969", "0.6525629", "0.645023", "0.6450114", "0.6450114", "0.6445877", "0.64421535", "...
0.6301033
37
end of card_shuffle Deal the Dealer a Card
def deal_dealer_card card = @deck.delete_at(0) @dealer_hand << card end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deal_card\n if @unshuffled_deck[-1] == nil\n @unshuffled_deck = @addhand\n @addhand = @emptyarray\n @x = 0\n end\n card = @unshuffled_deck[@x]\n @unshuffled_deck[@x] = nil\n @x+=1\n return card\n end", "def hand_over_dealer\r\n puts \"Dealer getting 1 random card...\"\r\n...
[ "0.8009064", "0.7723573", "0.7551772", "0.74831754", "0.7421461", "0.7408734", "0.73830014", "0.73792255", "0.73752725", "0.7366532", "0.7351065", "0.7266771", "0.7245088", "0.72328687", "0.7229793", "0.72269017", "0.72122264", "0.71954054", "0.7176603", "0.71583277", "0.7141...
0.7416056
5
end of deal_dealer_card_method Dealing Player Cards
def deal_player_card(current_player) card = @deck.delete_at(0) if current_player == 1 then @player1_hand << card end if current_player == 2 then @player2_hand << card end if current_player == 3 then @player3_hand << card end if current_player == 4 then @player4_hand << card end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deal_cards\n\t\t\tend", "def deal_cards\n Print.heading('Dealing initial cards')\n deal_card_to_players\n dealer_card_to_dealer(false) #false to hide first dealer card\n deal_card_to_players\n dealer_card_to_dealer(true)\n end", "def deal_cards\r\n\t\t@player.draw_card(@deck.deal_card)\r\n\...
[ "0.8399073", "0.8333051", "0.8246254", "0.816907", "0.813615", "0.8123897", "0.8027193", "0.79399896", "0.7863337", "0.7849715", "0.7823181", "0.7813507", "0.7798923", "0.7755101", "0.775068", "0.77466846", "0.7744429", "0.7708262", "0.76856196", "0.76445395", "0.764265", "...
0.74183035
27
end of dealing player card Displaying Dealer Cards (Return the only yhe 2cd card unless (the arg passed was equal to "dealer"))
def display_dealer_card(dealer="") card = [] if dealer == "dealer" card = @dealer_hand # Fetch all of dealers cards else card = ["blank card"] card << @dealer_hand.fetch(1) # Fetch dealers 2cd card end return card end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deal_cards\n Print.heading('Dealing initial cards')\n deal_card_to_players\n dealer_card_to_dealer(false) #false to hide first dealer card\n deal_card_to_players\n dealer_card_to_dealer(true)\n end", "def dealer_turn\n @dealer.show_hidden_card\n render_cards(@dealer.cards_in_hand, \"The...
[ "0.7787684", "0.7362852", "0.72794175", "0.7216833", "0.7202246", "0.70144176", "0.6866023", "0.683401", "0.67140174", "0.66904163", "0.6627497", "0.66192585", "0.66174513", "0.65922326", "0.6584375", "0.65674686", "0.6558081", "0.6553478", "0.652138", "0.65158176", "0.650630...
0.78210616
0
end of displaying player card resets player's hand
def reset_players_hand(current_player) if current_player == 1 then @player1_hand = [] end if current_player == 2 then @player2_hand = [] end if current_player == 3 then @player3_hand = [] end if current_player == 4 then @player4_hand = [] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_hand\n @hand_cards.clear\n @points = 0\n end", "def reset_hand\n @hand_played = []\n end", "def reset!\n @hands.each(&:discard!)\n @cards += @used\n @used = []\n end", "def reset_hand\n @hand = []\n end", "def hand_finished\n\t\t\t\tloop do\n\t\t\t\t\tline = socke...
[ "0.7663884", "0.7539696", "0.73500526", "0.73055166", "0.7229147", "0.71547246", "0.7144904", "0.7088463", "0.7042899", "0.7007274", "0.6996447", "0.69890136", "0.69469804", "0.6937299", "0.69277155", "0.69094914", "0.6899752", "0.6873629", "0.68638563", "0.68516827", "0.6804...
0.70044774
10
end of reset player's hand Sum of Dealer's Lowest total
def determine_dealers_lowest_total sum_of_dealers_hand = 0 @dealer_hand.each {|x| card_value = @deckhash.fetch(x) if card_value == 1 then card_value = 11 end sum_of_dealers_hand = sum_of_dealers_hand + card_value } # ### This method returns sum of dealer's hand return sum_of_dealers_hand end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_hand_total\n players_hand.inject(0) {|sum, card| sum + card.value}\n end", "def add_players_lowest_hand(current_player)\n sum_of_players_hand = 0\n if current_player == 1 then\n @player1_hand.each {|x|\n card_value = @deckhash.fetch(x)\n sum_of_players_hand = sum_of_player...
[ "0.7092059", "0.702379", "0.689563", "0.6800404", "0.6776867", "0.6775392", "0.67534953", "0.67503077", "0.6670954", "0.6640104", "0.66092175", "0.6577457", "0.65701336", "0.65369356", "0.65296155", "0.6514623", "0.64995784", "0.64392304", "0.641659", "0.63874984", "0.6370802...
0.7519934
0
end of add dealer's hand This method returns sum of dealer's best total
def determine_dealers_best_total # @dealer_hand = ['ace of spades', '5 of spades', '4 of spades', 'ace of diamonds'] # @player1_hand = ['3 of spades', 'ace of hearts', '4 of spades', 'ace of clubs'] # @player1_hand = ['ace of clubs', '2 of clubs', 'ace of hearts', '4 of hearts'] # @dealer_hand = ['king of hearts', '6 of diamonds'] sum_of_dealers_hand = 0 number_of_aces_in_hand = 0 @dealer_hand.each {|x| # begin loop adding dealers hand card_value = @deckhash.fetch(x) if card_value == 1 then # adjust aces to a value of 11 card_value = 11 number_of_aces_in_hand = number_of_aces_in_hand + 1 end sum_of_dealers_hand = sum_of_dealers_hand + card_value } #end of loop adding dealers hand if sum_of_dealers_hand > 21 then # must set one or more aces back to one loop do if number_of_aces_in_hand == 0 then break end sum_of_dealers_hand = sum_of_dealers_hand - 10 if sum_of_dealers_hand < 22 then break end number_of_aces_in_hand = number_of_aces_in_hand - 1 end #end of loop do end #end of sum_of_dealers_hand > 21 # $stdout.write("Showing card and value #{sum_of_dealers_hand}, #{number_of_aces_in_hand} \n") # ### this method returns of the dealer's best hand' sum_of_dealers_hand = sum_of_dealers_hand + 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_dealers_lowest_total\n sum_of_dealers_hand = 0\n @dealer_hand.each {|x|\n card_value = @deckhash.fetch(x)\n if card_value == 1 then card_value = 11\n end\n sum_of_dealers_hand = sum_of_dealers_hand + card_value\n }\n # ### This method returns sum of dealer's hand\n ...
[ "0.73483783", "0.70323396", "0.6732792", "0.67178863", "0.6560544", "0.6409373", "0.6403011", "0.6392923", "0.63879514", "0.63788706", "0.6357766", "0.6295152", "0.6250366", "0.6207558", "0.6176634", "0.6168933", "0.6111468", "0.6110106", "0.6106015", "0.6066673", "0.60666347...
0.72417325
1
end of determine dealers best total Method to sum players to the best total(to account for aces) This method returns sum of player's best hand
def determine_players_best_total(current_player) # @player1_hand = ['ace of spades', '5 of spades', '4 of spades', 'ace of diamonds'] # @player1_hand = ['3 of spades', 'ace of hearts', '4 of spades', 'ace of clubs'] # @player1_hand = ['ace of clubs', '2 of clubs', 'ace of hearts', '4 of hearts'] sum_of_players_hand = 0 number_of_aces_in_hand = 0 if current_player == 1 then @player1_hand.each {|x| #begin loop adding players hand card_value = @deckhash.fetch(x) if card_value == 1 then #adjust aces to a value of 11 card_value = 11 number_of_aces_in_hand = number_of_aces_in_hand + 1 end #end of ace adjustment sum_of_players_hand = sum_of_players_hand + card_value } #end of loop adding players hand if sum_of_players_hand > 21 then #must set one or more aces back to one loop do if number_of_aces_in_hand == 0 then break end sum_of_players_hand = sum_of_players_hand - 10 if sum_of_players_hand < 22 then break end number_of_aces_in_hand = number_of_aces_in_hand - 1 end #end of loop do end #end of sum_of_players_hand > 21 end #end if current player = 1 if current_player == 2 then @player2_hand.each {|x| #begin loop adding players hand card_value = @deckhash.fetch(x) if card_value == 1 then #adjust aces to a value of 11 card_value = 11 number_of_aces_in_hand = number_of_aces_in_hand + 1 end #end of ace adjustment sum_of_players_hand = sum_of_players_hand + card_value } #end of loop adding players hand if sum_of_players_hand > 21 then #must set one or more aces back to one loop do if number_of_aces_in_hand == 0 then break end sum_of_players_hand = sum_of_players_hand - 10 $stdout.write("sum of players hand #{sum_of_players_hand} :") if sum_of_players_hand < 22 then break end number_of_aces_in_hand = number_of_aces_in_hand - 1 end #end of loop do end #end of sum_of_players_hand > 21 end #end if current player = 2 if current_player == 3 then @player3_hand.each {|x| #begin loop adding players hand card_value = @deckhash.fetch(x) if card_value == 1 then #adjust aces to a value of 11 card_value = 11 number_of_aces_in_hand = number_of_aces_in_hand + 1 end #end of ace adjustment sum_of_players_hand = sum_of_players_hand + card_value } #end of loop adding players hand if sum_of_players_hand > 21 then #must set one or more aces back to one loop do if number_of_aces_in_hand == 0 then break end sum_of_players_hand = sum_of_players_hand - 10 # $stdout.write("sum of players hand #{sum_of_players_hand} :") if sum_of_players_hand < 22 then break end number_of_aces_in_hand = number_of_aces_in_hand - 1 end #end of loop do end #end of sum_of_players_hand > 21 end #end if current player = 3 if current_player == 4 then @player4_hand.each {|x| #begin loop adding players hand card_value = @deckhash.fetch(x) if card_value == 1 then #adjust aces to a value of 11 card_value = 11 number_of_aces_in_hand = number_of_aces_in_hand + 1 end #end of ace adjustment sum_of_players_hand = sum_of_players_hand + card_value } #end of loop adding players hand if sum_of_players_hand > 21 then #must set one or more aces back to one loop do if number_of_aces_in_hand == 0 then break end sum_of_players_hand = sum_of_players_hand - 10 # $stdout.write("sum of players hand #{sum_of_players_hand} :") if sum_of_players_hand < 22 then break end number_of_aces_in_hand = number_of_aces_in_hand - 1 end #end of loop do end #end of sum_of_players_hand > 21 end #end if current player = 4 # ### This method returns sum of player's best hand return sum_of_players_hand end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_dealers_best_total\n # @dealer_hand = ['ace of spades', '5 of spades', '4 of spades', 'ace of diamonds']\n # @player1_hand = ['3 of spades', 'ace of hearts', '4 of spades', 'ace of clubs']\n # @player1_hand = ['ace of clubs', '2 of clubs', 'ace of hearts', '4 of hearts']\n # @dealer_hand...
[ "0.77136475", "0.742315", "0.7167293", "0.7083669", "0.70728785", "0.7057982", "0.6936001", "0.6885964", "0.6884353", "0.6854238", "0.6812462", "0.6795545", "0.6780712", "0.6778064", "0.67451924", "0.66781193", "0.6651935", "0.66492975", "0.6607205", "0.65959024", "0.6542137"...
0.75809574
1
end of sum of player's best hand Sum up of all the player's current hand This method returns sum of player's hand
def add_players_lowest_hand(current_player) sum_of_players_hand = 0 if current_player == 1 then @player1_hand.each {|x| card_value = @deckhash.fetch(x) sum_of_players_hand = sum_of_players_hand + card_value # $stdout.write("Showing card and value #{x}, #{sum_of_players_hand}, #{card_value} \n") } end #end if current player = 1 if current_player == 2 then @player2_hand.each {|x| card_value = @deckhash.fetch(x) sum_of_players_hand = sum_of_players_hand + card_value # $stdout.write("Showing card and value #{x}, #{sum_of_players_hand}, #{card_value} \n") } end #end if current player = 2 if current_player == 3 then @player3_hand.each {|x| card_value = @deckhash.fetch(x) sum_of_players_hand = sum_of_players_hand + card_value # $stdout.write("Showing card and value #{x}, #{sum_of_players_hand}, #{card_value} \n") } end #end if current player = 3 if current_player == 4 then @player4_hand.each {|x| card_value = @deckhash.fetch(x) sum_of_players_hand = sum_of_players_hand + card_value # $stdout.write("Showing card and value #{x}, #{sum_of_players_hand}, #{card_value} \n") } end #end if current player = 4 # ### This method returns sum of player's hand return sum_of_players_hand end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_player_hand(player_hand)\n player_hand.reduce(:+)\n end", "def get_hand_sum(curr_hand) \n curr_hand.inject(0) { |sum, card| sum + card }\n end", "def player_hand_total\n players_hand.inject(0) {|sum, card| sum + card.value}\n end", "def get_player_total(player_hand)\n\tplayer_total ...
[ "0.7518541", "0.74518615", "0.7345666", "0.7178283", "0.71606296", "0.69473803", "0.6850758", "0.6776467", "0.67761457", "0.67357767", "0.6707099", "0.6635455", "0.6632383", "0.66071683", "0.660602", "0.66054374", "0.65918857", "0.6557082", "0.65395415", "0.65181434", "0.6517...
0.7314292
3
Row explanation: [ "month_name", ruby_prs, js_prs, pythong_prs ] Output: [ [ "january", 1, 2, 3 ], ... [ "dicember", 6, 0, 2 ], ]
def monthly_language_activity @data.fetch("activity") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def month_array\r\n\t\t[[\"January\", \"1\"],[\"February\", \"2\"], \r\n\t\t[\"March\", \"3\"],[\"April\",4],\r\n\t\t[\"May\",5],[\"June\",6],\r\n\t\t[\"July\",7],[\"August\",8],\r\n\t\t[\"September\",9],[\"October\",10],\r\n\t\t[\"November\",11],[\"December\",12]]\r\n\tend", "def month_names; end", "def month...
[ "0.6679028", "0.63668233", "0.6273568", "0.6183829", "0.6107074", "0.606694", "0.59649074", "0.59382457", "0.5894731", "0.58943886", "0.5887359", "0.58782953", "0.5857224", "0.5857224", "0.58405876", "0.5829198", "0.5786427", "0.57749456", "0.5740887", "0.56753874", "0.567004...
0.0
-1
Fetch all documents at this scope.
def all(extra_parameters = {}) klass.all(params(extra_parameters)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all(*vars)\n result = Query.get self, *vars\n result.get_docs\n end", "def all\n @document = Document.all\n end", "def all(params={})\n scoped_attributes = self.class.scopes.inject({}){|r,k| r.merge(k.to_s => send(k))}\n scoped_attributes.merge!(params)\n body = connection.s...
[ "0.7350431", "0.70373404", "0.68038696", "0.672279", "0.6682842", "0.6653729", "0.6647518", "0.66374654", "0.65687865", "0.65375215", "0.6487783", "0.6405739", "0.6319488", "0.63042766", "0.62618166", "0.62565845", "0.6241662", "0.62393904", "0.6234384", "0.62326854", "0.6207...
0.0
-1
Fetch the first document at this scope.
def first(extra_parameters = {}) klass.first(params(extra_parameters)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first\n find.limit(1).next_document\n end", "def first\n response = query(:per_page => 1, :page => 1).get!\n response[:results].first\n end", "def first(*args)\n query = scoped_query(args.last.respond_to?(:merge) ? args.pop : {})\n\n if args.any?\n new_collection...
[ "0.75297153", "0.72958803", "0.70266074", "0.70233303", "0.6916869", "0.68905544", "0.68613297", "0.68105555", "0.67515945", "0.66868764", "0.6680791", "0.66408634", "0.66088617", "0.6588913", "0.65075207", "0.64805984", "0.6478315", "0.6474067", "0.64712924", "0.6463976", "0...
0.0
-1
Paginate the documents at this scope.
def paginate(extra_parameters = {}) klass.paginate(params(extra_parameters)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginate(options={})\n populate_pagination_attributes_from_options(options)\n limit(per_page)\n offset((page - 1) * per_page)\n self\n end", "def paginate(options={})\n page = [options[:page].to_i, 1].max\n per_page = (options[:per_page] || per_page).to_i\n req...
[ "0.7644259", "0.74222755", "0.7249519", "0.7222618", "0.7197751", "0.71957314", "0.7180792", "0.71390957", "0.7047344", "0.6989861", "0.69371796", "0.6811305", "0.6800669", "0.6788106", "0.6700812", "0.6662037", "0.6657402", "0.66351646", "0.6631685", "0.6631172", "0.6620033"...
0.70397025
9
Build an object at this scope. e.g. Post.scope(:name => "James").build.name => "James"
def build(extra_parameters = {}) klass.new(params_without_modifiers(extra_parameters)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_with_scope(name); end", "def build_entry\n model_scope.new\n end", "def build_person\n @person ||= people_scope.build\n @person.attributes = person_params\n end", "def build(params = {})\n association.build(model, params)\n end", "def push_scope(data)\n @scopes....
[ "0.67134726", "0.66358393", "0.61561906", "0.57893085", "0.5769956", "0.574379", "0.5689608", "0.56583", "0.56583", "0.563985", "0.56386757", "0.5618825", "0.56106585", "0.5582285", "0.5535852", "0.55302507", "0.549636", "0.5490312", "0.54728025", "0.5469826", "0.5430845", ...
0.0
-1
Create an object at this scope. e.g.
def create(extra_parameters = {}) klass.create(params_without_modifiers(extra_parameters)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_object\n @object = scope.new params[object_name.to_sym]\n set_instance\n end", "def new\n BikeObject.new(self, 'Object', @type, @name)\n end", "def create_object\n definition.sought_type.new\n end", "def new\n AwesomeObject.new(self)\n end", "def new\n AwesomeObject.ne...
[ "0.77991676", "0.6936549", "0.6880084", "0.67573494", "0.67573494", "0.6510978", "0.6478314", "0.6458054", "0.643385", "0.64300156", "0.64300156", "0.64300156", "0.64300156", "0.64300156", "0.64300156", "0.64300156", "0.64300156", "0.64300156", "0.6368954", "0.6361923", "0.63...
0.0
-1
Override respond_to? so that we can return true when it's another named_scope.
def respond_to?(method_name, include_private = false) klass.has_named_scope?(method_name) || super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_named_scope?(name)\n scope_proxy.has_named_scope?(name)\n end", "def respond_to?(name, include_private=false) #:nodoc:\n super || (current && current.respond_to?(name, include_private))\n end", "def respond_to?(name, include_private = false)\n return true if @extensions.any...
[ "0.7062525", "0.67563516", "0.67437124", "0.6613717", "0.6609312", "0.6579753", "0.6521163", "0.6433764", "0.6337225", "0.63301414", "0.6260782", "0.6258281", "0.62270206", "0.62126464", "0.6212093", "0.618832", "0.61655074", "0.61206186", "0.6084983", "0.6071883", "0.6070187...
0.7358306
0
Use method_missing to respond to other named scopes on klass.
def method_missing(method_name, *args, &block) respond_to?(method_name) ? chain_with(method_name) : super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(name, *args, &block)\n @klass.send(name, *args, &block)\n end", "def method_missing(method, *args)\r\n self.class.method_missing(method, *args)\r\n end", "def method_missing(method_name, *args) self end", "def method_missing(method_name, *args) self end", "def method_miss...
[ "0.70185107", "0.6781858", "0.6773153", "0.6773153", "0.67460823", "0.67460823", "0.67295384", "0.6712492", "0.66845554", "0.66845554", "0.66845554", "0.66845554", "0.6621574", "0.66075516", "0.66075516", "0.65530634", "0.6552229", "0.6552229", "0.6552229", "0.65402293", "0.6...
0.5628653
96
Chain with another one of klass's named_scopes.
def chain_with(scope_name) self + klass.send(scope_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scopes *names\n self.scope_names ||= []\n\n names.each do |scope|\n self.scope_names << scope\n\n # hand chaining duties off to the ResourceProxy instance\n define_singleton_method scope do\n resource_proxy.append_scope(scope)\n end\n\n # ResourceProxy inst...
[ "0.62880945", "0.62569034", "0.6231957", "0.61421496", "0.60990936", "0.6068418", "0.606082", "0.60203743", "0.5983783", "0.59340775", "0.5843913", "0.5834608", "0.57688344", "0.560718", "0.5588773", "0.5517115", "0.55141205", "0.54924166", "0.5491937", "0.54753065", "0.54543...
0.73902106
0
Create a new Scope that is the combination of self and other, where other takes priority
def +(other_scope) self.class.new(klass, parameters.merge(other_scope.parameters)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inherit_scope(other)\n @scope = other.scope\n end", "def scope\n @scope ||= Scope.new(parent)\n end", "def scope\n @scope.dup\n end", "def newscope(parent, options = {})\n raise _('having multiple named scopes is not supported when scripting')\n end", "def apply_scopes(*)\n ...
[ "0.7560674", "0.66863286", "0.6504503", "0.6476411", "0.6380694", "0.6317037", "0.62521005", "0.6178332", "0.60455847", "0.5993693", "0.59464115", "0.5939075", "0.5919033", "0.58723295", "0.5846496", "0.5746002", "0.57339793", "0.5711369", "0.56971073", "0.56944644", "0.56920...
0.7458148
1
Remove all participants from the collection type and only add back in admins
def remove_all_participants Hyrax::CollectionTypeParticipant.where(hyrax_collection_type_id: id).all.find_each(&:destroy!) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_from_all_dil_collections\r\n self.collections.each do |collection|\r\n collection.members.remove_member_by_pid( self.pid )\r\n collection.save\r\n self.collections.delete(collection)\r\n end\r\n end", "def remove_from_collection(parentCollectionIDs)\n parentCollectionIDs.each ...
[ "0.65713054", "0.6464294", "0.63182724", "0.6244887", "0.62036663", "0.61435837", "0.60248536", "0.60248536", "0.59281874", "0.58952624", "0.5755043", "0.5730473", "0.5687973", "0.5687973", "0.5687444", "0.5677673", "0.55783665", "0.55783665", "0.55681825", "0.55658275", "0.5...
0.75309914
1
GET /emergency_contacts GET /emergency_contacts.json
def index @emergency_contacts = @center.emergency_contacts.all @emergency_contact = @center.emergency_contacts.new respond_to do |format| format.html # index.html.erb format.json { render json: @emergency_contacts } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n json_response(@contacts, user_id: @user.id, status: :ok)\n end", "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end", "def get_contacts(options = {})\n send_request(\"get\", contacts_url, body...
[ "0.71869874", "0.710475", "0.7029353", "0.7006708", "0.6962597", "0.692548", "0.6916064", "0.6889901", "0.6838649", "0.6821554", "0.67712927", "0.6756197", "0.66952246", "0.667467", "0.664404", "0.6627212", "0.6594267", "0.65733856", "0.65723616", "0.6526417", "0.65031433", ...
0.7200374
0
POST /emergency_contacts POST /emergency_contacts.json
def create @emergency_contact = @center.emergency_contacts.new(params[:emergency_contact]) respond_to do |format| if @emergency_contact.save format.html { redirect_to center_emergency_contacts_url, notice: 'Emergency contact was successfully created.' } format.json { render json: @emergency_contact, status: :created, location: center_emergency_contacts_url } format.js else format.html { render action: "index" } format.json { render json: @emergency_contact.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @applicant_emergency_contact = current_applicant.applicant_emergency_contacts.build(applicant_emergency_contact_params)\n\n respond_to do |format|\n if @applicant_emergency_contact.save\n format.html { redirect_to applicant_emergency_contacts_url, notice: 'Applicant emergency contact...
[ "0.7238898", "0.69134545", "0.67750245", "0.677401", "0.6728599", "0.6704094", "0.66930544", "0.66844046", "0.66192204", "0.65934294", "0.6546587", "0.65421885", "0.6525396", "0.6511407", "0.65057737", "0.6478198", "0.641267", "0.6406949", "0.63996226", "0.6348653", "0.630895...
0.72008085
1
PUT /emergency_contacts/1 PUT /emergency_contacts/1.json
def update @emergency_contact = @center.emergency_contacts.find(params[:id]) respond_to do |format| if @emergency_contact.update_attributes(params[:emergency_contact]) format.html { redirect_to center_emergency_contacts_url, notice: 'Emergency contact was successfully updated.' } format.json { head :no_content } else format.html { render action: "index" } format.json { render json: @emergency_contact.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @emergency_contact.update(emergency_contact_params)\n format.html { redirect_to @emergency_contact, notice: 'Emergency contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @emergency_contact }\n else\n f...
[ "0.69413257", "0.6739482", "0.6661685", "0.6651498", "0.6629754", "0.6544506", "0.65320355", "0.6517999", "0.6488193", "0.64694434", "0.64680797", "0.64465714", "0.63275117", "0.6323684", "0.6313558", "0.63087916", "0.6301961", "0.6275024", "0.61950135", "0.6186241", "0.61711...
0.72265565
0
DELETE /emergency_contacts/1 DELETE /emergency_contacts/1.json
def destroy @emergency_contact = @center.emergency_contacts.find(params[:id]) @emergency_contact.destroy respond_to do |format| format.html { redirect_to center_emergency_contacts_url } format.json { head :no_content } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @emergency_contact.destroy\n respond_to do |format|\n format.html { redirect_to emergency_contacts_url, notice: 'Emergency contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(contactname)\n\n end", "def destroy\n @contact.des...
[ "0.7421368", "0.73579836", "0.7348901", "0.72321564", "0.721836", "0.7125018", "0.710601", "0.70785946", "0.7065338", "0.7065338", "0.7065338", "0.7042987", "0.7018197", "0.70136285", "0.7007058", "0.7007058", "0.7007058", "0.7007058", "0.70043147", "0.6969277", "0.6959026", ...
0.7182751
5
Return a title on a perpage basis.
def title # Sets the browser title bar display base_title = "Grademypitch" if @title.nil? base_title else "#{base_title} | #{@title}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end", "def page_title\n page.title\n end", "def pagetitle(page)\n \"Page #{page}\"\nend", "def page_title(title)\n content_for_wrapper(:page_title, title)\n end", "def page_title\n end", "def titl...
[ "0.7777971", "0.77103335", "0.75592935", "0.75191945", "0.7482916", "0.73910475", "0.7365925", "0.72978526", "0.72698855", "0.72201085", "0.71792275", "0.7164163", "0.7158475", "0.71547365", "0.7139089", "0.7119529", "0.7119529", "0.7119529", "0.7119529", "0.7110865", "0.7106...
0.0
-1
Letters also wrap around. For example, if the target is target = 'z' and letters = ['a', 'b'], the answer is 'a'. Examples: Input: letters = ["c", "f", "j"] target = "a" Output: "c" Input: letters = ["c", "f", "j"] target = "c" Output: "f" Input: letters = ["c", "f", "j"] target = "d" Output: "f" Input: letters = ["c", "f", "j"] target = "g" Output: "j" Input: letters = ["c", "f", "j"] target = "j" Output: "c" Input: letters = ["c", "f", "j"] target = "k" Output: "c"
def next_greatest_letter(letters, target) letters.each do |letter| return letter if letter > target end letters[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spelling_penalty\n chars.inject_with_index(0) do |penalty, char, i| \n if i < @options[:target].size\n # add to penalty the differences between ascii values in the two strongs * the multiplier\n penalty + ((@options[:target][i] - char[0]).abs * @options[:spelling_multiplier])\n ...
[ "0.6263147", "0.59900063", "0.56929064", "0.54568946", "0.52123284", "0.5184635", "0.5175917", "0.51453555", "0.5139499", "0.5135679", "0.5120789", "0.5089753", "0.5039978", "0.50380373", "0.50269955", "0.5017165", "0.5009133", "0.49814713", "0.49745113", "0.49641395", "0.494...
0.55259824
3
Input: none Return: Array of class name strings
def assemble_race_names race_names = [] RACES.each_key do | key | if RACES[key][:subraces].empty? race_names << key else RACES[key][:subraces].each { |subrace| race_names << subrace } end end race_names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classes\n return [] unless classes = self[\"class\"]\n classes.strip.split(/\\s+/)\n end", "def class_names\n classes.map &:name\n end", "def class_names\n return if @class_names.empty?\n @class_names.uniq.sort\n end", "def class_list\n array = []\n ObjectSpace.e...
[ "0.84288144", "0.8351828", "0.7914066", "0.775523", "0.7728422", "0.75971234", "0.75971234", "0.7441282", "0.7420649", "0.7397904", "0.7305958", "0.7299291", "0.7175605", "0.71508366", "0.71216613", "0.70579606", "0.7051302", "0.7014196", "0.69802696", "0.69609004", "0.688794...
0.0
-1
Indent each line of a string by n spaces
def indent(n) indent = " " * n gsub '\n', "\n#{indent}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indent(string, n)\n tabs = \"\\t\" * n\n wrap = screen_width - (n * 8) - 1\n\n tabs + string.gsub(/(.{1,#{wrap}})(\\s+|\\Z)/, \"\\\\1\\n#{tabs}\").rstrip\n end", "def indent(str, count = 2)\n str = require_string! str\n pre = ' ' * count\n\n map_lines(str) { |line| \"#{pre}#{...
[ "0.8151938", "0.7972252", "0.78305465", "0.77427477", "0.77108395", "0.76289326", "0.7585391", "0.75265837", "0.75257385", "0.75050694", "0.74884945", "0.74743265", "0.7383328", "0.73805463", "0.73201305", "0.7262584", "0.7253317", "0.71463615", "0.712658", "0.7092507", "0.70...
0.780284
3
num The Integer that will be the starting point. Examples previous_number(101) => 100 Returns the number before the input.
def previous_number(num) return num - 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prev_num(num1)\n return num1 + 1\nend", "def previous_number(number)\n return number - 1\nend", "def previous_number(number)\n return number - 1\nend", "def previous_number(number)\n return number - 1 \nend", "def previous_number(number)\n return number-1\nend", "def previous_number(in...
[ "0.7594526", "0.73985696", "0.73985696", "0.73568785", "0.73310405", "0.7218397", "0.7161143", "0.68676937", "0.65727973", "0.65406317", "0.65239036", "0.6452188", "0.6416887", "0.63998336", "0.63734347", "0.63734347", "0.63734347", "0.63734347", "0.6274615", "0.62695825", "0...
0.77267605
3
Any variables that need to be changed should be done inside the customize method
def customize # If the PACKAGE_VERSION variable is passed from the command line, then set # @package_version equal to what was passed. Else, use the current version # of puppet if ENV['PACKAGE_VERSION'] @package_version = ENV['PACKAGE_VERSION'] else @package_version = '2.7.3' end # Puppet-specific Variables @title = "Puppet_Install" @reverse_domain = "com.puppetlabs" @package_major_version = @package_version.split('.')[0] @package_minor_version = @package_version.split('.')[1] + @package_version.split('.')[2] @puppet_file = "puppet-#{@package_version}" @puppet_url = "http://downloads.puppetlabs.com/puppet/" @puppet_tarfile = "#{@puppet_file}.tar.gz" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom; end", "def custom; end", "def use_default_customizations!\n DEFAULT_CUSTOMIZATIONS.each_pair do |field, default_value|\n send(\"#{field}=\".to_sym, default_value)\n end\n DEFAULT_COLORS.each_key do |field|\n send(\"color_#{field}=\".to_sym, nil)\n end\n save\n end", "def...
[ "0.622962", "0.622962", "0.6183651", "0.6172321", "0.6101626", "0.6065511", "0.60627764", "0.60318035", "0.59992373", "0.5955803", "0.59350264", "0.58234197", "0.58234197", "0.5808141", "0.57784057", "0.5750394", "0.57392853", "0.5703728", "0.56711465", "0.5664207", "0.560243...
0.56186396
20
The pack method is for adding files to the package's payload. Note that
def pack # Set the variable here so it can grab the contents of @working_tree (which # is set in the make_directory_tree method). @work = "#{@working_tree['WORK_D']}" # Download and unpack the Puppet Source safe_system("curl #{@puppet_url}/#{@puppet_tarfile} -o #{@puppet_tarfile}") safe_system("#{TAR} xzf #{@puppet_tarfile}") # Make all necessary directories FileUtils.mkdir_p("#{@work}/private/etc/puppet/") FileUtils.mkdir_p("#{@work}/usr/bin") FileUtils.mkdir_p("#{@work}/usr/sbin") FileUtils.mkdir_p("#{@work}/usr/share/doc/puppet") FileUtils.mkdir_p("#{@work}/usr/share/man/man5") FileUtils.mkdir_p("#{@work}/usr/share/man/man8") FileUtils.mkdir_p("#{@work}/Library/Ruby/Site/1.8/puppet") # Install necessary files safe_system("#{INSTALL} -o root -g wheel -m 644 ./#{@puppet_file}/conf/auth.conf #{@work}/private/etc/puppet/auth.conf") safe_system("#{DITTO} ./#{@puppet_file}/bin/ #{@work}/usr/bin") safe_system("#{DITTO} ./#{@puppet_file}/sbin/ #{@work}/usr/sbin") safe_system("#{INSTALL} -o root -g wheel -m 644 ./#{@puppet_file}/man/man5/puppet.conf.5 #{@work}/usr/share/man/man5/") safe_system("#{DITTO} ./#{@puppet_file}/man/man8/ #{@work}/usr/share/man/man8") safe_system("#{DITTO} ./#{@puppet_file}/lib/ #{@work}/Library/Ruby/Site/1.8/") # Setup a preflight script and replace variables in the files with # the correct paths. safe_system("#{INSTALL} -o root -g wheel -m 644 ./#{@puppet_file}/conf/osx/preflight #{@working_tree['SCRIPT_D']}") safe_system("sed -i '' \"s\#{SITELIBDIR}\#/usr/lib/ruby/site_ruby/1.8\#g\" #{@working_tree['SCRIPT_D']}/preflight") safe_system("sed -i '' \"s\#{BINDIR}\#/usr/bin\#g\" #{@working_tree['SCRIPT_D']}/preflight") # Install documentation (matching for files with capital letters) Dir.foreach("./#{@puppet_file}") do |file| safe_system("#{INSTALL} -o root -g wheel -m 644 ./#{@puppet_file}/#{file} #{@work}/usr/share/doc/puppet") if file =~ /^[A-Z][A-Z]/ end # Set Permissions FileUtils.chmod_R(0755, "#{@work}/usr/bin") FileUtils.chown_R('root', 'wheel', "#{@work}/usr/bin") FileUtils.chmod_R(0755, "#{@work}/usr/sbin") FileUtils.chown_R('root', 'wheel', "#{@work}/usr/sbin") FileUtils.chmod_R(0755, "#{@work}/usr/share/man/man8") FileUtils.chown_R('root', 'wheel', "#{@work}/usr/share/man/man8") FileUtils.chmod_R(0644, "#{@work}/Library/Ruby/Site/1.8/") FileUtils.chown_R('root', 'wheel', "#{@work}/Library/Ruby/Site/1.8/") Find.find("#{@work}/Library/Ruby/Site/1.8/") do |dir| FileUtils.chmod(0755, dir) if File.directory?(dir) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pack\n end", "def pack_and_store(path, payload)\n repo = Git.open(path)\n repo.checkout(\n payload.get(:data, :code_fetcher, :info, :commit_sha)\n )\n asset_key = [\n payload.get(:data, :code_fetcher, :info, :owner),\n payload.get(:data, :code_fetcher...
[ "0.6717095", "0.6685833", "0.63863534", "0.62842476", "0.6281442", "0.6254959", "0.61852974", "0.6153507", "0.6123465", "0.6112158", "0.60896695", "0.6053871", "0.5985677", "0.5981764", "0.59525067", "0.59082395", "0.5865977", "0.585019", "0.5844643", "0.5834223", "0.58309823...
0.5878857
16
GET /generations/1 GET /generations/1.json
def show @generation = Generation.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end", "def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format....
[ "0.72182393", "0.69145536", "0.68541217", "0.67455214", "0.66895014", "0.66623473", "0.6657807", "0.6629121", "0.65609545", "0.6556157", "0.65105367", "0.6473188", "0.6347972", "0.63292503", "0.6297179", "0.6195624", "0.61636966", "0.61082566", "0.6102985", "0.607009", "0.606...
0.61764705
16
POST /generations POST /generations.json
def create @generation = Generation.new(generation_params) respond_to do |format| if @generation.save format.html { redirect_to ['admin', @generation], notice: 'Generación Creada' } format.json { render :show, status: :created, location: @generation } else format.html { render :new } format.json { render json: @generation.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to [:admin, @generation], notice: 'Generation was successfully created.' }\n format.json { render json: @generation, status: :created, location: @generatio...
[ "0.685122", "0.68067175", "0.67470443", "0.6706753", "0.65785855", "0.64659756", "0.6319495", "0.6313439", "0.62647986", "0.62048316", "0.6186005", "0.6130324", "0.61227375", "0.6090344", "0.60627484", "0.5976743", "0.59718966", "0.5924296", "0.5880258", "0.58572423", "0.5835...
0.6827705
1
PATCH/PUT /generations/1 PATCH/PUT /generations/1.json
def update @generation=Generation.find(params[:id]) if @generation.update generation_params redirect_to ['admin', @generation], notice: "Generación Actualizada" else render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json...
[ "0.6585978", "0.6511767", "0.6459439", "0.6459439", "0.6335657", "0.6257809", "0.6228514", "0.61052334", "0.6002895", "0.59362787", "0.5845462", "0.5836802", "0.57950205", "0.57382905", "0.56891745", "0.56534123", "0.56159323", "0.5595707", "0.55128634", "0.54778814", "0.5476...
0.54898703
19
DELETE /generations/1 DELETE /generations/1.json
def destroy @generation = Generation.find(params[:id]) @generation.destroy redirect_to admin_generations_path, notice: "Generación Eliminada" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @generation = Generation.find(params[:id])\n @generation.destroy\n\n respond_to do |form...
[ "0.76810807", "0.7625209", "0.7541312", "0.7512504", "0.73264915", "0.73050326", "0.73050326", "0.7105164", "0.7092853", "0.7059248", "0.6804798", "0.6790985", "0.6757595", "0.67345625", "0.6710581", "0.66901994", "0.664723", "0.6640292", "0.6623032", "0.6612428", "0.6608636"...
0.71145606
7
GET /pop_elements GET /pop_elements.json
def index @pop_elements = PopElement.all @orders = Order.user_order(current_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop\n raise 'No such element' if @elements.length == 0\n @elements.slice!(-1)\n end", "def destroy\n @pop_element.destroy\n respond_to do |format|\n format.html { redirect_to pop_elements_url, notice: 'Pop element was successfully destroyed.' }\n format.json { head :no_conten...
[ "0.5957871", "0.59574497", "0.58689344", "0.57009786", "0.56459033", "0.5609212", "0.5464483", "0.5464483", "0.5464483", "0.5452894", "0.5425035", "0.54077536", "0.5375061", "0.5355811", "0.53151405", "0.53111637", "0.5288002", "0.5250561", "0.52495956", "0.52224517", "0.5219...
0.6736786
0
GET /pop_elements/1 GET /pop_elements/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pop_elements = PopElement.all\n @orders = Order.user_order(current_user)\n end", "def set_pop_element\n @pop_element = PopElement.find(params[:id])\n end", "def destroy\n @pop_element.destroy\n respond_to do |format|\n format.html { redirect_to pop_elements_url, notice: '...
[ "0.6431328", "0.63912076", "0.61080146", "0.5964796", "0.57741797", "0.56562006", "0.53761244", "0.5345411", "0.532197", "0.5264794", "0.52607346", "0.5248459", "0.5225622", "0.52188843", "0.5149898", "0.51099485", "0.51062495", "0.50872844", "0.50872016", "0.50702053", "0.50...
0.0
-1
POST /pop_elements POST /pop_elements.json
def create @pop_element = PopElement.new(pop_element_params) respond_to do |format| if @pop_element.save format.html { redirect_to @pop_element, notice: 'Pop element was successfully created.' } format.json { render :show, status: :created, location: @pop_element } else format.html { render :new } format.json { render json: @pop_element.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pop_element\n @pop_element = PopElement.find(params[:id])\n end", "def destroy\n @pop_element.destroy\n respond_to do |format|\n format.html { redirect_to pop_elements_url, notice: 'Pop element was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "...
[ "0.5941232", "0.59227943", "0.5871767", "0.58611125", "0.5806829", "0.54562044", "0.54066193", "0.5341756", "0.5319789", "0.52240765", "0.5222521", "0.518781", "0.51378864", "0.5075515", "0.507208", "0.507208", "0.507208", "0.507208", "0.507208", "0.5071094", "0.5071094", "...
0.62175685
0
PATCH/PUT /pop_elements/1 PATCH/PUT /pop_elements/1.json
def update respond_to do |format| if @pop_element.update(pop_element_params) format.html { redirect_to @pop_element, notice: 'Pop element was successfully updated.' } format.json { render :show, status: :ok, location: @pop_element } else format.html { render :edit } format.json { render json: @pop_element.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pop_element\n @pop_element = PopElement.find(params[:id])\n end", "def update\n @element.update_attributes(element_params)\n respond_with @element\n end", "def patch!\n request! :patch\n end", "def update(element)\n elementHash = element.to_hash\n parameter = { basic_auth...
[ "0.6089538", "0.59587145", "0.58091044", "0.57889915", "0.57531", "0.5728098", "0.57038134", "0.56774074", "0.5652095", "0.5599764", "0.5574666", "0.556536", "0.555922", "0.55307627", "0.5495266", "0.5492134", "0.5484089", "0.54624957", "0.5443202", "0.5440393", "0.5433492", ...
0.7205981
0
DELETE /pop_elements/1 DELETE /pop_elements/1.json
def destroy @pop_element.destroy respond_to do |format| format.html { redirect_to pop_elements_url, notice: 'Pop element was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end", "def destroy\n @element = Element.find(params[:id])\n @element.destroy\n\n respond_to do |format|\n format.html { redirect_to elements_url }\n format.jso...
[ "0.69420797", "0.6347632", "0.6322426", "0.62980604", "0.6294488", "0.6269577", "0.61933786", "0.6171343", "0.6145988", "0.6143168", "0.6142986", "0.6117265", "0.61075187", "0.6084483", "0.6084483", "0.60462195", "0.60415006", "0.6030267", "0.6029937", "0.60239446", "0.602115...
0.7247742
0
Use callbacks to share common setup or constraints between actions.
def set_pop_element @pop_element = PopElement.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 pop_element_params params.require(:pop_element).permit(:name, :price, :master_type, :sub_type, :availability) 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
List notification groups List all notification groups from the current user
def notification_groups_list(opts = {}) data, _status_code, _headers = notification_groups_list_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_members\n Notification.where(group_owner_id: id)\n end", "def index\n @groups = []\n for member in current_user.members\n @groups << member.group\n end\n end", "def list_groups\n if @user.permission_level.value == PermissionLevel.order(\"value DESC\").first.value\n ...
[ "0.730336", "0.70379317", "0.6966023", "0.6914727", "0.69081515", "0.68440163", "0.6807493", "0.6733953", "0.66246724", "0.6614498", "0.66074836", "0.6607402", "0.65997714", "0.6574667", "0.65604717", "0.65604717", "0.65504134", "0.65265447", "0.6526043", "0.6525542", "0.6518...
0.73533
0
List notification groups List all notification groups from the current user
def notification_groups_list_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: NotificationGroupsApi.notification_groups_list ...' end # resource path local_var_path = '/notification_groups' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Array<Object>' # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: NotificationGroupsApi#notification_groups_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notification_groups_list(opts = {})\n data, _status_code, _headers = notification_groups_list_with_http_info(opts)\n data\n end", "def group_members\n Notification.where(group_owner_id: id)\n end", "def index\n @groups = []\n for member in current_user.members\n @gro...
[ "0.73533", "0.730336", "0.70379317", "0.6966023", "0.6914727", "0.69081515", "0.68440163", "0.6807493", "0.6733953", "0.66246724", "0.6614498", "0.66074836", "0.6607402", "0.65997714", "0.6574667", "0.65604717", "0.65604717", "0.65504134", "0.65265447", "0.6526043", "0.652554...
0.58553296
89
Mark all notification groups as read Mark all notification groups of the current user as read
def notification_groups_mark_all_as_read(opts = {}) data, _status_code, _headers = notification_groups_mark_all_as_read_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_notifications_as_read!(user)\n self.notifications.where(read: false, user_id: user.id).update_all(read: true)\n end", "def mark_notification_as_read!\n notification = User.find(@userid).notifications\n @received_msg.each do |notify|\n notification.update(notify['id'], :checked => true);\n...
[ "0.7631108", "0.75232005", "0.7271338", "0.7209958", "0.71136564", "0.7043174", "0.69399095", "0.68428254", "0.67394173", "0.67244416", "0.6717934", "0.6698578", "0.6649359", "0.66276115", "0.659942", "0.6558207", "0.6492215", "0.64887977", "0.6462056", "0.64539206", "0.64539...
0.7305678
2
Mark all notification groups as read Mark all notification groups of the current user as read
def notification_groups_mark_all_as_read_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: NotificationGroupsApi.notification_groups_mark_all_as_read ...' end # resource path local_var_path = '/notification_groups/mark_all_as_read' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Array<Object>' # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: NotificationGroupsApi#notification_groups_mark_all_as_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_notifications_as_read!(user)\n self.notifications.where(read: false, user_id: user.id).update_all(read: true)\n end", "def mark_notification_as_read!\n notification = User.find(@userid).notifications\n @received_msg.each do |notify|\n notification.update(notify['id'], :checked => true);\n...
[ "0.7631108", "0.75232005", "0.7305678", "0.7271338", "0.7209958", "0.71136564", "0.7043174", "0.69399095", "0.68428254", "0.67394173", "0.67244416", "0.6717934", "0.6698578", "0.6649359", "0.66276115", "0.659942", "0.6558207", "0.6492215", "0.64887977", "0.6462056", "0.645392...
0.5988537
45
Mark a notification group as read Mark a notifications group of the current user as read
def notification_groups_mark_as_read(id, opts = {}) data, _status_code, _headers = notification_groups_mark_as_read_with_http_info(id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_notifications_as_read!(user)\n self.notifications.where(read: false, user_id: user.id).update_all(read: true)\n end", "def mark_as_read\n DeterLab.mark_notifications(current_user_id, [ params[:id] ], [ { isSet: true, tag: Notification::READ } ])\n render text: 'ok'\n end", "def mark_notific...
[ "0.7862807", "0.785672", "0.77921647", "0.7673758", "0.71944684", "0.7186961", "0.71617806", "0.7138312", "0.7112343", "0.70780116", "0.70743436", "0.70266604", "0.70162874", "0.69602764", "0.695181", "0.6930366", "0.6929326", "0.69209427", "0.69209427", "0.6866497", "0.68664...
0.67752004
23
Mark a notification group as read Mark a notifications group of the current user as read
def notification_groups_mark_as_read_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: NotificationGroupsApi.notification_groups_mark_as_read ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling NotificationGroupsApi.notification_groups_mark_as_read" end # resource path local_var_path = '/notification_groups/{id}/mark_as_read'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'NotificationGroupDetail' # auth_names auth_names = opts[:auth_names] || ['Basic', 'Token'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: NotificationGroupsApi#notification_groups_mark_as_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end response = ::Phrase::Response.new(data, headers) return response, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_notifications_as_read!(user)\n self.notifications.where(read: false, user_id: user.id).update_all(read: true)\n end", "def mark_as_read\n DeterLab.mark_notifications(current_user_id, [ params[:id] ], [ { isSet: true, tag: Notification::READ } ])\n render text: 'ok'\n end", "def mark_notific...
[ "0.7862807", "0.785672", "0.77921647", "0.7673758", "0.71944684", "0.7186961", "0.71617806", "0.7138312", "0.7112343", "0.70780116", "0.70743436", "0.70266604", "0.70162874", "0.69602764", "0.695181", "0.6930366", "0.6929326", "0.69209427", "0.69209427", "0.6866497", "0.68664...
0.5999688
56
mail the user after signing up
def after_request_activation(user, transition) UserMailer.deliver_activation_request(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signed_up(user)\n @user = user\n\n mail to: user.email\n end", "def signed_up(user)\n @user = user\n mail to: @user.email\n end", "def signed_up(user)\n @user = user\n \n mail to: @user.email, subject: 'Sign Up Confirmation.'\n end", "def signup(new_user)\n mail(to: new_user.em...
[ "0.8328465", "0.8240757", "0.8168592", "0.8064086", "0.80555254", "0.8003733", "0.7993122", "0.7984771", "0.79757863", "0.79600984", "0.7957878", "0.79577404", "0.79267603", "0.78966814", "0.7887288", "0.7880466", "0.78695846", "0.78671706", "0.78385407", "0.7788349", "0.7788...
0.0
-1
mail the user to confirm activation
def after_activate(user, transition) UserMailer.deliver_activation_confirmation(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activation_confirmation(user)\n @root_url = root_url\n mail(:subject => setup_subject(I18n.t('activation_complete')),\n :to => user.email)\n end", "def activation_needed_email(user)\n @user = user\n @url = users_activate_path(id: user.activation_token)\n mail(to: user.email, subject:...
[ "0.8492212", "0.82157195", "0.8210168", "0.8205198", "0.8194635", "0.815073", "0.8123249", "0.8118494", "0.81072223", "0.8092254", "0.8091004", "0.8085906", "0.80744064", "0.80635005", "0.8042117", "0.8041977", "0.80369604", "0.8033361", "0.80249697", "0.801234", "0.801234", ...
0.7425051
92
mail the user to notify they have had their account suspended
def after_suspend(user, transition) UserMailer.deliver_suspension_notice(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atest_ID_25861_suspended_user_notification()\n # Need suspended account\n end", "def atest_ID_25861_suspended_user_notification()\n # Need suspended account\n end", "def trial_ending(user)\n mail to: user.email, subject: \"Only 72 Hours Left of Review Alerts!\"\n end", "def suspended_mail(r...
[ "0.7561353", "0.7561353", "0.70071226", "0.70059025", "0.6854304", "0.68167055", "0.6814337", "0.6727689", "0.66945815", "0.6685348", "0.66592884", "0.66494024", "0.66096187", "0.6603581", "0.658231", "0.6521331", "0.6508501", "0.650128", "0.64746267", "0.6450896", "0.6450631...
0.69546735
4
default location in ./lib
def ft FancifyTable.new([[1,2],[3,4]]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lib_path; end", "def lib_path; end", "def lib_path; end", "def lib\n File.join root, 'lib'\n end", "def default_loadpath\n ['lib']\n end", "def lib\n File.join(@root, 'lib')\n end", "def lib\n File.join root, 'lib'\n end", "def lib\n File.join root, 'lib'\n end", "def lib...
[ "0.78100336", "0.78100336", "0.78100336", "0.7459476", "0.7364248", "0.73402137", "0.73262787", "0.73262787", "0.71357423", "0.71357423", "0.71357423", "0.70296407", "0.7027694", "0.7027694", "0.7027694", "0.7027694", "0.7027694", "0.7027694", "0.7027694", "0.70157915", "0.69...
0.0
-1
GET /users GET /users.json
def index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n para...
[ "0.82109934", "0.7873764", "0.7860689", "0.78108346", "0.78067017", "0.7678852", "0.76586664", "0.76318866", "0.7582366", "0.75291824", "0.7487637", "0.74485743", "0.7439024", "0.7437192", "0.7427442", "0.73978853", "0.73978853", "0.73978853", "0.73978853", "0.7377353", "0.73...
0.0
-1
get the user's name. TODO : can this be fixed in druby so i ca access Username directly? def getName
def name=(user) @name=user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n userName\n end", "def get_username\n @user_name ||= self.user.username\n end", "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "def user_name\n return User.f...
[ "0.8510286", "0.8253431", "0.81872946", "0.81639075", "0.81639075", "0.801866", "0.79995126", "0.7944848", "0.7914847", "0.79084367", "0.7885268", "0.7870681", "0.78506553", "0.78332055", "0.78332055", "0.78220844", "0.78083766", "0.78002864", "0.77891535", "0.77659565", "0.7...
0.0
-1
Enhance entry content through additional readability parsing
def enhance require 'open-uri' source = open(self.url).read return Readability::Document.new(source).content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_entry(entry_name, content); end", "def parse(entry, content_id)\n return '' unless entry.respond_to?(:event)\n # clean the html\n html = white_list(entry.event)\n \n # parse all standard lj tags first\n html = parse_lj_embed_tags(html,entry)\n html = parse_lj_user_tags...
[ "0.6827422", "0.5886299", "0.58785635", "0.5751225", "0.5726346", "0.5726346", "0.57228243", "0.561852", "0.5605897", "0.5574541", "0.5544793", "0.5529843", "0.55210596", "0.54944944", "0.5487143", "0.54641396", "0.5460121", "0.5448047", "0.5438285", "0.5436883", "0.543416", ...
0.0
-1
Distribute entry for all users subscribed to entries' feed
def distribute_to_feed_postboxes self.feed.postboxes.each do |postbox| self.distribute_to(postbox) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associate_feed_entries\n feed_users = FeedUser.find_all_by_feed_id(self.feed_id)\n entry_list = []\n feed_users.each do |feed_user|\n feu = FeedEntryUser.new\n feu.feed_id = self.feed_id\n feu.feed_entry_id = self.id\n feu.user_id = feed_user.user_id\n entry_list.push(feu)\n ...
[ "0.6506629", "0.6101022", "0.6036367", "0.5999645", "0.59847975", "0.5864682", "0.58420336", "0.5826251", "0.58260345", "0.5805036", "0.57635134", "0.5740913", "0.57036173", "0.569269", "0.56819063", "0.5669513", "0.5654116", "0.5613711", "0.5607827", "0.5589152", "0.5563618"...
0.5830821
7
Distribute entry to the pending leaflet for specified user
def distribute_to(postbox) leaflet = postbox.find_or_create_active_leaflet leaflet.entries << self unless leaflet.entries.exists? self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itemized_stash_data(users)\n user = users.first\n # enable stash for the user?\n end", "def add_stash_to_all_users\n add_stash_to_all_users_link.click\n end", "def raffle_entry user\n @user = user\n\n mail to: \"nrgracia@stanford.edu\"\n end", "def update_user(user)\n @...
[ "0.54341406", "0.539824", "0.5181867", "0.51694775", "0.5134313", "0.51079077", "0.5049179", "0.4929479", "0.49120942", "0.49120942", "0.48985064", "0.48944438", "0.48727462", "0.48544717", "0.48423412", "0.48423412", "0.48398894", "0.48283106", "0.47862995", "0.47750166", "0...
0.60076034
0
return true or false
def test_condition(i) case self.rc_query when (:contains || :is) #i =~ #self.rc_regex when :does_not_contain #i =~ #self.rc_regex when :is_greater_than i > self.rc_integer_value when :is_less_than i < self.rc_integer_value when :equals i == self.rc_integer_value else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def success?() end", "def success?(*) end", "def result?\n false\n end", "def check ; true ; end", "def result?\n true\n end", "def success?\n return true\n end", "def success?\n end", "def do_pigs_fly?\n return true,false\nend", "def success?()\n result !...
[ "0.76842064", "0.7317909", "0.72932243", "0.7269014", "0.7193875", "0.7127188", "0.7072812", "0.7021545", "0.6982793", "0.6935535", "0.6935535", "0.6920994", "0.6912691", "0.6871823", "0.6865664", "0.6835404", "0.6820766", "0.68019915", "0.6725268", "0.66672367", "0.6633488",...
0.0
-1
time samtools view ./0.bam | ./plot_dist_mapq.rb for i in `seq 0 8`; do samtools view ./$i.bam | ./plot_dist_mapq.rb $i 2>/dev/null & done ; wait & /stornext/snfs1/nextgen/software/jdk1.6.0_01/bin/java jar Xmx8g /stornext/snfs1/nextgen/software/picardtools/current/MergeSamFiles.jar INPUT=1.bam INPUT=2.bam TMP_DIR=/space1/tmp/ OUTPUT=./out.bam VALIDATION_STRINGENCY=STRICT
def per(x,t) p = (x * 100)/t "#{p}%" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildSampeCommand(read1File, read2File, read1Seq, read2Seq)\n puts \"BWA command\"\n puts @bwaPath\n puts @reference\n puts read1File + \" \" + read2File\n puts read1Seq + \" \" + read2Seq\n puts @samFileName\n cmd = \"time \" + @bwaPath + \" sampe -P \" + \n \" -r \" + buildRGStr...
[ "0.6300588", "0.6162396", "0.60683596", "0.5817398", "0.5784051", "0.57587767", "0.5755168", "0.5717495", "0.5697194", "0.5686249", "0.5679784", "0.56323355", "0.5626766", "0.55453444", "0.55391115", "0.5514224", "0.54895353", "0.54724365", "0.54600847", "0.54364926", "0.5399...
0.0
-1
runs sql commands within a file. Useful for running external scripts such as importing data
def run_sql_file(file, &block) sql = clean_sql(File.read(file)) split_sql_commands(sql).map do |cmd| run_cmd(cmd).tap do |result| block.call(cmd, result) if block end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_sql_file(path, connection = ApplicationRecord.connection)\n connection.execute(IO.read(path))\nend", "def query(sql, file)\n return if sql.nil? || file.nil?\n sql.strip!\n get_copy_data(sql.chomp(';'), file)\n end", "def run_sql_script(path, adapter = dss, ctx = {})\n sql = Er...
[ "0.7691078", "0.705187", "0.7034006", "0.6773791", "0.6603297", "0.65852493", "0.6580585", "0.657862", "0.64328474", "0.6422488", "0.6384859", "0.632344", "0.62999606", "0.62642056", "0.62631977", "0.62557673", "0.62017816", "0.6195048", "0.61868215", "0.61494285", "0.6108902...
0.78862566
0
the main method used when running user's code
def run_sql(limit: 100, cmds: $sql_commands, print: true, label: 'SELECT Results', collapsed: false, &block) Display.status("Running sql commands...") cmds = [cmds] if cmds.is_a? String results = cmds.map do |cmd| dataset = run_cmd(cmd) || [] if dataset.count > 0 lbl = label lbl += " (Top #{limit} of #{dataset.count})" if dataset.count > limit lbl = "-" + lbl if collapsed block.call(dataset, lbl) if block Display.table(dataset.to_a.take(limit), label: lbl, allow_preview: true) if print end dataset end results.select! {|r| r.count > 0 } if results.length > 1 $sql_multi = true $sql_results = results else $sql_multi = false $sql_results = results.first || [] end rescue Sequel::DatabaseError => ex msg = ex.message.gsub("SQLite3::SQLException: ", ""); puts Display.print("ERROR", "There was an error with the SQL query:\n\n#{msg.strip}") [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main; end", "def main\n end", "def main\n\n end", "def run_main\n end", "def main\n\nend", "def program; end", "def main(argv)\n # override this; no default action in main\n end", "def main\n puts \"computor\"\nend", "def execute\n setup\n begin\n data = main\n ...
[ "0.8578571", "0.8496346", "0.8463617", "0.8413922", "0.8062536", "0.79373", "0.7746156", "0.76237535", "0.758176", "0.74220675", "0.7372789", "0.73050517", "0.723203", "0.719297", "0.7119105", "0.7119105", "0.7119105", "0.7119105", "0.7119105", "0.7119105", "0.7119105", "0....
0.0
-1
useful helper for finding a specific record and wrapping it in a Hashie::Mash
def find_record(table, id) result = DB[table].where(id: id).first result ? Hashie::Mash.new(result) : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find hash\n field, value = hash.first\n if index(field).unique\n if id = redis.get(colon(name, field, value))\n new id\n end\n else\n raise \"no unique index on #{field}\"\n end\n end", "def find_record(item, no_raise: false, meth: nil, ...
[ "0.6404742", "0.6362594", "0.6355808", "0.6352963", "0.63056916", "0.6195487", "0.6142753", "0.6138917", "0.6133673", "0.6085911", "0.60740435", "0.6068127", "0.6068127", "0.60568583", "0.6047444", "0.6046035", "0.6030505", "0.602891", "0.5956645", "0.59502757", "0.5940312", ...
0.71577936
0
helper method for returning the last queried dataset
def last_results $sql_multi ? $sql_results.last : $sql_results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_data\n get_current['data']\n end", "def last\n result ? all.last : limit(1).descending.all.last\n end", "def get_last\r\n return nil unless @head\r\n cursor = @head\r\n while cursor.next\r\n cursor = cursor.next\r\n end\r\n return cursor.data\r\n en...
[ "0.7100028", "0.70508283", "0.7015582", "0.69888574", "0.6978995", "0.6947397", "0.69471025", "0.68313754", "0.67654467", "0.6763334", "0.6763334", "0.6760208", "0.6760208", "0.6760208", "0.6760208", "0.67437077", "0.67138016", "0.67138016", "0.66860956", "0.6643272", "0.6641...
0.70065767
3
loops through each sql result and returns the row as a Hashie::Mash. If multiple results were returned, the last result set will be used
def each_result(results = last_results, &block) results.each do |result| block.call(Hashie::Mash.new(result)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_rows(sql)\n execute(sql) do |r|\n i = -1\n cps = db.conversion_procs\n cols = r.fetch_fields.map do |f| \n # Pretend tinyint is another integer type if its length is not 1, to\n # avoid casting to boolean if convert_tinyint_to_bool is set.\n ...
[ "0.72692496", "0.7105443", "0.7092875", "0.7083107", "0.7067302", "0.6878713", "0.6834572", "0.68228084", "0.68021697", "0.6779759", "0.6705803", "0.6664653", "0.6627259", "0.66172636", "0.65640014", "0.6547251", "0.6530729", "0.6467955", "0.64433676", "0.6437422", "0.6425402...
0.597673
35
returns the unique column values contained within the result set
def pluck_unique(column_name, results = last_results) results.map {|r| r[column_name]}.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values_distinct(column)\n values(column).uniq\n end", "def column_values attribute\n self.map{|row| row[attribute]}.to_a.uniq\n end", "def distinct\n result = empty_dup\n uniq_rows = rows.uniq\n uniq_rows.each do |row|\n result << row\n end\n result\n ...
[ "0.74648225", "0.7228825", "0.7008775", "0.6572763", "0.65444523", "0.6499435", "0.63154155", "0.62317437", "0.60778254", "0.60629845", "0.60582674", "0.60230774", "0.601775", "0.59118074", "0.58979434", "0.5893905", "0.5879149", "0.58765554", "0.58665615", "0.5855902", "0.58...
0.71440125
2
//////////////////////////////////////////////////////////////////////////// // Class helpers & accessors.
def uid (@in['uid_hi'] << 16) | @in['uid_lo'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def class; end", "def class; end", "def instance; end", "def instance; end", "def instance; end", "def initialize\n\n end", "def initialize\n\n end", "def implementation; end", "def implementation; end", "def getters; end", "def class() end", "def class_variables; end"...
[ "0.7919786", "0.6944393", "0.6944393", "0.6791091", "0.6791091", "0.6791091", "0.671222", "0.671222", "0.66667444", "0.66667444", "0.6635319", "0.66351116", "0.66179955", "0.6601462", "0.6601462", "0.66014427", "0.66014427", "0.66014427", "0.66014427", "0.66014427", "0.660144...
0.0
-1
//////////////////////////////////////////////////////////////////////////// // Utility functions.
def fileModeToFileType @@FM2FT[@mode & MSK_FILE_MODE] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def terpene; end", "def probers; end", "def berlioz; end", "def user_os_complex\r\n end", "def ibu; end", "def file_utils; end", "def stderrs; end", "def schubert; end", "def tiny; end", "def ext; end", "def ext; end", "def anchored; end", "def specie; end", "def sp...
[ "0.599519", "0.5604515", "0.55783224", "0.5510952", "0.54838866", "0.5455098", "0.5382202", "0.53464663", "0.53452194", "0.5324838", "0.5316659", "0.5316659", "0.5278308", "0.525551", "0.525551", "0.525551", "0.525551", "0.5178268", "0.5120912", "0.5119151", "0.5103225", "0...
0.0
-1
Adds the file with the given filename to the working copy.
def add(filename) not_implemented('add') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_file(filename)\n dir = File.dirname(filename).gsub(\"#{@dest}\",\".\")\n fn = File.basename(filename)\n folder = @folders[dir] || @folders[dir]=[]\n folder << fn\n end", "def add_file(filename)\n dir = File.dirname(filename).gsub(\"#{@dest}\",\".\")\n fn = File.basename(f...
[ "0.7280785", "0.7280785", "0.67722666", "0.6755351", "0.6636438", "0.65272945", "0.64990014", "0.6490678", "0.64827275", "0.64653426", "0.64012533", "0.6349266", "0.63392943", "0.6336141", "0.6332972", "0.6309191", "0.63026386", "0.62867916", "0.6258293", "0.6233408", "0.6221...
0.6749832
4
Removes the file with the given filename from the working copy. When this method is executed, the file should no longer be present on the disk.
def remove(filename) not_implemented('remove') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_file\n FileUtils.rm(full_filename) if File.exists?(full_filename)\n end", "def remove(filename); end", "def remove_file(name)\n @files.delete_at(name) if @files[name]\n end", "def remove(filename)\n send_request(FXP_REMOVE, :string, filename)\n end", "def r...
[ "0.74631965", "0.72423965", "0.7238968", "0.71797854", "0.7156031", "0.70848185", "0.7041913", "0.6966986", "0.6947973", "0.69134533", "0.6902328", "0.6859245", "0.6859245", "0.68490314", "0.6793277", "0.67878145", "0.6775145", "0.67609227", "0.6740448", "0.671225", "0.670988...
0.693963
9
Moves the file with the given filename to a new location. When this method is executed, the original file should no longer be present on the disk.
def move(src, dst) not_implemented('move') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move\n display_change\n File.move(@real_path, new_path, false)\n end", "def execute()\r\n FileUtils.mv(@OldFilePath, @NewFilePath)\r\n end", "def rename_file\n return unless filename_changed?\n\n old_full_filename = [base_path, filename_was].join(\"/\")\n\n ...
[ "0.70535296", "0.6991466", "0.69445086", "0.68627465", "0.6700984", "0.66592026", "0.66377234", "0.6622271", "0.6591527", "0.6551897", "0.64417833", "0.63584733", "0.6329053", "0.63048226", "0.6259425", "0.62380344", "0.6234982", "0.62339795", "0.6217973", "0.6132246", "0.612...
0.0
-1
GET /hostnesses GET /hostnesses.xml
def index @hostnesses = Hostness.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @hostnesses } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @hostness = Hostness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hostness }\n end\n end", "def index\n @hosts = Host.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { r...
[ "0.68635285", "0.65740025", "0.6359163", "0.62932813", "0.62361896", "0.6197955", "0.6121101", "0.60841703", "0.6070646", "0.5979585", "0.5961438", "0.5909579", "0.58809775", "0.5790083", "0.57673913", "0.5752485", "0.57215196", "0.5703022", "0.5699883", "0.5694871", "0.56719...
0.72850645
0
GET /hostnesses/1 GET /hostnesses/1.xml
def show @hostness = Hostness.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @hostness } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @hostnesses = Hostness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hostnesses }\n end\n end", "def index\n @hosts = Host.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :x...
[ "0.69564337", "0.6650198", "0.66445667", "0.65678656", "0.63863635", "0.63815725", "0.6205011", "0.61212337", "0.6086184", "0.6044151", "0.59948623", "0.59616804", "0.5838251", "0.58010316", "0.57935536", "0.57739466", "0.57423043", "0.56908023", "0.5686185", "0.56332624", "0...
0.6760495
1
GET /hostnesses/new GET /hostnesses/new.xml
def new @hostness = Hostness.new form_vars respond_to do |format| format.html # new.html.erb format.xml { render :xml => @hostness } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @hostel = Hostel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hostel }\n end\n end", "def new\n @search = Host.search params[:search]\n @host = Host.new\n\n respond_to do |format|\n format.html # new.html.erb\n format...
[ "0.7179569", "0.68829554", "0.6757467", "0.6683666", "0.6638123", "0.656303", "0.6513526", "0.6488726", "0.6478186", "0.64642197", "0.6353725", "0.63527936", "0.63490635", "0.6342386", "0.6342386", "0.6342386", "0.6342386", "0.6342386", "0.6342386", "0.6342386", "0.6342386", ...
0.67921734
2
POST /hostnesses POST /hostnesses.xml
def create @hostness = Hostness.new(params[:hostness]) respond_to do |format| if @hostness.save format.html { redirect_to(hostnesses_path, :notice => 'Hostness was successfully created.') } format.xml { render :xml => @hostness, :status => :created, :location => @hostness } else format.html { form_vars; render :action => "new" } format.xml { render :xml => @hostness.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def create\n @host = Host.new(params[:host])\n\n respond_to do |format|\n if @host.save\n flash[:notice] = 'Host was succes...
[ "0.5698757", "0.55954844", "0.5579512", "0.5578174", "0.5548586", "0.5535028", "0.54966384", "0.54574406", "0.5428928", "0.5425906", "0.54229516", "0.5422574", "0.5414821", "0.5387365", "0.5379054", "0.53437716", "0.53436977", "0.5343105", "0.5320054", "0.52994925", "0.529854...
0.6325835
0
PUT /hostnesses/1 PUT /hostnesses/1.xml
def update @hostness = Hostness.find(params[:id]) respond_to do |format| if @hostness.update_attributes(params[:hostness]) format.html { redirect_to(hostnesses_path, :notice => 'Hostness was successfully updated.') } format.xml { head :ok } else format.html { form_vars; render :action => "edit" } format.xml { render :xml => @hostness.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def upd...
[ "0.6754589", "0.6555582", "0.60603553", "0.59828085", "0.5975185", "0.59656584", "0.5785308", "0.57744956", "0.5686697", "0.5661723", "0.5655726", "0.56341565", "0.5629273", "0.5625961", "0.5614185", "0.5588911", "0.55689406", "0.55587876", "0.54896235", "0.5488187", "0.54797...
0.59360385
6
DELETE /hostnesses/1 DELETE /hostnesses/1.xml
def destroy @hostness = Hostness.find(params[:id]) @hostness.destroy respond_to do |format| format.html { redirect_to(hostnesses_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @host = Host.find(params[:id])\n @host.destroy\n\n respond_to do |format|\n format.html { redirect_to(hosts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @host = Host.find(params[:id])\n @host.destroy\n\n respond_to do |format|\n format.html { r...
[ "0.6759713", "0.6759713", "0.67567664", "0.6668124", "0.6635069", "0.6596829", "0.65685165", "0.65454626", "0.6481324", "0.641212", "0.641212", "0.6387421", "0.6386383", "0.6381551", "0.63055396", "0.62727594", "0.61862683", "0.61856204", "0.6154864", "0.61529523", "0.6142259...
0.6853823
0
+level+ may be 0 or greater, and should be something like an integer. +seq+ is an array with a sequence of steps (:fw, :right, or :left) which will replace each :fw (means: forward) part of the path. A nice default is provided.
def initialize level = 1, seq = nil super() @path = [:fw] seq = [:fw, :left, :fw, :right, :fw, :right, :fw, :left, :fw] level.times do @path.map! { |el| el == :fw ? seq.dup : el }.flatten! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level_up\n $levels.push('/..')\nend", "def turtle level\n if level.zero? then @level_0\n elsif level == 1 then @level_1\n else\n s = ''\n @level_1.each_byte do |b|\n b == @level_0_byte ? s += turtle(level-1) : s += b.chr\n end\n s\n end\n end", "def level= level...
[ "0.5314205", "0.5260916", "0.5234392", "0.51740676", "0.50891215", "0.49452057", "0.49185005", "0.4801137", "0.4801137", "0.47863123", "0.47711605", "0.47627452", "0.4758066", "0.47531688", "0.47139624", "0.47053957", "0.47049835", "0.46991277", "0.468896", "0.46480274", "0.4...
0.678769
0
get form authenticity_token hack of CSRF
def get_token render :text => form_authenticity_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_authenticity_token() 'token' end", "def form_authenticity_token\n \"foo\"\n end", "def authenticity_token\n @authenticity_token || helper.form_authenticity_token\n end", "def authenticity_token\n @authenticity_token || helper.form_authenticity_token\n end", "def form_authenticity_t...
[ "0.83122253", "0.81716126", "0.81558424", "0.81546754", "0.7946493", "0.78806067", "0.7771748", "0.77306855", "0.7704565", "0.76784277", "0.7641175", "0.7593425", "0.7561072", "0.75298667", "0.7473944", "0.740587", "0.7388497", "0.7337628", "0.73260564", "0.729371", "0.728996...
0.7741136
7
PUT /theme/1 PUT /theme/1.xml
def update @site = Site.find_by_id( @site.id) if @site.nil? || @site.site_layout.nil? respond_to do |format| @themes = Layout::Theme.load.sort {|a,b| a.order <=> b.order } @selected_theme = @themes.find_by_name(@site.site_layout.theme) flash[:notice] = I18n.t("not_found", :scope => TRANSLATION_SCOPE) format.html { render :action => "index" } format.xml { render :xml => @site.errors, :status => :unprocessable_entity } return end end # 属性設定 # @site.user_id = current_user.id @site.site_layout.attributes = params[:site_layout] @site.user = current_user respond_to do |format| # 変更されていれば、履歴を作成 if @site.site_layout.save(:validate => true) format.html { redirect_to(index_url, :notice => I18n.t("updated", :scope => TRANSLATION_SCOPE))} format.xml { head :ok } else @themes = Layout::Theme.load @selected_theme = @themes.find_by_name(@site.site_layout.theme) format.html { render :action => "index" } format.xml { render :xml => @site.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @theme.update_attributes(params[:theme])\n flash[:notice] = 'Theme was successfully updated.'\n format.html { redirect_to(@theme) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml {...
[ "0.7322025", "0.7128681", "0.7128681", "0.7128681", "0.7128341", "0.6991868", "0.6907588", "0.681075", "0.68104094", "0.6758635", "0.6749063", "0.6746038", "0.67352057", "0.6732127", "0.66134316", "0.658973", "0.6568242", "0.64616096", "0.6418009", "0.64179015", "0.64179015",...
0.5577075
56
params method to prevent weird injections from frontend. Only allow parameters required for model initialization.
def product_params params.permit(:name, :product_id, :price, :category_id, :about, :thumbnail_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize( params )\n super( Parametrization.permit( params, whitelist, model_name ) )\n @params = @params.with_indifferent_access # After building the internal params hash, make it a little friendlier.\n end", "def valid_params?; end", "def params\n raise NotImplementedError\n end", ...
[ "0.7256675", "0.70451313", "0.7026993", "0.69838357", "0.6812983", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "0.680973", "...
0.0
-1
Creates a new logical connection to the server.
def initialize(options = {}) @options = DEFAULT_OPTIONS.merge(options) parse_domain_name REQUIRED_OPTIONS.each { |key| raise "No #{key} specified" unless @options.key?(key) } @password = @options.delete(:password) @session_id = @options[:session_id] @api_path = @options[:path] @ca_certs = @options[:ca_certs] # The temporary file to store the CA certificates will be created when needed: @ca_file = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect\n @connection.create\n end", "def new_connection; end", "def create_tcp_connection(temp: false)\n tcp_connection = Rex::Socket::Tcp.create(\n 'PeerHost' => host,\n 'PeerPort' => port.to_i,\n 'Context' => context,\n 'Timeout' => timeout\n )\n self.connectio...
[ "0.7175921", "0.66526514", "0.6577228", "0.65604943", "0.65220433", "0.64861435", "0.64453906", "0.6373857", "0.6297211", "0.62688094", "0.62649953", "0.6263107", "0.6260199", "0.62430567", "0.6232543", "0.6217174", "0.6150901", "0.61492836", "0.6146864", "0.6144577", "0.6128...
0.0
-1
Checks if the API is available in the given candidate path. It does so sending a request without authentication. If the API is available there it will respond with the "WWWAutenticate" header and with the "RESTAPI" or "ENGINE" realm.
def probe_api_path(uri, path) uri = URI.join(uri, path) request = RestClient::Resource.new(uri.to_s, :verify_ssl => OpenSSL::SSL::VERIFY_NONE) begin request.get rescue RestClient::Exception => exception response = exception.response logger.error "#{self.class.name}#probe_api_path: exception probing uri: '#{uri}'. Exception: #{$ERROR_INFO}" return false if response.nil? if response.code == 401 www_authenticate = response.headers[:www_authenticate] if www_authenticate =~ /^Basic realm="?(RESTAPI|ENGINE)"?$/ return true end end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route_api?\n request.get? && path.match(%r{^/api})\n end", "def check_api_key\n # Return 403 Forbidden if there is no api key in the request headers\n head :forbidden unless self.current_api_key\n end", "def try_route\n\t\t\t\thttp_method = request.http_method\n\t\t\t\thttp...
[ "0.6675907", "0.6228955", "0.61627173", "0.6135951", "0.6103222", "0.6023788", "0.60127217", "0.6006747", "0.59986216", "0.59982985", "0.59527326", "0.59212697", "0.59128135", "0.58839536", "0.58041584", "0.5770006", "0.57698023", "0.5695591", "0.55857885", "0.55670345", "0.5...
0.6123965
4
Probes all the candidate paths of the API, and returns the first that success. If all probes fail, then the first candidate will be returned.
def find_api_path(uri) CANDIDATE_API_PATHS.detect { |path| probe_api_path(uri, path) } || CANDIDATE_API_PATHS.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe\n path = detect_path\n raise Error, 'API path not found' unless path\n\n detect_version(path).map { |version| ProbeResult.new(version: version) }\n end", "def probe\n path = detect_path\n raise OvirtSDK4::Error.new('API path not found') unless path\n detect_version(path...
[ "0.65709126", "0.61971354", "0.56022227", "0.5500517", "0.5206111", "0.514551", "0.5140843", "0.50757813", "0.5075698", "0.50582874", "0.504951", "0.50423217", "0.5020953", "0.50137943", "0.49814612", "0.498063", "0.49609333", "0.4949002", "0.49309647", "0.49101096", "0.49017...
0.53918535
4
Returns the path of the API, probing it if needed.
def api_path @api_path ||= find_api_path(base_uri) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n # if an api_version is specified and the path does not already contain\n # one, prepend it to the path\n api_version = raw_options[:api_version] || Blupee.config.api_version\n \"/#{api_version}/#{raw_path}\"\n end", "def api_path(path)\n \"#{options[:base_path]}...
[ "0.7206963", "0.7098479", "0.7054683", "0.69686484", "0.6953233", "0.6939049", "0.68937266", "0.6871654", "0.66723686", "0.66668826", "0.6626966", "0.6597206", "0.6591955", "0.64411867", "0.6433396", "0.64278024", "0.64240927", "0.6382282", "0.6366482", "0.63334465", "0.63058...
0.7940841
0
Parse domain out of the username string
def parse_domain_name if @options[:domain].blank? && !@options[:username].blank? if @options[:username].include?('\\') @options[:domain], @options[:username] = username.split('\\') elsif @options[:username].include?('/') @options[:domain], @options[:username] = username.split('/') end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username_domain(username = nil)\n username ||= options[:username] if options\n return unless username\n username.to_s.split('@').last\n end", "def parse_user_domain(hostname)\n return hostname.split('.').first if Rails.configuration.url_host.empty?\n Rails.configuration.url_host.split(',').ea...
[ "0.79118145", "0.78218126", "0.7167245", "0.7149523", "0.714551", "0.713789", "0.7134789", "0.7083486", "0.7073546", "0.6886631", "0.6885214", "0.6874291", "0.6874291", "0.68356234", "0.6816738", "0.6813902", "0.6751128", "0.673275", "0.67262846", "0.67204493", "0.6656043", ...
0.8521616
0
Returns a file object containing the trusted CA certificates. The file will be created if it doesn't exist, and it shouldn't be removed or modified by the caller.
def ca_file return unless @ca_certs @ca_file ||= Tempfile.new('ca_file').tap do |tempfile| tempfile.write(@ca_certs) tempfile.close end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trusted_certs_content\n content = \"\"\n if chef_config[:trusted_certs_dir]\n Dir.glob(File.join(ChefConfig::PathHelper.escape_glob_dir(chef_config[:trusted_certs_dir]), \"*.{crt,pem}\")).each do |cert|\n content << \"cat > /etc/chef/trusted_certs/#{File.basename(cert)...
[ "0.6740507", "0.6589355", "0.6229071", "0.61627907", "0.615404", "0.6089785", "0.59886664", "0.597287", "0.5970318", "0.59263206", "0.5847469", "0.57526463", "0.5692456", "0.56913406", "0.56660044", "0.5619496", "0.5584074", "0.55695546", "0.55649084", "0.5553198", "0.5547324...
0.7190446
0
Returns true if unit is available, otherwise false. The unit is available if it is not occupied by a tenant.
def available? return @tenant == nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available?\n if tenant == false && @units != @number\n return true\n else \n return false\n end\n end", "def occupied?\n not @unit.nil?\n end", "def unit?\n !@unit.nil?\n end", "def units?\n return units.any?\n end", "def available?\n status == :available\n ...
[ "0.8500873", "0.72543454", "0.7066293", "0.68368345", "0.68214405", "0.67758125", "0.66916597", "0.6688044", "0.66567636", "0.66516143", "0.66198903", "0.6594279", "0.656273", "0.65550965", "0.65503156", "0.64900506", "0.64318836", "0.64191425", "0.6355586", "0.63407695", "0....
0.73926
1
Creates a new parser for N3 (or Turtle).
def initialize(n3_str, uri=nil) @uri = Addressable::URI.parse(uri) unless uri.nil? parser = N3GrammerParser.new document = parser.parse(n3_str) if document @graph = Graph.new process_directives(document) process_statements(document) else parser.terminal_failures.each do |tf| puts "Expected #{tf.expected_string.inspect} (#{tf.index})- '#{n3_str[tf.index,10].inspect}'" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_parser(grammar_paths)\n @search_parser ||= grammar_paths.inject(nil) do |parser,lucene_grammar|\n begin\n break parser unless parser.nil?\n # don't instantiate custom nodes\n Treetop.load_from_string(\n IO.read(lucene_grammar).gsub(...
[ "0.61424464", "0.6130579", "0.60563785", "0.59542274", "0.59065545", "0.59065545", "0.59065545", "0.59065545", "0.57602584", "0.57138985", "0.5700162", "0.5700162", "0.568779", "0.5652527", "0.5652527", "0.56236935", "0.56192493", "0.5601566", "0.5584199", "0.5578563", "0.557...
0.6471546
0
GET /ticketrezs GET /ticketrezs.xml
def index respond_to do |format| format.html # index.html.erb format.xml { render :xml => @ticketrezs } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end", "def index\n @tickets = @project.tickets.desc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { rende...
[ "0.6684903", "0.6608066", "0.6503497", "0.6477688", "0.6398327", "0.6339453", "0.6324002", "0.61693484", "0.5934766", "0.59085095", "0.58974314", "0.5861965", "0.5857106", "0.57998556", "0.5797091", "0.5787374", "0.5780197", "0.57764983", "0.57764983", "0.57764983", "0.577649...
0.71887994
0
GET /ticketrezs/1 GET /ticketrezs/1.xml
def show authorize! :read, Rezlineitem @rezlineitems = @ticketrez.rezlineitems @show = @ticketrez.show respond_to do |format| format.html # show.html.erb format.xml { render :xml => @ticketrez } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticketrezs }\n end\n end", "def getXMLTicket(path)\n resp2 = @@conn.get do |req|\n req.url path\n req.headers['Authorization'] = 'Basic aHIuc2VsbGVydEBnbWFpbC5jb206c2VzMTEy' #@TODO make...
[ "0.7217497", "0.6822987", "0.6659201", "0.6529385", "0.6438048", "0.6419128", "0.6352116", "0.6258671", "0.6258671", "0.6258671", "0.6258671", "0.6258671", "0.6258671", "0.6219957", "0.6171344", "0.6058073", "0.6005899", "0.59724534", "0.59609616", "0.5912952", "0.5873086", ...
0.600243
17
GET /ticketrezs/new GET /ticketrezs/new.xml
def new @show = Show.find_by_abbrev(params[:abbrev]) respond_to do |format| format.html # new.html.erb format.xml { render :xml => @ticketrez } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticket }\n end\n end", "def new\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticket }\n e...
[ "0.7298363", "0.7298363", "0.7298363", "0.7298363", "0.72870874", "0.71958387", "0.7041266", "0.69705427", "0.6679059", "0.66732913", "0.66107196", "0.65843314", "0.6580438", "0.6559251", "0.6538751", "0.6493178", "0.64846313", "0.64846313", "0.64846313", "0.64846313", "0.645...
0.0
-1