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
PUT /location_url_maps/1 PUT /location_url_maps/1.json
def update @location_url_map = LocationUrlMap.find(params[:id]) respond_to do |format| if @location_url_map.update_attributes(params[:location_url_map]) format.html { redirect_to @location_url_map, notice: 'Location url map was successfully updated.' } format.json { head :no_content } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end", "def create\n @location_url_map = LocationUrlMap.new(params[:location_url_map])\n\n respond_to do |format|\n if @location_url_map.save\n format.html { redirect_to @...
[ "0.687694", "0.65621614", "0.65343666", "0.6494813", "0.6272907", "0.62617207", "0.61912286", "0.61761653", "0.6155648", "0.61491865", "0.6139987", "0.61079025", "0.60746527", "0.60645247", "0.606134", "0.60488063", "0.6042777", "0.60088044", "0.59800977", "0.59597194", "0.59...
0.71221983
0
DELETE /location_url_maps/1 DELETE /location_url_maps/1.json
def destroy @location_url_map = LocationUrlMap.find(params[:id]) @location_url_map.destroy respond_to do |format| format.html { redirect_to location_url_maps_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @locationmap = Locationmap.find(params[:id])\n @locationmap.destroy\n\n respond_to do |format|\n format.html { redirect_to locationmaps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @map.destroy\n\n respond_to do |format|\n format.json { hea...
[ "0.75332254", "0.74469066", "0.7374722", "0.73695654", "0.73695654", "0.73695654", "0.73332655", "0.72196627", "0.72174823", "0.7166752", "0.7161462", "0.71186686", "0.70607877", "0.7037376", "0.7023859", "0.70120937", "0.7009195", "0.70080173", "0.7004471", "0.7004471", "0.7...
0.7758023
0
GET /directions GET /directions.json GET /directions/1/edit
def edit if @direction.created_by != current_user flash[:alert]="You cannot modify another user direction" redirect_to users_directions_url end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @recipe_direction = @recipe.directions.find(params[:id])\n\n respond_to do |format|\n if @recipe_direction.update_attributes(params[:recipe_direction])\n format.html { redirect_to([@recipe,@recipe_direction], :notice => 'Recipe direction was successfully updated.') }\n format....
[ "0.6961758", "0.6847339", "0.6801642", "0.67142516", "0.6604643", "0.65652347", "0.6497311", "0.6408504", "0.6262739", "0.6254223", "0.62454146", "0.6213341", "0.6193197", "0.6152059", "0.6152059", "0.61516094", "0.6136051", "0.61198515", "0.611602", "0.6106747", "0.6099429",...
0.0
-1
PATCH/PUT /directions/1 PATCH/PUT /directions/1.json
def update if @direction.created_by != current_user flash[:alert]="You cannot modify another user direction" redirect_to users_directions_url else respond_to do |format| if @direction.update(direction_params) format.html { redirect_to users_directions_url, notice: 'direction ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @recipe_direction = @recipe.directions.find(params[:id])\n\n respond_to do |format|\n if @recipe_direction.update_attributes(params[:recipe_direction])\n format.html { redirect_to([@recipe,@recipe_direction], :notice => 'Recipe direction was successfully updated.') }\n format....
[ "0.6533422", "0.63232374", "0.624737", "0.6144264", "0.6126535", "0.6120368", "0.6120364", "0.6072911", "0.60513616", "0.60482484", "0.603009", "0.599392", "0.59920007", "0.59832513", "0.5974518", "0.5964711", "0.5960777", "0.5960777", "0.59568876", "0.59568876", "0.592766", ...
0.5614929
95
DELETE /directions/1 DELETE /directions/1.json
def destroy if @direction.created_by != current_user flash[:alert]="You cannot delete another user direction" redirect_to users_directions_url else @direction.destroy respond_to do |format| format.html { redirect_to users_directions_url, notice: 'direction was successfully destro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @direction = Direction.find(params[:id])\n @direction.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_directions_url) }\n format.xml { head :ok }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n cli...
[ "0.71728027", "0.7169682", "0.7110927", "0.71003747", "0.7097746", "0.7058674", "0.70012677", "0.69858193", "0.6942893", "0.69394284", "0.6934431", "0.693232", "0.6910604", "0.6889771", "0.68864304", "0.686521", "0.6849877", "0.68231565", "0.68231565", "0.68231565", "0.682315...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_direction @direction = Direction.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 direction_params params.require(:direction).permit(:destination_id, :transportation_id, :price, :description) 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.6980244", "0.6782812", "0.6745103", "0.6741142", "0.6733961", "0.65925", "0.6503602", "0.64967257", "0.64822173", "0.64796996", "0.6456357", "0.6439594", "0.63803256", "0.6376499", "0.63644457", "0.6319286", "0.6299465", "0.6298051", "0.62935406", "0.62923044", "0.6291212"...
0.0
-1
Intro to Programming: Methods Author: Caleb Faught Date: 1/3/2016 This program multiplies two numbers using a method
def multiply(a, b) a * b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(first_number, second_number)\n return first_number * second_number\nend", "def multiply(first_number, second_number)\n return first_number * second_number\nend", "def multiply(number1, number2)\n number1 * number2\n end", "def multiply(num1, num2)\n\treturn num1 * num2\nend", "def multip...
[ "0.83137727", "0.83137727", "0.8303037", "0.830004", "0.82972485", "0.82972485", "0.829529", "0.82907", "0.82888645", "0.8286723", "0.824972", "0.8249663", "0.82453454", "0.8242948", "0.8242948", "0.8240786", "0.8240652", "0.8240151", "0.8240151", "0.8240151", "0.8240151", ...
0.0
-1
Opens an SSL socket for talking to the Apple Push Notification service.
def initialize(config = {}) NamedArgs.assert_valid!(config, :required => [:host, :port, :certificate, :certificate_passphrase], :optional => [:select_timeout]) self.config = config config[:select_timeout] ||= 0.1 connect_to_socket end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def socket\n connect unless connected?\n @ssl_sock\n end", "def setup_socket\n ctx = setup_certificate\n\n APN.log(:debug, \"Connecting to #{@host}:#{@port}...\")\n\n socket_tcp = TCPSocket.new(@host, @port)\n OpenSSL::SSL::SSLSocket.new(socket_tcp, ctx).tap do |s|\n ...
[ "0.71637166", "0.713585", "0.6904998", "0.6760148", "0.6719974", "0.6714131", "0.67108434", "0.66533977", "0.6601852", "0.6601852", "0.65856194", "0.6562345", "0.65609205", "0.654045", "0.6159826", "0.61569285", "0.61310613", "0.61310214", "0.6111505", "0.60736036", "0.595222...
0.0
-1
triggered on transaction added
def update_balance(transaction) if transaction.succeeded? sign = transaction.payment? ? 1 : -1 self.balance.update_attributes!(amount: (self.balance.amount + (transaction.amount * sign))) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_transaction(*)\n @connection.add_transaction_record(self)\n end", "def add_transaction\n\t\t\t@@transactions << self\n\t\tend", "def add_transaction(t)\n @transactions << t\n end", "def within_transaction; end", "def within_transaction; end", "def transaction_done\n puts \"...
[ "0.7572202", "0.7489496", "0.7349224", "0.7341101", "0.7341101", "0.7120828", "0.7017148", "0.6996003", "0.6996003", "0.6996003", "0.6971018", "0.69430596", "0.6935796", "0.6847144", "0.6819382", "0.6819382", "0.6817011", "0.6779055", "0.67107266", "0.6707186", "0.6698408", ...
0.0
-1
triggered on transaction deleted
def rollback_balance(transaction) if transaction.succeeded? sign = transaction.payment? ? -1 : 1 self.balance.update_attributes!(amount: (self.balance.amount + (BigDecimal.new(transaction.amount_was) * sign))) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def internal_delete_object\n if self.transaction_activity.is_confirmed?\n self.errors.add(:generic_errors, \"Transaction sudah di konfirmasi\")\n return self \n end\n \n self.destroy \n end", "def destroy\n @transaction.destroy\n\n head :no_content\n end", "def destroy\n @trans...
[ "0.7094362", "0.6975994", "0.689093", "0.68888557", "0.68496776", "0.68143666", "0.6800777", "0.67707944", "0.67707944", "0.67577684", "0.67208046", "0.67149514", "0.67149514", "0.67149514", "0.6658945", "0.6645988", "0.66446894", "0.66061664", "0.6591751", "0.6569931", "0.65...
0.0
-1
why the dash does it reduce height by one.
def print_borders bordertitle_init unless @_bordertitle_init_called raise ArgumentError, "Graphic not set" unless @graphic raise "#{self} needs width" unless @width raise "#{self} needs height" unless @height width = @width height = @height-1 window = @graphic startcol = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_height; 24; end", "def base_height; 24; end", "def height; end", "def height; end", "def height=(_); end", "def height=(_); end", "def terminal_height; end", "def terminal_height; end", "def height()\n 0\n end", "def height\n end", "def height\n end", "def height\n top...
[ "0.6668354", "0.6668354", "0.66208076", "0.66208076", "0.6534237", "0.6534237", "0.62850934", "0.62850934", "0.6265303", "0.62180865", "0.62180865", "0.61703306", "0.6120985", "0.6118266", "0.60284334", "0.6015704", "0.6015278", "0.599542", "0.5942056", "0.59326506", "0.59033...
0.0
-1
Getting instance method Reports/Reads the instance variable this_dogs_name
def name @this_dogs_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n #IMPLEMENTING INSTANCE VARIABLES using @\n @this_dogs_name\n end", "def name\n @this_dogs_name\n end", "def name \n @this_dogs_name\n end", "def name\n @this_dogs_name\n end", "def name\n @this_dog_name\n end", "def name\n @this_dogs_name\n #her...
[ "0.834312", "0.8194461", "0.81032145", "0.8091585", "0.8061296", "0.80610174", "0.8031265", "0.8031265", "0.8031265", "0.8031265", "0.80243534", "0.78657144", "0.77826655", "0.7746295", "0.6834475", "0.6672674", "0.6672674", "0.66604704", "0.65571046", "0.6555926", "0.6490729...
0.81404793
2
Helper method for bottomup implementation
def knapsack_table(weights, values, capacity) return 0 if capacity == 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end", "def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end", "def move_to_bottom\n ...
[ "0.70185775", "0.6855966", "0.6792547", "0.66875625", "0.66756815", "0.6672704", "0.66373646", "0.663226", "0.6596407", "0.6587347", "0.6516622", "0.65097195", "0.6507161", "0.64792657", "0.6440934", "0.6431597", "0.6431418", "0.63186693", "0.6293141", "0.62752163", "0.626493...
0.0
-1
changed from PBR, to mask the name of the gateway for untrusted CS reps
def initialize(options = {}) requires!(options, :password) @options = options super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gateway_name\n gateway[:name]\n end", "def inspect; 'GATEWAY'; end", "def reserved_net_checker; end", "def reserved_nets_regex; end", "def clean_name\n global? ? registry.hostname : name\n end", "def clean_name\n global? ? registry.hostname : name\n end", "def _gateway_for_ip(ip)\n ...
[ "0.66099495", "0.5837366", "0.5696662", "0.5655217", "0.5534411", "0.5534411", "0.5522949", "0.55208313", "0.55208313", "0.54057455", "0.5387596", "0.53310657", "0.5322569", "0.5302729", "0.5294715", "0.5277671", "0.5276431", "0.5272462", "0.5247679", "0.5243726", "0.52435285...
0.0
-1
need a way to prevent user from seeing other users' trees; add :show later index method added 3 aug 17 to list all people on landing page (for now) (step 18)
def index @people = Person.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \t@trees = Tree.where(user_id: current_user)\n end", "def nest\n authorize :big_wedgie\n @patients=User.find(:all,:conditions=>{:role=>5,:hatched=>false}, :order => \"family_name,given_names\")\n render :layout=>'layouts/standard'\n end", "def index\n # show overview ...
[ "0.7014063", "0.67660856", "0.6564454", "0.6542515", "0.65422636", "0.65240914", "0.651852", "0.6514221", "0.6461069", "0.64497834", "0.64262575", "0.64245015", "0.6390109", "0.63873756", "0.63744086", "0.63586974", "0.63515353", "0.63313323", "0.6317353", "0.6305869", "0.629...
0.0
-1
create method added 28 jul 17 for making submit form create new person (step 15)
def create # next line commented out and following line added 2 aug 17 for connecting users to people (step 17) # Person.create(person_params) current_user.people.create(person_params) # check nomster/flixter code in this area redirect_to new_person_path # change to redirect to page showi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @person = Person.new(params[:person])\n \n #save name(s)\n #params[:name].each {|name| \n # @name = Name.new\n # @name.name = name\n # @name.person_id = @person.id\n # @name.save\n #}\n\n respond_to do |format|\n if @person.save\n flash[:notice] = 'Person ...
[ "0.7900217", "0.7761033", "0.7719527", "0.76651967", "0.7631929", "0.7620159", "0.7558877", "0.7540268", "0.7533519", "0.7478359", "0.74699754", "0.7461525", "0.73762023", "0.73602533", "0.7345431", "0.73384726", "0.73384726", "0.73384726", "0.73384726", "0.73384726", "0.7338...
0.7991728
0
show method added 3 aug 17 for person detail page (step 18)
def show @person = Person.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n find_and_show Person\n end", "def show\n # don't need to look for person here; done in 'before_action' callback by set_person\n if ! @person \n # logger.debug(\"PeopleController.show: no person found for id# #{params[:id]}\")\n flash.now[:alert] = \"There isn't any person# \" + :id...
[ "0.79585284", "0.79576075", "0.7811191", "0.77314126", "0.7595971", "0.7532103", "0.75312054", "0.7499038", "0.74894786", "0.7476982", "0.7459952", "0.74591136", "0.73993224", "0.7389759", "0.738958", "0.7353738", "0.7353738", "0.7353738", "0.7353738", "0.7353738", "0.7353738...
0.7991173
2
edit method added 5 aug 17 for editing person details (step 19)
def edit @person = Person.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; e...
[ "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.804674", "0.80131495", "0.790...
0.7902636
25
edit method added 6 aug 17 for updating person details (step 20)
def update @person = Person.find(params[:id]) # byebug @person.update_attributes(person_params) # not updating...but redirecting to correct page redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n @person = Person.find(params[:id])\n end", "def edit\n @person = Person.find(params[:id])\n end", "def edit\n @person = Person.find(params[:id])\n end", "def edit\n \n end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def ed...
[ "0.78878814", "0.78878814", "0.78878814", "0.7842486", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", "0.7789032", ...
0.0
-1
person_params method added 28 jul 17 for making submit form create new person (step 15)
def person_params params.require(:person).permit(:first_name, :middle_name, :last_name, :sex, :birth_date, :death_date, :father_id, :mother_id, :current_spouse_id, :notes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def person_params\n params.require(:person).permit(:form_of_address, :firstname, :lastname, :email, :phone, :phone2, :description, :gender, :language, :website, :institution_ids => [], :functionality_list => [], :target_group_list => [], :topic_ids => [])\n end", "def person_params\n params.require(...
[ "0.80178577", "0.7894682", "0.78682834", "0.7831784", "0.78081733", "0.77902734", "0.7785467", "0.7779003", "0.7773665", "0.7750971", "0.77426845", "0.77404666", "0.77345437", "0.77287453", "0.7703557", "0.76995724", "0.7697599", "0.7688669", "0.76864576", "0.7673011", "0.767...
0.7535931
36
Run an application 'cmd' in a separate thread and monitor its stdout. Also send status reports to the 'observer' by calling its "call(eventType, appId, message")"
def initialize(id, cmd, map_std_err_to_out = false, working_directory = nil, &observer) @id = id || self.object_id @observer = observer @@all_apps[@id] = self @exit_status = nil @threads = [] pw = IO::pipe # pipe[0] for read, pipe[1] for write pr = IO::pipe pe = IO::pipe logger....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runCmd\n puts \" Deployed and running #{@request.data['command']} #{@request.data['arguments']}\".light_green\n print ' STDOUT'.light_cyan + ' and' + ' STDERR'.light_magenta + \":\\n\"\n\n # offset (place saving) variables\n @stdoutOffset = 0\n @stderrOffset = 0\n begin\n #...
[ "0.6259508", "0.6162959", "0.6092662", "0.6078499", "0.60202587", "0.60202587", "0.5961883", "0.5872411", "0.58557457", "0.58479714", "0.5835799", "0.58180624", "0.5806955", "0.5801561", "0.57713616", "0.5765972", "0.5765972", "0.5750223", "0.57320124", "0.56998664", "0.56488...
0.6431964
0
Create a thread to monitor the process and its output and report that back to the server
def monitor_pipe(name, pipe) @threads << Thread.new() do begin while true do s = pipe.readline.chomp call_observer(name.to_s.upcase, s) end rescue EOFError # do nothing rescue => err logger.error "monitorApp(#{@id}): #{err}" logger.debug...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_reporting\n @reporting = Thread.new {\n while @report\n puts @server_process.readlines\n end\n }\n end", "def start_monitor\n @thread = Thread.start { monitor }\n end", "def start_monitor(analyzer_id, port)\n $logger.debug \"START MONITOR\"\n analyzer = Analyzer....
[ "0.72877234", "0.63694555", "0.6203973", "0.6124782", "0.60950863", "0.6088027", "0.59671426", "0.5939521", "0.59191746", "0.59056944", "0.5878587", "0.5820333", "0.5812329", "0.57948434", "0.57765603", "0.5769497", "0.57678604", "0.5752462", "0.5749672", "0.5747616", "0.5739...
0.5436903
52
pyramid(0) => [ ] pyramid(1) => [ [1] ] pyramid(2) => [ [1], [1, 1] ] pyramid(3) => [ [1], [1, 1], [1, 1, 1] ] Note: the subarrays should be filled with 1s
def pyramid(numbers) array_of_arrays = [] if numbers == 0 array_of_arrays end n = 1 numbers.times do array_of_arrays << Array.new(n){1} n += 1 end array_of_arrays end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyramid(numbers)\n newArr = []\n return newArr if numbers == 0\n count = 1\n numbers.times {\n innerArrs = []\n count.times {\n innerArrs.push(1)\n }\n newArr.push(innerArrs)\n count += 1\n }\n return newArr\nend", "def pyramid(n)\n outer_array = []\n 0.upto(n) do |i|\n next if...
[ "0.8229271", "0.7992598", "0.7543914", "0.7238601", "0.677352", "0.67565984", "0.6696915", "0.6680538", "0.65282494", "0.65205437", "0.64924467", "0.648031", "0.6440412", "0.6437384", "0.6325887", "0.63225985", "0.6295549", "0.62754774", "0.62468874", "0.6244628", "0.62423253...
0.7979319
2
analyze children DOM nodes of the specific action_node, get all of action node params
def analyze_node_children(action_node) res_array = [] action_node.element_children.each do |child| if child.key?("class") reg_res = /action-([\w-]+)/.match(child["class"]) unless reg_res.nil? arg_name = replace_to_underscore(reg_res[1]) arg_value = child["data-value"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_child_nodes(node); end", "def extract_input_parameters(op_node, doc)\n result = []\n op_name = op_node.attributes['name'].to_s\n doc.each_element_with_attribute('name', op_name, 0,\n '//schema/element') do |method_node|\n seq_node = REXML::XPath.first(method_n...
[ "0.5880947", "0.5820683", "0.57808965", "0.577351", "0.5771133", "0.57641715", "0.56337917", "0.56304777", "0.5626457", "0.55882", "0.55859494", "0.5542976", "0.54732424", "0.54627466", "0.53916293", "0.5283343", "0.5236005", "0.5219181", "0.51856005", "0.5177343", "0.5157014...
0.8024374
0
Called after svc_activate completes boilerplate functions.
def _activate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate; end", "def across_service_state\n super\n end", "def activate()\n end", "def initialize\n @ewallet_services = {}\n build_service_map\n end", "def bi_service\n end", "def activate!\n raise NotImplementedError\n end", "def service; end", "def post_setup\...
[ "0.65022814", "0.6335205", "0.6273364", "0.61699486", "0.6071976", "0.5939863", "0.57093954", "0.5704533", "0.5666018", "0.56311667", "0.56046695", "0.55785805", "0.5531578", "0.55309397", "0.5530148", "0.5523366", "0.54943913", "0.54925627", "0.54899603", "0.54873914", "0.54...
0.6448944
1
Called before svc_deactivate does boilerplate functions.
def _deactivate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_deactivate\n end", "def deactivate; end", "def deactivate\n (self.class.deactivate_hooks + deactivate_hooks).each do |block|\n block.call self\n end\n end", "def deactivate()\n end", "def across_service_state\n super\n end", "def deactivate\n \n end", "def servic...
[ "0.73963845", "0.6522424", "0.63083375", "0.6299316", "0.60118884", "0.6005257", "0.5991053", "0.5966091", "0.5925988", "0.5747169", "0.5726621", "0.56580263", "0.56203634", "0.56084615", "0.55842656", "0.5576372", "0.5546411", "0.5546411", "0.5507355", "0.5501628", "0.550162...
0.69643605
1
GET /contact_forms/new GET /contact_forms/new.xml
def new @contact_form = ContactForm.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @contact_form } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @contactos = Contactos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contactos }\n end\n end", "def new\n @contacts = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @conta...
[ "0.778204", "0.7777375", "0.7760263", "0.77564603", "0.77564603", "0.77564603", "0.7668297", "0.76075286", "0.75307995", "0.7427575", "0.74138767", "0.73908883", "0.7282339", "0.7263025", "0.7238764", "0.72267586", "0.7221244", "0.7186807", "0.71305627", "0.70955163", "0.7065...
0.7934486
0
POST /contact_forms POST /contact_forms.xml
def create @contact_form = ContactForm.new(params[:contact_form]) if @contact_form.valid? ContactMailer.contact_benvarim(@contact_form).deliver flash[:notice] = "Mesajınız tarafımıza ulaştı. En kısa sürede sizinle iletişime geçeceğiz. Teşekkürler" return redirect_to :action => :index else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @contact_form = ContactForm.new(params[:contact_form])\n \n respond_to do |format|\n if @contact_form.valid?\n Contact.deliver_contact(@contact_form)\n flash[:notice] = 'Message succesfully sent.'\n format.html { redirect_to(root_path) }\n #format.xml { rende...
[ "0.6607394", "0.6275123", "0.6263818", "0.6102993", "0.59977746", "0.597487", "0.5960051", "0.5911788", "0.5894338", "0.58942777", "0.58700526", "0.5853356", "0.58245426", "0.5819338", "0.5802356", "0.57707596", "0.57707596", "0.57707596", "0.5766331", "0.5746589", "0.5740295...
0.54640317
80
Fun with enumerations ...
def words %w(this array has five words) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enumerator ; end", "def enumerator ; end", "def |(enum); end", "def infinite_select_2(enum)\n Enumerator.new do |yielder|\n enum.each do |value|\n yielder.yield(value) if yield(value)\n end\n end\nend", "def enumerator; end", "def run_enum\n arr = (0..10).to_a\n find(arr) { |el| el...
[ "0.67322385", "0.67322385", "0.670965", "0.65069056", "0.64301604", "0.63735247", "0.6191968", "0.60896724", "0.6060471", "0.604717", "0.60325414", "0.60293275", "0.6023966", "0.59941334", "0.59737694", "0.5928462", "0.59270734", "0.5839065", "0.5827683", "0.5826828", "0.5804...
0.0
-1
get access token for api requests
def get_access_token uri = URI.parse(@token_url) http = Net::HTTP.new(uri.host, uri.port) req = Net::HTTP::Post.new(uri.request_uri) auth = Base64.encode64(@login + ':' + @password).gsub("\n", "") req['Authorization'] = "Basic #{auth}" send = 'grant_type=client_credentials' req.body = send ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_access_token\n\t\treturn @credentials.get_access_token\n\tend", "def get_access_token_json\n HTTParty.post(get_request_access_token_url)\n end", "def access_token\n api_key.access_token rescue \"\"\n end", "def get_access_token\n raise HyvesException, 'You need an request token to make get...
[ "0.8204312", "0.8152461", "0.80792", "0.80600923", "0.80521446", "0.8039534", "0.79859257", "0.79799694", "0.7977469", "0.7968746", "0.7909061", "0.79051286", "0.7889446", "0.78735626", "0.7859974", "0.78574073", "0.7844993", "0.7831024", "0.7804496", "0.777917", "0.77749985"...
0.7993631
6
send request to the server
def send_request method, params = {} uri = URI.parse(@api_url) if Time.now.to_i > @exp + 3600 get_acces_token @exp = Time.now.to_i end required = { 'access_token' => @access_token, 'method' => method } params = required.merge(params) params = URI.escape(params.collect{ |k,v| "#{k}=#{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_request; end", "def send_request(req); end", "def send_request\n @response = _send_request\n end", "def send_request(method, url)\n @response = client.run_request(method, url, @body, headers) do |req|\n req.params = params\n end\n end", "def request(request)\n @socket.re...
[ "0.8128962", "0.7990024", "0.7520173", "0.7367704", "0.7351351", "0.73228204", "0.7234618", "0.7189119", "0.7187505", "0.7108176", "0.707105", "0.70435274", "0.7036366", "0.70097595", "0.69799113", "0.6951126", "0.69380516", "0.69192815", "0.6890673", "0.68865067", "0.6849669...
0.67152274
26
search track by search term
def tracks_search params = { :query => 'love', :page => 1 } json = send_request 'tracks_search', params if json['success'] == true json['tracks'] else puts "Error: " + json['message'] exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_track\n term = params[:search_track][:term].strip # remove trailing spaces\n unless term.empty?\n @term = term\n #logger.debug \"searching for: \" + @term\n @tracks = Track.search @term \n render \"/searches/track_results\"\n else\n redirect_to root_url, :notice => \"Y...
[ "0.72702765", "0.70895344", "0.70793736", "0.7021963", "0.6948462", "0.69349366", "0.6928619", "0.68858916", "0.685424", "0.68031245", "0.6789214", "0.67606974", "0.6759008", "0.6759008", "0.6759008", "0.6759008", "0.6759008", "0.6759008", "0.6759008", "0.6759008", "0.6759008...
0.0
-1
get info about track
def tracks_get_info params = { :track_id => nil } json = send_request 'tracks_get_info', params if json['success'] == true json['data'] else puts "Error: " + json['message'] exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_info( params )\n xml = LastFM.get( \"track.getInfo\", params )\n LastFM::Track.from_xml( xml )\n end", "def print_track track\n puts('Track title is: ' + track.track_title)\n\tputs('Track file location is: ' + track.track_location)\nend", "def info(options={})\n get(:standard...
[ "0.8079709", "0.7696206", "0.7629991", "0.7598124", "0.7598124", "0.74878395", "0.7480556", "0.7463441", "0.74306065", "0.736359", "0.7284881", "0.7280493", "0.71391684", "0.71370786", "0.7026609", "0.68860334", "0.68739635", "0.68474424", "0.68078774", "0.6785126", "0.677228...
0.7727919
1
get download link for track
def tracks_get_download_link params = { :track_id => nil, :reason => 'save' } json = send_request 'tracks_get_download_link', params if json['success'] == true json['url'] else puts "Error: " + json['message'] exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track_download\n connection.get(links.download_location)[\"url\"]\n end", "def url\n @client.get_download_link(@path)\n end", "def download_link\n download_params = { :sub => 'download', :fileid => @fileid, :filename => @remote_filename, :cookie => @api.cookie }\n DOWN...
[ "0.8160343", "0.7440568", "0.7234691", "0.7161076", "0.7136366", "0.71140665", "0.71140665", "0.7074691", "0.6984451", "0.6820432", "0.67383283", "0.67383283", "0.66706914", "0.6666837", "0.65722096", "0.65445185", "0.6527525", "0.64755005", "0.6449127", "0.64439976", "0.6438...
0.81532913
1
get top tracks for period
def get_top_list params = { :list_type => 1, :page => 1, :language => 'en' } json = send_request 'get_top_list', params if json['success'] == true json['tracks'] else puts "Error: " + json['message'] exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_top_tracks( params )\n LastFM.get( \"chart.getTopTracks\", params )\n end", "def top_tracks\n lfm_path = \"artist.topTracks&artist=#{@name}\"\n lfm_data = LastFm::fetch_data(lfm_path)\n return Track.create_from_hash(Hash.from_xml(lfm_data)['lfm']['toptracks']['track'])\n end...
[ "0.77540165", "0.7239786", "0.69759053", "0.6933077", "0.6913311", "0.6850608", "0.6846291", "0.679161", "0.67087686", "0.6696691", "0.6674563", "0.6626067", "0.65618205", "0.6466273", "0.63179475", "0.6276046", "0.6255501", "0.61907864", "0.61903584", "0.61274135", "0.611427...
0.6567918
12
GET /bid_events GET /bid_events.json
def index @bid_events = BidEvent.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response....
[ "0.7342957", "0.71420056", "0.7054842", "0.6992731", "0.6949456", "0.6884161", "0.6847148", "0.6779865", "0.6727815", "0.667954", "0.6671477", "0.6659943", "0.6614731", "0.661265", "0.66093224", "0.6606276", "0.6597985", "0.6572928", "0.65572286", "0.6543842", "0.6531557", ...
0.7667168
0
GET /bid_events/1 GET /bid_events/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bid_events = BidEvent.all\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => ...
[ "0.7462803", "0.7018609", "0.6948375", "0.68241435", "0.68116647", "0.671994", "0.66858846", "0.6603963", "0.6596125", "0.6589443", "0.6572079", "0.6550744", "0.6544802", "0.6537752", "0.64324", "0.6428955", "0.64207876", "0.6410057", "0.64001787", "0.6393666", "0.6392573", ...
0.0
-1
POST /bid_events POST /bid_events.json
def create @bid_event = BidEvent.new(bid_event_params) respond_to do |format| if @bid_event.save format.html { redirect_to :back } format.json { render :show, status: :created, location: @bid_event } else format.html { redirect_to :back } format.json { render json: @...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_type\n :bid_posted\n end", "def create_event event, data={}\n data[:event] = event\n post '/event', data\n end", "def create\n megam_rest.post_event(to_hash)\n end", "def create\n @bet_event = BetEvent.new(bet_event_params)\n\n respond_to do |format|\n if @...
[ "0.7224387", "0.66388935", "0.6631353", "0.662609", "0.65981436", "0.65893763", "0.6542279", "0.6492566", "0.644032", "0.64151144", "0.64094", "0.63980263", "0.6397688", "0.6356308", "0.6326462", "0.63215834", "0.6318866", "0.63053143", "0.62896746", "0.62855923", "0.6262429"...
0.7658851
0
PATCH/PUT /bid_events/1 PATCH/PUT /bid_events/1.json
def update respond_to do |format| if @bid_event.update(bid_event_params) format.html { redirect_to @bid_event, notice: 'Bid event was successfully updated.' } format.json { render :show, status: :ok, location: @bid_event } else format.html { render :edit } format.json { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j...
[ "0.70640016", "0.7037234", "0.7018264", "0.69999444", "0.6963281", "0.69553876", "0.68974286", "0.6836075", "0.6833081", "0.6825082", "0.67885876", "0.6779216", "0.6779216", "0.67664695", "0.673555", "0.67229855", "0.6691224", "0.6691224", "0.66833293", "0.6653402", "0.664979...
0.7433791
0
DELETE /bid_events/1 DELETE /bid_events/1.json
def destroy @bid_event.destroy respond_to do |format| format.html { redirect_to :back, notice: 'Bid event was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end", "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_...
[ "0.72683036", "0.72230273", "0.72026503", "0.72026503", "0.72026503", "0.7198105", "0.71778286", "0.71678966", "0.7121198", "0.7100364", "0.7093196", "0.7084182", "0.7080059", "0.70776147", "0.707001", "0.7065188", "0.70600563", "0.7045582", "0.70413554", "0.701838", "0.70129...
0.74801016
0
Use callbacks to share common setup or constraints between actions.
def set_bid_event @bid_event = BidEvent.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 bid_event_params params.require(:bid_event).permit(:auctionable_id, :participant_id, :final, :amount) 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.6980244", "0.6782812", "0.6745103", "0.6741142", "0.6733961", "0.65925", "0.6503602", "0.64967257", "0.64822173", "0.64796996", "0.6456357", "0.6439594", "0.63803256", "0.6376499", "0.63644457", "0.6319286", "0.6299465", "0.6298051", "0.62935406", "0.62923044", "0.6291212"...
0.0
-1
GET /users GET /users.json
def index @users = User.order(:created_at).reverse_order respond_to do |format| format.html # index.html.erb format.json { render json: @users } end 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 /users/1 GET /users/1.json
def show @workshops = Workshop.where(:host_id => @user).first_meeting_in_the_future @other_workshops = Workshop.where(:host_id => @user).where(%Q(#{Workshop.quoted_table_column(:id)} NOT IN (#{@workshops.select(Workshop.quoted_table_column(:id)).to_sql}))) @workshops = @workshops.order(%Q(#{Meeting.quoted_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ...
[ "0.8105987", "0.77028173", "0.77012515", "0.76255774", "0.75825965", "0.7481543", "0.74611485", "0.7446646", "0.73058766", "0.7299786", "0.72892565", "0.7277604", "0.72351575", "0.7232825", "0.7232825", "0.7232825", "0.7232825", "0.7232825", "0.7232825", "0.7232825", "0.72246...
0.0
-1
PUT /users/1 PUT /users/1.json
def update respond_to do |format| if @user.update_attributes(user_params) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @user.errors, statu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "de...
[ "0.74114245", "0.73920554", "0.73041475", "0.7254177", "0.7202618", "0.70756376", "0.70535713", "0.7029043", "0.70075685", "0.69883573", "0.6983195", "0.694263", "0.69409895", "0.692315", "0.6909438", "0.687742", "0.68486536", "0.6834162", "0.6821841", "0.6801179", "0.6770304...
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user.destroy respond_to do |format| format.html { redirect_to users_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\...
[ "0.7874731", "0.77506596", "0.77133244", "0.76088846", "0.74708045", "0.7405474", "0.7405474", "0.7368195", "0.73442423", "0.73387444", "0.7326243", "0.7307869", "0.73075813", "0.730459", "0.72960675", "0.7289731", "0.72895604", "0.7287604", "0.728217", "0.7248778", "0.724877...
0.0
-1
This is the main entry point to do a search on a node. It takes a single argument: actor: Actor is the node that you want to find a path to KB from. It returns an array (sorted with your input first) that is the path from your node to KB himself!
def calculate_path(actor) reset_baconator(actor) node_search do |current_node| process_single_node(current_node) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_paths(&block)\n follow,kill,find,continue = SearchParams.process(&block)\n\n paths,path = [],[]\n search = lambda do |node|\n if find[node]\n paths << path.dup\n next if not continue[node]\n end\n next if kill[node]\n [*follow[node]].each do |n|\n next ...
[ "0.60612416", "0.60062635", "0.5987664", "0.5960038", "0.59383076", "0.58702797", "0.57719135", "0.5749362", "0.573108", "0.5665421", "0.56614286", "0.56580925", "0.55549705", "0.55283886", "0.5423808", "0.54209185", "0.54026175", "0.5391854", "0.5345416", "0.5345416", "0.534...
0.69740254
0
This is the heart of the algorithm, the rest is just dressing. This method takes a newly created node and checks for a few conditions: 1. if the node is in the current queue. If it is, check to see if our new node is better than the one in the queue. If it is, delete the one in the queue. 2. if the node is in the marke...
def process_new_node(node) continue_unless_match(node) do if (node_in_queue = queue.find { |n| n.name == node.name }).present? if node.depth < node_in_queue.depth @requeued += 1 queue.delete(node_in_queue) queue << node end elsif (node_in_que...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bfs_adj_list(queue, item)\n @checked_edges = []\n @current_node = start\n queue.add(@current_node)\n until current_node == item || current_node.nil?\n @current_node.linked_list.each do |next_node|\n queue.add(next_node)\n end\n current_node = queue.pop\n end\n return @cu...
[ "0.60295427", "0.5903617", "0.582361", "0.57879", "0.5786121", "0.57254773", "0.5682167", "0.5644632", "0.5603063", "0.56027365", "0.55969846", "0.5590909", "0.5565344", "0.55479974", "0.5516536", "0.5495897", "0.54725796", "0.546303", "0.5455273", "0.544869", "0.5448497", ...
0.736025
0
This is our early exit method. Before I added this the algorithm would frequently encounter Kevin Bacon and add him to the queue to be processed later. I think this is fine for normal A because the queue doesn't usually contain 15k+ nodes. This method is to detect a KB occurrence along an edge and return it immediately...
def continue_unless_match(node) if match_target?(node) mark_final(node) else yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize_kevin_bacon_search\n\t\t# winning_attempts = []\n\t\t# find_kevin_bacon_2(winning_attempts)\n\t\t# if winning_attempts.count > 0\n\t\t\t# winning_attempts.each do |attempt|\n\t\t\t\t# compare with a neighbor, shorter one wins\n\t\t\t\t# there will be lots of ties we skip over\n\t\t# else\n\t\t\t# retu...
[ "0.58985263", "0.5771893", "0.57246894", "0.55478996", "0.5458583", "0.54439247", "0.5441797", "0.5348145", "0.53411967", "0.5318328", "0.5289007", "0.52093935", "0.5191542", "0.51673466", "0.51635146", "0.5128747", "0.5127169", "0.5090813", "0.50825065", "0.5071253", "0.5070...
0.0
-1
This method handles the search itself, iterating from node to node always picking one that is more likely to be the "closest". When the search is over it does some cleanup, saves results and returns the final link
def node_search while (current_node = queue.shift).present? && final.nil? @processed += 1 yield(current_node) log "\rProcessing #{start.name}.... %d / %d / %d / %d @ %ds - depth: %d", @unmarked, @requeued, @processed, @steps, (Time.now - @started), current_node.depth end forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(node = @root)\n if node.position == @target\n @target_node = node\n return\n else\n node.connected_knights.each { |knight| search(knight) }\n end\n end", "def search(path, final_point)\n\n current = path.first\n puts \"current.center = #{current.center}\"\n puts \"fin...
[ "0.5761403", "0.5711617", "0.55944145", "0.55161023", "0.54583377", "0.54534084", "0.54137915", "0.53558475", "0.53134894", "0.53065735", "0.53065735", "0.52927953", "0.52780896", "0.52531135", "0.5248028", "0.52434766", "0.523802", "0.5220844", "0.51955533", "0.5156452", "0....
0.5590692
3
This method just iterates over the final_path array and sets bacon_links if they haven't been set already
def save_results unless self.options[:disable_save] == true self.final_path.inject(nil) do |previous, link| unless previous.nil? || previous.element.bacon_link.present? previous.element.update_attribute(:bacon_link_id, link.element.id) end link end e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_links\n stack = [[[], @source]]\n until stack.empty?\n roots, dir = *stack.pop\n dir.children.each do |child|\n name = block_given? && yield(child) || child.basename.to_s\n path = roots + [name]\n\n if child.directory?\n stack.push [path, c...
[ "0.6111278", "0.5903717", "0.5741223", "0.5713852", "0.5649628", "0.5641128", "0.55046433", "0.54379046", "0.5267791", "0.5245827", "0.52334785", "0.5224897", "0.5214171", "0.5181331", "0.5173785", "0.51330286", "0.513089", "0.51248217", "0.5122469", "0.5098709", "0.5098709",...
0.60734284
1
GET /shared_networks or /shared_networks.json
def index @dhcp_server = DhcpServer.find_by_id(params[:dhcp_server_id]) @shared_networks = @dhcp_server.shared_networks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNetworks\n require 'rest_client'\n require 'uri'\n\n if @role.nil? and !current_actor.superadmin\n json_response({ message: \"You don't have permission to view networks\" }, :unauthorized)\n return\n end\n\n # Env variables for Manager host and port\n serviceManagerHost = Setting...
[ "0.63297606", "0.6178825", "0.61230993", "0.5980063", "0.5943054", "0.5925526", "0.59147304", "0.5911124", "0.5809114", "0.5750242", "0.5736931", "0.5734022", "0.5689281", "0.5684427", "0.5676094", "0.56479126", "0.56213284", "0.5618179", "0.5606813", "0.5596688", "0.5594735"...
0.6576499
0
GET /shared_networks/1 or /shared_networks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dhcp_server = DhcpServer.find_by_id(params[:dhcp_server_id])\n @shared_networks = @dhcp_server.shared_networks\n end", "def getNetworks\n require 'rest_client'\n require 'uri'\n\n if @role.nil? and !current_actor.superadmin\n json_response({ message: \"You don't have permission ...
[ "0.6604246", "0.63007635", "0.62950814", "0.62409884", "0.6182594", "0.6172283", "0.61569375", "0.6147682", "0.6119205", "0.6092617", "0.6004094", "0.59928006", "0.59640837", "0.5942595", "0.59054506", "0.5899723", "0.58890873", "0.58890873", "0.58890873", "0.58721787", "0.58...
0.0
-1
POST /shared_networks or /shared_networks.json
def create if params[:dhcp_server_id] && @dhcp_server = DhcpServer.find_by_id(params[:dhcp_server_id]) @shared_network = @dhcp_server.shared_networks.new(shared_network_params) end respond_to do |format| if @shared_network.save format.html { redirect_to @shared_network, notice: "Shared ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shared_network_params\n params.require(:shared_network).permit(:name, :relayed_from_ip, :dhcp_server_id)\n end", "def create\n @network = current_user.networks.new(network_params)\n\n respond_to do |format|\n if @network.save\n format.html { redirect_to @network, notice: t(:nertwork...
[ "0.6481814", "0.6411195", "0.6124933", "0.60934806", "0.6084129", "0.6080946", "0.60784817", "0.6007433", "0.59008366", "0.5897317", "0.58472234", "0.5778644", "0.57528406", "0.5732499", "0.57100236", "0.5682836", "0.56720537", "0.56531435", "0.5647075", "0.5613593", "0.56017...
0.7163627
0
PATCH/PUT /shared_networks/1 or /shared_networks/1.json
def update respond_to do |format| if @shared_network.update(shared_network_params) format.html { redirect_to @shared_network, notice: "Shared network was successfully updated." } format.json { render :show, status: :ok, location: @shared_network } else format.html { render :edit,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @network = current_organization.owned_networks.find(params[:id])\n \n if @network.update_attributes(params[:network]) then\n redirect_to network_path(@network)\n else\n render :action => 'edit'\n end\n end", "def update\n respond_to do |format|\n if @network.update...
[ "0.66169935", "0.6463253", "0.64619946", "0.642729", "0.6381115", "0.6381115", "0.6343366", "0.62766516", "0.6198222", "0.61754453", "0.60571164", "0.603599", "0.599076", "0.5963279", "0.592944", "0.58869636", "0.5864141", "0.5847652", "0.581532", "0.5796457", "0.57880276", ...
0.72853696
0
DELETE /shared_networks/1 or /shared_networks/1.json
def destroy @shared_network.destroy respond_to do |format| format.html { redirect_to shared_networks_url, notice: "Shared network was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @network.destroy\n\n respond_to do |format|\n format.html { redirect_to networks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @network.destroy\n respond_to do |format|\n format.html { redirect_to networks_url }\n format.json { head :no_co...
[ "0.69121706", "0.6892804", "0.6892804", "0.6892804", "0.67723244", "0.6647553", "0.6631112", "0.6600696", "0.6590614", "0.6517128", "0.65061224", "0.6502067", "0.6471297", "0.64693606", "0.6466486", "0.64408386", "0.6430905", "0.6422126", "0.640457", "0.6312267", "0.630553", ...
0.747191
0
Use callbacks to share common setup or constraints between actions.
def set_shared_network @shared_network = SharedNetwork.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def shared_network_params params.require(:shared_network).permit(:name, :relayed_from_ip, :dhcp_server_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
GET /infos GET /infos.json
def set_model @model = Info end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info\n response = from_server \"api/info.json\"\n response.data\n end", "def info(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/info\", options: params.compact).tap do |resp|\n resp.body = resp.body.map { |_k, data| data }\...
[ "0.74006987", "0.7390524", "0.7390524", "0.7360638", "0.72469443", "0.72044826", "0.70949435", "0.70629776", "0.70065945", "0.69521254", "0.6898222", "0.6888555", "0.6762928", "0.6745386", "0.66563773", "0.6623607", "0.6600353", "0.65996075", "0.65996075", "0.65961534", "0.65...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def define_eccept if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info) true else redirect_to root_path end 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.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def resource_params params.require(:info).permit(:send_new_film, :send_comments_to_film, :ban, :data, :name, :city, :user_id, :bio, :telephone, :photo) 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
('XOX', 'OXO', 'XXO') => [['X', 'O', 'X'], ['O', 'X', 'O'], ['X', 'X', 'O']]
def board(*rows) = rows.map(&:chars)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def every_possible_pairing_of_word(arr)\n i1 = arr\n i2 = []\n i1.combination(2).to_a\nend", "def partlist(arr)\n len = arr.length\n i = 0\n masterArr = []\n while i < len - 1 do\n masterArr << [arr[0..i].join(\" \")] + [arr[i+1..len].join(\" \")]\n i += 1\n end\n masterArr\nend", "def two_d_tra...
[ "0.6284727", "0.62010163", "0.601011", "0.59418887", "0.593559", "0.5907421", "0.58761936", "0.5874938", "0.5865587", "0.58516544", "0.5843115", "0.58171856", "0.5796519", "0.57888705", "0.578294", "0.5781645", "0.57683444", "0.5759031", "0.57569855", "0.5755521", "0.57543486...
0.0
-1
300 seconds = 5 minutes
def set_duration if self.end_time # self.duration = (end_time - start_time).to_i self.duration = (end_time - start_time).to_i else self.duration = DEFAULT_DURATION self.end_time = self.start_time + self.duration end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeout_seconds\n return 1200\n end", "def _timeout_in\n 1.minute\n end", "def delay_time\n end", "def sleep_time\n 60\n end", "def timer; end", "def timer; end", "def timer; end", "def timer; end", "def first_data_timeout(seconds); end", "def timeout_in\n 15.minutes\n end", ...
[ "0.7025738", "0.69961846", "0.6950477", "0.68791646", "0.68307036", "0.68307036", "0.68307036", "0.68307036", "0.6813412", "0.67885137", "0.6773924", "0.67615247", "0.67615247", "0.67190534", "0.67185307", "0.6703982", "0.6703982", "0.6703982", "0.6674652", "0.6674652", "0.66...
0.0
-1
GET /categors GET /categors.json
def index @categors = Categor.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_ba...
[ "0.72684443", "0.7017578", "0.69099087", "0.68865865", "0.6809532", "0.6699798", "0.6687315", "0.65827006", "0.65793586", "0.6563316", "0.650584", "0.6499714", "0.6474723", "0.647456", "0.647456", "0.64648175", "0.64580625", "0.6453424", "0.6449803", "0.64452", "0.6440751", ...
0.6882814
4
GET /categors/1 GET /categors/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n render json: @owner.cats\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def index\n @categors = Categor.all\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category...
[ "0.69073355", "0.6884178", "0.6830113", "0.6787832", "0.6762298", "0.6749226", "0.6737553", "0.6717624", "0.6703124", "0.66919595", "0.6553862", "0.65348417", "0.65315217", "0.65254855", "0.6517232", "0.65167385", "0.6504475", "0.6504226", "0.6504226", "0.65041786", "0.648755...
0.0
-1
POST /categors POST /categors.json
def create @categor = Categor.new(categor_params) respond_to do |format| if @categor.save format.html { redirect_to @categor, notice: 'Categor was successfully created.' } format.json { render :show, status: :created, location: @categor } else format.html { render :new } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n @categoria = Categoria.new(categoria_params)\n if @categoria.save\n render json: @categoria\n else\n render json: @categoria.errors, s...
[ "0.65499645", "0.654182", "0.651359", "0.6454083", "0.63511384", "0.6306456", "0.6264472", "0.62414837", "0.6095076", "0.6088621", "0.6059703", "0.600981", "0.60088015", "0.59859186", "0.5982543", "0.5938925", "0.5920198", "0.589909", "0.58966285", "0.58739054", "0.5856812", ...
0.6083942
10
PATCH/PUT /categors/1 PATCH/PUT /categors/1.json
def update respond_to do |format| if @categor.update(categor_params) format.html { redirect_to @categor, notice: 'Categor was successfully updated.' } format.json { render :show, status: :ok, location: @categor } else format.html { render :edit } format.json { render json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n json_update(category,category_params, Category)\n end", "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n respond_to do |format|\n if @categ.update(categ_params)\n format...
[ "0.70073706", "0.65630263", "0.63563913", "0.63253295", "0.6263381", "0.6219702", "0.6205993", "0.6164474", "0.6154682", "0.6132187", "0.6112866", "0.611148", "0.6095441", "0.6046407", "0.6045753", "0.6045271", "0.60125226", "0.601214", "0.6010036", "0.60071665", "0.6003823",...
0.5831122
46
DELETE /categors/1 DELETE /categors/1.json
def destroy @categor.destroy respond_to do |format| format.html { redirect_to categors_url, notice: 'Categor was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @categ.destroy\n respond_to do |format|\n format.html { redirect_to categs_url, notice: 'Categ was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n render json: @category, status: :ok\n end", "def destroy\n ...
[ "0.7168394", "0.7070791", "0.705443", "0.70505136", "0.7001394", "0.6990325", "0.6980655", "0.69408643", "0.6889897", "0.68867445", "0.6884782", "0.6882192", "0.6880496", "0.68753654", "0.6874369", "0.68567395", "0.6849637", "0.68480176", "0.68480176", "0.6839021", "0.6832030...
0.7117829
1
Use callbacks to share common setup or constraints between actions.
def set_categor @categor = Categor.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 categor_params params.require(:categor).permit(:name, :description) 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.6980244", "0.6782812", "0.6745103", "0.6741142", "0.6733961", "0.65925", "0.6503602", "0.64967257", "0.64822173", "0.64796996", "0.6456357", "0.6439594", "0.63803256", "0.6376499", "0.63644457", "0.6319286", "0.6299465", "0.6298051", "0.62935406", "0.62923044", "0.6291212"...
0.0
-1
using a filename override to produce a gif for each status type (probably only useful for examples) passing true allows the filename to be overridden to use the status name e.g passing.gif (otherwise the default is to overwrite the build_status.gif)
def generate(status) @build_status.shield(status, true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_png(status)\n status ? 'enabled_icon.png' : 'disabled_icon.png'\n end", "def status\n image_name = if params[:sha]\n @project.sha_status_image(params[:sha])\n elsif params[:ref]\n @project.status_image(params[:ref])\n else\n ...
[ "0.65196365", "0.6388624", "0.63542837", "0.6134261", "0.61080325", "0.6047964", "0.60096043", "0.59613305", "0.5865567", "0.5754178", "0.5708126", "0.5697688", "0.5608837", "0.55675834", "0.5505207", "0.5493509", "0.5483153", "0.54801464", "0.54756373", "0.542849", "0.540741...
0.49683473
88
prints a random quote for the given character
def random_quote print Scraper.quotes(self.url).sample end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_char\n random_byte.chr\n end", "def random_letter\n (rand(93) + 33).chr\n end", "def random_str()\n p (0...5).map { (65 + rand(26)).chr }.join\nend", "def rand_char\n @chars.sample\n end", "def rand_text_debug(length, char = 'A')\n char * (length.kind_of?(Range) ? lengt...
[ "0.6875866", "0.6844034", "0.68277776", "0.6824397", "0.6736243", "0.67118406", "0.66866654", "0.6680548", "0.6602776", "0.6557526", "0.65254295", "0.6516029", "0.6493108", "0.64747465", "0.6466254", "0.6404369", "0.6404369", "0.63874376", "0.6335597", "0.63170606", "0.622931...
0.6167262
26
returns client with the given name if in catalog, nil otherwise
def find_client(cl_name) chef_clients.find{|ccl| ccl.name == cl_name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client(name)\n @clients[name]\n end", "def client(name)\n client_to_find = name\n @clients.find {|key, value| key == client_to_find } \n end", "def client_by_name(client_name, options={})\n params = {\n :klass => Invoicexpress::Models::Client,\n :client_name => c...
[ "0.7461554", "0.72448874", "0.6751125", "0.6730373", "0.6347541", "0.6302841", "0.6262264", "0.62593555", "0.62583286", "0.62396866", "0.60926545", "0.6027987", "0.59745234", "0.58995444", "0.58955723", "0.5864997", "0.58145213", "0.58141255", "0.580185", "0.5777895", "0.5738...
0.7631904
0
returns node with the given name if in catalog, nil otherwise
def find_node(nd_name) chef_nodes.find{|nd| nd.name == nd_name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_node_by_name(name)\n @nodes[name]\n end", "def node(name)\n name = name.to_sym\n @nodes.detect{|node|\n node.name == name\n }\n end", "def node(name)\n return node_manager.find(name)\n end", "def node(node_name)\n nodes(node_name).first\nend", "def find_node n...
[ "0.7302811", "0.72384673", "0.70962054", "0.6867888", "0.6824223", "0.66507334", "0.66507334", "0.66373825", "0.6506296", "0.6406524", "0.6344627", "0.6322645", "0.6281175", "0.62650424", "0.62615025", "0.62580705", "0.62104064", "0.6207571", "0.6201695", "0.6172223", "0.6140...
0.66447043
7
Fetch latest VMs data from IaaS cloud. VMs data may have already changed since last fetch.
def fog_servers @fog_servers = @cloud.fog_servers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_vms\n @vms = []\n\n response = @conn.get do |req|\n req.url \"/api/v1/vms\"\n req.headers = rest_headers\n end\n\n @vms = json(response.body)[:vms]\n end", "def getVMs\n @vms = VirtualMachine.all(@ip_address)\n end", "def fetch_source_vms(machines)\n m...
[ "0.6139468", "0.6089622", "0.58962965", "0.574113", "0.5641018", "0.55559736", "0.5500894", "0.543942", "0.5426199", "0.54239506", "0.5413929", "0.5385825", "0.5378813", "0.5377976", "0.5376633", "0.5367271", "0.53434896", "0.53380436", "0.533247", "0.5331492", "0.5318471", ...
0.0
-1
Walk the list of chef nodes and vivify the server, associate the chef node if the chef node knows about its instance id, memorize that for lookup when we discover cloud instances.
def discover_chef_nodes! chef_nodes.each do |chef_node| if chef_node["cluster_name"] && chef_node["facet_name"] && chef_node["facet_index"] cluster_name = chef_node["cluster_name"] facet_name = chef_node["facet_name"] facet_index = chef_node["facet_index"] elsif ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_chef_vars(instances, &block)\n instances.each { |inst|\n query = \"name:#{inst['server_name']}\"\n query_nodes = Chef::Search::Query.new\n query_nodes.search('node', query) do |node_item|\n yield node_item\n end\n }\n end", "def configu...
[ "0.65978086", "0.5968856", "0.5905545", "0.5733403", "0.5731529", "0.57278365", "0.5720704", "0.56708366", "0.5657499", "0.5551808", "0.5539001", "0.54826766", "0.5443563", "0.543581", "0.5435099", "0.5430089", "0.54233277", "0.5416663", "0.53843415", "0.53735346", "0.5356209...
0.6896865
0
Walk the list of servers, asking each to discover its chef client.
def discover_chef_clients! servers.each(&:chef_client) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def servers\n response = self.class.get(\"/#{self.class.account}/clients.xml\")\n response['clients'].map { |client| ScoutScout::Server.new(client) }\n end", "def auto_discover_nodes!\n @servers = execute(:all_nodes)\n end", "def on servers, opts = {}\n merge_opts_with_env opts\n (@servers...
[ "0.62424344", "0.61584276", "0.60496235", "0.60252994", "0.59080523", "0.589454", "0.58799773", "0.58003765", "0.5771883", "0.5767836", "0.5754896", "0.5738781", "0.5724092", "0.56879", "0.56797117", "0.56577253", "0.56380457", "0.5619802", "0.5615986", "0.5604066", "0.554220...
0.7904829
0
calling servers vivifies each facet's Ironfan::Server instances
def discover_ironfan! self.servers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def servers\n result = Gorillib::ModelCollection.new(item_type: Ironfan::Dsl::Server, key_method: :full_name)\n facets.each{ |f| f.servers.each{ |s| result << s } }\n result\n end", "def servers\n Vultr::Resource::Server.new(@faraday)\n end", "def servers\n svrs = @facets...
[ "0.7145249", "0.66080713", "0.65388787", "0.6312905", "0.62822276", "0.60124826", "0.59508574", "0.5913551", "0.5907443", "0.5907443", "0.58597666", "0.5858585", "0.5854561", "0.5836972", "0.5836008", "0.5815113", "0.5802215", "0.578478", "0.5779332", "0.5768619", "0.5741779"...
0.6009946
6
These two methods ape some of Slackbotsy that Alice relies on
def user_name "someone" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def weber; end", "def who_we_are\r\n end", "def probers; end", "def schubert; end", "def anchored; end", "def suivre; end", "def wrapper; end", "def mitch_hedberg; end", "def jack_handey; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end"...
[ "0.67654836", "0.6363704", "0.6188933", "0.6089054", "0.6052647", "0.5935243", "0.5876301", "0.5858875", "0.5852147", "0.5850302", "0.58452857", "0.58452857", "0.58452857", "0.58452857", "0.5840196", "0.5840196", "0.5833869", "0.5830786", "0.58242255", "0.5771378", "0.5752107...
0.0
-1
Browse submissions by subreddit
def browse(subreddit, options={}) subreddit = sanitize_subreddit(subreddit) options.merge! :handler => "Submission" if options[:limit] options.merge!({:query => {:limit => options[:limit]}}) end read("/r/#{subreddit}.json", options ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sub_reddits = SubReddit.all\n end", "def index\n @subreddits = Subreddit.all\n end", "def set_sub_reddit\n @sub_reddit = SubReddit.find(params[:id])\n end", "def index\n if params[:subreddit_id]\n @subreddit = Subreddit.where(:name => params[:subreddit_id]).first\n @link...
[ "0.7124004", "0.6855304", "0.63800204", "0.63184494", "0.6307528", "0.6185622", "0.6079092", "0.6066089", "0.6039154", "0.60340786", "0.5937841", "0.58817077", "0.58779365", "0.58456814", "0.58254373", "0.5818503", "0.58145064", "0.5807875", "0.57978475", "0.57711416", "0.576...
0.7769326
0
Initializes a remote shell session.
def initialize(uri,environment=nil,&block) @history = [] super(uri,environment,&block) replay if block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_ssh_session\n @ssh_session.close if !(@ssh_session.nil? or !@ssh_session.closed?)\n ssh_opts = ssh_connection_options\n @log.info(\"Opening ssh connection to #{ssh_opts[:host]} as user #{ssh_opts[:user]}\")\n @ssh_session = ::Net::SSH.start(ssh_opts[:host], ssh_opts[:user])\n ...
[ "0.6975127", "0.65724707", "0.6431692", "0.6420581", "0.6386613", "0.6327419", "0.62586087", "0.6249977", "0.62115073", "0.6206296", "0.6165593", "0.6151843", "0.61368924", "0.61168647", "0.6101461", "0.60865885", "0.60578173", "0.60405034", "0.6007472", "0.6000655", "0.59986...
0.0
-1
Enqueues a program to be ran in the session.
def run(program,*arguments) @history << [program, *arguments] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enq(*args)\r\n app.enq(self, args)\r\n end", "def queue_cmd(cmd)\n\t\tself.commands << cmd\n\tend", "def run_program_with runner\n @@runner_symbol = runner\n end", "def command_req_queue\n \"wamp:#{self.name}:command\"\n end", "def queue_cmd(cmd)\n\t\tconsole.queue_c...
[ "0.57491136", "0.5734303", "0.5511872", "0.54967755", "0.5449932", "0.5449932", "0.5425947", "0.54001933", "0.5372216", "0.5348943", "0.53467816", "0.53462094", "0.5310851", "0.52828926", "0.5279634", "0.52754384", "0.5260568", "0.52578545", "0.52032137", "0.51901215", "0.516...
0.50827545
25
Adds a command to be executed.
def exec(command) @history << [command] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(command)\n @commands_to_run << command\n end", "def addCommand(command)\n unless command.kind_of?(RedisCommand)\n raise TypeError, \"Invalid Command\"\n end\n @commandlists[command.command_name] = command\n end", "def register_command(cmd)\n registered_commands << cmd\n\n ...
[ "0.7877477", "0.7555394", "0.75349927", "0.75027055", "0.7497047", "0.74694115", "0.7417705", "0.73670626", "0.7326258", "0.7306705", "0.7241272", "0.7235677", "0.72229666", "0.72171885", "0.7144362", "0.71141005", "0.7061196", "0.70545775", "0.7052211", "0.69842535", "0.6981...
0.6433316
49
Enqueues an `echo` command to be ran in the session.
def echo(message) run 'echo', message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def echo(*args, **kwargs)\n queue EchoCommand, args, kwargs\n end", "def echo message\r\n command 'echo', message\r\n end", "def echo(string)\n @commands << \"echo #{string}\"\n end", "def append_echo(msg)\n @echo ? msg : \"\\n\" + msg\n end", "def puts(message)\n session_com...
[ "0.7714335", "0.7562441", "0.7102794", "0.6976715", "0.6913497", "0.6580129", "0.64754033", "0.63106734", "0.62989444", "0.621792", "0.6209111", "0.6181098", "0.60946697", "0.585637", "0.5790819", "0.57413363", "0.57351226", "0.57040066", "0.56962913", "0.5612091", "0.5587718...
0.7102279
3
Enqueues a directory change for the session.
def cd(path) @history << ['cd', path] if block_given? yield @history << ['cd', '-'] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directory=(dir)\n @queue << \"directory #{dir}\"\n end", "def folder_changed(choo_dir, choo_file)\n dir = choo_dir.filename\n choo_file.current_folder = dir\nend", "def watch(watched_dirs)\n watched_dirs << @directory\n end", "def sync\n callback = Proc.new do |modifie...
[ "0.66240084", "0.5848729", "0.5843797", "0.5791251", "0.5625955", "0.54738444", "0.5473036", "0.5415002", "0.53921956", "0.5387384", "0.5372037", "0.53523165", "0.5350159", "0.53392524", "0.5334873", "0.5329979", "0.5317721", "0.5306699", "0.5280638", "0.5203932", "0.519867",...
0.0
-1
Joins the command history together with ` && `, to form a single command.
def join commands = [] @history.each do |command| program = command[0] arguments = command[1..-1].map { |word| shellescape(word.to_s) } commands << [program, *arguments].join(' ') end return commands.join(' && ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join\n @history.map { |command| command.join(' ') }.join(' && ')\n end", "def command_join_string!\n (@mode == :pipe) ? \" | \" : \" && \"\n end", "def cmd_concat_operator\n\t\t\" & \"\n\tend", "def cmd_history argv\n setup argv\n msg run_cmd(\"history\")\n end", "def append(cmd)...
[ "0.83657336", "0.655436", "0.6490149", "0.60556024", "0.57919544", "0.57624817", "0.5724072", "0.56349045", "0.557734", "0.55674154", "0.55322087", "0.5494611", "0.5466595", "0.5460956", "0.5445618", "0.53817046", "0.53697", "0.53402126", "0.527912", "0.5226734", "0.5166557",...
0.77290756
1
Converts the URI to one compatible with SSH.
def ssh_uri unless @uri.host raise(InvalidConfig,"URI does not have a host: #{@uri}",caller) end new_uri = @uri.host new_uri = "#{@uri.user}@#{new_uri}" if @uri.user return new_uri end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh_uri\n new_uri = @uri.host\n new_uri = \"#{@uri.user}@#{new_uri}\" if @uri.user\n\n return new_uri\n end", "def ssh_url\n uri = URI.parse(git_url)\n uri.scheme = 'ssh'\n uri.path = ''\n uri.fragment = nil\n uri\n end", "def ssh_url\n uri = URI.parse(git_url)\n uri...
[ "0.7386018", "0.7084052", "0.7084052", "0.7084052", "0.6751908", "0.6751908", "0.6751908", "0.6596224", "0.6226065", "0.6226065", "0.6188683", "0.6083935", "0.59629595", "0.5927276", "0.5832705", "0.5826019", "0.58195454", "0.58195454", "0.57525903", "0.57496494", "0.57461923...
0.7585489
0
Starts a SSH session with the destination server.
def ssh(*arguments) options = [] # Add the -p option if an alternate destination port is given if @uri.port options += ['-p', @uri.port.to_s] end # append the SSH URI options << ssh_uri # append the additional arguments arguments.each { |arg| options << arg.to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_ssh(&session)\n config = self.class.ssh_config\n Net::SSH.start( config[:host],\n config[:user],\n config.fetch(:options, { }),\n &session )\n end", "def start\n conf = RecursiveOpenStru...
[ "0.79202706", "0.731813", "0.7121111", "0.711978", "0.70974183", "0.7092082", "0.68625164", "0.6806414", "0.67836416", "0.67721796", "0.67570144", "0.6696814", "0.6670026", "0.6657172", "0.6652661", "0.664511", "0.6638376", "0.6564653", "0.651227", "0.6475351", "0.6467406", ...
0.56969666
60
Replays the command history on the remote server.
def replay ssh(self.join) unless @history.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_history argv\n setup argv\n msg run_cmd(\"history\")\n end", "def replay(game)\n\t\t@moves.each { |move|\n\t\t\tmove.replay(game)\n\t\t}\n\tend", "def interactive_history_forward e\n if not @history.at_end\n store_in_history\n @history.foreward\n restore_from_history\n end\n...
[ "0.6385726", "0.5946922", "0.58703506", "0.58410007", "0.5822949", "0.56553656", "0.56212425", "0.56212425", "0.5502818", "0.54623795", "0.54347557", "0.5412227", "0.5393369", "0.5351581", "0.52871466", "0.5257497", "0.52570885", "0.52438754", "0.5216578", "0.5216578", "0.521...
0.8206218
1
given actor store the movie they are in
def get_actors_movies_ids(actor_moviedb_id) credits = Tmdb::People.credits(actor_moviedb_id) actors_movies = credits["cast"] actors_movies_ids = [] actors_movies.each do |movie| actors_movies_ids << movie["id"] end actors_movies_ids end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actors\n Actor.where(:movie_id => id)\n end", "def actors\n this_movies_performances = Performance.where(\"movie_id\" => self.id)\n\n this_movies_actors_ids = []\n this_movies_performances.each do |performance|\n this_movies_actors_ids << performance.actor_id\n end\n\n Actor.where(\"i...
[ "0.6881409", "0.6576189", "0.652976", "0.64663166", "0.6450976", "0.6377282", "0.6359186", "0.6270733", "0.62471694", "0.62311405", "0.6229493", "0.6228383", "0.6227405", "0.6185689", "0.61650467", "0.61602944", "0.6133937", "0.61001086", "0.6096293", "0.607067", "0.60617065"...
0.6225391
14
Gets all records currently stored in the repo.
def all copy_and_return(@records) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def records\n @records ||= search.records\n end", "def records\n @records ||= []\n end", "def all\n repository.all(self)\n end", "def all\n storage.map(&:repository)\n end", "def all\n Ribs.with_handle(self.database) do |h|\n h.all(self.metadata.p...
[ "0.71488833", "0.71295893", "0.7019961", "0.6678276", "0.66527516", "0.66292584", "0.6580683", "0.65593344", "0.64902467", "0.64512134", "0.64239603", "0.64144987", "0.63974017", "0.63543797", "0.63248557", "0.6299443", "0.6299443", "0.6299443", "0.6299443", "0.6299443", "0.6...
0.7308192
0
Finds a single record by its id.
def find(id) find_one do |record| record.id == id end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def find(id)\n find_by_id(id).tap { |result|\n if result.nil?\n raise RecordNotFound, \"#{self...
[ "0.85668963", "0.85668963", "0.8520119", "0.84583294", "0.84033626", "0.83976406", "0.8372884", "0.82651365", "0.8210715", "0.81107086", "0.8093826", "0.80820405", "0.80820405", "0.80773216", "0.8045423", "0.79820037", "0.79645956", "0.7961733", "0.7961733", "0.79486835", "0....
0.88328063
0
Finds the first record in the repository for a given query.
def find_one(&block) copy_and_return(@records.find(&block)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(query)\n @coll.find(query).first\n end", "def first_object(query, kwargs = {})\n objs = objects(query, kwargs)\n return objs.length > 0 ? objs[0] : nil\n end", "def first!\n first or raise RecordNotFound\n end", "def find_one(query={}, opts={})\n return nil unle...
[ "0.74313986", "0.73425186", "0.73067033", "0.721608", "0.71535355", "0.7141012", "0.7089554", "0.7077705", "0.7075799", "0.7005932", "0.69494396", "0.6886588", "0.6848912", "0.684863", "0.68231463", "0.6821111", "0.67916286", "0.67864305", "0.67864305", "0.6785049", "0.674787...
0.6160657
47
Finds all records in the repository for a given query.
def find_all(&block) copy_and_return(@records.select(&block)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_by_query(query, options={})\n find_by_query(:all, query, options)\n end", "def all(query); end", "def query(query_hash, options = {})\n\t \tget_records('-findquery', query_hash, options)\n\t end", "def for_query(query)\n all.find { |f| f.query == query }\n end", "def ...
[ "0.76915795", "0.67522085", "0.6742919", "0.66776264", "0.66691744", "0.66691744", "0.64811236", "0.64806163", "0.6357846", "0.6339344", "0.6330298", "0.6276869", "0.62387913", "0.6220127", "0.6217761", "0.6195358", "0.6139881", "0.6094584", "0.6093607", "0.60821456", "0.6040...
0.0
-1
Clones result or array and returns it ensuring any changes don't
def copy_and_return(result_or_array) if result_or_array.nil? nil elsif result_or_array.is_a?(Array) result_or_array.map {|r| copy_and_return(r) } else result_or_array.clone end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone; end", "def clone; end", "def clone; end", "def clone() end", "def clone\n copy(false)\n end", "def clone(*) end", "def clone(*) end", "def clone\n end", "def copy array\n array.map(&:clone)\nend", "def clone\n end", "def clone\n end", "def clone\n end", "def cl...
[ "0.68025506", "0.68025506", "0.68025506", "0.67390805", "0.6738215", "0.6692575", "0.6692575", "0.6662887", "0.66100407", "0.65831393", "0.65831393", "0.65831393", "0.64331347", "0.63769984", "0.6365408", "0.63442403", "0.63442403", "0.6339752", "0.6329446", "0.6320187", "0.6...
0.75133026
0
Saves the object to the persistance store. Returns true/falsed depending on the success of the operation,
def save(obj) # if obj.errors.empty? set_or_replace_record obj # true # else # false # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n put_object\n true\n end", "def save\n if valid?\n persist!\n true\n else\n false\n end\n end", "def save\n\t\tif valid?\n\t\t\tpersist!\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def save\n return false if not self.valid?\n ...
[ "0.8281773", "0.81680596", "0.81440884", "0.7815373", "0.7792592", "0.7752067", "0.77065074", "0.77048236", "0.7578825", "0.75239", "0.7464235", "0.7423626", "0.7404586", "0.73654175", "0.73261434", "0.7224234", "0.7216859", "0.7210023", "0.71884924", "0.7149584", "0.7133034"...
0.7128151
21
Inserts the record if it doesn't exist in the store and removes/inserts the record if it does.
def set_or_replace_record(obj) @records.delete_if {|record| record.id == obj.id } obj.id ||= (@id_counter += 1) # Dup to clean up any extra added pieces, like Errors @records << obj.dup obj end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_or_update record\n db_name = database_name_for(record)\n coll_name = collection_name_for(record)\n id = id_for(record)\n pointer = \"/#{db_name}/#{coll_name}/#{id}\"\n if id\n res = collection_for(record).update({:_id => id}, interpret(record), :ups...
[ "0.68983513", "0.6711953", "0.6616386", "0.65694463", "0.65632343", "0.6395709", "0.6302431", "0.6241969", "0.62393874", "0.62293595", "0.6203786", "0.6126948", "0.61130923", "0.60744876", "0.60596114", "0.60328984", "0.6026597", "0.5982317", "0.5960642", "0.5955086", "0.5920...
0.5922614
20
This method has to be implemented in the class
def persist(input_stream) raise "persist is not implemented" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def schubert; end", "def custom; end", "def custom; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def private_method\n end", "def refutal()\n end", "d...
[ "0.8311812", "0.73409015", "0.73409015", "0.6918052", "0.6890384", "0.6890384", "0.6883761", "0.6883761", "0.6883761", "0.6883761", "0.6854392", "0.67906344", "0.66915035", "0.66839635", "0.6617119", "0.6519539", "0.6519539", "0.6519539", "0.6519539", "0.6474937", "0.6425198"...
0.0
-1
MSSID MSSName LastUpdated DIGITFENCEINDEX DEFAULTHANDLING SERVICEKEY PROTOCOLTYPE DIGITSTYPE NETWORKLISTSINDEX NODEID SCFBUNDLEID GSMSCFADDR VERSION SSN
def load_entries_from_edw STDERR.puts "Loading Camel Criteria Data from EDW for #{mss_name}." data = [] SqlServer.create(EDW::SOURCE, EDW::DM_ALCATEL::DATABASE) do |db| db.query sql # puts db.fields data = db.data end data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_from_msats!(options = {})\n # Update local cache\n @msats_detail = raw_msats_nmi_detail(options)\n parse_msats_detail\n self\n end", "def smember(key, el)\n @client.sendmsg(\"SMEMBER #{key} #{el}\")\n read_response == \"true\"\n end", "def connection_status_mcnet_login;...
[ "0.50796944", "0.49557957", "0.49514386", "0.4943044", "0.48850223", "0.4847123", "0.47913426", "0.4766206", "0.470704", "0.4688812", "0.4686358", "0.46324703", "0.46183592", "0.46116048", "0.45825493", "0.4571226", "0.45686552", "0.45656937", "0.45457244", "0.4535827", "0.45...
0.0
-1