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
Create hash of ID : name for campaigns to reduce SQL queries
def map_current_campaign obj = Campaign.all obj.map { |i| {i.id => i.name} } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_id_to_name\n build_hash('id', 'name')\n end", "def make_name_to_id\n build_hash('name', 'id')\n end", "def name_to_id\n @name_to_id ||= build_hash('name', 'id')\n end", "def id_to_name\n @id_to_name ||= build_hash('id', 'name')\n end", "def hash\n \tcustom_...
[ "0.7076154", "0.68978345", "0.64494586", "0.6381707", "0.6318889", "0.6181594", "0.61018836", "0.60958326", "0.60492915", "0.60205233", "0.59977305", "0.59341717", "0.59311247", "0.59009004", "0.58809716", "0.5878962", "0.5867717", "0.58575815", "0.58214635", "0.58214635", "0...
0.60883975
8
Gets model ID based on model and record name
def get_id(model, name) id = 0 model.each do |hash| hash.each do |k, v| if v == name id = k.to_i end end end id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identifier(model)\n models[model]\n end", "def model_identifier\n raise 'Invalid' unless id\n \"#{self.class.name}##{id}\"\n end", "def model_id(model)\n \"#{model.class.name}_#{model.id}\"\n end", "def model_id(model)\n \"#{model.class.name}_#{model.id}\"\n end", "def mode...
[ "0.79415965", "0.76920384", "0.7648577", "0.7648577", "0.76384825", "0.74904454", "0.7464851", "0.7336254", "0.724609", "0.72034025", "0.7130989", "0.7076558", "0.70564365", "0.69469094", "0.6946889", "0.6895405", "0.682353", "0.6821909", "0.6782467", "0.67534894", "0.6664175...
0.73677665
7
Convert epoch to datetime
def create_timestamp(line) Time.strptime(line[1], '%Q') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch_time\n return time + epoch\n end", "def epoch_time(epoch)\n Time.at(epoch)\n end", "def epoch_from_date(date)\n\tdate.to_time.to_i\nend", "def parse_date(number)\n EPOCH + number\n end", "def epoch_now()\n Time.now.to_i\n end", "def epoch(t)\n if t.nil...
[ "0.7543322", "0.73945737", "0.7208017", "0.70204616", "0.6906099", "0.6894437", "0.6803816", "0.6625578", "0.6540396", "0.6496771", "0.639279", "0.63536924", "0.63092124", "0.63021076", "0.6268806", "0.6144256", "0.6092145", "0.6090771", "0.60146165", "0.5943346", "0.5856585"...
0.0
-1
Instantiates a new chatMessageMentionedIdentitySet and sets the default values.
def initialize() super @odata_type = "#microsoft.graph.chatMessageMentionedIdentitySet" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_input_set()\n return MentionsInputSet.new()\n end", "def new_input_set()\n return CreateDiscussionInputSet.new()\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.sharePointIdentitySet\"\n end", "def new_input_set()\n...
[ "0.5407633", "0.530626", "0.52582264", "0.514099", "0.5118158", "0.51073664", "0.5103081", "0.4988172", "0.49874946", "0.4927944", "0.49022213", "0.4893766", "0.48874784", "0.4848603", "0.48404488", "0.48087367", "0.48043317", "0.48032695", "0.47889948", "0.4775442", "0.47750...
0.7595744
0
The deserialization information for the current model
def get_field_deserializers() return super.merge({ "conversation" => lambda {|n| @conversation = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkConversationIdentity.create_from_discriminator_value(pn) }) }, }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end", "def serialized_attributes\n read_inheritable_attribute(\"attr_serialized\") || { }\n end", "def get_field_deserializers()\n return super.merge({\n \"detectionStatus...
[ "0.65103906", "0.63228637", "0.632284", "0.6309272", "0.6295075", "0.623873", "0.62322974", "0.6214971", "0.61998814", "0.619934", "0.61737543", "0.61737084", "0.6170426", "0.6162578", "0.6161866", "0.6157894", "0.61552656", "0.61428016", "0.61396116", "0.6137667", "0.611978"...
0.0
-1
Serializes information the current object
def serialize(writer) raise StandardError, 'writer cannot be null' if writer.nil? super writer.write_object_value("conversation", @conversation) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize\n end", "def serialize(object) end", "def serialize; end", "def serialize; end", "def serialize\n \n end", "def serialize\n raise NotImplementedError\n end", "def serialize\n raise NotImplementedError\n end", "def dump\r\n super + to_s\r\n end", ...
[ "0.7951372", "0.7645999", "0.7579812", "0.7579812", "0.7440032", "0.720861", "0.720861", "0.7207583", "0.7016516", "0.70007193", "0.6992252", "0.69838214", "0.69723576", "0.69666415", "0.69666415", "0.6942002", "0.69417155", "0.6933786", "0.6913977", "0.6891677", "0.68810964"...
0.0
-1
FIXME: list and view cause a lot of DB queries. GET /categories/list
def list @categories = current_user.categories.where locked: false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t@categories = Category.all\n\tend", "def index\n\t\t@categories = Category.all\n\tend", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.a...
[ "0.7994172", "0.7972839", "0.77720314", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", "0.7717609", ...
0.0
-1
Declaration of Sinatra setup
def setup Sinatra::Base.set :environment, :test end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n\t\tCapybara.app = Sinatra::Application.new\n\tend", "def setup\n Capybara.app = Sinatra::Application.new\n end", "def app\r\n Sinatra::Application\r\n end", "def app\n\tSinatra::Application.new\nend", "def initialize_server(port)\r\n set :port, port # Specify Port For Sinatra S...
[ "0.7710279", "0.7515303", "0.7465486", "0.7448955", "0.7435416", "0.7414839", "0.7400131", "0.7373367", "0.7373367", "0.73221964", "0.72735524", "0.72735524", "0.72735524", "0.72735524", "0.72735524", "0.72735524", "0.72735524", "0.7263015", "0.72208923", "0.7045224", "0.6971...
0.7864585
0
Sets up a Sinatra::Base subclass defined with the block given. Used in setup or individual spec methods to establish the application.
def mock_app(base=Sinatra::Base, &block) @app = Sinatra.new(base, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Padrino::Application, &b...
[ "0.7297808", "0.7297808", "0.7297808", "0.69814306", "0.69814306", "0.69814306", "0.69814306", "0.62156034", "0.61392915", "0.60577965", "0.60233897", "0.591671", "0.58503765", "0.5845827", "0.57181865", "0.56230164", "0.56179124", "0.56122386", "0.56106097", "0.5606689", "0....
0.73344165
0
Short for last_response.body. Making it easier to work with the returned body of a response
def body response.body.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def body\n last_response.body\nend", "def response_body\n @response[:body]\n end", "def response_body; end", "def response_body; end", "def body\n @response.body if success?\n end", "def json_body\n JSON.parse(last_response.body)\n end", "def body\n response&.body.to_s\n ...
[ "0.8419166", "0.77713126", "0.75321347", "0.75321347", "0.74801517", "0.7444741", "0.7412687", "0.7359754", "0.72698206", "0.7255496", "0.7229628", "0.7229628", "0.71953523", "0.71696174", "0.7160816", "0.71240616", "0.71134645", "0.70760125", "0.707424", "0.7061066", "0.7029...
0.7047496
20
alias_method :markup, :body Short for last_response.status. Making it easier to work with the returned status of a response
def status response.status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response body=nil, status=nil\n return @current.response unless body\n\n response.status status || 200\n response.body body\n throw :done\n end", "def api_response\n response api_html(to_markup)\n end", "def render_reply (status, message)\n\n format, type = determine_out_format\n\...
[ "0.65285236", "0.6528363", "0.6348456", "0.63042784", "0.6288949", "0.6288949", "0.6275204", "0.6266299", "0.62558866", "0.6246683", "0.6246683", "0.6178519", "0.6079838", "0.6046598", "0.60448015", "0.60319567", "0.60186493", "0.6017917", "0.5974721", "0.5967812", "0.5937977...
0.0
-1
Delegate other missing methods to response.
def method_missing(name, *args, &block) if response && response.respond_to?(name) response.send(name, *args, &block) else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method, *args, &block)\n @response.respond_to?(method) ? @response.__send__(method, *args, &block) : super\n end", "def method_missing(method_name, *args, &block)\n if Response.instance_methods(false).include?(method_name) || Array.instance_methods(false).include?(method_name)...
[ "0.76575166", "0.762057", "0.7241325", "0.7218816", "0.7218816", "0.69651294", "0.6798961", "0.66735494", "0.6624919", "0.6456614", "0.6456614", "0.6456614", "0.6456614", "0.6456614", "0.6456614", "0.6456614", "0.6456614", "0.6456614", "0.6456614", "0.6456614", "0.6456614", ...
0.70922744
5
Also check response since we delegate there.
def respond_to?(symbol, include_private=false) super || (response && response.respond_to?(symbol, include_private)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def got_response(response)\n end", "def call_response?\n false\n end", "def verify_response\n\n self.exec\n end", "def receive_response(response); end", "def handle_response(response); end", "def handle_response(response); end", "def handle_response(response)\n case response[:st...
[ "0.72302747", "0.7222957", "0.7157972", "0.6859478", "0.6850729", "0.6850729", "0.68425536", "0.6737989", "0.6686518", "0.66622806", "0.6619649", "0.6581509", "0.65772194", "0.65490526", "0.6502435", "0.649453", "0.6432881", "0.6432636", "0.6432636", "0.6432636", "0.6432636",...
0.0
-1
Flexible method to test the ERB output. Accepts custom :layout & :url options passed. ==== Examples erb_app "" body.should == 'some result' body.should have_tag(:some_tag) NB! the custom URL must be declared in the MyTestApp in order to work erb_app "", :url => "/customerburl" last_request.path_info.should == "/custome...
def erb_app(view, options = {}) options = {:layout => '<%= yield %>', :url => '/tests' }.merge(options) get options[:url], :view => view, :layout => options[:layout], :engine => :erb end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haml_app(view, options = {}) \n options = {:layout => '= yield ', :url => '/tests' }.merge(options)\n get options[:url], :view => view, :layout => options[:layout], :engine => :haml \n end", "def test_how_it_works \n get :how_it_works\n assert_response :success\n assert_templat...
[ "0.6673333", "0.5568919", "0.55681443", "0.54412574", "0.542656", "0.5401952", "0.53429693", "0.5338883", "0.5321159", "0.5320055", "0.5297228", "0.52932864", "0.52735025", "0.526888", "0.52497524", "0.5244317", "0.5235036", "0.5202835", "0.5172412", "0.5158828", "0.51383984"...
0.70759064
0
Flexible method to test the HAML output ==== Examples haml_app "= some_method('value')" body.should == 'some result' body.should have_tag(:some_tag) NB! the custom URL must be declared in the MyTestApp in order to work haml_app "= 'customhamlurl'.upcase", :url => "/customhamlurl" last_request.path_info.should == "/cust...
def haml_app(view, options = {}) options = {:layout => '= yield ', :url => '/tests' }.merge(options) get options[:url], :view => view, :layout => options[:layout], :engine => :haml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haml\n # needed to use haml with erb\n unless is_haml?\n init_haml_helpers\n end\n\n capture_haml do\n yield\n end\n end", "def test_how_it_works \n get :how_it_works\n assert_response :success\n assert_template 'how_it_works'\n end", "def verify_haml_existence\n ...
[ "0.58968645", "0.5442165", "0.5412636", "0.53744245", "0.5364073", "0.5346176", "0.5345619", "0.533941", "0.530055", "0.52807814", "0.52469015", "0.5216006", "0.5187339", "0.5185077", "0.51742464", "0.5147112", "0.5144904", "0.51395667", "0.51267797", "0.5119252", "0.5099658"...
0.6947243
0
Takes in object that belongsto user Checks whether its user is the same as the current user
def has_user_permission?(object) object and object.user and current_user and object.user == current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_owner?\n User.find(params[:user_id]) == current_user\n end", "def i_dont_own?(object)\n if(current_user.present? and object.user.present? and object.user.id.present? and (current_user.id == object.user.id))\n false\n else\n true\n end\n end", "def ==(other)\n self.class ...
[ "0.7385477", "0.73725533", "0.7207043", "0.7147117", "0.7147117", "0.7147117", "0.7146747", "0.71018106", "0.7067719", "0.6973133", "0.6964436", "0.69570905", "0.6941497", "0.69404936", "0.6938557", "0.6919989", "0.6886177", "0.6878821", "0.68653995", "0.68356293", "0.6800989...
0.0
-1
GET /bets GET /bets.json
def index if params[:match].present? && params[:user].present? @bets = Bet.where("match_id = ?","#{params[:match]}").where("user_id = ?","#{params[:user]}").order(:match_id).paginate(:page => params[:page], :per_page => 100) else if params[:match].present? @bets = Bet.where("match_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_bets\n @bets = Bet.where('owner = ? AND status != ? AND status != ?', params[:id], \"won\", \"lost\").to_a\n @bets.sort! {|x,y| x.id <=> y.id }\n render 'my-bets.json.jbuilder'\n end", "def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n ...
[ "0.72012347", "0.7153755", "0.7152996", "0.6877465", "0.67755765", "0.6765664", "0.67613935", "0.67014116", "0.66781926", "0.66459954", "0.6556469", "0.64943355", "0.6493282", "0.647705", "0.64469385", "0.6429107", "0.64146525", "0.6407468", "0.6400594", "0.6400594", "0.63914...
0.0
-1
GET /bets/1 GET /bets/1.json
def show respond_to do |format| if @bet.public? if params[:modal].present? format.html { render :show_modal, layout: false } else format.html { render :show } end else format.html { redirect_to '/404' } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baskets }\n end\n end", "def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet...
[ "0.70487636", "0.7009476", "0.6973065", "0.6912315", "0.67557585", "0.6748973", "0.6744951", "0.6688687", "0.66649526", "0.66623133", "0.6557058", "0.65371937", "0.65075505", "0.6496308", "0.6478005", "0.6440343", "0.6433474", "0.6424011", "0.6377692", "0.63746893", "0.635760...
0.0
-1
POST /bets POST /bets.json
def create @bet = Bet.new(bet_params) @bet.user = User.find(session[:user_id]) @modal = params[:modal].present? ? true:false respond_to do |format| if @bet.save if @modal format.html { redirect_to :root } else format.html { redirect_to @bet, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def create\n @bet = Bet.new(params[:bet])\n\n respond_to do |format|\n if @bet.save\n format.html { redirect_to @bet, notice: 'Bet was successfully created.' }\n format.json { render json: @be...
[ "0.63637143", "0.6326079", "0.6307491", "0.61378026", "0.60871506", "0.6051604", "0.60336953", "0.60268337", "0.5990327", "0.598453", "0.59775484", "0.59080195", "0.5892942", "0.5886788", "0.58627987", "0.5822075", "0.58182746", "0.58015615", "0.5789065", "0.5773754", "0.5744...
0.0
-1
PATCH/PUT /bets/1 PATCH/PUT /bets/1.json
def update respond_to do |format| @modal = params[:modal].present? ? true:false if !@bet.owner?(User.find(session[:user_id])) format.html { redirect_to '/404' } end if @bet.update(bet_params) if @modal format.html { re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @belt.update(belt_params)\n format.html { redirect_to @belt, notice: 'Belt was successfully upd...
[ "0.6545733", "0.644129", "0.63832885", "0.6369682", "0.6310062", "0.6253483", "0.62093407", "0.6206475", "0.62014115", "0.61857027", "0.6159483", "0.6144371", "0.6117626", "0.61127365", "0.6104617", "0.61045575", "0.6079003", "0.6079003", "0.6079003", "0.60639805", "0.6050984...
0.0
-1
DELETE /bets/1 DELETE /bets/1.json
def destroy respond_to do |format| if @bet.public? format.html { redirect_to '/404' } end @bet.destroy format.html { redirect_to bets_url, notice: 'Bet was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bet = Bet.find(params[:id])\n @bet.destroy\n\n respond_to do |format|\...
[ "0.6977481", "0.6823814", "0.6787822", "0.6787822", "0.677869", "0.67413366", "0.6717596", "0.66813517", "0.6680549", "0.6653353", "0.66492283", "0.66403115", "0.66353464", "0.6632616", "0.6627756", "0.66217786", "0.6616641", "0.66162986", "0.6599536", "0.65902275", "0.656381...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_bet @bet = Bet.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 bet_params params.require(:bet).permit(:match_id, :user_id, :bet, :bet_left_score, :bet_right_score, :yellow_card, :red_card, :own_goal, :extra_time, :penalty) 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
Early users of the service may not have an organisation linked to their user account. Because of this, we need to check for an organisation and create one if none is present. We also check for the mandatory organisation details to be complete before we can allow a user to create a new application.
def orchestrate_dashboard_journey create_organisation_if_none_exists(current_user) redirect_based_on_organisation_completeness(current_user.organisations.first) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_organisation_if_none_exists(user)\n\n # rubocop:disable Style/GuardClause\n unless user.organisations.any?\n\n logger.info \"No organisation found for user ID: #{user.id}\"\n\n create_organisation(user)\n\n end\n # rubocop:enable Style/GuardClause\n\n end", "def create_organisat...
[ "0.78181297", "0.7145008", "0.6606198", "0.65948856", "0.651268", "0.64830995", "0.6469862", "0.63971955", "0.6382056", "0.63760704", "0.63681823", "0.62876046", "0.62098324", "0.6185513", "0.6182824", "0.6171114", "0.6143213", "0.6137133", "0.6127855", "0.6127358", "0.612198...
0.6500736
5
Checks for the presence of mandatory fields on a given user. Returns true if all mandatory fields are present, otherwise returns false.
def user_details_complete(user) user_details_fields_presence = [] user_details_fields_presence.push(user.name.present?) user_details_fields_presence.push(user.date_of_birth.present?) user_details_fields_presence.push( ( user.line1.present? && user.townCity.present? && use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid?\n if field_validation\n required_fields_present? && present_fields_valid?\n else\n required_fields_present?\n end\n end", "def required_fields_valid?\n check_required\n errors.empty?\n end", "def required_fields_valid?\n check_required\n errors.empty?\n end", "def...
[ "0.70282835", "0.699866", "0.699866", "0.6807985", "0.6740561", "0.6692087", "0.6616173", "0.65824723", "0.65712595", "0.65283585", "0.6492556", "0.6486478", "0.647919", "0.64597505", "0.6424714", "0.64122283", "0.6390698", "0.6383535", "0.6348045", "0.6297988", "0.62785006",...
0.6608246
7
Checks for the presence of an organisation associated to a user and creates one if none exists
def create_organisation_if_none_exists(user) # rubocop:disable Style/GuardClause unless user.organisations.any? logger.info "No organisation found for user ID: #{user.id}" create_organisation(user) end # rubocop:enable Style/GuardClause end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_organisation(user)\n\n user.organisations.create\n\n logger.info \"Successfully created organisation ID: #{user.organisations.first.id}\"\n\n end", "def create\n @org = authed_user.orgs.build(org_params)\n\n respond_to do |format|\n if @org.save\n format.html { redirect_to @or...
[ "0.7949865", "0.6970669", "0.68213004", "0.6777257", "0.6763265", "0.67289746", "0.6706216", "0.6620233", "0.65424716", "0.65207916", "0.64913744", "0.6457572", "0.6456698", "0.6434342", "0.64207864", "0.6407305", "0.63839746", "0.63826334", "0.6318175", "0.6311072", "0.62859...
0.85736215
0
Creates an organisation and links this to the current_user
def create_organisation(user) user.organisations.create logger.info "Successfully created organisation ID: #{user.organisations.first.id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @organization = current_user.organizations.build(params[:organization])\n if @organization.save\n redirect_to @organization, :flash => { :success => \"Profile created!\" }\n else\n render 'pages/home'\n end\n end", "def create\n @org = authed_user.orgs.build(org_params)\n\n...
[ "0.76577175", "0.76489383", "0.74461126", "0.7264057", "0.72146213", "0.7184443", "0.71663165", "0.7146501", "0.7118448", "0.7096454", "0.69813603", "0.6970759", "0.69616", "0.69441825", "0.6939405", "0.6908393", "0.6854843", "0.68223614", "0.682138", "0.68147457", "0.6811193...
0.81704515
0
Redirects the user based on the completeness of their associated organisation If complete, we redirect to new_application_path, otherwise if an organisation is missing mandatory details, we redirect to the first page of the organisation section of the service
def redirect_based_on_organisation_completeness(organisation) if helpers.complete_organisation_details?(organisation) logger.info "Organisation details complete for #{organisation.id}" redirect_to(:start_an_application) else logger.info "Organisation details not complete for #{organisatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def org_redirection_method\n if org_present?\n redirect_to root_path if org_controller?\n else\n redirect_to new_organization_path unless org_controller?\n end\n end", "def orchestrate_dashboard_journey\n\n create_organisation_if_none_exists(current_user)\n\n redirect_based_...
[ "0.7521789", "0.74435115", "0.65203136", "0.6178472", "0.60928553", "0.5936647", "0.59279525", "0.5892715", "0.588387", "0.57915413", "0.57849777", "0.5767008", "0.57563585", "0.5710925", "0.5675158", "0.5622502", "0.5621261", "0.56199616", "0.5601298", "0.5596438", "0.559604...
0.8365631
0
Custom SSL for a zone create custom ssl for a zone
def create(certificate:, private_key:, bundle_method: nil) id_check('certificate', certificate) id_check('private_key', private_key) bundle_method_check(bundle_method) unless bundle_method.nil? # TODO: validate the cert/key using openssl? Could be difficult if they are # privately generated dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssl_generate_certificate\n Rex::Socket::SslTcpServer.ssl_generate_certificate\n end", "def ssl\n if @options[\"ssl-gen-self-signed-certs\"]\n puts \"Generating private key and certificate\"\n args = [\n \"-C\", HOSTNAME,\n \"-n\", HOSTNAME,\n \"-o\", @options[\"ssl-organ...
[ "0.6692864", "0.6639635", "0.66130596", "0.6436214", "0.64331895", "0.6393796", "0.6382922", "0.6341892", "0.63394785", "0.63394785", "0.633285", "0.62957764", "0.6279391", "0.6217941", "0.6184294", "0.6178944", "0.6125967", "0.6101913", "0.60956746", "0.6092554", "0.60895365...
0.0
-1
list custom ssl configurations
def list(page: 1, per_page: 50, order: 'priority', direction: 'asc', match: 'all') raise ("order must be one of #{VALID_ORDERS}") unless VALID_ORDERS.include?(order) raise ('direction must be asc || desc') unless (direction == 'asc' || direction == 'desc') raise ('match must be all || any') unless (match ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssl_options; end", "def ssl_options; end", "def list opts = {}\n get_with_size_and_position('ssl/v1', opts)\n end", "def ssl_opts; end", "def ssl\n conf['dashboard']['ssl']\n end", "def list\n Puppet::SSL::Certificate.search(\"*\").collect { |c| c.name }\n end", "def connection_op...
[ "0.71865004", "0.71865004", "0.69044715", "0.68966466", "0.6700768", "0.6655273", "0.6541844", "0.6518658", "0.64502263", "0.63685966", "0.63612264", "0.63439137", "0.63230723", "0.6320396", "0.62837726", "0.62828594", "0.627898", "0.6240322", "0.62237674", "0.62235266", "0.6...
0.0
-1
details of a single config
def show(configuration_id:) raise 'ssl configuration id required' if configuration_id.nil? cf_get(path: "/zones/#{zone_id}/custom_certificates/#{configuration_id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config\n overview[\"config\"]\n end", "def config\n info['Config']\n end", "def inspect\n @config.inspect\n end", "def get_config\n\t\tend", "def config\r\n\t\t\t\"<p>No additional configuration is available</p>\"\r\n\t\tend", "def name\n @config.name\n end", "def ge...
[ "0.7971245", "0.78522444", "0.7480634", "0.7058997", "0.7020148", "0.7002042", "0.69495475", "0.6925021", "0.6916561", "0.6877925", "0.6865401", "0.68594503", "0.6849955", "0.6821706", "0.6821706", "0.6821706", "0.68035775", "0.6777584", "0.6733366", "0.67140293", "0.6712077"...
0.0
-1
updates a custom ssl record
def update(id:, private_key: nil, certificate: nil, bundle_method: nil) id_check('id', id) id_check('private_key must be provided') if private_key.nil? bundle_method_check(bundle_method) data = {private_key: private_key, certificate: certificate, bundle_method: bundle_method} cf_patch(path: "/zones/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_custom_ssl(doc, sso_ssl)\n @logger.debug('sso - in update_key_store updating keyStore attribute')\n Utils.find_and_update_attribute(sso_ssl, 'id', 'ssoSSLConfig')\n Utils.find_and_update_attribute(sso_ssl, 'keyStoreRef', 'ssoKeyStore')\n Utils.find_and_update_attribute(sso_ssl, 'trus...
[ "0.6683319", "0.6177309", "0.6177309", "0.60592735", "0.60469145", "0.60253173", "0.5996167", "0.59877026", "0.59606767", "0.59511745", "0.59511745", "0.59263563", "0.5906694", "0.5899764", "0.58966684", "0.58562016", "0.5828952", "0.58202547", "0.5818765", "0.57739985", "0.5...
0.54997337
30
delete a custom ssl cert
def delete(id:) id_check('id', id) cf_delete(path: "/zones/#{zone_id}/custom_certificates/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_cert(cert={})\n request :delete, '/certs', cert\n end", "def delete(certificate_thumbprint)\n cert_delete(certstore_handler, certificate_thumbprint)\n end", "def delete_certificate(name)\n client.delete(\"/v1/auth/cert/certs/#{encode_path(name)}\")\n return true\n end", "d...
[ "0.8041754", "0.7120767", "0.7090872", "0.69652694", "0.6822441", "0.67899054", "0.65714157", "0.65528715", "0.64854175", "0.64469516", "0.64146054", "0.6376491", "0.63146925", "0.6281734", "0.6260256", "0.6257441", "0.62010187", "0.6192752", "0.6163464", "0.61002225", "0.609...
0.6075568
21
Cancels a call if its state is 'queued' or 'ringing'
def cancel! state_guard { modify_call 'Status' => 'cancelled' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancelled?\n !@call.status.nil? && @call.status.code == Core::StatusCodes::CANCELLED\n end", "def canceled?\n @state == :cancel\n end", "def cancel?(id); end", "def cancel!\n if charged && !canceled\n refund!\n recharge!\n end\n end", "def canceled?\n procedure = @...
[ "0.67196065", "0.64078265", "0.633724", "0.6331373", "0.629218", "0.6280712", "0.62430984", "0.6224813", "0.61552197", "0.6145176", "0.6143109", "0.61291987", "0.6093765", "0.60727894", "0.6067459", "0.6059929", "0.6026478", "0.5990281", "0.5982703", "0.59726465", "0.59560716...
0.7072537
0
Converts self into a new SQL LIKE pattern matching if self ends with another string.
def to_sql_ends_with "%#{to_sql_escaped_for_like}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sql_contains\n \"%#{to_sql_escaped_for_like}%\"\n end", "def match_wildcard_end_in_cached\n table[:cached].matches(end_wildcard)\n end", "def like(*args)\n SQL::StringExpression.like(*args)\n end", "def name_like(name)\n name = SqlHelper::escapeWildcards(name)\n ...
[ "0.6174873", "0.60932255", "0.56874967", "0.5680736", "0.56636417", "0.55166334", "0.5481247", "0.53501964", "0.53058934", "0.53004706", "0.525261", "0.5236964", "0.51421994", "0.5118042", "0.5118042", "0.5096226", "0.507465", "0.5030486", "0.50269735", "0.50234663", "0.50220...
0.71034104
0
Converts self into a new SQL LIKE pattern matching if self is part of another string.
def to_sql_contains "%#{to_sql_escaped_for_like}%" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_like(pattern)\n <<~SQL\n REPLACE(REPLACE(REPLACE(#{pattern},\n #{q('%')}, #{q('\\\\%')}),\n #{q('_')}, #{q('\\\\_')}),\n #{q('*')}, #{q('%')})\n SQL\n end", "def like(*args)\n SQL::StringExpressio...
[ "0.6563026", "0.6520488", "0.61499923", "0.6046988", "0.5924875", "0.5907662", "0.5907662", "0.58105934", "0.5804079", "0.5733385", "0.5726151", "0.57044226", "0.56629694", "0.56511515", "0.5634385", "0.5530775", "0.5458276", "0.5387186", "0.53379077", "0.53001803", "0.528621...
0.6658911
0
TODO: move this in a class in lib, path_prefix should be setable in Qwerty.options Use Pathname class: Or ViewResolver
def locate_template(document) view_prefix = 'cms' return File.join(view_prefix, document.template) unless document.template.blank? return File.join(view_prefix, document.node.get(:template)) unless document.node.get(:template).blank? paths = [document.title.parameterize('_'), document.permalink...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_paths; end", "def view_paths; end", "def view_paths; end", "def path; super; end", "def define_path_helpers; end", "def append_view_path(path); end", "def append_view_path(path); end", "def generate_path_from options\n options.path || view_model_path\n end", "def prepend_vi...
[ "0.7260806", "0.7260806", "0.7260806", "0.6420041", "0.64040077", "0.6296635", "0.6296635", "0.6265784", "0.6261759", "0.6261759", "0.61445254", "0.61133057", "0.61112523", "0.6072297", "0.60400695", "0.60400695", "0.60400695", "0.60400695", "0.60400695", "0.60400695", "0.604...
0.0
-1
show: only works directly with UUID, user does not have to be logged in
def show @answer = Answer.find_by_uuid(params[:id]) @question = @answer.question end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n if params[:id].present?\n @user = User.find_by_uuid(params[:id])\n else\n @user = current_user\n end\n end", "def show\n handle_hashed_id_query\n end", "def show\n \tuser = User.find params[ :user_id ]\n expose user, serializer: UserSerializer\n end", "def show\n ...
[ "0.77844805", "0.75898015", "0.7092063", "0.7058618", "0.70572174", "0.70507586", "0.69887227", "0.69830936", "0.6958208", "0.6952673", "0.6946933", "0.6945297", "0.6922035", "0.69215065", "0.691487", "0.69097567", "0.6905097", "0.68788797", "0.68696654", "0.68668693", "0.686...
0.0
-1
edit: only works directly with UUID, user does not have to be logged in
def edit @answer = Answer.find_by_uuid(params[:id]) if !@answer.pending? redirect_to(answer_path(@answer.uuid), notice: 'You have already answered this question.') and return end @question = @answer.question respond_to do |format| format.html # new.html.erb format.json { render j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uuid; end", "def uuid; end", "def uuid() = @uuid ||= SecureRandom.uuid", "def suuid; uuid; end", "def set_uuid\n @uuid = Uuid.find(params[:id])\n end", "def uuid\n SecureRandom.uuid\nend", "def to_param\n uuid\n end", "def to_param\n uuid\n end", "def to_param\n uuid\n end"...
[ "0.7095827", "0.7095827", "0.7091454", "0.705854", "0.6828241", "0.6823377", "0.66493684", "0.66493684", "0.66493684", "0.66325295", "0.6619036", "0.65588635", "0.6557898", "0.6556475", "0.6492582", "0.6492582", "0.6490238", "0.64811707", "0.6466435", "0.64542615", "0.6437964...
0.0
-1
update: only works directly with UUID, user does not have to be logged in
def update @answer = Answer.find_by_uuid(params[:id]) @question = @answer.question respond_to do |format| begin if @answer.update_attributes(params[:answer]) format.html { redirect_to answer_path(@answer.uuid), notice: 'Your answer was successfully saved.' } format.json { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if current_user.admin?\n respond_to do |format|\n if @uuid.update(uuid_params)\n format.html { redirect_to @uuid, notice: 'Uuid was successfully updated.' }\n format.json { render :show, status: :ok, location: @uuid }\n else\n format.html { render :edit }...
[ "0.73334724", "0.68829286", "0.6733881", "0.66651416", "0.6650292", "0.6566353", "0.6551616", "0.6542972", "0.6492964", "0.64654034", "0.6456026", "0.64432526", "0.63789016", "0.6373369", "0.6373369", "0.6373369", "0.6305351", "0.63048255", "0.6224067", "0.6220393", "0.620979...
0.0
-1
Autoplays background music Plays music called "[normal BGM]n" if it's night time and it exists
def autoplayAsCue if @map.autoplay_bgm if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/"+ @map.bgm.name+ "n") pbCueBGM(@map.bgm.name+"n",1.0,@map.bgm.volume,@map.bgm.pitch) else pbCueBGM(@map.bgm,1.0) end end if @map.autoplay_bgs pbBGSPlay(@map.bgs) end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autoplay\n if @map.autoplay_bgm\n if PBDayNight.isNight? && FileTest.audio_exist?(\"Audio/BGM/\"+ @map.bgm.name+ \"n\")\n pbBGMPlay(@map.bgm.name+\"n\",@map.bgm.volume,@map.bgm.pitch)\n else\n pbBGMPlay(@map.bgm)\n end\n end\n if @map.autoplay_bgs\n pbBGSPlay(@map.bgs...
[ "0.7930184", "0.7924129", "0.7843786", "0.7315316", "0.7315316", "0.7080407", "0.7057019", "0.69119024", "0.6865276", "0.6515543", "0.6221085", "0.6214753", "0.61974907", "0.6185453", "0.6180954", "0.6096908", "0.60731345", "0.60574985", "0.6037157", "0.60320395", "0.6017996"...
0.78785115
2
Plays background music Plays music called "[normal BGM]n" if it's night time and it exists
def autoplay if @map.autoplay_bgm if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/"+ @map.bgm.name+ "n") pbBGMPlay(@map.bgm.name+"n",@map.bgm.volume,@map.bgm.pitch) else pbBGMPlay(@map.bgm) end end if @map.autoplay_bgs pbBGSPlay(@map.bgs) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end", "def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end", "def autoplayAsCue\n if @map.autoplay_bgm\n if PBDayNight.isNight? && FileTest.audio_exist?(\"Audio/BG...
[ "0.74584305", "0.74584305", "0.74496603", "0.74298334", "0.733784", "0.73315203", "0.709724", "0.6909136", "0.68509966", "0.6708965", "0.6396589", "0.62327355", "0.61703265", "0.61506325", "0.614864", "0.6126944", "0.6108338", "0.60887957", "0.6044452", "0.6028612", "0.600757...
0.7335617
5
Override this method to handle logs in a custom manner
def log(level, message) @@logger_instance.log(level, message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logs\n end", "def logs\n\n end", "def log\n end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log_writer; end", "def error_log\n end", "def error_log\n end", "def error_log\n ...
[ "0.70685905", "0.69314194", "0.6758214", "0.67366207", "0.67366207", "0.67366207", "0.67366207", "0.67366207", "0.67366207", "0.67366207", "0.67366207", "0.6699041", "0.659872", "0.659872", "0.659872", "0.65744734", "0.6491919", "0.6491919", "0.6491919", "0.6491919", "0.64919...
0.0
-1
Write a function called&nbsp;stringifyNumbers&nbsp;which takes in an object and finds all of the values which are numbers and converts them to strings. Recursion would be a great way to solve this!
def stringify_numbers(obj) obj.update(obj) do |key, value| if value.class == Hash stringify_numbers(value) elsif value.class == Integer value = value.to_s end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ints_to_strings(data)\n case data\n when Hash\n data.map { |k, v| [k, ints_to_strings(v)] }.to_h\n when Array\n data.map { |x| ints_to_strings(x) }\n when Fixnum\n data.to_s\n else\n data\n end\nend", "def stringify_integers_deep!(hash)\n hash.each do |key, value|\n hash[key] =...
[ "0.64688605", "0.63523304", "0.622316", "0.6191036", "0.6176646", "0.6176646", "0.61760396", "0.5976946", "0.59364915", "0.59348744", "0.59039986", "0.5884703", "0.58753604", "0.58663726", "0.586503", "0.5846555", "0.58391714", "0.58318263", "0.5823943", "0.5810061", "0.57318...
0.7747452
0
GET /resolveds/1 GET /resolveds/1.xml
def show @resolved = Resolved.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @resolved } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resolved_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"resolved\", :fields => \"incident_number\" }\n end", "def new\n @resolved = Resolved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml...
[ "0.6337667", "0.6223259", "0.5900921", "0.58743036", "0.58713204", "0.577555", "0.57583016", "0.5732691", "0.57217723", "0.5720491", "0.57132196", "0.5683717", "0.5562539", "0.55259943", "0.5516401", "0.5480734", "0.54605955", "0.5451176", "0.5428828", "0.5399793", "0.5336731...
0.72619694
0
GET /resolveds/new GET /resolveds/new.xml
def new @resolved = Resolved.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @resolved } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @resolved = Resolved.new(params[:resolved])\n\n respond_to do |format|\n if @resolved.save\n format.html { redirect_to(@resolved, :notice => 'Resolved was successfully created.') }\n format.xml { render :xml => @resolved, :status => :created, :location => @resolved }\n e...
[ "0.7005335", "0.65837544", "0.64840305", "0.6404256", "0.6287968", "0.62053573", "0.6192134", "0.61356354", "0.60915166", "0.60695314", "0.5987923", "0.5976369", "0.5962804", "0.59565866", "0.5952361", "0.5947502", "0.5934915", "0.59124386", "0.5909561", "0.59049535", "0.5902...
0.7793708
0
POST /resolveds POST /resolveds.xml
def create @resolved = Resolved.new(params[:resolved]) respond_to do |format| if @resolved.save format.html { redirect_to(@resolved, :notice => 'Resolved was successfully created.') } format.xml { render :xml => @resolved, :status => :created, :location => @resolved } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @resolved = Resolved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resolved }\n end\n end", "def update\n @resolved = Resolved.find(params[:id])\n\n respond_to do |format|\n if @resolved.update_attributes(params[:resolved])\n ...
[ "0.6111651", "0.5964764", "0.5855442", "0.57891315", "0.5555157", "0.548681", "0.5316061", "0.5271442", "0.5108193", "0.50794345", "0.5020871", "0.50147074", "0.4890942", "0.48537752", "0.4834598", "0.4830299", "0.48238522", "0.47833225", "0.47790268", "0.4741849", "0.473511"...
0.7083474
0
PUT /resolveds/1 PUT /resolveds/1.xml
def update @resolved = Resolved.find(params[:id]) respond_to do |format| if @resolved.update_attributes(params[:resolved]) format.html { redirect_to(@resolved, :notice => 'Resolved was successfully updated.') } format.xml { head :ok } else format.html { render :action => "e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def create\n @resolved = Resolved.new(params[:resolved])\n\n respond_to do |format|\n if @resolved.save\n format.html { redirect_to(@resolved, :notice => 'Resolv...
[ "0.6062911", "0.59468746", "0.5827808", "0.56382275", "0.5562406", "0.5463031", "0.53950506", "0.5359699", "0.52849406", "0.5238515", "0.52361417", "0.5233792", "0.52218384", "0.5179663", "0.51772946", "0.51610214", "0.5156411", "0.5152463", "0.51264507", "0.5101786", "0.5082...
0.6956214
0
DELETE /resolveds/1 DELETE /resolveds/1.xml
def destroy @resolved = Resolved.find(params[:id]) @resolved.destroy respond_to do |format| format.html { redirect_to(resolveds_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ref = Ref.find(params[:id])\n @ref.destroy\n\n respond_to do |format|\n format.html { redirect_to(refs_url) }\n format.xml { head :ok }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par...
[ "0.6383092", "0.6255533", "0.61969423", "0.6190469", "0.6184803", "0.6177497", "0.6169496", "0.6149004", "0.61234474", "0.6105832", "0.607271", "0.6055782", "0.605395", "0.60362834", "0.6009023", "0.59909487", "0.5969025", "0.59130704", "0.5911353", "0.59039944", "0.5901722",...
0.7394927
0
Check if params of send_code contain correct data
def verify_send_code_data(params) params[:game].is_a?(Game) && params[:code_string].is_a?(String) && params[:user].is_a?(User) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isvalid?(code:)\n @channel.each { |k,v| return true if code == v[:code] }\n return false\n end", "def verify_code\n if params.include?(:phone_number) and params.include?(:activate_code)\n if User.exists?(:phone_number => params[:phone_number], :code => params[:activate_code])\n success...
[ "0.6714814", "0.6610825", "0.6470325", "0.647011", "0.631478", "0.6274081", "0.62718374", "0.6219423", "0.6204574", "0.6174848", "0.6149086", "0.61475474", "0.6113011", "0.61051387", "0.61009705", "0.6095494", "0.60717607", "0.60395247", "0.602552", "0.6023239", "0.6014676", ...
0.79901385
0
Check if params of get_hint contain correct data
def verify_get_hint_data(params) params[:game].is_a?(Game) && (params[:task].is_a?(Task) || params[:task_id].is_a?(String)) && params[:user].is_a?(User) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_hint?\n hint.present?\n end", "def has_hint?\n hint.present?\n end", "def hasHint?(hint)\n @hints.member?(hint)\n end", "def hint?\n !defined?(@hint) || @hint\n end", "def check_params; true; end", "def hint\n return @hint\n end", ...
[ "0.73922646", "0.73922646", "0.6799947", "0.66451967", "0.63588846", "0.6092694", "0.6039908", "0.592412", "0.5831437", "0.56918466", "0.5680528", "0.56804514", "0.5654063", "0.565146", "0.564876", "0.5625007", "0.5611272", "0.5603009", "0.5594416", "0.55669993", "0.55550045"...
0.79681665
0
Check if params of get_hint contain correct data
def verify_get_code_by_action_bonus_data(params) params[:game].is_a?(Game) && (params[:bonus].is_a?(TeamBonus) || params[:bonus_id].is_a?(String)) && (params[:code].is_a?(Code) || params[:code_id].is_a?(String)) && params[:user].is_a?(User) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_get_hint_data(params)\n params[:game].is_a?(Game) &&\n (params[:task].is_a?(Task) || params[:task_id].is_a?(String)) &&\n params[:user].is_a?(User)\n end", "def has_hint?\n hint.present?\n end", "def has_hint?\n hint.present?\n end", "def hasHint?(...
[ "0.79681665", "0.73922646", "0.73922646", "0.6799947", "0.66451967", "0.63588846", "0.6092694", "0.6039908", "0.592412", "0.5831437", "0.56918466", "0.5680528", "0.56804514", "0.5654063", "0.565146", "0.564876", "0.5625007", "0.5611272", "0.5603009", "0.5594416", "0.55669993"...
0.555252
22
Check if params of get_hint contain correct data
def verify_attach_unzoned_codes_data(params) params[:game].is_a?(Game) && params[:codes].is_a?(Hash) && params[:user].is_a?(User) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_get_hint_data(params)\n params[:game].is_a?(Game) &&\n (params[:task].is_a?(Task) || params[:task_id].is_a?(String)) &&\n params[:user].is_a?(User)\n end", "def has_hint?\n hint.present?\n end", "def has_hint?\n hint.present?\n end", "def hasHint?(...
[ "0.7968383", "0.7392975", "0.7392975", "0.68008536", "0.66462916", "0.6359213", "0.6092547", "0.6040275", "0.5924522", "0.5832312", "0.5691861", "0.56805384", "0.5680171", "0.5654644", "0.5652281", "0.56502277", "0.5625629", "0.5612086", "0.5604159", "0.5594013", "0.55673456"...
0.0
-1
before_action :load_resource, except: [:index, :create]
def index session[:return_to] = request.url super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_singular_resource\n raise Exception.new(\"#{params[:controller].capitalize} controller has not implemented load_singular_resource\")\n end", "def load_resource(*args)\n ControllerApe.add_before_filter(self, :load_resource, *args)\n end", "def load_resource_instance\n if new_acti...
[ "0.67501354", "0.66817766", "0.6601599", "0.6578841", "0.65582424", "0.6505745", "0.6409212", "0.61365706", "0.6123581", "0.6103933", "0.60084516", "0.60084516", "0.60084516", "0.60084516", "0.60084516", "0.60084516", "0.60084516", "0.60084516", "0.5958172", "0.5926867", "0.5...
0.0
-1
This mixin overrides the exploit method so that it can initiate the service that corresponds with what the client has requested.
def exploit start_service() print_status("Server started.") # Call the exploit primer primer # Wait on the service to stop self.service.wait end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_request(service); end", "def service; end", "def service; raise NotImplementedError; end", "def set_service\n @service = Service.find(params[:id])\n @service = @service.becomes(@service.type.constantize) if @service.valid?\n @service.current_request = request\n end", "def met...
[ "0.670004", "0.6322625", "0.6247485", "0.611292", "0.6107348", "0.6037987", "0.6037987", "0.6017639", "0.5993595", "0.5927916", "0.58882236", "0.58779126", "0.5855161", "0.58319545", "0.5824642", "0.582319", "0.5781958", "0.57794297", "0.575847", "0.5755661", "0.5750781", "...
0.63678855
1
Primer method to call after starting service but before handling connections
def primer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def did_start_up\n end", "def ensure_service!\n raise \"Must have active connection\" unless @service\n end", "def ensure_service!\n raise \"Must have active connection\" unless @service\n end", "def ensure_service!\n raise \"Must have active connection\"...
[ "0.67051363", "0.6669582", "0.6669582", "0.6669582", "0.6669582", "0.6593877", "0.6592083", "0.6592083", "0.6532684", "0.6528277", "0.6526006", "0.6489839", "0.6489839", "0.6488107", "0.6452728", "0.6448638", "0.643695", "0.638886", "0.63638085", "0.6352772", "0.6352772", "...
0.0
-1
Stops the service, if one was created.
def cleanup super if(service) stop_service() print_status("Server stopped.") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_service\n DRb.stop_service\n end", "def stop\n DRb.stop_service\n end", "def stop\n server.synchronize do\n File.unlink(service_link) if File.symlink?(service_link)\n sleep(1) until !server.running?\n end\n end", "def service_stop; end", "def service_stop(name)\n...
[ "0.7722823", "0.76764166", "0.7660551", "0.7592391", "0.7544221", "0.73828405", "0.73231936", "0.72241324", "0.7172199", "0.71324795", "0.71324795", "0.70601696", "0.7016538", "0.70093304", "0.69802064", "0.6973314", "0.69698995", "0.69499576", "0.6931087", "0.691559", "0.684...
0.6745907
27
Called when a client has data available for reading.
def on_client_data(client) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_readable\n if @zk_client.running?\n\n read_io_nb if @zk_client.dispatch_next_callback(false)\n\n elsif attached?\n logger.debug { \"#{self.class.name}: @zk_client was not running? and attached? #{attached?}, detaching!\" }\n detach\n end\n end", "def listening(cl...
[ "0.66961265", "0.6253309", "0.6241255", "0.6038009", "0.5990247", "0.59676754", "0.59378904", "0.59191173", "0.5898489", "0.5876737", "0.5822041", "0.58034533", "0.5801588", "0.57793266", "0.5742865", "0.57339513", "0.5732218", "0.572142", "0.5675374", "0.5630761", "0.5614878...
0.68299854
0
Starts the service. Override this method in consumers
def start_service(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start\n\t\t\t@named.each do |name, service|\n\t\t\t\tConsole.logger.debug(self) {\"Starting #{name}...\"}\n\t\t\t\tservice.start\n\t\t\tend\n\t\tend", "def start\n\t\t\t@named.each do |name, service|\n\t\t\t\tAsync.logger.debug(self) {\"Starting #{name}...\"}\n\t\t\t\tservice.start\n\t\t\tend\n\t\tend", "d...
[ "0.762043", "0.76060194", "0.7326073", "0.7075979", "0.70736426", "0.7045681", "0.7032156", "0.70176035", "0.69886553", "0.69886553", "0.69759756", "0.68589246", "0.68511516", "0.6824913", "0.680188", "0.67930424", "0.6780766", "0.67544883", "0.67357826", "0.67199016", "0.671...
0.7179652
3
Returns the local host that is being listened on.
def srvhost datastore['SRVHOST'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_host\n get('beef.http.host') || '0.0.0.0'\n end", "def server_host\n Socket.gethostname\n end", "def host\n\t\t\t# FIXME: This is both a hack and the best way I know to do this.\n\t\t\tSocket.getaddrinfo(Socket.gethostname, 0)[0][2]\n\t\tend", "def getlocalname\n if [nil, '0...
[ "0.7858572", "0.7677472", "0.73947304", "0.73888874", "0.73113203", "0.73105216", "0.72241426", "0.718445", "0.71839494", "0.71839494", "0.7164666", "0.71296924", "0.70734847", "0.7047482", "0.70388925", "0.7018183", "0.70180184", "0.7012319", "0.6970533", "0.69619447", "0.69...
0.0
-1
Returns the local port that is being listened on.
def srvport datastore['SRVPORT'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_port\n socket = Socket.new(:INET, :STREAM, 0)\n socket.bind(Addrinfo.tcp(\"127.0.0.1\", 0))\n port = socket.local_address.ip_port\n socket.close\n port\n end", "def local_port\n return @local_port\n end", "def local_port\n get('beef.http.po...
[ "0.8475594", "0.843552", "0.7994834", "0.7780935", "0.76213557", "0.7593161", "0.75741357", "0.75125724", "0.7474071", "0.745969", "0.73054665", "0.73050964", "0.7266612", "0.71966857", "0.7177048", "0.71582216", "0.7105814", "0.7105814", "0.71044225", "0.70962656", "0.709594...
0.0
-1
Regenerates the payload, substituting the current RHOST and RPORT with the supplied client host and port from the socket.
def regenerate_payload(cli, arch = nil, platform = nil, target = nil) ohost = datastore['RHOST'] oport = datastore['RPORT'] p = nil begin # Update the datastore with the supplied client peerhost/peerport datastore['RHOST'] = cli.peerhost datastore['RPORT'] = cli.peerport if ((...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reopen\n close\n @socket = UDPSocket.new\n host, port = server.split(\":\")\n @socket.connect(host, port.to_i)\n end", "def reopen\n close\n @socket = UDPSocket.new\n host, port = server.split(':')\n @socket.connect(host, port)\n end", ...
[ "0.5669525", "0.5627997", "0.55657756", "0.5393999", "0.529191", "0.5278038", "0.51767766", "0.51605326", "0.51430005", "0.5136263", "0.5086093", "0.5078593", "0.5056923", "0.5056119", "0.50454813", "0.50441873", "0.5042458", "0.49330926", "0.49270806", "0.49047974", "0.49011...
0.6532635
0
Determines appropriate listener comm
def _determine_server_comm(srv_comm = datastore['ListenerComm'].to_s) case srv_comm when 'local' comm = ::Rex::Socket::Comm::Local when /\A[0-9]+\Z/ comm = framework.sessions[srv_comm.to_i] raise(RuntimeError, "Socket Server Comm (Session #{srv_comm}) does not exist") unless comm rai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listener=(_arg0); end", "def listener; end", "def listen(p0) end", "def listen(p0) end", "def listen(p0) end", "def listeners; end", "def listen(listener, who)\n @listeners[who] ||= []\n @listeners[who] << listener\n end", "def current_listener\n @current_listener = Listener.first\n en...
[ "0.6020698", "0.59721977", "0.5666783", "0.5666783", "0.5666783", "0.56547475", "0.5607788", "0.55163753", "0.55102426", "0.55070275", "0.55001354", "0.5484072", "0.5474986", "0.54712343", "0.53967947", "0.53467685", "0.5340723", "0.53358895", "0.5296327", "0.5267737", "0.523...
0.6844925
0
Open the menu. Specify a path to show where the menu was opened.
def open(path) @last_path = path @gtk_menu.popup(nil, nil, 0, 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_project(path)\n UI.puts \"Opening '#{path}'\"\n `open \"#{path}\"`\n end", "def select_menu(path)\r\n menu_item(path).click\r\n end", "def menu_open\n @open_signals.each do |signal|\n signal.call(@last_path, :open)\n end\n end", "def open_menu\n ...
[ "0.7236599", "0.7119136", "0.6563683", "0.6365264", "0.62756884", "0.6270899", "0.6141986", "0.6025522", "0.6008375", "0.5995364", "0.59888345", "0.5965301", "0.59177387", "0.58649343", "0.5836241", "0.5751077", "0.5747301", "0.57427454", "0.57184535", "0.5682301", "0.5677643...
0.8435782
0
Add a block that will be called when the user choose to open a file The block take two argument: the path to the file to open, and a symbol to indicate the kind: :open, :split_open, :tab_open
def add_open_signal(&block) @open_signals << block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(file, mode='r', &block)\n if @default == :open_file\n open_file file, mode, &block\n else\n open_hg file, mode, &block\n end\n end", "def open!(file, *args, &block); end", "def open_files *o\n activate\n end", "def open path, mode=\"r\"...
[ "0.6955246", "0.68464875", "0.66490185", "0.66344357", "0.6615029", "0.65609026", "0.65452677", "0.6544384", "0.6500942", "0.63249916", "0.6304904", "0.6268143", "0.6234346", "0.62174207", "0.6214982", "0.6197563", "0.6051085", "0.6034184", "0.6015431", "0.59020585", "0.58805...
0.52760094
79
Add a block that will be called when the user choose to refresh the file tree. The block doesn't take an argument.
def add_refresh_signal(&block) @refresh_signals << block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_add(&block)\n @tree.initial_add(&block)\n do_refresh\n\n ## Launch a timer to refresh the file list\n #Gtk.timeout_add(Config[:files_refresh_interval] * 100000) do \n # puts \"Auto-refreshing\"\n # do_refresh\n # true\n #end\n end", "def block_node; end",...
[ "0.7674167", "0.6002323", "0.6002323", "0.5975834", "0.5951283", "0.58783627", "0.5863224", "0.5849644", "0.5849644", "0.58237207", "0.57717013", "0.5770175", "0.5737764", "0.5737764", "0.5737764", "0.5737764", "0.5737764", "0.5737764", "0.5737764", "0.5737764", "0.5737764", ...
0.56291133
38
Signals that a file must be opened
def menu_open @open_signals.each do |signal| signal.call(@last_path, :open) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_started(file, options); end", "def is_file_open?\n (@file_handle != nil)\n end", "def is_file_open?\n (@file_handle != nil)\n end", "def file!\n file or fail Error, \"no file is attached\"\n end", "def open?(filename); end", "def check_file\n super\n e...
[ "0.628477", "0.62499845", "0.62481654", "0.62428993", "0.624", "0.6217171", "0.61456376", "0.61322236", "0.6112772", "0.6061764", "0.6053029", "0.6051566", "0.6025264", "0.60179055", "0.5967822", "0.5829877", "0.5812253", "0.57990456", "0.5710255", "0.5707595", "0.5707595", ...
0.0
-1
Open a dialog to enter a new file name to create
def menu_new dialog = Gtk::FileChooserDialog.new("New file", @parent_window.gtk_window, Gtk::FileChooser::ACTION_SAVE, nil, [Gtk::Stock::CANCEL, G...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_btnNewFile_clicked\n filename = dialog_saveFile.newDialog\n if filename\n file_put_contents(filename, \"\")\n @gui[:fcbLocation].set_filename(filename)\n end\n end", "def set_NewFileName(value)\n set_input(\"NewFileName\", value)\n end", "def on_btnChooseFile_clicked(widg...
[ "0.7580716", "0.68728274", "0.6549308", "0.64609456", "0.64030826", "0.63820684", "0.6344817", "0.62873507", "0.6214176", "0.6188542", "0.6182718", "0.6182718", "0.6162469", "0.6162469", "0.6080447", "0.6048381", "0.6025884", "0.5949915", "0.59188694", "0.5917009", "0.5910322...
0.6950731
1
Open a dialog to enter a new folder name to create
def menu_new_folder dialog = Gtk::FileChooserDialog.new("New folder", @parent_window.gtk_window, Gtk::FileChooser::ACTION_CREATE_FOLDER, nil, [Gtk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_folder_chooser icon=Gtk::Stock::SAVE\n \n chooser = Gtk::FileChooserDialog.new(\"Choose a folder\", @glade.get_widget(\"mainWindow\"),\n Gtk::FileChooser::ACTION_CREATE_FOLDER,nil,\n [Gtk::Stock::CANCEL, Gtk::Dialog:...
[ "0.7007883", "0.6750825", "0.6602571", "0.6574745", "0.65604717", "0.63698393", "0.6288389", "0.6283467", "0.62638426", "0.62270314", "0.61818063", "0.6045135", "0.6023229", "0.6008298", "0.59897983", "0.59652215", "0.5956834", "0.59279907", "0.58986974", "0.5831073", "0.5815...
0.77928424
0
Open a dialog to enter a new name for a file or directory
def menu_rename dialog = Gtk::FileChooserDialog.new("Rename #{File.basename(@last_path)}", @parent_window.gtk_window, Gtk::FileChooser::ACTION_SAVE, nil, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name\n @rename_window.text = @info_window.name\n @rename_window.open\n @rename_window.activate\n end", "def set_NewFileName(value)\n set_input(\"NewFileName\", value)\n end", "def menu_svn_rename\n dialog = Gtk::FileChooserDialog.new(\"Rename #{File.basename(@last_path)}\...
[ "0.6943494", "0.6832721", "0.6769571", "0.66819155", "0.6628977", "0.64618856", "0.63064796", "0.6263818", "0.6180521", "0.61790556", "0.6156941", "0.613396", "0.6130249", "0.6122196", "0.61175025", "0.61175025", "0.6081002", "0.6078291", "0.6078291", "0.6048715", "0.60483986...
0.7037355
1
Open a dialog and ask the user if he really wants to delete the target file or directory. Note that for safety, directories can only be removed if they are empty.
def menu_delete name = File.basename(@last_path) dialog = Gtk::MessageDialog.new(@parent_window.gtk_window, Gtk::MessageDialog::Flags::MODAL, Gtk::MessageDialog::Type::QUESTION, Gtk::MessageDial...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def menu_svn_delete\n dialog = Gtk::MessageDialog.new(@parent_window.gtk_window,\n Gtk::MessageDialog::Flags::MODAL,\n Gtk::MessageDialog::Type::QUESTION,\n Gtk::MessageDialog::Button...
[ "0.6476803", "0.6367229", "0.6366906", "0.588791", "0.5747838", "0.57050353", "0.5633497", "0.5627531", "0.5616059", "0.5521007", "0.5510721", "0.5457537", "0.54568374", "0.5444363", "0.5430643", "0.5392572", "0.5391535", "0.53906614", "0.5358319", "0.5331218", "0.5285295", ...
0.71124244
1
Signals that the file tree must be refreshed
def menu_refresh @refresh_signals.each do |signal| signal.call end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild(event)\n info \"Rebuilding updates from file system\"\n end", "def notify_reloading\n notify(\"RELOADING=1\")\n end", "def refresh!\n load if changed?\n end", "def updated_by_last_action(true_or_false)\n super\n # If this file has been updated, notify our parent ...
[ "0.6731954", "0.6437294", "0.6249797", "0.622745", "0.6169263", "0.61690426", "0.61610794", "0.6109467", "0.6104685", "0.6078401", "0.6078401", "0.59234923", "0.58799535", "0.5858838", "0.58576524", "0.583337", "0.58309233", "0.5821612", "0.58006305", "0.57953537", "0.575834"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:name, :company_id, :approved, :role) 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
Method to create a list input: string of items separated by spaces steps: initialize an empty hash split string up by spaces (creating an array of the items) FOR EACH item in the array add it to the hash, setting the default quantity to 1 call the 'Method to print a list' on the hash output: return the hash Method to a...
def create_list_of(string_of_items) ary_of_items = string_of_items.split(' ') item_list = {} ary_of_items.each {|x| item_list[x] = 1} print_list(item_list) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_list_items(input_string)\n \n hsh = {}\n \n # create an array containing each item \n array_input = input_string.split(' ')\n \n # create a hash from the array (iterate), containing the information of key/value pairs \n array_input.each do |item|\n # set default quantity as value\n hsh[it...
[ "0.8271929", "0.8221906", "0.80897313", "0.8077826", "0.80100286", "0.8007987", "0.8005388", "0.79840285", "0.7980387", "0.79241824", "0.78049636", "0.77245164", "0.76289725", "0.7621532", "0.7604476", "0.7604144", "0.7568579", "0.75529754", "0.75518876", "0.75195676", "0.749...
0.0
-1
Default method, subclasses must override this
def run super # first, ensure we're fingerprinted require_enrichment uri = _get_entity_name html = http_get_body("https://URL/plugins/servlet/oauth/users/icon-uri?consumerUri=https://www.whatismyip.com/") if html =~ /<title>What Is My IP/ _create_linked_issue("atlassian_jira_oauth_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overrides; end", "def custom; end", "def custom; end", "def default; end", "def default; end", "def private; end", "def special\n override\n end", "def defaults\n super\n end", "def implementation; end", "def implementation; end", "def default\n end", "def defaults; end", ...
[ "0.7415348", "0.73554313", "0.73554313", "0.6991004", "0.6991004", "0.69613177", "0.69572926", "0.6824949", "0.6801543", "0.6801543", "0.67361915", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_article @article = Rails.cache.fetch "article-#{params[:id]}" do Article.find(params[:id]) 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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Bind the autoplayer algorithm with a player player:PlayerOnGame instance
def bind_player(player) @alg_player = player @log.info("[#{@alg_player.type}] Autoplayer #{@alg_player.type} bound with #{player.name}. Ignore actions predifined.") @action_queue = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_ai_player\n @bots << setup_player(:bot => true)\n end", "def player_of_game(game)\n game.player(self)\n end", "def set_player\n\n end", "def setup\n @turn_order_delegate = self\n @end_game_delegate = self\n #a = self.players.length if self.players\n #puts \"first player id: #{@play...
[ "0.6519462", "0.6368495", "0.6317016", "0.61702454", "0.6016159", "0.59253436", "0.59181714", "0.5895269", "0.58694696", "0.5867627", "0.58600295", "0.57421017", "0.5708928", "0.56554645", "0.56554645", "0.56554645", "0.56554645", "0.56554645", "0.56554645", "0.56554645", "0....
0.7715458
0
Determine the median of 4 elements in ary: ar[left] ar[left + gap ] ar[left + gap 2] ar[left + gap 3] Verify: ar[left + gap 2] contains median value
def median_of_four(ary, left, gap) i1 = left + gap i2 = i1 + gap i3 = i2 + gap i4 = i3 + gap val_1, val_2, val_3, val_4 = ary.values_at(i1, i2, i3, i4) if val_1 <= val_2 if val_2 <= val_3 if val_2 <= val_4 if val_3 > val_4 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def median\n sorted = @array.sort\n middle = ((@array.size + 1.0) / 2) - 1 # subscript of middle element of array, with .5 if there are two middle values\n if middle.floor == middle # middle is an integer\n sorted[middle]\n else\n (sorted[middle.floor] + sorted[middle.ceil]) / 2.0\n end\n ...
[ "0.78722024", "0.7866745", "0.77276677", "0.77250636", "0.76814103", "0.76579195", "0.7614672", "0.7590267", "0.7581101", "0.75783205", "0.7553505", "0.75453824", "0.75428987", "0.75336224", "0.7526204", "0.7524231", "0.7515193", "0.7500039", "0.74985456", "0.74806726", "0.74...
0.7933915
0
Insert with regard to gap
def insert(ary, low, right, gap) loc = low + gap while loc <= right i = loc - gap value = ary[loc] while i >= low && (cur_val = ary[i]) > value ary[i + gap] = cur_val i -= gap end ary[i + gap] = value loc += gap ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_at_bottom\n assume_bottom_position\n end", "def increase_gap\n\n @gap = @gap + 50\n\n end", "def increase_gap\n\n @gap = @gap + 50\n\n end", "def insert(p0, p1) end", "def before(val) insertion(val, 0) end", "def insert_after(range, content); end", "def insert_after(range, co...
[ "0.6902504", "0.68276554", "0.68276554", "0.67789406", "0.665606", "0.64846647", "0.64846647", "0.64846647", "0.64846647", "0.64846647", "0.64846647", "0.64846647", "0.64846647", "0.6474402", "0.6474402", "0.6474402", "0.6474402", "0.6474402", "0.6474402", "0.6474402", "0.647...
0.6603927
5
value to the closest precision of two. The argument will always be a float.
def solution(value) # enter your solution here value.round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(f)\n return (f * GeoRecord::SCALE).round.to_f / GeoRecord::SCALE\n end", "def round_float(float, places); end", "def precision_at_fraction_recall val\n @p.each_index do |i|\n return actual_precision(i) if tpr(i) < val\n end\n 0.0\n end", "def round_float(f...
[ "0.70201826", "0.6780403", "0.67802495", "0.672591", "0.6596702", "0.65944034", "0.6576844", "0.6510424", "0.649406", "0.6467226", "0.6464888", "0.6462574", "0.6432015", "0.6404657", "0.6404657", "0.631244", "0.62479573", "0.6237204", "0.62322664", "0.6220491", "0.6214318", ...
0.5980371
38
We keep a volatile copy of the raw token for initial communication The stored refresh_token may be mapped and not available in cleartext. Some strategies allow restoring stored secrets (e.g. symmetric encryption) while hashing strategies do not, so you cannot rely on this value returning a present value for persisted t...
def plaintext_token if secret_strategy.allows_restoring_secrets? secret_strategy.restore_secret(self, :token) else @raw_token end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plaintext_refresh_token\n if secret_strategy.allows_restoring_secrets?\n secret_strategy.restore_secret(self, :refresh_token)\n else\n @raw_refresh_token\n end\n end", "def refresh_token\n return nil unless (temp_refresh_token = read_attribute(:refresh_token))\n # logger...
[ "0.76498544", "0.76003456", "0.76003456", "0.7354128", "0.7299812", "0.72879046", "0.720145", "0.70815766", "0.70815766", "0.7063146", "0.7051899", "0.6994444", "0.6963738", "0.6936685", "0.6904326", "0.6876837", "0.68507427", "0.68168896", "0.6807058", "0.6801389", "0.677227...
0.7067614
9
Generates token value with UniqueToken class.
def generate_token @raw_token = Doorkeeper::OAuth::Helpers::UniqueToken.generate secret_strategy.store_secret(self, :token, @raw_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_token\n self.token = UniqueToken.generate\n end", "def generate_token\n if self.token.blank?\n self.id = self.token = UniqueToken.generate\n end\n end", "def assign_unique_token\n unless(self.token)\n begin\n self.token = rand(36**...
[ "0.83239883", "0.7600196", "0.7559753", "0.75551474", "0.7534787", "0.7373623", "0.7359469", "0.7204116", "0.7182965", "0.7142432", "0.71397275", "0.7101241", "0.7069843", "0.7042888", "0.7021282", "0.70152545", "0.700517", "0.70028013", "0.699539", "0.69651437", "0.6941267",...
0.67024666
41
isSymmetric?(setOfPairs) Given a set of pairs (an array of arrays), return true if the set represents a symmetric relation. Examples: isSymmetric?([[1,2],[2,1]]) should return true isSymmetric?([[1,1],[1,2],[2,1]]) should return true isSymmetric?([]) should return true isSymmetric?([[1,2],[2,1],[1,3]]) should return fa...
def isSymmetric?(pairs) # your code here end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_symmetric(node)\n symmetric_helper(node, node)\nend", "def symmetrical?(arr)\n\nend", "def is_symmetric(root)\n symmetric_helper(root, root)\nend", "def is_symmetric(root)\n isMirror(root, root)\nend", "def symmetric?\n @colt_property.isSymmetric(@colt_matrix)\n end", "def isSymmetr...
[ "0.65886307", "0.65842927", "0.6510373", "0.6433326", "0.64065754", "0.6166851", "0.61292475", "0.59733886", "0.5970983", "0.5845162", "0.5800768", "0.568112", "0.5650403", "0.5639411", "0.5634728", "0.5606743", "0.5592407", "0.5590179", "0.558732", "0.5585848", "0.5492668", ...
0.78865844
0
GET /users GET /users.json
def index @users = User.all 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.8208889", "0.7873795", "0.78585523", "0.7810331", "0.78043205", "0.76764965", "0.76579225", "0.76317936", "0.75821173", "0.7528563", "0.7488214", "0.74481684", "0.74393696", "0.7437317", "0.74257094", "0.7398454", "0.7398454", "0.7398454", "0.7398454", "0.73749185", "0.737...
0.0
-1
GET /users/1 GET /users/1.json
def show begin @user = User.find(params[:id]) rescue ActiveRecord::RecordNotFound redirect_to home_url, :notice => 'Invalid user.' else respond_to do |format| format.html # show.html.erb format.json { render json: @user } end end end
{ "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.81046426", "0.7703556", "0.77011716", "0.76262826", "0.7582106", "0.74818", "0.7461394", "0.7446168", "0.730656", "0.7300699", "0.72902125", "0.72781444", "0.72358584", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.722...
0.0
-1
GET /users/new GET /users/new.json
def new @user = User.new respond_to do |format| format.html # new.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n ...
[ "0.8287397", "0.8169197", "0.8155916", "0.80483407", "0.8022376", "0.8021751", "0.8009459", "0.7950995", "0.793078", "0.793078", "0.7873476", "0.7873476", "0.7873476" ]
0.7860956
87
POST /users POST /users.json
def create @user = User.new(params[:user]) respond_to do |format| if @user.save session[:username] = @user.username session[:name] = @user.name session[:id] = @user.id format.html { redirect_to home_url, notice: 'User was successfully created.' } format.json { rend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69...
0.0
-1
PUT /users/1 PUT /users/1.json
def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { re...
{ "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.74118364", "0.7391657", "0.7303552", "0.7253468", "0.720215", "0.707407", "0.70519817", "0.702646", "0.7005611", "0.69875664", "0.69819397", "0.6941456", "0.6939727", "0.69212985", "0.6907294", "0.68761027", "0.68474513", "0.68327546", "0.6820883", "0.679931", "0.67685133"...
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to users_url } format.json { head :ok } 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.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7245172", "0.7242216"...
0.7250935
30
Expected output: ['tea', 'water', 'soda water'] Creating a method beverages Parameters array, letter Select method include with the specific letter
def beverages(array, letter) array.select{|value| value.include?(letter)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_select array, letter\n # iterates\n array.each do |value|\n # checks for letter at each index\n if value.include?(letter)\n # if letter is included in value at index, puts value\n puts value\n end\n ...
[ "0.5975165", "0.59291774", "0.578874", "0.57280946", "0.5725126", "0.56660366", "0.5654365", "0.5599563", "0.5575811", "0.5560298", "0.5537749", "0.54981625", "0.54402673", "0.5411099", "0.53984284", "0.5378272", "0.53652763", "0.53652763", "0.53640777", "0.53508824", "0.5343...
0.6279463
0
Expected output: 'bby Rd' Create a methods called remove_vowels Parameter string Use delete method with argument of all lowercase and uppercase vowels
def remove_vowels string string.delete 'aeiouAEIOU' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_vowels(string)\n string.delete\"aeiouAEIOU\"\n# use the .delete accessor and include uppercase and lower case characters to be deleted\nend", "def vowel_delete string\n string.downcase.delete('aeiou')\nend", "def remove_vowel sentence\n sentence.delete 'aeiou'\nend", "def remove_vowels(s)\n s....
[ "0.7913878", "0.7910228", "0.785301", "0.7846157", "0.782858", "0.78087", "0.77897096", "0.7766627", "0.7755391", "0.7731524", "0.772457", "0.7676119", "0.7671815", "0.7671792", "0.765514", "0.76528627", "0.7599191", "0.7589001", "0.75558084", "0.7549121", "0.7542438", "0.7...
0.7777098
7
return 'Breakfest' 'Dinner' puts 'Dinner' end puts meal def count_sheep 5.times do |sheep| puts sheep if sheep >= 2 return end end end puts count_sheep
def tricky_number if true number = 1 else 2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_sheep \n 5.times do |sheep| \n puts sheep\n if sheep >= 2\n return\n end \n end \nend", "def count_sheep\n 5.times do |sheep|\n puts sheep\n return if sheep >= 2\n end\nend", "def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n en...
[ "0.873025", "0.86791986", "0.86326253", "0.86326253", "0.86326253", "0.86326253", "0.86326253", "0.86326253", "0.86326253", "0.86326253", "0.86326253", "0.86326253", "0.86326253", "0.81782573", "0.81782573", "0.81782573", "0.81782573", "0.81782573", "0.81782573", "0.81782573", ...
0.0
-1
If `factor` is omitted it is set to `delay_seconds` to reproduce legacy behavior.
def exponential(delay_seconds, options={}) factor = options.fetch(:factor, delay_seconds) fuzz_factor = options.fetch(:fuzz_factor, 0) lambda do |retry_no, error| unfuzzed = delay_seconds * factor**(retry_no - 1) return unfuzzed if fuzz_factor.zero? r = 2 * rand -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_delay\n 0.seconds\n end", "def delay\n @delay ||= 600\n end", "def default_delay\n @@default_delay ||= 0\n end", "def delay\n @delay || initial_delay\n end", "def delay\n @delay || initial_delay\n end", "def increment_delay!\n @delay = ...
[ "0.7088727", "0.6860023", "0.6717809", "0.67151207", "0.6684554", "0.65461016", "0.6544859", "0.6538749", "0.65301967", "0.64917713", "0.64068997", "0.63689643", "0.63689643", "0.6324902", "0.6324902", "0.63184816", "0.63168985", "0.63168985", "0.628459", "0.6203376", "0.6201...
0.51176393
97
def load_library(file) library = YAML.load_file(file) end def get_japanese_emoticon(name) load_library.each do |lib_name, emote| if lib_name == name return emote[1] end end end def get_english_meaning(j_emote) load_library.each do |lib_name, emote| if emote[1] == j_emote return lib_name end end end
def load_library(file_path) library = {"get_meaning" => {}, "get_emoticon" => {} } YAML.load_file(file_path).each do |meaning, array| english, japanese = array library["get_emoticon"][english] = japanese library["get_meaning"][japanese] = meaning end library end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_library(file_path)\n emoji_sheet = YAML.load_file(file_path)\n japanese_meaning = {}\n western_to_japanese = {}\n emoji_sheet.each do |meaning, emojis|\n japanese_meaning[emojis.last] = meaning\n western_to_japanese[emojis.first] = emojis.last\n end\n hash = {\"get_emoticon\" => western_to_jap...
[ "0.8475412", "0.84005886", "0.8205641", "0.81706583", "0.80123395", "0.7945182", "0.7891008", "0.7816877", "0.77234924", "0.76571524", "0.7604774", "0.75242144", "0.7522403", "0.7513193", "0.7485301", "0.7483769", "0.7482993", "0.7453498", "0.7441256", "0.734126", "0.7330555"...
0.86587995
0
This will create a new song on the station and publish it to redis
def create params[:song][:user_id] = current_user.id @song = Song.new(params[:song]) if @song.save redis_auth $redis.publish "new song", ActiveSupport::JSON.encode({ :station => params[:station_id], :user => current_user.name, :song => @song }) render :js => "ajaxCallback('#{params[:div]}'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song\n\t\tresponse.headers['Content-Type'] = 'text/javascript' # Tells Rails/Redis that content is JavaScript\n\t\troom = current_user.room\n\t\tnew_song_params = song_params\n\t\tnew_song_params[:added_by] = current_user.username\n\t\t# --- If this is the first song, set it as currently playing ---\n\t\ti...
[ "0.6869841", "0.6587061", "0.65864843", "0.64857095", "0.64829516", "0.6447169", "0.63210475", "0.6301608", "0.6299227", "0.629454", "0.62467104", "0.6197981", "0.6171954", "0.6144005", "0.60913205", "0.60401535", "0.6035704", "0.60191834", "0.59967715", "0.59806424", "0.5976...
0.74483186
0
click the element and wait for page to load TODO: wait on block instead if givven
def click_wait @webpage.click_wait(@locator) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_load_and_click(element)\n click_element(element, Utils.medium_wait)\n end", "def click\n\tbegin\n\t @selenium.click(@locator)\n\trescue => e\n\t sleep(3)\n\t @selenium.click(@locator)\n\tend\n\n\tbegin\n\t @selenium.wait_for_page_to_load\n\trescue => e\n\t sleep(2)\n\t @seleniu...
[ "0.85336345", "0.80110353", "0.7824987", "0.77155924", "0.7606101", "0.7599218", "0.7553668", "0.7507784", "0.73662615", "0.7349355", "0.7319956", "0.7298455", "0.7132013", "0.7131472", "0.69237196", "0.69185734", "0.68899816", "0.6836532", "0.6835787", "0.6823465", "0.682212...
0.8225942
1
initialize arguments can either be passed in as a hash or in the block if they are passed in as a hash they are saved in options
def initialize(options=Hash.new, &initializer) self.name = options[:name] self.age = options[:age] self.quote = options[:quote] @initializer = (initializer || Proc.new { |person| }) reinit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(options={}, &block)\n set_defaults\n apply_options(options, &block)\n end", "def initialize(&block)\n @required_options = []\n instance_exec &block\n end", "def initialize(options = {}, &block)\n\t\t \n\t\t\tyield self unless block == nil\n\t\tend", ...
[ "0.824411", "0.81815195", "0.7927815", "0.7864803", "0.7864803", "0.78312135", "0.7739417", "0.77381253", "0.77308303", "0.7595963", "0.75947887", "0.7515915", "0.74744403", "0.7467997", "0.7409546", "0.74093944", "0.73525417", "0.73377407", "0.7316734", "0.72992283", "0.7293...
0.6847457
65
calling the block defined in the method reinit
def reinit @initializer.call(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reapply_blocks\n @reapply_blocks ||= []\n end", "def post_init_block(&block)\n with(&block)\n end", "def reseter(&ruby_block)\n @reseter_proc = ruby_block\n end", "def reset!\n initialize\n end", "def reset(*args,&ruby_block)\n # Gain access ...
[ "0.6677806", "0.662658", "0.6621642", "0.6561954", "0.6514975", "0.6514975", "0.650402", "0.64942265", "0.64942265", "0.6439536", "0.64043677", "0.64043677", "0.64043677", "0.64043677", "0.63286567", "0.6327124", "0.6266411", "0.6257549", "0.6184108", "0.6179074", "0.61693424...
0.74737424
0
GET /engineering_projects GET /engineering_projects.json
def index order = sortable_column_order, "project_number desc" @engineering_projects = EngineeringProject.paginate page: params[:page], order: order, per_page: 25 respond_to do |format| format.html # index.html.erb format.json { render json: @engineering_projects } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def projects\n request(method: 'getAllProjects')\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def index\n if params.has_key?(:offered)\n # mapping for url : /api/version/users/1/projects\n @projects = @parent.offered_projects.all\n elsif params.has_key?(...
[ "0.75617987", "0.74024093", "0.7265072", "0.71840125", "0.71648496", "0.71592647", "0.70759004", "0.70752716", "0.7038061", "0.7029686", "0.7002877", "0.6980959", "0.69573736", "0.6949818", "0.6947772", "0.6945581", "0.69132847", "0.69131714", "0.69095904", "0.68697226", "0.6...
0.6949093
14