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
POST /page_layouts POST /page_layouts.json
def create @page_layout = PageLayout.new(params[:page_layout].permit(:content_type, :name, :num_panels, :html_content, :preview_content)) respond_to do |format| if @page_layout.save format.html { redirect_to @page_layout, notice: 'Page layout was successfully created.' } format.json { render json: @page_layout, status: :created, location: @page_layout } else format.html { render action: "new" } format.json { render json: @page_layout.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @page_layout = PageLayout.new(page_layout_params)\n\n respond_to do |format|\n if @page_layout.save\n format.html { redirect_to @page_layout, notice: 'Page layout was successfully created.' }\n format.json { render :show, status: :created, location: @page_layout }\n else\...
[ "0.69990563", "0.6583946", "0.6574872", "0.6369562", "0.6280874", "0.6273467", "0.62604433", "0.61786604", "0.61393356", "0.61302334", "0.6099715", "0.60451514", "0.6017372", "0.59939104", "0.5958494", "0.5947139", "0.5909881", "0.58079875", "0.57904464", "0.5782169", "0.5772...
0.68761873
1
PUT /page_layouts/1 PUT /page_layouts/1.json
def update @page_layout = PageLayout.find(params[:id]) respond_to do |format| if @page_layout.update_attributes(params[:page_layout].permit(:content_type, :name, :num_panels, :html_content, :preview_content)) format.html { redirect_to @page_layout, notice: 'Page layout was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @page_layout.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @page_layout.update(page_layout_params)\n format.html { redirect_to @page_layout, notice: 'Page layout was successfully updated.' }\n format.json { render :show, status: :ok, location: @page_layout }\n else\n format.html { render :edit }\n ...
[ "0.69732124", "0.65983593", "0.63687336", "0.6293352", "0.6200896", "0.616221", "0.6065516", "0.60508513", "0.5994529", "0.59830374", "0.5922484", "0.59045666", "0.5865171", "0.5855048", "0.58503294", "0.58223206", "0.58223206", "0.57966095", "0.5776531", "0.5757416", "0.5751...
0.70146316
0
DELETE /page_layouts/1 DELETE /page_layouts/1.json
def destroy @page_layout = PageLayout.find(params[:id]) @page_layout.destroy render nothing: true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @page_layout.destroy\n respond_to do |format|\n format.html { redirect_to page_layouts_url, notice: 'Page layout was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page_layout = PageLayout.find(params[:id])\n @page_layout.destro...
[ "0.7612717", "0.7445287", "0.6877057", "0.6825137", "0.67758924", "0.67735666", "0.67633116", "0.67560697", "0.6709093", "0.6704735", "0.67003274", "0.66938627", "0.66914994", "0.66914994", "0.66840386", "0.6672112", "0.6660483", "0.6656724", "0.6643532", "0.6624787", "0.6607...
0.7393379
2
To include name in slug generation if iso is not unique
def iso_id_candidates [:iso, [:iso, :name]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_slug\n self.slug = name.parameterize if name.present?\n end", "def slug\n @attributes[:slug] = @attributes[:name] && PublicEarth::Db::Collection.create_slug(@attributes[:name]) unless @attributes[:slug] \n @attributes[:slug]\n end", "def generate_slug\n self.slug = self.n...
[ "0.7597248", "0.7539618", "0.7444704", "0.7344496", "0.7309511", "0.7307128", "0.7300593", "0.72906995", "0.7270576", "0.7270576", "0.72520244", "0.72520244", "0.72429913", "0.72373813", "0.7209783", "0.7208416", "0.720004", "0.71561265", "0.71561265", "0.71508646", "0.714688...
0.0
-1
Returns the comment with the most nods Ties are broken by recency
def hottest_comment unless comments.empty? comments.map{|c| [c,c.votes.count]}.sort{|x,y| y[1] <=> x[1]}.first[0] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highest_rating_comment\r\n comments.rating_desc.pluck(:body).first\r\n end", "def get_most_comments_made(num_users = 5)\n get_most_generic_for_users(DOCS[:most_comments_made], num_users)\n end", "def most_commented\n @movies = Movie.joins(:comment).\n select('movie.movie_id, mov...
[ "0.61262304", "0.5964447", "0.5904252", "0.58359617", "0.5720219", "0.57176816", "0.56465256", "0.5643187", "0.5591224", "0.5538518", "0.54853076", "0.5458474", "0.54157615", "0.54125094", "0.5295551", "0.5290576", "0.52858317", "0.52719975", "0.52617353", "0.5223332", "0.519...
0.6424277
0
TODO: A proper test of `LiveDeparturesfind_departures` with mocks and stubs in place so a live HTTP request isn't made, but it still tests the full call.
def test_cleaning_departures_removes_html assert_equal( [[nil, nil, nil, 'Expected at 12:34 (10 mins late)']], @plugin.clean_departures([[nil, nil, nil, '12:34 &lt;br/&gt; 10 mins late']]) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def departures\n json = Client511.new.departures(agency.name, name)\n parse_departures(json)\n end", "def airport_departures(id, params={})\n perform_get(\"/airports/#{id}/departures.xml\", params)\n end", "def parse_departures(json)\n # this will return blank if there are any failures in the...
[ "0.71762145", "0.6725612", "0.6688542", "0.6602975", "0.64884067", "0.6412662", "0.62525374", "0.6210405", "0.5836256", "0.5813999", "0.56894416", "0.56731606", "0.54753536", "0.5433523", "0.5418426", "0.53615755", "0.5337836", "0.5303925", "0.5220638", "0.52157766", "0.51912...
0.0
-1
GET /messages/1 GET /messages/1.json
def show @message = Message.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @message } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end", "def messages\n get_json('messages.json')\n end", "def show\n @message = Message.find(params[:id])\n render json: @message\n\n end", "def show\n\t\t@messages = Message.where(recipient: params[:id...
[ "0.7583435", "0.75054526", "0.7227938", "0.7189203", "0.7122256", "0.70854056", "0.7068396", "0.70571357", "0.70463675", "0.70463675", "0.70219374", "0.6960585", "0.6960082", "0.695794", "0.6953388", "0.69278705", "0.6888865", "0.6868248", "0.68636215", "0.68605536", "0.68567...
0.7067737
27
GET /messages/new GET /messages/new.json
def new @message = Message.new respond_to do |format| format.html # new.html.erb format.json { render json: @message } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end...
[ "0.81525946", "0.81525946", "0.81073797", "0.8089234", "0.8006565", "0.77983874", "0.7789831", "0.7594306", "0.7535214", "0.7526649", "0.7513911", "0.7468994", "0.7447991", "0.743061", "0.7428836", "0.74261725", "0.7420901", "0.74186707", "0.7409109", "0.74038494", "0.7389708...
0.8146461
18
POST /messages POST /messages.json
def create begin text = params["Content"] if !text.downcase.start_with?("test") mobile = params["MSISDN"] if !mobile.start_with?("+") mobile = "+#{mobile}" end service = SmsService.new @message = SmsService.handle_sms_sending(text, mobile) render text: 'success', status: 200 else if Rails.env == "production" msg = text.split(" ")[1] HTTParty.post(ENV['DEVELOPEMENT_SERVER_URL'], :query => { "Content" => msg, "MSISDN" => params["MSISDN"] }) end render text: 'success', status: 200 end rescue => error respond_to do |format| format.all { render json: (@message.errors if !@message.nil?), status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end", "def create\n message = Message.new(message_params)\n message.message = params[:message_text]\n message.display_name = params[:display_name]\n message.save!\n render json: message\n end", "def create\n @messag...
[ "0.7465386", "0.71694404", "0.7112854", "0.7095524", "0.70685273", "0.70200527", "0.69382447", "0.6844289", "0.683413", "0.683015", "0.68281627", "0.68281627", "0.6783851", "0.6763146", "0.67002374", "0.6698929", "0.66701055", "0.66322166", "0.66246116", "0.6623654", "0.66130...
0.0
-1
PUT /messages/1 PUT /messages/1.json
def update @message = Message.find(params[:id]) respond_to do |format| if @message.update_attributes(params[:message]) format.html { redirect_to @message, notice: 'Message was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @message.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end", "def update\n message = Message.find(params[:id])\n message...
[ "0.7445271", "0.7232131", "0.70806783", "0.70384103", "0.6996537", "0.696421", "0.69263357", "0.6819277", "0.6767609", "0.6749294", "0.66883415", "0.6650034", "0.6626438", "0.6626438", "0.66143435", "0.66041696", "0.6576473", "0.65658504", "0.65658504", "0.6557103", "0.653893...
0.6605325
32
DELETE /messages/1 DELETE /messages/1.json
def destroy @message = Message.find(params[:id]) @message.destroy respond_to do |format| format.html { redirect_to messages_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end", "def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @message.destroy\n \n ...
[ "0.79609585", "0.77497977", "0.77200526", "0.76647854", "0.7641925", "0.7633622", "0.7629708", "0.7614517", "0.76078284", "0.76073515", "0.76073515", "0.75949657", "0.7591787", "0.7591787", "0.7591787", "0.7591787", "0.75550777", "0.75406426", "0.7508448", "0.7487534", "0.747...
0.7552779
38
GET /matches GET /matches.json
def index @user_skills = UserSkill.all.where(user_id: current_user) @result = @user_skills @result_first = @user_skills.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end", "def index\n @matches = @current_user.matches.include...
[ "0.752813", "0.7394124", "0.730342", "0.7210067", "0.72072196", "0.7200118", "0.7068271", "0.7068271", "0.7068271", "0.7068271", "0.7068271", "0.70285064", "0.69965607", "0.69690144", "0.69647396", "0.6962711", "0.6949953", "0.69074726", "0.6834273", "0.6762692", "0.6753257",...
0.0
-1
GET /matches/1 GET /matches/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end", "def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def index\n @matches = Match.where(\"player2_id IS N...
[ "0.76179665", "0.747113", "0.7408183", "0.72241014", "0.7158438", "0.71064603", "0.7097788", "0.6979289", "0.69566995", "0.6949862", "0.69414395", "0.69414395", "0.69414395", "0.69414395", "0.69414395", "0.6835067", "0.68285567", "0.6806905", "0.6789736", "0.6748504", "0.6724...
0.0
-1
POST /matches POST /matches.json
def create @match = Match.new(match_params) respond_to do |format| if @match.save format.html { redirect_to @match, notice: 'Match was successfully created.' } format.json { render :show, status: :created, location: @match } else format.html { render :new } format.json { render json: @match.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, :notice => 'Match was successfully created.' }\n format.json { render :json => @match, :status => :created, :location => @match }\n else\n format.html...
[ "0.7027553", "0.701098", "0.694482", "0.694482", "0.6934786", "0.6931627", "0.6931627", "0.6931627", "0.6930915", "0.68570215", "0.6843774", "0.67469937", "0.6663773", "0.6626364", "0.66005003", "0.6598705", "0.655482", "0.6509454", "0.6420226", "0.63428754", "0.6207761", "...
0.6931728
9
PATCH/PUT /matches/1 PATCH/PUT /matches/1.json
def update respond_to do |format| if @match.update(match_params) format.html { redirect_to @match, notice: 'Match was successfully updated.' } format.json { render :show, status: :ok, location: @match } else format.html { render :edit } format.json { render json: @match.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n match = Match.find_by(id: match_params[:id])\n\n match.update match_params\n if match.valid?\n render json: { match: match}, status: :created\n else\n render json: { errors: match.errors.full_messages }, status: :not_accepted\n end\n end", ...
[ "0.70964456", "0.6786647", "0.6782915", "0.6764678", "0.67572457", "0.67428124", "0.67191803", "0.668586", "0.667489", "0.6599572", "0.65211093", "0.6477119", "0.6456196", "0.6456196", "0.6444519", "0.6441327", "0.64008534", "0.6341176", "0.6338921", "0.6338921", "0.63316846"...
0.6592267
20
DELETE /matches/1 DELETE /matches/1.json
def destroy @match.destroy respond_to do |format| format.html { redirect_to matches_url, notice: 'Match was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n ...
[ "0.77277064", "0.77277064", "0.77277064", "0.7716669", "0.7681116", "0.7677394", "0.75557905", "0.750139", "0.7480887", "0.7477815", "0.74418634", "0.7368489", "0.7350068", "0.7212901", "0.71896535", "0.7179009", "0.7168191", "0.7138714", "0.7122301", "0.7076286", "0.705552",...
0.74096155
21
Use callbacks to share common setup or constraints between actions.
def set_match @match = Match.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 match_params params.fetch(:match, {}) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.zombie_mailer.lost_brain.subject
def lost_brain @greeting = "Hi" mail to: "to@example.org" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject\n self['subject'] || msg['subject']\n end", "def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end", "def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end", "def subject\...
[ "0.6745106", "0.6651402", "0.6640591", "0.65325004", "0.651964", "0.6429486", "0.64014393", "0.6398752", "0.6381237", "0.6372287", "0.63578606", "0.63275075", "0.62972367", "0.62921363", "0.6253607", "0.62302095", "0.61961585", "0.6135981", "0.6132872", "0.61228186", "0.61064...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_fechamento_caixa @fechamento_caixa = FechamentoCaixa.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def fechamento_caixa_params params.require(:fechamento_caixa).permit(:periodo, :fin_conta_id, :vl_saldo, :created_by, :updated_by) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
transform list of object to hash
def obj_to_hash hash = {} instance_variables.each do |var| hash[var.to_s.delete('@')] = instance_variable_get(var) end hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n @list\n end", "def hash\n lists.inject({}){ |hash, p| hash[p[0]] ||= []; hash[p[0]] << p[1]; hash }\n end", "def _hash(obj)\n obj.transform_values { |v| _renc(v) }\n end", "def list_as_hash solr_list\n # map\n if solr_list.values.first.is_a? Hash\n solr_list\n ...
[ "0.724186", "0.721491", "0.6860893", "0.6753415", "0.66888386", "0.65884674", "0.65136474", "0.64857864", "0.64635473", "0.6322234", "0.6299382", "0.6299382", "0.6288334", "0.6286816", "0.62822276", "0.6255443", "0.62459326", "0.6204806", "0.6204806", "0.6204806", "0.6193187"...
0.0
-1
POST /deposits POST /deposits.json
def create @deposit = Deposit.new(deposit_params) @deposit.user_id = current_user.id @account = Account.find(@deposit.account_id) respond_to do |format| if @deposit.deposit format.html { redirect_to account_path(@deposit.account_id), notice: 'Deposit was successfully created.' } format.json { head :no_content } else format.html { render action: 'new' } format.json { render json: @deposit.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @deposits = Deposit.all\n end", "def index\n @deposits_products = DepositsProduct.all\n end", "def deposits\n Transfer.where(\n to: id,\n transfer_type: 'deposit'\n )\n end", "def create\n\t\tuser = User.find_by(id: expense_params['user_id'])\n\t\tdebt = Debt.find_by(id: ...
[ "0.6045376", "0.58791155", "0.5852229", "0.58200926", "0.5814019", "0.5808424", "0.57976574", "0.57976574", "0.57976574", "0.5781376", "0.57768184", "0.57768184", "0.5775814", "0.5757064", "0.57515126", "0.57327616", "0.5721809", "0.5700982", "0.5636977", "0.5632284", "0.5626...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def deposit_params params.require(:deposit).permit(:account_id, :amount_string) 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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
GET /cultural_heritage/transfers GET /cultural_heritage/transfers.xml
def index if (user_signed_in? && ([4].include?(current_user.role))) @title_view = 'Traslados' @heritages = CulturalHeritage::CulturalHeritage.all @origins = CulturalHeritage::CulturalInstitution.all @destinies = CulturalHeritage::CulturalInstitution.all if params[:cultural] == nil @cultural_heritage_transfers = CulturalHeritage::Transfer.all else @cultural_heritage = CulturalHeritage::CulturalHeritage.where("name LIKE '%#{params[:cultural][:cultural_heritage]}%'") @cultural_heritage_transfers = CulturalHeritage::Transfer.where( 'cultural_heritage in (?)', (@cultural_heritage.empty? ? '' : @cultural_heritage.map(&:id)) ).all end respond_to do |format| format.html # index.html.erb format.xml { render :xml => @cultural_heritage_transfers } end else respond_to do |format| format.html { redirect_to(new_user_session_path) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\r\n @transfers = Transfer.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @transfers.to_xml(:dasherize => false) }\r\n end\r\n end", "def index\n @transfers = Transfer.resources(params[:resource].capitalize)\n end", "d...
[ "0.67475545", "0.62262493", "0.6160427", "0.61515254", "0.6069626", "0.6069626", "0.6069626", "0.6069626", "0.5961614", "0.5851656", "0.58492666", "0.58081424", "0.5770886", "0.5763382", "0.5745827", "0.56908345", "0.5687964", "0.5664329", "0.56057227", "0.55973524", "0.55930...
0.0
-1
GET /cultural_heritage/transfers/1 GET /cultural_heritage/transfers/1.xml
def show if (user_signed_in? && ([4].include?(current_user.role))) @title_view = 'Traslados' @cultural_heritage_transfer = CulturalHeritage::Transfer.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @cultural_heritage_transfer } end else respond_to do |format| format.html { redirect_to(new_user_session_path) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\r\n @transfers = Transfer.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @transfers.to_xml(:dasherize => false) }\r\n end\r\n end", "def index\n @transfers = Transfer.resources(params[:resource].capitalize)\n end", "d...
[ "0.6806048", "0.6048231", "0.58817494", "0.5875957", "0.58432657", "0.58432657", "0.58432657", "0.58432657", "0.5826843", "0.57024556", "0.570245", "0.5682147", "0.56725705", "0.566742", "0.5638998", "0.55246127", "0.5517258", "0.5511642", "0.55007845", "0.54963833", "0.54898...
0.0
-1
GET /cultural_heritage/transfers/new GET /cultural_heritage/transfers/new.xml
def new if (user_signed_in? && ([4].include?(current_user.role))) @title_view = 'Traslados' @cultural_heritage_transfer = CulturalHeritage::Transfer.new @cultural_heritage_cultural_heritages = CulturalHeritage::CulturalHeritage.find(:all,:conditions=>{:group=>[1],:deleted=>[0]}) @heritages = CulturalHeritage::CulturalHeritage.all @origins = CulturalHeritage::CulturalInstitution.all @destinies = CulturalHeritage::CulturalInstitution.all @responsable = User.find_all_by_role(1) respond_to do |format| format.html # new.html.erb format.xml { render :xml => @cultural_heritage_transfer } end else respond_to do |format| format.html { redirect_to(new_user_session_path) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\r\n @stock_transfer = StockTransfer.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @stock_transfer }\r\n end\r\n end", "def new\n @transmission = Transmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n ...
[ "0.6906682", "0.67701554", "0.66838217", "0.65381354", "0.65360916", "0.64551103", "0.6432051", "0.6428586", "0.6416907", "0.6408581", "0.6371746", "0.6371746", "0.6365325", "0.63596267", "0.63517714", "0.63127965", "0.63103783", "0.6303357", "0.62935555", "0.62935555", "0.62...
0.0
-1
POST /cultural_heritage/transfers POST /cultural_heritage/transfers.xml
def create if (user_signed_in? && ([4].include?(current_user.role))) @title_view = 'Traslados' aux = params[:cultural_heritage_transfer][:enddate] @cultural_heritage_transfer = CulturalHeritage::Transfer.new(params[:cultural_heritage_transfer]) @cultural_heritage_transfer.creator = current_user.id if (aux.nil? || aux.blank?) aux = Time.now.strftime("%d/%m/%Y").to_s end @cultural_heritage_transfer.enddate = DateTime.strptime(aux, "%d/%m/%Y") TransferMailer.registered_email(@cultural_heritage_transfer.obj_responsable).deliver #harcode par evitar problemas con el nil del id de petrimonio incluido en la tabla transfer @cultural_heritage_transfer.cultural_heritage = 1 @heritages = params[:lheritage] i = 0 @heritages.each do |theritage| heritagextransfer = CulturalHeritage::MyHeritageXTransfer.new([:transfer => @cultural_heritage_transfer.id]) heritagextransfer.heritage = theritage.to_i @cultural_heritage_transfer.list_heritage_x_transfer << heritagextransfer i = i +1 end is_equal_cultural_institution = (@cultural_heritage_transfer.obj_cultural_institution_origin.id == @cultural_heritage_transfer.obj_cultural_institution_destiny.id) is_valid_dates = (@cultural_heritage_transfer.startdate <= DateTime.strptime(aux, "%d/%m/%y")) respond_to do |format| if (is_equal_cultural_institution) @errorTransInsti = "Las instituciones de origen y destino deben ser diferentes." end if (!is_valid_dates) @errorTransDate = "La fecha de inicio debe ser menor a la de fin." end if (!is_equal_cultural_institution && is_valid_dates) if @cultural_heritage_transfer.save format.html { redirect_to(@cultural_heritage_transfer, :notice => 'El traslado fue registrado satisfactoriamente.')} format.xml { render :xml => @cultural_heritage_transfer, :status => :created, :location => @cultural_heritage_transfer } else format.html { render :action => "new"} format.xml { render :xml => @cultural_heritage_transfer.errors, :status => :unprocessable_entity } end else @title_view = 'Traslados' @cultural_heritage_transfer = CulturalHeritage::Transfer.new @cultural_heritage_cultural_heritages = CulturalHeritage::CulturalHeritage.all @heritages = CulturalHeritage::CulturalHeritage.all @origins = CulturalHeritage::CulturalInstitution.all @destinies = CulturalHeritage::CulturalInstitution.all @responsable = User.find_all_by_role(1) format.html { render :action => "new"} format.xml { render :xml => @cultural_heritage_transfer.errors, :status => :unprocessable_entity } end end else respond_to do |format| format.html { redirect_to(new_user_session_path) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @transfer = @branch.transfers.create(params[:transfer])\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to branch_transfer_path(@branch,@transfer), notice: 'Transfer was successfully created.' }\n format.json { render json: @transfer, status: :created, lo...
[ "0.65394026", "0.6180988", "0.6163391", "0.61448133", "0.6038608", "0.59975845", "0.5993064", "0.59844625", "0.5962423", "0.5957068", "0.59562325", "0.59476733", "0.59476733", "0.5892881", "0.58154196", "0.5753635", "0.5753387", "0.5718585", "0.569295", "0.5616165", "0.561506...
0.5431124
32
PUT /cultural_heritage/transfers/1 PUT /cultural_heritage/transfers/1.xml
def update if (user_signed_in? && ([4].include?(current_user.role))) @title_view = 'Traslados' @cultural_heritage_transfer = CulturalHeritage::Transfer.find(params[:id]) respond_to do |format| if @cultural_heritage_transfer.update_attributes(params[:cultural_heritage_transfer]) format.html { redirect_to(@cultural_heritage_transfer, :notice => 'Transfer was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @cultural_heritage_transfer.errors, :status => :unprocessable_entity } end end else respond_to do |format| format.html { redirect_to(new_user_session_path) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @transfer.update(transfer_params)\n render :show, status: :ok, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post ...
[ "0.5862874", "0.580076", "0.57516956", "0.56915516", "0.56915516", "0.568979", "0.5617538", "0.561608", "0.561608", "0.561608", "0.561608", "0.561608", "0.561608", "0.561608", "0.561608", "0.561608", "0.561608", "0.561608", "0.561608", "0.55972385", "0.55967355", "0.5490002...
0.51444584
43
DELETE /cultural_heritage/transfers/1 DELETE /cultural_heritage/transfers/1.xml
def destroy if (user_signed_in? && ([4].include?(current_user.role))) @title_view = 'Traslados' @cultural_heritage_transfer = CulturalHeritage::Transfer.find(params[:id]) @cultural_heritage_transfer.destroy respond_to do |format| format.html { redirect_to(cultural_heritage_transfers_url) } format.xml { head :ok } end else respond_to do |format| format.html { redirect_to(new_user_session_path) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @transfer.destroy\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end", ...
[ "0.6774147", "0.64989793", "0.64629817", "0.6446107", "0.6413874", "0.63245857", "0.6288936", "0.6287663", "0.62828565", "0.62777174", "0.62719", "0.6263515", "0.6249306", "0.6244502", "0.6243132", "0.62141466", "0.6212043", "0.6181617", "0.61765504", "0.61712706", "0.6171270...
0.0
-1
Enters data in specified fields on iMedidataRave connection page.
def imedidata_rave_connection_data_enter(field, value) #if link_account_button case field.downcase when 'rave account' option = rave_account_dropdown_options.detect { |item| item.value == value} option.click unless option.nil? when 'password' password_text.set value #TODO: when 'role' else raise "Option: #{field} is not supported." end #end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runFieldEntryDialog(username,password,dbid,field)\r\n @qbc = QuickBase::Client.new(username,password)\r\n if @qbc and @qbc.requestSucceeded\r\n @qbc.getSchema(dbid)\r\n if @qbc.requestSucceeded\r\n field = field.join(' ')\r\n field.strip!\r\n fieldID =...
[ "0.59361565", "0.56940764", "0.5460564", "0.54551566", "0.538901", "0.523532", "0.51828843", "0.50958234", "0.50720274", "0.5018067", "0.49675888", "0.49576074", "0.49304816", "0.49246156", "0.49081463", "0.48983786", "0.48813313", "0.4833241", "0.48327798", "0.48126844", "0....
0.58310735
1
clicks "Link account" button on iMedidataRave connection page.
def link_account_click link_account_button.click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_myaccount\n button_myaccount.click\n end", "def link_account(m, nick)\n\t\t\t\tnick = CGI::escape(nick)\n\t\t\t\t@backend.set(m.user, nick)\n\t\t\t\tm.reply(\"#{m.user} is now linked with account #{nick}!\")\n\t\t\tend", "def click_sign_in_link\n find(SIGN_IN_LINK_ID).click\n end", "...
[ "0.6677254", "0.6622858", "0.64729214", "0.64691806", "0.6440816", "0.6433552", "0.6363757", "0.62843585", "0.61845237", "0.6112237", "0.6086133", "0.6074697", "0.6063061", "0.60620195", "0.60600287", "0.603827", "0.60002595", "0.5988864", "0.59430087", "0.59352124", "0.59112...
0.8097771
0
Unsubscribe current user from newsletter. We only support direct unsubscribing for a logged in user
def unsubscribe_from_newsletter email = current_user ? current_user.email : '' @newsletter = Newsletter.find_newsletter(params['token']) if @newsletter result = @newsletter.unsubscribe(email) respond_to do |format| if result msg = I18n.t('nms.unsubscribe_successuful') format.html { redirect_back fallback_location: main_app.index_url, notice: msg } format.json { render json: { success: true, msg: msg } } else msg = I18n.t('nms.Email_NotExists') format.html { redirect_back fallback_location: main_app.index_url, alert: msg } format.json { render json: { success: false, msg: msg } } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end", "def unsubscribe\n user = User.where(email: params[:md_email]).first\n user.unsubscribe!\n\n redirect_to root_path, notice: t(\"unsubscribed\")\n end", "def unsubscribe\n @entry.subscribers.delete(current_user)\n end", ...
[ "0.8054064", "0.78868693", "0.76948607", "0.7673526", "0.7546246", "0.7507263", "0.74364007", "0.7414118", "0.73360324", "0.7331726", "0.7323698", "0.723409", "0.72333795", "0.71702707", "0.71600366", "0.71317863", "0.7117016", "0.71076727", "0.7098581", "0.7098108", "0.70827...
0.73426956
8
returns the start time of the round (start of prep)
def start_time return "1530"; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_time\n start\n end", "def start_time(ride)\n return nil unless ride.points.any?\n ride.points.first.time\n end", "def get_start_time()\n return process_stamp(@start_time)\n end", "def start_time\n eval(start) if start.present?\n end", "def start_time\n ...
[ "0.7801633", "0.7485971", "0.7460767", "0.7404101", "0.7376509", "0.7369731", "0.73649913", "0.7344061", "0.7289737", "0.72593766", "0.71766883", "0.71766883", "0.7122798", "0.70978785", "0.70941544", "0.7071533", "0.70208657", "0.70208657", "0.70120704", "0.692877", "0.69211...
0.6949172
19
returns amount of time passed in prep will end at 15:00
def prep_time_passed return "7:34" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prep_time_end\n return \"1545\";\n end", "def time_remaining\n\n end", "def time_remaining\n end", "def ready_in_time\n return self.preparation_time + self.cooking_time\n end", "def get_time_remaining\n\n end", "def get_otp_remaining_time\n (Time.now.utc.to_i / 30 + 1) * 30 - Time....
[ "0.70607376", "0.6902107", "0.6879608", "0.68460494", "0.67541826", "0.66756666", "0.6668687", "0.6642415", "0.66374916", "0.66305435", "0.6583779", "0.65096575", "0.6498058", "0.64962345", "0.64520925", "0.64416516", "0.6433681", "0.64311624", "0.6429047", "0.6405697", "0.63...
0.6650676
7
returns time of prep time end
def prep_time_end return "1545"; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prep_time_passed\n return \"7:34\"\n end", "def get_completion_time()\n return process_stamp(@end_time)\n end", "def ready_in_time\n return self.preparation_time + self.cooking_time\n end", "def time\n end_time - start_time\n end", "def start_time; end", "def run_time\n ...
[ "0.7040492", "0.69155884", "0.69117796", "0.6894435", "0.6749047", "0.6746213", "0.67409855", "0.67369086", "0.66894", "0.6668123", "0.66502726", "0.663287", "0.6624115", "0.6578999", "0.65421873", "0.65381217", "0.65091604", "0.6508431", "0.6508431", "0.6476123", "0.6451051"...
0.73265177
0
returns the round number of this round
def get_rank list = self.tournament.rounds.to_a; #this list will be chronological already i = 0; while list[i].id != self.id i = i + 1; end return (i + 1); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round\n @round || (to ? to.round - 1 : 0)\n end", "def round() end", "def current_round; (@current_turn / 2).floor end", "def to_i\n @value.round\n end", "def to_i\n @value.round\n end", "def to_i\n @value.round\n end", "def round( num )\n h = get_ma...
[ "0.7461032", "0.7239211", "0.70303154", "0.695497", "0.695497", "0.695497", "0.6947131", "0.68821335", "0.6829172", "0.6819945", "0.67258185", "0.67172295", "0.66244", "0.6617051", "0.6546086", "0.6521931", "0.6454435", "0.6353477", "0.6316041", "0.62562615", "0.6233282", "...
0.58069223
75
=begin :type i: Integer :type val: Integer :rtype: Void =end
def update(i, val) @hash[i] = val end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f i\n return i\n end", "def f(i, *)\n i\n end", "def Iter(val)\n\n # initialize block array\n nums = Array.new(val) {|e| e = e * (3*val)}\n $i = 0\n while $i < val do\n initial_val = nums[$i]\n\n # modify array\n new_va...
[ "0.607996", "0.59766257", "0.5974595", "0.59178156", "0.5890372", "0.57924646", "0.5772978", "0.5755976", "0.5723376", "0.5674274", "0.56264424", "0.56146663", "0.55909246", "0.55909246", "0.55593", "0.5526016", "0.55132335", "0.5491245", "0.54909956", "0.5462108", "0.5409411...
0.58390194
5
=begin :type i: Integer :type j: Integer :rtype: Integer =end
def sum_range(i, j) @sum[j] - @sum[i] + @nums[i] + sum_updator(i, j) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def j0( i, j )\n k = 0\n while k <= j\n break if table_vars[self.class.indices2coords(i,k)]\n k+=1\n end\n k\n end", "def f(i, j)\n i + j\n end", "def sum_range(i, j)\n \n end", "def weight(i, j)\n return 1\n end", "def getElem(i,j)\r\n #elindulunk az ado...
[ "0.73619694", "0.6929214", "0.6925783", "0.69130445", "0.66765815", "0.6615297", "0.6512403", "0.65026", "0.63890356", "0.6264233", "0.6235927", "0.6155833", "0.60862094", "0.60603726", "0.605579", "0.6011441", "0.598147", "0.5974591", "0.59306777", "0.59240025", "0.59230834"...
0.62268883
11
GET /burritos GET /burritos.json
def index @burritos = Burrito.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags ...
[ "0.65203756", "0.6376935", "0.62230587", "0.6221558", "0.61355615", "0.6130059", "0.6118938", "0.6106933", "0.6074767", "0.60611033", "0.60264987", "0.6024992", "0.6021587", "0.6020366", "0.60154766", "0.60049325", "0.5984004", "0.59788316", "0.59728944", "0.5967952", "0.5966...
0.7447004
0
GET /burritos/1 GET /burritos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @burritos = Burrito.all\n end", "def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index...
[ "0.7194189", "0.6512655", "0.6339631", "0.6325211", "0.62879", "0.6284505", "0.62351406", "0.61754143", "0.61563665", "0.6151381", "0.61473984", "0.6097245", "0.60898155", "0.6078731", "0.6077141", "0.6072625", "0.6067048", "0.60584104", "0.6055933", "0.6051997", "0.60443115"...
0.0
-1
POST /burritos POST /burritos.json
def create @burrito = Burrito.new(burrito_params) respond_to do |format| if @burrito.save format.html { redirect_to @burrito, notice: 'Burrito was successfully created.' } format.json { render action: 'show', status: :created, location: @burrito } else format.html { render action: 'new' } format.json { render json: @burrito.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @burpy = Burpy.new(burpy_params)\n\n respond_to do |format|\n if @burpy.save\n format.html { redirect_to @burpy, notice: 'Burpy was successfully created.' }\n format.json { render :show, status: :created, location: @burpy }\n else\n format.html { render :new }\n ...
[ "0.660842", "0.61697555", "0.612673", "0.6017055", "0.60044104", "0.5990578", "0.59331447", "0.5909392", "0.5852216", "0.5823027", "0.579433", "0.57675254", "0.5765178", "0.5758901", "0.57565486", "0.57475585", "0.5731315", "0.5716312", "0.57044095", "0.56954765", "0.56752646...
0.7288779
0
PATCH/PUT /burritos/1 PATCH/PUT /burritos/1.json
def update respond_to do |format| if @burrito.update(burrito_params) format.html { redirect_to @burrito, notice: 'Burrito was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @burrito.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\...
[ "0.63767904", "0.63767904", "0.63667494", "0.63167423", "0.62790555", "0.6216396", "0.62036926", "0.618567", "0.6132998", "0.6132051", "0.6128417", "0.6101095", "0.6087144", "0.6083662", "0.6018055", "0.60124266", "0.600246", "0.599509", "0.59844923", "0.5959673", "0.59169227...
0.67352754
0
DELETE /burritos/1 DELETE /burritos/1.json
def destroy @burrito.destroy respond_to do |format| format.html { redirect_to burritos_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n...
[ "0.7062354", "0.68754494", "0.6829979", "0.6762248", "0.6753424", "0.6722405", "0.6712396", "0.6690358", "0.6690358", "0.6690358", "0.6690358", "0.66895103", "0.6688481", "0.66727597", "0.66440374", "0.66248924", "0.66239214", "0.6615623", "0.6599944", "0.6589985", "0.6584042...
0.73165685
0
Use callbacks to share common setup or constraints between actions.
def set_burrito @burrito = Burrito.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 burrito_params params.require(:burrito).permit(:location, :burrito_name, :taqueria_name, :website, :phone, :price, :meat_type, :meat_rating, :size_rating, :tortilla_rating, :salsa_rating, :other_rating, :flavor_rating, :service_rating, :selection_rating, :environment_rating, :post_eating_rating, :chips, :overall_rating, :notes, :keywords) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_aslegal @basica = Sivel2Sjr::Aslegal.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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def aslegal_params params.require(:aslegal).permit(*atributos_form) 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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_project @project = Project.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 project_params params.require(:project).permit(:title, :category, :level, :description, :status, :image_file, tasks_attributes: [:id, :title, :description, :difficult, :image_file, :_destroy]) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
def recolor(co) self.color = co end
def current_speed puts "current speen is #{@current_speed} Km/h" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recolor(color)\n @color = color\n self\n end", "def setcolorrep(*)\n super\n end", "def colorChange(couleur)\n @color=couleur\n apply\n end", "def spray_paint(new_color)\n self.color = new_color\n end", "def set_color=(new_color)\n @@color = new_color\n end", "def color=...
[ "0.8901896", "0.80041486", "0.80020267", "0.7846454", "0.76558983", "0.76465607", "0.76229477", "0.7585915", "0.7581721", "0.75572443", "0.75276524", "0.7397775", "0.7335599", "0.73158604", "0.7266861", "0.72544473", "0.72530305", "0.7227967", "0.7227967", "0.7227967", "0.719...
0.0
-1
Send Request to Server, get response
def send_request(request = "", host = "127.0.0.1", port = 40600) begin @server.connect(host, port) @server.send(request, 0) response, address = @server.recvfrom(1024*1024) rescue Exception => e response = e.message end puts response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_request\n @response = _send_request\n end", "def send_request; end", "def send_request(req); end", "def do_request\n\t\t\tself.response = post_request(options)\n\t\tend", "def request\n self.response = prepare_response(http_communication.content)\n end", "def send_request(req, ti...
[ "0.75244224", "0.70862174", "0.69638896", "0.6924288", "0.6919844", "0.6909634", "0.6892689", "0.6839833", "0.6830124", "0.68132335", "0.680484", "0.6787894", "0.6770423", "0.67381334", "0.6714813", "0.6700732", "0.6694823", "0.6618229", "0.66150075", "0.6606594", "0.6586598"...
0.73604494
1
TODO:implement following method after session is complate
def update end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session; end", "def session; end", "def session; end", "def session; end", "def session\n end", "def session; @session; end", "def session; @session; end", "def session; @session; end", "def copy_session_variables!; end", "def session() request.session end", "def session_id; end", "def s...
[ "0.73131305", "0.73131305", "0.73131305", "0.73131305", "0.69271064", "0.68783045", "0.68783045", "0.68783045", "0.6597103", "0.6579822", "0.65462625", "0.65462625", "0.65462625", "0.64871776", "0.64871776", "0.6454338", "0.6435604", "0.641819", "0.641819", "0.63940465", "0.6...
0.0
-1
Always use symbol value for schema dumper
def type_cast_for_schema(value) cast_value(value).to_sym.inspect end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_symbol\n return data.db_symbol\n end", "def symbol\n @symbol\n end", "def symbol\n Util.from_bytes :symbol, value\n end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def symbol; end", "def to_sym\n nil\n end", ...
[ "0.69471675", "0.6714609", "0.66742724", "0.6586514", "0.6586514", "0.6586514", "0.6586514", "0.6586514", "0.6586514", "0.6550429", "0.6550429", "0.6550429", "0.6550429", "0.64659625", "0.64659625", "0.64659625", "0.643889", "0.62581295", "0.62108386", "0.6186", "0.6155872", ...
0.62059385
19
Rotates the image based on the EXIF Orientation
def fix_exif_rotation manipulate! do |img| img.auto_orient img = yield(img) if block_given? img end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_exif_rotation\n manipulate! do |img|\n img.tap(&:auto_orient)\n end\n end", "def fix_exif_rotation\n return unless self.file.content_type.start_with? 'image'\n \n manipulate! do |img|\n img.tap(&:auto_orient)\n img = yield(img) if block_given?\n img\n end\n ...
[ "0.7754148", "0.77405953", "0.7697319", "0.73620343", "0.7232811", "0.7130476", "0.6982682", "0.6613536", "0.6471975", "0.6400095", "0.63219213", "0.6225883", "0.61183906", "0.61074835", "0.60326624", "0.6016943", "0.5882964", "0.5882964", "0.5882964", "0.587996", "0.5869347"...
0.77658087
1
Strips out all embedded information from the image
def strip manipulate! do |img| img.strip img = yield(img) if block_given? img end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip\n write_opts[:strip] = true\n get_image\n end", "def strip_exif_metadata\r\n manipulate! do |img|\r\n img.strip\r\n img = yield(img) if block_given?\r\n img\r\n end\r\n end", "def strip\n manipulate! do |image|\n @_strip = true\n image\n end\...
[ "0.69993025", "0.6768661", "0.674063", "0.6471348", "0.6450849", "0.61621034", "0.6132503", "0.6118782", "0.6118782", "0.6078553", "0.6047238", "0.6047238", "0.5960177", "0.58465916", "0.58133566", "0.5753141", "0.57260305", "0.56480426", "0.56461763", "0.5626181", "0.5572290...
0.60910726
11
given a list of time_blocks, sorts them by start_time outputs sorted list of time_blocks
def quicksort_timeblocks(time_blocks) if (time_blocks.size <= 1) return time_blocks end pivot = time_blocks[0] left = [] right = [] time_blocks[1..time_blocks.size-1].each do |tb| if (tb.term.to_i < pivot.term.to_i) left.push(tb) elsif (pivot.term.to_i < tb.term.to_i) right.push(tb) elsif (before_in_week(tb.day, pivot.day)) left.push(tb) elsif (before_in_week(pivot.day, tb.day)) right.push(tb) elsif (tb.start_time < pivot.start_time) left.push(tb) else right.push(tb) end end sorted_left = quicksort_timeblocks(left) sorted_right = quicksort_timeblocks(right) time_blocks = sorted_left.push(pivot) + sorted_right return time_blocks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort\n\t@events = @events.sort_by { | e | e.time_from_start }\n\trecalc_delta_from_times()\n end", "def sorted_by_time(times)\n times.to_a.sort_by{|x| x.last}.reverse.reject{|x| x.last < SHOW_ABOVE}\n end", "def sorted_by_time(times)\n times.to_a.sort_by{|x| x.last}.reverse.reject{|x| x.l...
[ "0.6733762", "0.6614889", "0.6588259", "0.6567195", "0.6076971", "0.59652287", "0.5949944", "0.5912682", "0.58948416", "0.58788687", "0.58744115", "0.585673", "0.57821167", "0.5756305", "0.57162416", "0.5679656", "0.56782854", "0.5668281", "0.5624496", "0.556854", "0.5524704"...
0.7794943
0
given a sorted list of time_blocks, determines if there is any overlap between consecutive time_blocks
def exists_overlap?(time_blocks) (0..time_blocks.size - 2).each do |i| if (time_blocks[i].term == time_blocks[i+1].term && time_blocks[i].day == time_blocks[i+1].day && time_blocks[i].end_time > time_blocks[i+1].start_time) return true end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_schedule?(time_blocks)\n time_blocks = quicksort_timeblocks(time_blocks)\n return !exists_overlap?(time_blocks)\n end", "def OverlappingRanges(arr)\n first_num = arr[0]\n second_num = arr[1]\n third_num = arr[2]\n forth_num = arr[3]\n first_arr = (first_num..second_num).to_a\n second_arr =...
[ "0.74753326", "0.6586606", "0.65610206", "0.65078634", "0.65019685", "0.6324649", "0.6321844", "0.6286414", "0.62597454", "0.62562114", "0.6234426", "0.623237", "0.6195989", "0.61556464", "0.6093179", "0.60334283", "0.5991044", "0.5984078", "0.5879891", "0.5878225", "0.587701...
0.85285515
0
takes in a list of time_blocks and determines if there is any overlap between them. problem could have been solved in O(n) using a hash, but in the interest of space, it's being solved in O(nlogn) where n is most likely less than 20 for reasonable inputs
def valid_schedule?(time_blocks) time_blocks = quicksort_timeblocks(time_blocks) return !exists_overlap?(time_blocks) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists_overlap?(time_blocks)\n (0..time_blocks.size - 2).each do |i|\n if (time_blocks[i].term == time_blocks[i+1].term &&\n time_blocks[i].day == time_blocks[i+1].day &&\n time_blocks[i].end_time > time_blocks[i+1].start_time)\n return true\n end\n end\n return fals...
[ "0.80231434", "0.6492872", "0.63112074", "0.6310496", "0.6144999", "0.6128836", "0.6122804", "0.59847754", "0.5966661", "0.5930632", "0.5917238", "0.59004205", "0.58799493", "0.58649945", "0.58375293", "0.58342534", "0.5745064", "0.57410014", "0.5731178", "0.5727211", "0.5693...
0.7130986
1
checks to see if the time_blocks satisfy the requirements of the course
def requirement_satisfied?(time_blocks, course) lecture_satisfied = false lab_satisfied = !course.lab_required # if lab isn't required, it's satisfied immediately tutorial_satisfied = !course.tutorial_required time_blocks.each do |tb| if (tb.section.course == course) if (tb.section_type == 'LectureSection') lecture_satisfied = true elsif (tb.section_type == 'LabSection') lab_satisfied = true elsif (tb.section_type == 'TutorialSection') tutorial_satisfied = true end end end return lecture_satisfied && lab_satisfied && tutorial_satisfied end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_time_blocks(time_blocks)\n b = time_blocks.select(&:collision_free?)\n\n # Test environment has unreliable data entry for start times.\n b = b.select(&:in_future?) unless Rails.env.test?\n\n b\n end", "def complete_schedule?(time_blocks, courses)\n # check to see ...
[ "0.80400884", "0.7950925", "0.7577084", "0.7186832", "0.7156186", "0.685437", "0.6701453", "0.6675008", "0.6626862", "0.6576335", "0.65577203", "0.64652973", "0.6397239", "0.6392195", "0.6344637", "0.6337235", "0.6337235", "0.63142765", "0.6309463", "0.629813", "0.6287905", ...
0.759033
2
takes in a list of time_blocks and a list of required courses as input and determines whether all of the required courses have been satisfied and ensures no additional courses were added
def complete_schedule?(time_blocks, courses) # check to see that all course requirements have been satisfied # this part is more likely to return false than the next part courses.each do |course| if (!requirement_satisfied?(time_blocks, course)) return false end end # check to see that we haven't added any unnecessary courses # this is more of an error check, rather than something that we # expect to ever be false time_blocks.each do |tb| course = tb.section.course if (!courses.include? course) # we added an unnecessary section return false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def requirement_satisfied?(time_blocks, course)\n lecture_satisfied = false\n lab_satisfied = !course.lab_required # if lab isn't required, it's satisfied immediately\n tutorial_satisfied = !course.tutorial_required\n time_blocks.each do |tb|\n if (tb.section.course == course)\n if (tb.sect...
[ "0.7444379", "0.6800184", "0.6729787", "0.6582793", "0.6240914", "0.6213811", "0.61334395", "0.6049465", "0.59994924", "0.5989895", "0.59332263", "0.59065163", "0.5832477", "0.5814292", "0.5803746", "0.5778696", "0.5744416", "0.5743178", "0.57411855", "0.57364255", "0.5731454...
0.8095915
0
given a list of schedules, filters out invalid scheduels
def filter_schedules(schedules) # filter out all the false and invalid entries from the array schedules = schedules.select {|s| s && valid_schedule?(s) && !s.empty?} if (schedules.empty?) return false end return schedules end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def possibly_coliding_schedules\n Schedule.where(possibly_coliding_schedules_query)\n end", "def filter_schedule\n if !NcsNavigatorCore.configuration.with_specimens?\n scheduled_activity_report.without_collection!\n end\n end", "def unregistered_events\n tournament\n .schedules\...
[ "0.65265036", "0.64705276", "0.61116165", "0.6063267", "0.59964", "0.5898464", "0.5853349", "0.5784519", "0.5708031", "0.56791776", "0.566385", "0.5659192", "0.5650419", "0.56489736", "0.55707526", "0.5567819", "0.5559496", "0.55077106", "0.55044657", "0.54447794", "0.5421258...
0.8193394
0
given a nonempty list of sections, try construction schedules with each section takes in a list of sections and a list of schedules. returns a new list of schedules, which is |schedules| |sections| in size.
def schedule_sections(sections, schedules) if (sections.empty?) return schedules end new_schedules = [] sections.each do |sec| # try adding sec to each possible schedule schedules.each do |sched| # build the time blocks associated with this section # onto an existing schedule schedule = sched + TimeBlock.where(section: sec) # add constructed schedule to the list of new schedules new_schedules.push(schedule) end return new_schedules end return new_schedules end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule_lecture_sections(sections, schedules)\n if (sections.empty?)\n return schedules\n end\n\n new_schedules = []\n schedules.each do |sched|\n # try adding sec to each possible schedule\n sections.each do |lec|\n # build the time blocks associated with this section\n ...
[ "0.77372867", "0.6574664", "0.65459496", "0.6533707", "0.6429127", "0.62306225", "0.61325955", "0.6004973", "0.6002293", "0.59278363", "0.576654", "0.5735865", "0.5603211", "0.55394864", "0.5447234", "0.5402213", "0.53660315", "0.53594106", "0.53254557", "0.53140426", "0.5304...
0.82091826
0
given a nonempty list of lecture sections, try construction schedules with each section takes in a list of sections and a list of schedules. returns a new list of schedules, which is |schedules| |sections| in size.
def schedule_lecture_sections(sections, schedules) if (sections.empty?) return schedules end new_schedules = [] schedules.each do |sched| # try adding sec to each possible schedule sections.each do |lec| # build the time blocks associated with this section # onto an existing schedule schedule = sched + TimeBlock.where(section: lec) schedules = [schedule] # if need-be, add in all possible associated lab sections if (lec.course.lab_required) schedules = schedule_sections(LabSection.where(lecture_section: lec), schedules) end # if need-be, add in all possible associated tutorial sections if (lec.course.tutorial_required) schedules = schedule_sections(TutorialSection.where(lecture_section: lec), schedules) end # add constructed schedule to the list of new schedules new_schedules += schedules end end return new_schedules end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule_sections(sections, schedules)\n if (sections.empty?)\n return schedules\n end\n\n new_schedules = []\n sections.each do |sec|\n # try adding sec to each possible schedule\n schedules.each do |sched|\n # build the time blocks associated with this section\n # ont...
[ "0.808948", "0.7070376", "0.6907947", "0.6520502", "0.64065355", "0.6284374", "0.6252015", "0.6247081", "0.5743568", "0.56527776", "0.55988735", "0.55469674", "0.5517027", "0.5495439", "0.5435585", "0.54125416", "0.54113793", "0.5297406", "0.5288516", "0.52852535", "0.5283299...
0.8126844
0
given a list of required courses, a list of scheduled sections, a list of timeblocks computes the optimal schedule. this method ignores the fact that labs/tutorials exist and only schedules lectures
def schedule_courses(courses, schedules) if (courses.empty?) return filter_schedules(schedules) end course_required = courses.pop # add in all possible lecture sections new_schedules = schedule_lecture_sections(LectureSection.where(course: course_required), schedules) # filtering takes place when the base case is proc-ed return schedule_courses(courses, new_schedules) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule_lecture_sections(sections, schedules)\n if (sections.empty?)\n return schedules\n end\n\n new_schedules = []\n schedules.each do |sched|\n # try adding sec to each possible schedule\n sections.each do |lec|\n # build the time blocks associated with this section\n ...
[ "0.747918", "0.70103824", "0.6923481", "0.6796594", "0.65888834", "0.6422448", "0.59950536", "0.59621507", "0.5920438", "0.57928663", "0.5772021", "0.5765576", "0.57612705", "0.57581633", "0.57397205", "0.5710813", "0.5663679", "0.561708", "0.5594401", "0.5594363", "0.5536736...
0.6879357
3
main scheduling method. takes RequiredCourse.all (later will be RequiredCourse.where(user: User)) outputs list of time_blocks.
def schedule # obtain list of required courses course_titles = RequiredCourse.all # obtains Courses associated with each of these titles courses = [] course_titles.each do |ct| courses.push(Course.where(subject: Subject.where(department: ct.department), courseId: ct.courseId).first) end return schedule_courses(courses, [[]]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def course_schedule(course_list)\n # YOUR WORK HERE\nend", "def schedules\n\n\n\n main_courses = Course.where(department_id: self.department_id)\n .where(course_num: self.course_num)\n .where(term_id: self.search.term_id)\n .where(parent_course_id: nil)\n .includes(:child_courses)\n\n ...
[ "0.6369097", "0.6211875", "0.6194045", "0.5995274", "0.5958421", "0.591832", "0.5915382", "0.59144855", "0.5819252", "0.5806309", "0.5781568", "0.5751305", "0.57286227", "0.5665596", "0.56623137", "0.565211", "0.5628332", "0.56265014", "0.5605288", "0.55829823", "0.5577583", ...
0.66321725
0
List of supported tags. They can be attributes, simple descendans or collections (e.g. , )
def supported_tags [ # attributes :nexpose_id, :title, :severity, :pci_severity, :cvss_score, :cvss_vector, :published, :added, :modified, # simple tags :description, :solution, # multiple tags :references, :tags ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supported_tags\n [\n # attributes\n :name,\n\n # simple tags\n\n # multiple tags\n :fingerprints, :configurations, :tests\n ]\n end", "def supported_tags\n [\n # attributes\n\n # simple tags\n :attack_class, :attack_score, :attack_type...
[ "0.8322899", "0.8264635", "0.81958175", "0.78902245", "0.7847601", "0.7714153", "0.7699081", "0.7699081", "0.7698933", "0.7698933", "0.7616432", "0.752016", "0.74641365", "0.74394125", "0.74047077", "0.7341768", "0.7333347", "0.7333347", "0.7333347", "0.73278475", "0.73263174...
0.7960614
3
This allows external callers (and specs) to check for implemented properties
def respond_to?(method, include_private=false) return true if supported_tags.include?(method.to_sym) super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasProperties\n end", "def implements?() \n return true if self[:implements].length > 0\n end", "def property(_name)\n raise Orocos::NotFound, \"#property is not implemented in #{self.class}\"\n end", "def property?(name); end", "def respond_to_missing?(_method_name, _include...
[ "0.69781977", "0.6623428", "0.6542872", "0.6531313", "0.64859307", "0.64859307", "0.6481428", "0.64122206", "0.63959366", "0.6388995", "0.6374073", "0.63069195", "0.6274078", "0.62618935", "0.6194146", "0.6192656", "0.61722946", "0.6159801", "0.61135954", "0.6089457", "0.6082...
0.0
-1
This method is invoked by Ruby when a method that is not defined in this instance is called.
def method_missing(method, *args) # We could remove this check and return nil for any non-recognized tag. # The problem would be that it would make tricky to debug problems with # typos. For instance: <>.potr would return nil instead of raising an # exception unless supported_tags.include?(method) super return end # First we try the attributes. In Ruby we use snake_case, but in XML # CamelCase is used for some attributes translations_table = { :nexpose_id => 'id', :pci_severity => 'pciSeverity', :cvss_score => 'cvssScore', :cvss_vector =>'cvssVector' } method_name = translations_table.fetch(method, method.to_s) return @xml.attributes[method_name].value if @xml.attributes.key?(method_name) # Then we try simple children tags: description, solution tag = @xml.xpath("./#{method_name}/ContainerBlockElement").first if tag lines = [] # Go through Paragraphs and extract them. # FIXME: we're using .//. to get paragraphs nested in Nexpose lists, # ideally we'd convert this lists into Textile bullet point lists. tag.xpath(".//Paragraph").each do |xml_paragraph| lines << xml_paragraph.text.split("\n").collect(&:strip).join(' ').strip end return lines.join("\n\n") end # Finally the enumerations: references, tags if method_name == 'references' @xml.xpath("./references/reference").collect{|entry| {:source => entry['source'], :text => entry.text} } elsif method == 'tags' @xml.xpath("./tags/tag").collect(&:text) else # nothing found, the tag is valid but not present in this ReportItem return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_undefined(*) end", "def method_missing(*)\n invertable nil\n end", "def method_missing(undefined_meth_yet,*args,&block)\n \"#{self.class.to_s} doesn't know how to perform :#{undefined_meth_yet}\"\n end", "def ignore_method_conflicts; end", "def undef_method (sym) end", "def ign...
[ "0.78595203", "0.75643706", "0.7449398", "0.72783905", "0.7204321", "0.70745724", "0.6995571", "0.6986706", "0.69339406", "0.69211334", "0.69187367", "0.67292094", "0.672223", "0.6706291", "0.66812825", "0.66616035", "0.6633869", "0.65735424", "0.65520364", "0.653568", "0.653...
0.0
-1
def autocomplete(input, dictionary) words = Array.new newinput = (input.gsub(/[^azAZ]/, '')).downcase dictionary.each do |word| word = (word.gsub(/[^azAZ]/, '')) if word[0,newinput.length].downcase == newinput[0,newinput.length] words << word end end return words[0,5] end def autocomplete(input, dictionary) words = Array.new newInput = (input.gsub(/[^azAZ]/, '')).downcase dictionary.each do |word| newWord = (word.gsub(/[^azAZ]/, '')) if newWord[0,newInput.length].downcase == newInput[0,newInput.length] words << word end end return words[0,5] end
def autocomplete(input, dictionary) words = Array.new dictionary.each do |word| if (word.gsub(/[^a-zA-Z]/, '')).downcase.start_with? (input.gsub(/[^a-zA-Z]/, '')).downcase words << word end end return words.first(5) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autocomplete(input, dictionary)\n results = []\n sanitized_input = input.gsub(/[^A-Za-z]/, '')\n\n dictionary.each do |word|\n break if results.length >= 5\n next unless word.downcase.start_with?(sanitized_input)\n results << word\n end\n results\nend", "def autocomplete(input, dictionary)\n m...
[ "0.8394701", "0.82822573", "0.8235448", "0.67641926", "0.66517955", "0.66414744", "0.6601964", "0.64574856", "0.6452446", "0.64384675", "0.6422685", "0.6391152", "0.63426495", "0.6325722", "0.63229823", "0.6313708", "0.62654126", "0.6261073", "0.62463033", "0.620572", "0.6196...
0.87137014
0
This is code to play a normal game of black jack Player.show_players.each do |player|
def dealer_hit # puts "Dealer has #{@dealer.total}" @dealer.hit until @dealer.total > 16 # puts "Dealer has #{@dealer.total}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_players()\n\t\tfor i in 0...@num_players\n\t\t\tprint_player(i)\n\t\tend\n\tend", "def each_player\n @players.each\n end", "def play(players)\n while !win?\n players.each do |player|\n self.end_if_tie\n self.draw\n puts \"#{player.name} turn with #{player.sign}\"\n ...
[ "0.7531391", "0.7404798", "0.7235183", "0.7148809", "0.70698", "0.7055667", "0.7052667", "0.7047539", "0.704645", "0.7040463", "0.70030314", "0.699813", "0.698837", "0.6979746", "0.6946158", "0.69391686", "0.6932869", "0.69227386", "0.6918335", "0.6903447", "0.6886465", "0....
0.0
-1
this gets set to true after the player has searched
def initialize monster_chance end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_players(search_names)\n @player_names.include?(each_player)\n end", "def search_players(player_name)\n # for player in @players\n # if player == player_name\n # return true\n # else\n # return false\n # end\n # end\n # better way to write - had implicit true...
[ "0.67606705", "0.6263118", "0.6138832", "0.6124798", "0.60925627", "0.60541046", "0.6044105", "0.6040157", "0.60345554", "0.60310686", "0.60288566", "0.6013712", "0.60048604", "0.59758794", "0.597121", "0.59627885", "0.59493786", "0.5929618", "0.59023196", "0.5877031", "0.585...
0.0
-1
the name of your dungeon room
def name name = "Cess Pool" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n client.api.get_room_name(id)[:name]\n rescue MatrixNotFoundError\n # No room name has been specified\n nil\n end", "def roomName(hash={})\n\t\t$roomtitle = $_SERVERSTRING_.gsub(/<[^>]+>/o,'')\n\t\tif $roomtitle.include?(',')\n\t\t\t$roomarea = $roomtitle.split(',').first\n\t\tend\...
[ "0.69853634", "0.6961451", "0.6834113", "0.6818291", "0.6780446", "0.65525585", "0.65503234", "0.654624", "0.65431345", "0.64392257", "0.6407", "0.63788605", "0.63609445", "0.63369226", "0.62885594", "0.6063957", "0.60584587", "0.60458595", "0.60446894", "0.60413665", "0.6030...
0.55976856
61
description of your dungeon room
def enter $movement = "take path" puts "This room opens up into a somewhat large cavernous room that mostly contains "\ "a dark and foul looking body of... something. It most likely used to be water, but the lack "\ "of a current and the fact that the denezins of this place have used it as a latrine for "\ "what seems like centuries has turned the body into a foul smelling disease ridden pool."\ "A path runs along side of the pool leading to other parts of the dungeon." if @monster puts "An evil #{@monster.monster} is doing its business here." else puts "Except for an occasional bubbling from the pool, the room is eerily quite." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_current_description\n\t\tputs find_room_in_dungeon(@player.location).full_description\n\tend", "def description\n description = \"\"\n if @monster\n puts \"An evil #{@monster.monster} is here.\"\n else\n puts \"The room is eerily quite.\"\n end\n end", "def new_description\n ...
[ "0.74016255", "0.7383432", "0.72446746", "0.71832085", "0.67810535", "0.67122126", "0.6630565", "0.65945643", "0.65163213", "0.6362242", "0.63602525", "0.6356171", "0.633107", "0.63063425", "0.62736493", "0.6179207", "0.6126561", "0.61133516", "0.6108364", "0.6073961", "0.603...
0.0
-1
If the room has the chance to spawn a monster, this method spawns one
def monster_chance chance = roll.d100(1) if chance <= 10 @monster = MonsterTable::spawn_monster(1) #x is the level of the monster that will spawn end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monster_chance\n chance = roll.d100(1)\n if chance <= 50\n @monster = MonsterTable::spawn_monster(x) #x is the level of the monster that will spawn\n end\n end", "def spawn_smulg\r\n smulg = spawn_monster(\"Smulg\", 30, 15, 65, 50, rand(3..5), (3..10))\r\nend", "def monster_chance\n chan...
[ "0.7520816", "0.74858755", "0.74470526", "0.74470526", "0.6863493", "0.6673554", "0.6534435", "0.6486177", "0.64118665", "0.63252115", "0.62517506", "0.6149363", "0.60397077", "0.60044396", "0.59891236", "0.59783053", "0.5902805", "0.589295", "0.58896965", "0.5882123", "0.585...
0.7429467
4
special room rules should go here
def available_actions super.merge({ "search" => "You search the grimy pool" }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def room; end", "def checkroom(r)\n case r.status\n when :plan\n # moot\n when :dig\n # designation cancelled: damp stone etc\n r.dig\n when :dug, :finished\n # cavein / tree\n r.dig\n ...
[ "0.6776468", "0.6610233", "0.65536314", "0.64519364", "0.64519364", "0.64519364", "0.64519364", "0.64519364", "0.64519364", "0.64519364", "0.6416117", "0.61909324", "0.61909324", "0.61909324", "0.6113959", "0.6113959", "0.58802557", "0.57794803", "0.57621855", "0.57621855", "...
0.0
-1
GET /operators GET /operators.json
def index @operators = Operator.all respond_to do |format| format.xlsx end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_operators\r\n url = CLX.paths[:operator]\r\n @http_client.get(url)\r\n end", "def index\n @operators = Operator.search(params)\n @operators = Operator.all\n end", "def index\n @operators = Operator.all\n end", "def get_operators(type)\n for_type(type).collect(&:operator...
[ "0.8462162", "0.68992144", "0.68682736", "0.6682641", "0.666765", "0.6632869", "0.65660065", "0.64160776", "0.63378793", "0.6315977", "0.6219092", "0.6102382", "0.60445803", "0.60381645", "0.6022085", "0.5964486", "0.5963816", "0.59181553", "0.59169763", "0.58080137", "0.5808...
0.5401586
47
GET /operators/1 GET /operators/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_operators\r\n url = CLX.paths[:operator]\r\n @http_client.get(url)\r\n end", "def show\n\n @operator = Operator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @operator }\n end\n\n end", "def index\n @operators...
[ "0.8014865", "0.6972622", "0.6916583", "0.68020517", "0.6739799", "0.63865083", "0.6385131", "0.6360303", "0.63516927", "0.62621605", "0.6255083", "0.60545576", "0.5998705", "0.5936228", "0.5900211", "0.5813443", "0.5761558", "0.5761558", "0.5761558", "0.5756649", "0.5716798"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_operator @operator = Operator.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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def operator_params params.require(:operator).permit(:cc, :name, :position, :dateadmission, :state , :job_id, :lastname, :retirementdate, :description, :gender, :transportAllowance, :feedingAllowance, :vehicleAllowance, :housingAllowance, :childrenLicenseSince, :childrenLicenseUntil, :sanction, :flag, :basepay, :billingc_id, :company_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
GET /displays GET /displays.json
def index #next 2 lines say if nil equal .... params[:sort] ||='name' params[:direction] ||='ASC' @displays=Display.order(params[:sort]+" "+ params[:direction] ) @displays=@displays.paginate(:page=>params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @displays = Display.all\n end", "def show\n @display = Display.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @display }\n end\n end", "def show\n @displays = Display.all\n @names=[]\n @displays.each do |di...
[ "0.76689947", "0.68759215", "0.65153104", "0.6434051", "0.642243", "0.640952", "0.634131", "0.62547076", "0.6244456", "0.62403166", "0.62333804", "0.62201595", "0.6198984", "0.6198984", "0.61810094", "0.61743945", "0.6168888", "0.6162346", "0.6162151", "0.61588985", "0.615768...
0.0
-1
GET /displays/1 GET /displays/1.json
def show @displays = Display.all @names=[] @displays.each do |display| @names.push display.name end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @displays = Display.all\n end", "def show\n @display = Display.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @display }\n end\n end", "def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |form...
[ "0.74069947", "0.70486426", "0.67012197", "0.65519536", "0.6539053", "0.65357095", "0.65183634", "0.6514814", "0.6492739", "0.64175284", "0.6404083", "0.6404083", "0.6384531", "0.6375053", "0.6369893", "0.63500893", "0.63317925", "0.63306326", "0.6293989", "0.6293989", "0.629...
0.6285809
22
POST /displays POST /displays.json
def create @display = Display.new(display_params) respond_to do |format| if @display.save format.html { redirect_to @display, notice: 'Display was successfully created.' } format.json { render :show, status: :created, location: @display } else format.html { render :new } format.json { render json: @display.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @displays = Display.all\n end", "def create\n @display = Display.new(params[:display])\n\n respond_to do |format|\n if @display.save\n format.html { redirect_to @display, :notice => 'Display was successfully created.' }\n format.json { render :json => @display, :status =>...
[ "0.683263", "0.6662547", "0.6621808", "0.6215846", "0.60682476", "0.6065156", "0.60272396", "0.5992832", "0.59595144", "0.5944308", "0.5807038", "0.57802814", "0.5703285", "0.56886894", "0.5655639", "0.5647508", "0.56411475", "0.551437", "0.5499846", "0.54957354", "0.5491604"...
0.66945714
1
PATCH/PUT /displays/1 PATCH/PUT /displays/1.json
def update respond_to do |format| if @display.update(display_params) format.html { redirect_to @display, notice: 'Display was successfully updated.' } format.json { render :show, status: :ok, location: @display } else format.html { render :edit } format.json { render json: @display.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @display = Display.find(params[:id])\n\n respond_to do |format|\n if @display.update_attributes(params[:display])\n format.html { redirect_to @display, :notice => 'Display was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render...
[ "0.66917783", "0.6293573", "0.62039334", "0.6182595", "0.6115785", "0.60995644", "0.60700846", "0.60298556", "0.60213155", "0.5979341", "0.5975393", "0.59727", "0.5968698", "0.59445006", "0.59404606", "0.59377176", "0.5931369", "0.59214383", "0.5920247", "0.5913677", "0.59044...
0.64974666
1
DELETE /displays/1 DELETE /displays/1.json
def destroy @display.destroy respond_to do |format| format.html { redirect_to displays_url, notice: 'Display was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to displays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |fo...
[ "0.748138", "0.7295277", "0.6883154", "0.68739027", "0.68485904", "0.6832466", "0.68277794", "0.68199867", "0.67659575", "0.67593324", "0.66454387", "0.66435814", "0.66037893", "0.66037893", "0.6603657", "0.66025704", "0.66011417", "0.6591571", "0.65859663", "0.654852", "0.65...
0.7247227
2
Use callbacks to share common setup or constraints between actions.
def set_display @display = Display.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def display_params params.require(:display).permit(:Price, :name, :resolution, :brand, :aspect_ratio, :size, :ports, :response_time, :refresh_rate, :speakers, :dimensions, :panel, :release, :stand_misc, :gpu_sync,:image) 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.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289...
0.0
-1
Returns TRUE if state is a steady state
def steady_state?(state) STATES[state] >= STEADY_STATE_THRESHOLD end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stressed?\n self.stress_state == :stressed.to_s\n end", "def stopped?\n @state == :stopped\n end", "def state?(state)\n @state == state\n end", "def state?(state)\n @_state == state\n end", "def running?\n @state == :running\n end", "def has_state?\n !!current_state...
[ "0.72019666", "0.6838485", "0.68305165", "0.6787644", "0.67716557", "0.67371637", "0.6709601", "0.6708983", "0.6659452", "0.65997577", "0.6531159", "0.6483875", "0.6474388", "0.647117", "0.6467643", "0.64558977", "0.6449057", "0.6449057", "0.6442114", "0.6440279", "0.6428615"...
0.89943236
0
Returns TRUE if state is an error state
def error_state?(state) STATES[state] >= ERROR_STATE_THRESHOLD end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error?\n @status == ERROR_FLAG\n end", "def error?\n logger.debug { sign_message(\"Error state : #{@error}\") }\n if @error\n true\n else\n false\n end\n end", "def error_state?(sym); @error_states.include?(sym) end", "def error?\n ...
[ "0.81239337", "0.8123193", "0.81038606", "0.79848903", "0.7850123", "0.7766114", "0.7699111", "0.76921916", "0.7682959", "0.76175046", "0.758137", "0.758137", "0.7541372", "0.7507358", "0.75044316", "0.7502675", "0.74944824", "0.7476843", "0.7476843", "0.74665624", "0.7455355...
0.8689828
0
Returns array of all possible states preceeding given state
def valid_prev_states(state) normalized_state = normalize_state(state) prev = STATES.select do |_, v| normalize_state(v) < normalized_state && v < ERROR_STATE_THRESHOLD end prev.keys end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_states\n possible = []\n # possible states going up\n possible += next_states_in_dir(1) if @elevator != 3\n # possible states going down only make sense if there are actually some items available at lower floors\n items_lower = @floors[0...@elevator].map { |floor| floor.length }.sum\n po...
[ "0.7056619", "0.64581096", "0.63080424", "0.62575233", "0.6183176", "0.61278796", "0.60829926", "0.6079514", "0.6076583", "0.59964854", "0.59678894", "0.59642166", "0.59384745", "0.5905582", "0.58605", "0.58463514", "0.5741335", "0.5697643", "0.56764513", "0.56468266", "0.562...
0.65054613
1
Returns normalized state index
def normalize_state(state) val = state.is_a?(Integer) ? state : STATES[state] case when val.nil? raise "Invalid task state #{state.inspect}" when val >= ERROR_STATE_THRESHOLD return val - ERROR_STATE_THRESHOLD when val >= STEADY_STATE_THRESHOLD return val - STEADY_STATE_THRESHOLD else return val end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_state(index)\r\n @state[index]\r\n end", "def state(index = :all)\n index = check_index(index)\n res = cmd(COMMANDS[:state]).ord\n res = (0...size).to_a.map { |pos| (res & (0x01 << pos)) >> pos }\n res = res[index - 1] if index && index.nonzero?\n res\n end", "def stat...
[ "0.6698969", "0.64504623", "0.59010696", "0.59010696", "0.59010696", "0.59010696", "0.59010696", "0.59010696", "0.58222437", "0.5744206", "0.57425094", "0.57096684", "0.56679046", "0.5659119", "0.5651505", "0.5607494", "0.55906844", "0.55780315", "0.554398", "0.5535084", "0.5...
0.5887898
8
attr_accessor :action , :user def intialize
def allowed?(action,user) if user.tenant? flash[:notice] = "Sorry. You are not allowed to perform this action as a tenant" return redirect_to action, notice:"Sorry. You can't list a property as a tenant" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_action=(value)\n @user_action = value\n end", "def set_user_action\n @user_action = UserAction.find(params[:id])\n end", "def set_user_action\n @user_action = UserAction.find(params[:id])\n end", "def initialize( name , action )\n super(name)\n\n ...
[ "0.7323633", "0.70960164", "0.70960164", "0.70444906", "0.69833946", "0.6968363", "0.6968363", "0.6968363", "0.6968363", "0.6968363", "0.6968363", "0.6968363", "0.6968363", "0.6864927", "0.670446", "0.6667961", "0.6667926", "0.6659382", "0.66231257", "0.662033", "0.662033", ...
0.0
-1
TODO: uncomment when necessary def show
def update @item = @receipt.items.find_by(id: params[:id]) unless @item return render_error_code(:not_found, :db_failure, item: 'was not found') end if @item.update(permitted_params) render_ok else render_error_code(:bad_request, :db_failure, @item.errors) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show() end", "def show() end", "def show() end", "def show\n\t\t end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def s...
[ "0.8997242", "0.8997242", "0.8997242", "0.8953028", "0.88916487", "0.88916487", "0.88916487", "0.88916487", "0.88916487", "0.88916487", "0.88916487", "0.88916487", "0.88916487", "0.87509894", "0.8737588", "0.8595631", "0.85275805", "0.85014594", "0.85014594", "0.84929687", "0...
0.0
-1
Attempt to find the nth prime, extending the list as necessary
def nth loop do value = search( @ord ) return value unless value.nil? build_out_prime_list end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nth_prime(n)\n\n arry_prime = []\n value = 2\n\n while arry_prime.size < n\n if is_prime?(value)\n arry_prime << value\n end\n value += 1\n end\n arry_prime[-1]\nend", "def nth_prime(n)\n result = []\n i = 2\n while result.length < n\n result << i if is_prime?(i)\n i += 1\n end\n...
[ "0.7686149", "0.76397663", "0.75807524", "0.7555723", "0.75451016", "0.7531098", "0.7454893", "0.74522537", "0.7448926", "0.74470395", "0.74277186", "0.7417901", "0.7377454", "0.73126835", "0.7298629", "0.72497004", "0.7240094", "0.72246593", "0.7221682", "0.72024846", "0.718...
0.73964196
12
Access the class list of primes
def prime_list self.class.prime_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes\n return [] if self == 0\n return \"don't do that\" if self < 0\n list = [2]\n test = 3\n until list.length == self\n list << test if test.is_prime?\n test += 2\n end\n list\n end", "def primes (number)\n primes_array = []\n Prime.each(number) do |p|\n primes_array...
[ "0.6853353", "0.6410799", "0.63471085", "0.62410146", "0.62348104", "0.61873794", "0.6115796", "0.6108933", "0.6103797", "0.6101888", "0.60889345", "0.6060623", "0.6055522", "0.6055522", "0.6049918", "0.60498065", "0.60498065", "0.60498065", "0.60498065", "0.6040072", "0.6004...
0.7937223
0
Search through the list for the ord'th prime. It may not be there, in which case the list will be extended
def search( ord ) prime_list.each_with_index do |prime, idx| next unless prime return idx_to_value( idx ) if (ord -= 1) == 1 end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nth\n loop do\n value = search( @ord )\n return value unless value.nil?\n build_out_prime_list\n end\n end", "def find_prime\n x = 2\n while @prime_numbers.count < @total\n @prime_numbers << x if prime?(x)\n x += 1\n end\n end", "def next_prime\n if !@primes.inc...
[ "0.70017517", "0.6473775", "0.6270892", "0.60561806", "0.60535455", "0.60103494", "0.59738106", "0.5971176", "0.5886548", "0.58133715", "0.5777376", "0.5737627", "0.57341504", "0.5723128", "0.57136965", "0.56985897", "0.56904006", "0.5688431", "0.56780934", "0.5676974", "0.56...
0.8006238
0
Extend the prime list by doubling its size each time.
def build_out_prime_list new_size = prime_list.size + prime_list.size loop_end = Math.sqrt( idx_to_value( new_size ) ).ceil (prime_list.size..new_size).each { |idx| prime_list[idx] = true } prime_list.each_with_index do |prime, idx| next unless prime divisor = idx_to_value( idx ) break if divisor > loop_end (idx+1..new_size).each { |i| prime_list[i] = false if idx_to_value( i ) % divisor == 0 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepend(list, prime)\n newlist = []\n lists.each do |n|\n (0..9).each do |i|\n all = i.to_s + n.to_s\n next if non_pandigital(all)\n next unless all[0..2].to_i % prime == 0\n newlist << all\n end\n end\n return newlist\nend", "def resize\n old_array = @items\n @items = Arr...
[ "0.58790565", "0.58458966", "0.5764791", "0.5746924", "0.56567055", "0.56154007", "0.5511745", "0.5485052", "0.5479628", "0.54679096", "0.5458126", "0.54557395", "0.54378635", "0.54213846", "0.5418831", "0.5409527", "0.53463954", "0.5333288", "0.5322419", "0.53215545", "0.530...
0.67391866
0
Initialization of the client.
def initialize(network, host = 'localhost', port = 6379, logger = Logger.new(nil)) load(network, host, port) @redis_listener = Redis.new host: host, port: port, thread_safe: false @log = logger @failed_cmds = Array.new(10) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_client; end", "def initialize(client)\n\t\tself.client = client\n\tend", "def initialize(client)\n\t\tself.client = client\n\tend", "def initialize\n get_enterprise_token\n initialize_client\n end", "def initialize(client)\n\t self.client=client\n end", "def initialize(client)\n ...
[ "0.8439873", "0.7414807", "0.7414807", "0.73609716", "0.7336434", "0.73032886", "0.7213897", "0.7097944", "0.7088457", "0.7047015", "0.7017166", "0.7017166", "0.7017166", "0.7017166", "0.7017166", "0.7017166", "0.7017166", "0.7017166", "0.7017166", "0.7017166", "0.7017166", ...
0.0
-1
Destroy the entire database and configuration
def flushdb @redis.flushdb @log.info("Flushing database") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_database_configuration_file\n FileUtils.rm(database_configuration_file)\n end", "def delete_database\n FileUtils.rm_rf(@db_dir)\n end", "def destroy\n DATABASE.destroy(self)\n end", "def destroy_database_directory\n FileUtils.remove_dir(database_directory)...
[ "0.80495334", "0.7869672", "0.78596395", "0.77717066", "0.7713226", "0.7713226", "0.7629192", "0.76016885", "0.758977", "0.758032", "0.7410419", "0.73504245", "0.7331701", "0.7283644", "0.7211268", "0.7211268", "0.7172786", "0.7167686", "0.71504045", "0.71223176", "0.7103023"...
0.0
-1
Clean up a multiplexer's sensors and actuators
def clean_up(multi_id) net = get_multi_config(multi_id)[:network] @redis.del(network_path(net, :sensor, :value, multi_id)) @redis.del(network_path(net, :actuator, :value, multi_id)) @redis.del(network_path(net, :sensor, :config, multi_id)) @redis.del(network_path(net, :actuator, :config, multi_id)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teardown\n @port_a_pwm.stop if @port_a_pwm\n @port_b_pwm.stop if @port_b_pwm\n RPi::GPIO.clean_up(@pins[:in1])\n RPi::GPIO.clean_up(@pins[:in2])\n RPi::GPIO.clean_up(@pins[:in3])\n RPi::GPIO.clean_up(@pins[:in4])\n end", "def clean\n\t\t\twas_updated = updated?\...
[ "0.6781887", "0.6391119", "0.617976", "0.60569817", "0.6044834", "0.5985309", "0.597451", "0.5958026", "0.59488845", "0.59455895", "0.59243137", "0.5896971", "0.58922106", "0.5871499", "0.5871499", "0.5863591", "0.5856841", "0.5853097", "0.5843758", "0.58425194", "0.58008033"...
0.64491785
1