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
Use callbacks to share common setup or constraints between actions.
def set_patroller @patroller = Patroller.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 patroller_params params.require(:patroller).permit(:firstname, :lastname, :username, :password, :password_confirmation, :on_shift, :destination_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.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
this takes identifiers and makes sure there's no 'funny' characters. usefuly for filenaming on exports.
def safe_filename(id, suffix = "") filename = "#{id}_#{Time.now.getutc}_#{suffix}" filename.gsub(/\s+/, '_').gsub(/[^0-9A-Za-z_\.]/, '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prepareName ( name )\n name.to_s.gsub /[\\W]/, ''\n end", "def safe_name\n name.gsub(/(^[0-9]*|[^0-9a-z])/i, '')\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def clean!\n reject! { |n...
[ "0.62708044", "0.6157444", "0.6102533", "0.6102533", "0.60808986", "0.60685015", "0.60326415", "0.60287607", "0.6028656", "0.6021921", "0.59924304", "0.59846866", "0.59646285", "0.5952958", "0.5942895", "0.5930223", "0.5921514", "0.5894706", "0.5881625", "0.58593875", "0.5834...
0.0
-1
GET /finding_categories/1 GET /finding_categories/1.json
def show @finding_category = FindingCategory.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @finding_category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_ba...
[ "0.74467516", "0.7203288", "0.7000733", "0.6986794", "0.6930484", "0.6863982", "0.6790134", "0.6710041", "0.66874945", "0.66758376", "0.6672251", "0.6611452", "0.6597568", "0.6587721", "0.6567651", "0.6565139", "0.6563009", "0.6555238", "0.6522922", "0.65096253", "0.65075296"...
0.68232733
6
GET /finding_categories/new GET /finding_categories/new.json
def new @finding_category = FindingCategory.new respond_to do |format| format.html # new.html.erb format.json { render json: @finding_category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n puts @category.inspect\n @internal = @category.internals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internal }\n end\n end", "def create\n @finding_category = FindingCategory.new(params[:finding_category])\n\n respond_to do |fo...
[ "0.72752535", "0.708415", "0.7047515", "0.7039844", "0.7039844", "0.7039844", "0.7039844", "0.7039844", "0.7039844", "0.7039844", "0.7039844", "0.7039844", "0.70075417", "0.7001109", "0.6999652", "0.6894658", "0.6875193", "0.6874593", "0.68011844", "0.6777754", "0.6771486", ...
0.77567476
0
POST /finding_categories POST /finding_categories.json
def create @finding_category = FindingCategory.new(params[:finding_category]) respond_to do |format| if @finding_category.save format.html { redirect_to @finding_category, notice: 'Finding category was successfully created.' } format.json { render json: @finding_category, status: :created, location: @finding_category } else format.html { render action: "new" } format.json { render json: @finding_category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend", "def get_categories\r\n categ...
[ "0.67101246", "0.67053944", "0.6627576", "0.6317546", "0.631435", "0.6285874", "0.6283821", "0.62635845", "0.62451535", "0.6226264", "0.6132665", "0.6053539", "0.6035057", "0.60298723", "0.6008048", "0.5985442", "0.5976079", "0.59500194", "0.5927743", "0.5920818", "0.58871305...
0.65982735
3
PUT /finding_categories/1 PUT /finding_categories/1.json
def update @finding_category = FindingCategory.find(params[:id]) respond_to do |format| if @finding_category.update_attributes(params[:finding_category]) format.html { redirect_to @finding_category, notice: 'Finding category was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @finding_category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n ...
[ "0.70421666", "0.6950338", "0.65736663", "0.6304483", "0.6285515", "0.6259402", "0.62260747", "0.62210596", "0.62119824", "0.6146446", "0.6114679", "0.6110026", "0.6076849", "0.60741293", "0.6067139", "0.6067139", "0.60616183", "0.604284", "0.60335183", "0.5999612", "0.599189...
0.6544645
3
DELETE /finding_categories/1 DELETE /finding_categories/1.json
def destroy @finding_category = FindingCategory.find(params[:id]) @finding_category.destroy respond_to do |format| format.html { redirect_to finding_categories_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n IndicatorCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to indicator_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @category.destroy\n render json: @category, status: :ok\n end", "def DeleteCategory id\n ...
[ "0.7271275", "0.72421026", "0.72408587", "0.7213716", "0.71804744", "0.7149601", "0.71144086", "0.7104894", "0.7081873", "0.7079069", "0.70624286", "0.703901", "0.7030657", "0.7014515", "0.70017", "0.69924396", "0.6956417", "0.6947784", "0.6940629", "0.6939758", "0.6936186", ...
0.74620885
0
Defines what needs to be done every frame before drawing
def each_frame &block @update_block = block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw; end", "def draw; end", "def draw\n end", "def update\n super\n # update_bitmap # Not needed for now\n update_screen # Update the position the graphic should be displayed\n # update_frame # Update the frame count (if wanted later)\n end", "def on_timer\n @radius+=@increment\n...
[ "0.6483364", "0.6483364", "0.64535946", "0.6415081", "0.6386028", "0.63605684", "0.63605684", "0.63605684", "0.63605684", "0.6350158", "0.63367146", "0.63205576", "0.6304284", "0.6304284", "0.6304284", "0.62560415", "0.62404996", "0.6172232", "0.6151756", "0.614796", "0.61280...
0.0
-1
Removes shapes so they wont be drawn on the next frame
def empty_shapes shapes.clear end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_shape\n\t\t@shapes.delete_at(0)\n\tend", "def remove shape\n @remove_shapes << shape\n end", "def clear_shapes(dispose_images: true, dispose_patterns: true, redraw: :all)\n if redraw == true || redraw == :all\n shapes.dup.each {|shape| shape.dispose(dispose_images: dispose_im...
[ "0.7884592", "0.7062235", "0.67755306", "0.6573456", "0.656528", "0.642988", "0.63951784", "0.6380411", "0.636423", "0.6349313", "0.63451517", "0.630428", "0.63017327", "0.62989056", "0.62607706", "0.6171678", "0.6129536", "0.610888", "0.61084193", "0.61047494", "0.6081846", ...
0.7661757
1
===================================== Begin standard controller actions =====================================
def new # @user = params[:id] ? User.find(params[:id]) : nil @admin = Admin.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller\n end", "def controller\n end", "def...
[ "0.7232635", "0.7232635", "0.7232635", "0.7232635", "0.7232635", "0.7232635", "0.7232635", "0.7232635", "0.7232635", "0.7232635", "0.7142583", "0.7142583", "0.68219006", "0.6819696", "0.6671095", "0.6575314", "0.65591115", "0.65591115", "0.65591115", "0.65591115", "0.65591115...
0.0
-1
===================================== Begin nonstandard controller actions ===================================== I need to refactor all of these method below The delete old user method is nothing other than a call to usersdestroy The transfer capsule method is nothing other than a call to capsulesupdate The transfer authorization is nothing other than a call to authorizationsupdate relogin is nothing other than a call to sessionsupdate All of this is repeating code. NO REASON TO DO IT!!
def delete_old_user(user_id = nil) unless user_id.nil? user = User.find(user_id) user.delete end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_updated_user(user, user_params)\n#store update result\n success = user.update(user_params)\n#set action\n action = params[:user][:action]\n#set messages\n messages = user_errors(user) if !success\n#set appropriate path\n path = controller\n path = \"#{action}_#{controller}\" if !succes...
[ "0.638933", "0.6263533", "0.6187389", "0.617224", "0.6170761", "0.6147242", "0.6090217", "0.60769016", "0.6074358", "0.60707366", "0.60641897", "0.6042926", "0.60412323", "0.6035337", "0.6031656", "0.60227597", "0.6017357", "0.6016012", "0.600561", "0.5998685", "0.59923834", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def message_params params.require(:message).permit(:msg, :user_id, :irbappid, :receiverid) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
schedule an SMS reminder using Twilio use delayed_job to schedule the sms
def schedule_sms_reminder @twilio_number = ENV['TWILIO_NUMBER'] @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'] users = get_sms_list users.each do |user| reminder = "DCB Reminder: Don't forget! #{self.title} on #{self.start.to_formatted_s(:long_ordinal)} at #{self.location}" message = @client.account.messages.create( :from => @twilio_number, :to => user.phone, :body => reminder, ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform(reminder, number)\n \tclient = Twilio::REST::Client.new Rails.application.secrets.twilio_account_sid, Rails.application.secrets.twilio_auth_token\n \tmessage = client.messages.create from: '8326482121', to: 'number', body: 'Hi, This is a reminder to text @reminder.contact regarding @reminder.occasion...
[ "0.74521345", "0.72777504", "0.70886916", "0.69179696", "0.68303007", "0.6790092", "0.6777955", "0.66724193", "0.6670365", "0.65680546", "0.653149", "0.6509295", "0.648253", "0.6476962", "0.63983756", "0.6371083", "0.6308673", "0.62813187", "0.6267151", "0.6257946", "0.625508...
0.77765054
0
get list of users to send sms based on event category and subscription settings
def get_sms_list if(self.category_id == 1) users = User.where(:subscribed_to_sms => true, :faculty_meetings => true) elsif(self.category_id == 2) users = User.where(:subscribed_to_sms => true, :cpcb_seminars => true) elsif(self.category_id == 3) users = User.where(:subscribed_to_sms => true, :miscellaneous => true) elsif(self.category_id == 4) users = User.where(:subscribed_to_sms => true, :csb_seminars => true) else users = User.all end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @users = current_user.sent_messages.distinct.map(&:receiver)\n @users += current_user.received_messages.distinct.map(&:sender)\n @users = @users.uniq\n end", "def fGetSubscribedEventsFrom(email)\n @users.getSubscribedEventsFrom(email)\n end", "def users\n user_arr = []\n subs...
[ "0.63535416", "0.63179076", "0.6234601", "0.60484433", "0.60464984", "0.6039524", "0.5996851", "0.59820896", "0.5978038", "0.59246916", "0.59003437", "0.58164394", "0.5749327", "0.5726197", "0.5723718", "0.5707193", "0.56780326", "0.56710243", "0.5665289", "0.5657072", "0.564...
0.7663486
0
Return the amount still owed, based on the current payments made. balance_owed is positive if payment is still required. Negative if there has been an overpayment
def balance_owed discounted_price - amount_paid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_owed\n if workshop_price&.recurring_payments?\n to_pay = recurring_what_should_be_paid_by_now - amount_paid\n to_pay.negative? ? Money.new(0, workshop_price.price.currency) : to_pay\n else\n balance_owed\n end\n end", "def make_paymen...
[ "0.760779", "0.75766194", "0.6879996", "0.67062163", "0.66758806", "0.6591847", "0.6561904", "0.65551966", "0.64862216", "0.6482054", "0.6472453", "0.6438173", "0.64349043", "0.6410051", "0.63759834", "0.62988293", "0.62971175", "0.6284497", "0.6272039", "0.6243327", "0.62126...
0.7031924
2
suggested amount of next payment. when it's recurring, they payment should be whatever is needed to bring their payment plan up to date
def payment_owed if workshop_price&.recurring_payments? to_pay = recurring_what_should_be_paid_by_now - amount_paid to_pay.negative? ? Money.new(0, workshop_price.price.currency) : to_pay else balance_owed end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debt_payment\n loan_proceeds = 0\n debt_rate * loan_proceeds\n end", "def next_payment_due_on\n return second_payment_is_due_on unless second_payment_is_paid?\n return security_deposit_is_due_on unless security_deposit_is_paid?\n nil\n end", "def next_charge\n ( pre_finalised_quot...
[ "0.70018035", "0.688157", "0.6831241", "0.6709835", "0.6683807", "0.6676308", "0.66175604", "0.65061754", "0.64974445", "0.64899325", "0.6448404", "0.6415873", "0.6384381", "0.6316218", "0.6310627", "0.6283603", "0.62749386", "0.6258939", "0.6231241", "0.62239224", "0.6221828...
0.6771358
3
when a customer wants to make a payment, they should either charged the amount for this month (which could be less than the normal monthly amount), or the standard monthly amount, or whatever the balance_owed is
def make_payment_now_amount if payment_owed.positive? payment_owed elsif workshop_price.payment_price < balance_owed workshop_price.payment_price else balance_owed end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monthly_payment\n\t\tc = monthly_interest\n\t\tif interest_only?\n\t\t\tc * amount\n\t\telse\n\t\t\tn = total_payments\n\t\t\t(amount * ((c * ((1 + c)**n)) / (((1 + c)**n) - 1))).round(2)\n\t\tend\n\tend", "def fixed_monthly_payment(amount, months, ir )\n amount*( ir * ( 1 + ir ) **months )/(( 1 + ir )**mon...
[ "0.7146176", "0.6784461", "0.67612845", "0.6730483", "0.67149526", "0.65736157", "0.6503423", "0.64891005", "0.6485326", "0.64522815", "0.64249843", "0.6387869", "0.63806486", "0.6372748", "0.6372748", "0.6372748", "0.6372748", "0.6372748", "0.6362725", "0.6340477", "0.631527...
0.6804346
1
calculate what the actual date the initial payment should be. Usually it's date of registration. However, we may wish for payments not to be required until a certain date, either at the workshop or individual registration level
def initial_payments_should_start_on if payment_reminder_hold_until payment_reminder_hold_until else workshop.initial_payment_required_on ? workshop.initial_payment_required_on : created_at end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_payment_due_on\n entry = workshop_price.specific_payment_schedule(initial_payments_should_start_on, Date.today)\n entry ? entry[:due_on] : initial_payments_should_start_on.to_date\n end", "def set_initial_date\n unless date_requested\n self.date_requested = Dat...
[ "0.7121287", "0.69350725", "0.6792126", "0.671001", "0.6657006", "0.66070324", "0.65682006", "0.6522373", "0.6514033", "0.65031904", "0.6462178", "0.6459759", "0.6371235", "0.6344972", "0.6344575", "0.63232946", "0.6297239", "0.6295439", "0.62776417", "0.62753516", "0.6271611...
0.7420714
0
date when the most recent payment was due
def last_payment_due_on entry = workshop_price.specific_payment_schedule(initial_payments_should_start_on, Date.today) entry ? entry[:due_on] : initial_payments_should_start_on.to_date end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_payment_on\n payment_histories.try(:last).try(:payment_date)\n end", "def final_due_date\n del = self.deliverables\n return nil unless del.size > 0\n\n dates = del.collect(&:due).delete_if { |d| d.blank?}\n \n return dates.sort[-1] \n end", "def payment_deadline\n ...
[ "0.79088295", "0.7194772", "0.7183212", "0.7149584", "0.7125817", "0.68870795", "0.68575805", "0.67869663", "0.669513", "0.66895396", "0.6646917", "0.65948683", "0.65875703", "0.6559629", "0.6548857", "0.65419865", "0.65165305", "0.65140843", "0.6512419", "0.6493134", "0.6487...
0.75260377
1
date when the most recent payment was made, or nil if no payments yet
def last_payment_on payment_histories.try(:last).try(:payment_date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_payment\n @last_payment ||= payments.order(:created_at).last\n end", "def latest_payment\n payment_intent = as_stripe_subscription(['latest_invoice.payment_intent'])\n .latest_invoice\n .payment_intent\n\n payment_intent ? Payment.new(payment_intent) : nil\n end", "def l...
[ "0.74550563", "0.6789524", "0.67820585", "0.6604581", "0.6567325", "0.64551574", "0.6425981", "0.64098805", "0.64012533", "0.6278848", "0.62756395", "0.62716275", "0.6257609", "0.62540627", "0.6245166", "0.6242206", "0.6210591", "0.6208438", "0.6163959", "0.61467034", "0.6120...
0.7912343
0
Payment was entered manually, create the history record. You can tell it's a manual entry if the user_profile is filled in means a human did it.
def manual_payment(payment_history, cost, total_currency, user_profile, options) options ||= { item_ref: '', payment_method: 'cash', bill_to_name: '', payment_date: Time.now, notify_data: nil, transaction_id: nil, status: '' } amount = Monetize.parse(cost, total_currency) if payment_history new_amount_paid = amount_paid - workshop_price.to_base_currency(payment_history.total) + workshop_price.to_base_currency(amount) DmCore::PaymentHistories::UpdateService.call(payment_history, amount, user_profile, options) else new_amount_paid = amount_paid + workshop_price.to_base_currency(amount) payment_history = DmCore::PaymentHistories::CreateService.call(receipt_code, amount, user_profile, options) payment_histories << payment_history end if payment_history.errors.empty? update_attribute(:amount_paid_cents, new_amount_paid.cents) reload send('paid!') if balance_owed.cents <= 0 && accepted? else logger.error("===> Error: Registration.manual_payment: #{payment_history.errors.inspect}") end payment_history end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_process_payment_from_created; true; end", "def guard_process_payment_from_created; true; end", "def associate_payment_profile\n order = Spree::Order.where(\"email = ?\", @user.email).order(\"created_at\").last\n if order.try(:payments).present?\n payment_source = order.payments.last.source...
[ "0.5888046", "0.5888046", "0.57711905", "0.57648015", "0.5731838", "0.5704942", "0.5690862", "0.5677997", "0.5674387", "0.5655366", "0.56531125", "0.5642528", "0.56417996", "0.5640659", "0.5629226", "0.5598242", "0.558189", "0.5572696", "0.55574274", "0.5552021", "0.552651", ...
0.6409397
0
delete a payment and update the registrations total amount paid
def delete_payment(payment_id) payment = PaymentHistory.find(payment_id) if payment update_attribute(:amount_paid_cents, (amount_paid - workshop_price.to_base_currency(payment.total)).cents) payment.destroy suppress_transition_email send('accept!') if balance_owed.positive? && paid? return true end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment(amount)\n @balance -= amount\n end", "def destroy\n @payment.destroy\n end", "def destroy\n @payment.destroy\n end", "def remove_payment\n @payment = Payment.find(params[:id])\n @payment.update!(state: 2)\n end", "def unpay\n self.status = 'unpaid'\n self.pay_date = nil...
[ "0.69502175", "0.68306696", "0.68306696", "0.6783001", "0.6733149", "0.66879416", "0.66361076", "0.66115457", "0.65779483", "0.649427", "0.64202976", "0.6382097", "0.6336427", "0.62903214", "0.62848514", "0.6232087", "0.6227877", "0.6205248", "0.6205181", "0.6201912", "0.6184...
0.74459594
0
Return the payment page url, so that it can be used in emails
def payment_url DmEvent::Engine.routes.url_helpers.register_choose_payment_url(uuid, host: Account.current.url_host, locale: I18n.locale) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_redirection_url(token = nil)\n self.endpoint_url_with_token(:pay, token)\n end", "def payment_form_url\n \"#{host}/form/#{session_token}\"\n end", "def payment_url(option, type = nil)\n uri = URI.parse 'https://merchant.roboxchange.com/Index.aspx'\n\n sig = Digest::MD5.hex...
[ "0.76819533", "0.6975064", "0.68347156", "0.683118", "0.67793417", "0.67330116", "0.66858923", "0.66845757", "0.6585", "0.6499918", "0.6493453", "0.6421423", "0.6415703", "0.6390838", "0.63885033", "0.6382251", "0.636283", "0.6313849", "0.62788105", "0.6277183", "0.62688065",...
0.7699128
0
writeoff the registration if it needs to
def check_if_writeoff! should_writeoff? ? update_attribute(:writtenoff_on, Time.now) : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unregister\n @is_registered = false\n self\n end", "def finish_register\n end", "def un_register\n unless @unregistered\n @unregistered = true\n RightLinkLog.info(\"SEND [un_register]\")\n @amq.fanout('registration', :no_declare => @options[:secure]).publish(@seria...
[ "0.6548517", "0.6527835", "0.64324707", "0.6368416", "0.62250125", "0.6199081", "0.61139625", "0.60456955", "0.5838102", "0.5823472", "0.5744158", "0.5725183", "0.56882274", "0.5658836", "0.5642088", "0.5625759", "0.55872244", "0.55741936", "0.5531383", "0.55251914", "0.55251...
0.0
-1
called before all the actions.
def initialize_vars @auth_user_class = Auth.configuration.user_class.constantize @auth_user_params = permitted_params.fetch(:user,{}) @auth_user = params[:id] ? @auth_user_class.find_self(params[:id],current_signed_in_resource) : @auth_user_class.new(@auth_user_params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before\n end", "def before\n\t\t\ttrue\n\t\tend", "def before_run; end", "def before_action \n end", "def before_dispatch(env); end", "def before_dispatch(_env)\n end", "def before\n @before\n end", "def before_setup\n # do nothing by default\n end", "d...
[ "0.7472187", "0.738037", "0.7135338", "0.71250117", "0.7115296", "0.70932", "0.70235366", "0.7003708", "0.6948306", "0.6944127", "0.6938543", "0.68793386", "0.681699", "0.67870057", "0.6750174", "0.67456937", "0.67443526", "0.6724643", "0.67207074", "0.67067635", "0.67062384"...
0.0
-1
Creates a new Core
def initialize(config, view, save) @view = view @config = config @save = save @config_root = File.expand_path(File.dirname(@config)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @core = Core.new(params[:core])\n\n respond_to do |format|\n if @core.save\n format.html { redirect_to @core, :notice => 'Core was successfully created.' }\n format.json { render :json => @core, :status => :created, :location => @core }\n else\n format.html { rende...
[ "0.74710405", "0.73057425", "0.7162195", "0.6305093", "0.61118287", "0.6015263", "0.5754709", "0.57379574", "0.56422025", "0.56283873", "0.55929804", "0.5563337", "0.55058897", "0.5421787", "0.5407195", "0.5398143", "0.5378591", "0.5356679", "0.5356679", "0.5344365", "0.53432...
0.0
-1
Reads configuration and view files. Begins parsing.
def compile() begin @config = FILE_IMPORTER.load(@config, true) Wavy::Parsers::Import.load(@config, @config_root) Wavy::Parsers::Import.extract if @view == false exports = Wavy::Models::Exports.get exports.each do |key, export| rendered = self.class.render(export.path) output(rendered['template'], rendered['full_path'], rendered['file_path']) end else rendered = self.class.render(@view) output(rendered['template'], rendered['full_path'], rendered['file_path']) end rescue Exception => e puts e.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config_files\n load_config_files\n end", "def config_read\n f = File.expand_path(CONFIG_FILE)\n return unless File.readable? f\n\n hash = loadYML(f)\n @used_dirs = hash['DIRS']\n @visited_files = hash['FILES']\n @bookmarks = hash['BOOKMARKS']\n @used_dirs.concat get_env_paths\nend", "de...
[ "0.70940846", "0.69706935", "0.6787904", "0.67529136", "0.6674805", "0.64573133", "0.6361305", "0.6349348", "0.63306266", "0.63293815", "0.62796015", "0.62548894", "0.6225181", "0.6074508", "0.60727406", "0.6012343", "0.6007834", "0.5969578", "0.5969035", "0.59663665", "0.595...
0.0
-1
1. root route gets sent to custom method in this controller 2. Write custom method for anything you might need in this page 3. Gets send to the view 4. View displays the homepage & any links e.c.t. get'/' => 'restaurantshomepage'
def homepage # renders a random restaurant from the users' database # @resto = Restaurant.where user_id: @current_user.id # Get the user restaurant # @user_rest = User.first.restaurants.order('RANDOM()').first @present_user = @current_user if @present_user return @resto = @present_user.restaurants.order('RANDOM()').first else return @resto = Restaurant.order('RANDOM()').first end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route_index; end", "def homepage\n end", "def homepage\n end", "def homepage\n end", "def homepage\n end", "def home\n\t\t# Home Page\n\tend", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "...
[ "0.7125711", "0.70906156", "0.70906156", "0.7067028", "0.7067028", "0.7047632", "0.6691255", "0.6691255", "0.6691255", "0.6691255", "0.6691255", "0.6691255", "0.6691255", "0.6691255", "0.6691255", "0.6691255", "0.6691255", "0.6592917", "0.6537822", "0.6533487", "0.6533487", ...
0.6378672
75
This is used inside a larger query by using `inner_query.to_sql`
def inner_query self.class. select("#{SUBQUERY_TABLE_ALIAS}.*"). from("#{table_name} AS #{SUBQUERY_TABLE_ALIAS}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_query_transform__subquery query, tmp_table=\"resultset_table\"\n \"(#{query}) as #{tmp_table}\"\n end", "def to_sql\n source.select(bin_sql).to_sql\n end", "def subquery_columns\n explicit_columns_in_subquery? ? explicit_columns : super\n end", "def subquery_sql(options...
[ "0.74300194", "0.6737108", "0.6549201", "0.6525202", "0.6428989", "0.6353619", "0.63056195", "0.6212972", "0.6169222", "0.61442035", "0.60707885", "0.6025914", "0.59986246", "0.5994565", "0.59814334", "0.5975717", "0.59523225", "0.59518903", "0.5932555", "0.59297806", "0.5918...
0.6836351
1
Write a method that takes an Array of integers as input, multiplies all of the numbers together, divides the result by the number of entries in the Array, and then prints the result rounded to 3 decimal places. Examples: show_multiplicative_average([3, 5]) The result is 7.500 show_multiplicative_average([2, 5, 7, 11, 13, 17]) The result is 28361.667
def show_multiplicative_average(array) puts "The result is #{format("%.3f", array.reduce(:*)/array.size.to_f)}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_multiplicative_average(array)\n product = 1\n array.each do |n|\n product *= n\n end\n result = (product.to_f / array.size).round(3)\n puts \"The result is #{format('%.3f', result)}\"\nend", "def show_multiplicative_average(input_array)\n multiplication = 1\n number_array_entries = input_array...
[ "0.8890763", "0.87517095", "0.8674312", "0.86622226", "0.8637423", "0.86248296", "0.8609007", "0.86035836", "0.85917073", "0.85692704", "0.85638565", "0.85447335", "0.85423", "0.85417134", "0.853475", "0.8533737", "0.852572", "0.85233927", "0.85124844", "0.85082805", "0.85082...
0.8632474
5
Cleans fields (lowercase, removes spaces and changes for underscores)
def clean_fields(fields) fields.map { |k, v| [k.to_s.downcase.gsub(/ |-/, '_'), v] }.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean!\n reject! { |name| name.blank? }\n map! { |name| name.strip }\n map! { |name| name.downcase } if force_lowercase\n map! { |name| name.parameterize } if force_parameterize\n map! { |name| name.gsub('_','-') }\n uniq!\n end", "def clean_name\n clean_name = name.stri...
[ "0.7545027", "0.7237589", "0.72354484", "0.71635175", "0.7162165", "0.7087316", "0.6971027", "0.68357396", "0.6818341", "0.68072295", "0.67987686", "0.6789798", "0.67483747", "0.6733829", "0.6711727", "0.6694824", "0.6692787", "0.667472", "0.667472", "0.667472", "0.667472", ...
0.7696553
0
Build content depending on the type
def format_content(type, args, content) Formatter.new(content).apply(type, args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contentByType( type )\n\t\tcontent = nil\n\t\t@content.each_index { |i|\n\t\t\tif @content[i].type == type\n\t\t\t\tcontent = @content[i]\n\t\t\tend\n\t\t}\n\t\tcontent\n\tend", "def new\n @content = Content.new\n @content.creator_id ||= current_user\n\n if params.has_key?(:type)\n if params[:t...
[ "0.6495916", "0.64613456", "0.62248373", "0.6190327", "0.5953394", "0.59286165", "0.591037", "0.58962137", "0.58561444", "0.58106077", "0.57844365", "0.57800627", "0.5742189", "0.57418454", "0.5670497", "0.5666197", "0.56654775", "0.56093717", "0.5582191", "0.5574484", "0.557...
0.0
-1
TODO: Update lock here to be blocking and handle simultaneous withdrawal requests
def create lock_name = "withdrawal_lock_#{current_user.id}" Rails.logger.info "Processing withdrawal with lock: #{lock_name}" outcome = RedisMutex.with_lock(lock_name, block: 0) do Payments::RequestPayout.run(payout_params.merge(user: current_user)) end return render_error_response(outcome.errors.full_messages) unless outcome.valid? #render_success_response(outcome.result) NotificationMailer.withdraw_request(current_user.admin_user, current_user, payout_params[:amount]).deliver_later render json: { message: I18n.t('messages.payout.pending') } rescue RedisMutex::LockError Rails.logger.error "Failed to acquire withdrawal lock: #{lock_name}" render_error_response(I18n.t('errors.messages.failed_to_acquire_lock')) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_withdraw\n kraken = Kraken::Client.new(ENV['KRAKEN_PUBLIC_KEY'], ENV['KRAKEN_SECRET_KEY'])\n withdraw_txid = kraken.withdraw(currency, ENV['KEY_WITHDRAW'], amount)\n if !withdraw_txid.nil? && !withdraw_txid.empty?\n self.withdraw_txid = withdraw_txid\n self.save\n self.withdraw!...
[ "0.6515664", "0.62301534", "0.62301534", "0.6135736", "0.6053155", "0.6046474", "0.6014481", "0.5970653", "0.5950366", "0.5885209", "0.5869967", "0.5866319", "0.5849918", "0.5809785", "0.57874924", "0.57787967", "0.57366604", "0.5728013", "0.57235783", "0.57215846", "0.572047...
0.68741214
0
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: add items to your list set default quantity print the list to the console [can you use one of your other methods here?] output: list to be stored in a hash with the item name and quantity of that item Method to add an item to a list input: list, item name, and optional quantity steps: add items to the already existing list give new items quantity print the new list output: updated list with new items and quantity that will be stored in already existing hash Method to remove an item from the list input: taking away items and quantity from the existing list steps: enter items that are wanting to be removed print new list with removed items output: updated list with removed items and quantity that will be stored in already existing hash Method to update the quantity of an item input: quantity steps: update quantity for specific items print list output: updated list of the updated quantity that will be stored in already existing hash Method to print a list and make it look pretty input: list, item name, and optional quantity steps: orginized items and quantity set up output to look nice output: grocery list that look nice
def create_list(list) list = list.split(' ') shopping_list = {} list.each { |item| shopping_list[item.to_sym]= 1 } shopping_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(list, item, quantity=1)\r\n# input: item name and optional quantity\r\n# steps: \r\n # Use shopping list as input\r\n # Use the item to be added as 2nd input\r\n # Use the item quantity as a 3rd input (look up whether optional input is possible)\r\n # Add the item and quantity to the shopping list...
[ "0.81181836", "0.77934647", "0.7731781", "0.77267665", "0.77184063", "0.7702596", "0.76166534", "0.7547961", "0.7517691", "0.7504803", "0.746616", "0.74376625", "0.74017423", "0.7397457", "0.7394802", "0.7365766", "0.73112136", "0.72972", "0.71958214", "0.71945375", "0.717187...
0.0
-1
file uploader for the test Last modified: 01/11/2015
def upload_fixture_file filename, content_type ActionDispatch::Http::UploadedFile.new({ :filename => filename, :content_type => content_type, :tempfile => File.new("#{Rails.root}/test/fixtures/files/" + filename) }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modified_files; end", "def file_datetime\n @file_datetime\n end", "def mtime() end", "def mtime() end", "def file_uploads; end", "def last_modified\n# stat.mtime\n @bson['uploadDate'] || Date.new\n end", "def file(_event)\n setTimeout 0 do\n @submitted = true\n ...
[ "0.7003829", "0.6605828", "0.65576273", "0.65576273", "0.6487238", "0.64642924", "0.6448186", "0.6430858", "0.6405587", "0.63773555", "0.63337505", "0.63337505", "0.6326207", "0.6297265", "0.62464845", "0.62367827", "0.62326396", "0.62117547", "0.62088567", "0.62088567", "0.6...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_internal @description = Description.find(params[:id]) @internal = @description.internal 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 internal_params params.require(:internal).permit( :aortic_valve, :aortic_valve_circumference, :aortic_valve_specify, :arch_branches, :arch_branches_specify, :arch_configuartion, :arch_configuartion_specify, :atrial_septum, :atrial_septum_specify, :atrial_situs, :atrial_situs_specify, :bilateral, :bronchial_tree, :bronchial_tree_specify, :chambers_and_septae_normal, :combined_heart_and_lungs_weight, :congestion, :coronary_arteries, :coronary_arteries_specify, :cut_surface, :cut_surface_specify, :diaphragm_normal, :diaphragm_other, :diaphragm_position_configuration, :diaphragm_position_configuration_specify, :diphragm_defect, :ductus, :ductus_specify, :endocardium, :endocardium_specify, :epicardium, :epicardium_specify, :epiglottis, :epiglottis_specify, :esophagus_mucosa_and_wall, :esophagus_mucosa_and_wall_specify, :esophagus_normal, :esophagus_other, :esophagus_size_position_configuration, :esophagus_size_position_configuration_specify, :fixed_by_perfusion, :fixed_by_perfusion_specify, :foreign_material_in_lumen, :foreign_material_in_lumen_specify, :heart_configuration, :heart_configuration_specify, :heart_content, :heart_content_specify, :heart_normal, :heart_only_weight, :heart_position, :heart_position_specify, :heart_shape, :heart_shape_specify, :heart_size, :heart_size_specify, :hilar_nodes, :hilar_nodes_specify, :inferior_vena_cava, :inferior_vena_cava_specify, :interstitial_emphysema, :intima_and_wall, :intima_and_wall_specify, :larynx_and_trachea_normal, :larynx_other, :larynx_trachea_configuration_position, :larynx_trachea_configuration_position_specify, :left_lung_weight, :left_ventricular_wall_thickness, :lobar_pattern, :lobar_pattern_specify, :lung_to_body_weight_ratio, :lungs_consistency, :lungs_consistency_specify, :lungs_normal, :mediastinum_nodes_masses, :mediastinum_nodes_masses_specify, :mediastinum_normal, :mediastinum_other, :mediastinum_position_configuration, :mediastinum_position_configuration_specify, :mitral_valve, :mitral_valve_circumference, :mitral_valve_specify, :mucosal_surfaces, :mucosal_surfaces_specify, :myocardium, :myocardium_specify, :origins_of_aorta_and_pulmonary_artery, :origins_of_aorta_and_pulmonary_artery_specify, :parathyroid_gland, :parathyroid_gland_specify, :parenchyma_color, :parenchyma_color_specify, :pericardial_sac_amount_of_fluid, :pericardial_sac_amount_of_fluid_specify, :pericardial_sac_contents, :pericardial_sac_contents_specify, :pericardial_sac_normal, :petechiae_on_external_surface, :pleural_cavities_amount_of_fluid, :pleural_cavities_amount_of_fluid_specify, :pleural_cavities_normal, :pleural_cavities_other, :pleural_cavity_organ_relations, :pleural_cavity_organ_relations_specify, :pleural_nature_of_fluid, :pleural_nature_of_fluid_specify, :pleural_petechiae, :pleural_serosal_surfaces, :pleural_serosal_surfaces_specify, :pneumomediastinum, :pneumothorax, :pneumothorax_specify, :pulmonary_arteries, :pulmonary_arteries_specify, :pulmonary_veins, :pulmonary_veins_specify, :pulmonic_valave_circumference, :pulmonic_valve, :pulmonic_valve_specify, :right_lungs_weight, :right_ventricular_wall_thickness, :serosal_sarfaces, :serosal_sarfaces_specify, :state_of_expansion, :state_of_expansion_specify, :superior_vena_cava, :superior_vena_cava_specify, :thoracic_branches, :thoracic_branches_specify, :thymus_normal, :thymus_other, :thymus_pos_config_shape, :thymus_pos_config_shape_specify, :thyroid_external_surface, :thyroid_external_surface_specify, :thyroid_other, :thyroid_parathyroid_normal, :thyroid_parenchyma_or_cut_surface, :thyroid_parenchyma_or_cut_surface_specify, :thyroid_pos_config_shape, :thyroid_pos_config_shape_specify, :thyroid_weight, :tracheal_rings, :tracheastomy, :tricuspid_valve, :tricuspid_valve_circumference, :tricuspid_valve_specify, :valves_normal, :ventricular_septum, :ventricular_septum_specify, :ventricular_situs, :ventricular_situs_specify, :vessels, :vessels_and_ducts_normal, :vessels_specify, :visceral_pleura, :visceral_pleura_specify, :vocal_cords, :vocal_cords_specify, :weight, :description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
2/2/18 For the index view of Question
def index @questions = Question.all if params[:s] == "n" @questions = Kaminari.paginate_array(@questions.sort_by(&:created_at).reverse).page(params[:page]).per(5) elsif params[:s] == "t" @questions = Kaminari.paginate_array(@questions.sort_by(&:interaction_count).reverse).page(params[:page]).per(5) else @questions = @questions.page(params[:page]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n find_questions\n end", "def index\n @questions = @questionable.questions\n end", "def index\n @questions = Question.all # Model.all is a method built into active record used to return all records of that model\n end", "def index\n @questions = Question.all\n end", "def index\n ...
[ "0.73455983", "0.7194967", "0.7073355", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", "0.69815457", ...
0.6473201
76
2/2/18 For the new view of Question
def new @question = Question.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def question\n answer.question\n end", "def question\n self.question\n end", "def questions\n \n end", "def view_completed_question\n nil\n end", "def view_completed_question\n nil\n end", "def similar_questions\n\n end", "def view_question_text\n nil\n end", "def view_questi...
[ "0.7087378", "0.6972529", "0.6834864", "0.66931874", "0.66931874", "0.66921586", "0.6674913", "0.6673384", "0.6506199", "0.65040714", "0.6451184", "0.64268374", "0.6336436", "0.6323426", "0.62973875", "0.62701505", "0.62498254", "0.62337565", "0.61792797", "0.6152719", "0.611...
0.5571354
98
2/2/18 For the show view of Question
def show @question = Question.find(params[:id]) @answer = Answer.new @reply = Reply.new if params[:notif_id] if Notification.find_by(id: params[:notif_id]) Notification.find_by(id: params[:notif_id]).update(read: true) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @questions = @exam.questions\n @question = Question.new\n end", "def question\n answer.question\n end", "def show\n @question = Question.find(params[:id])\n #if !(@question.accessible(current_user.id, current_user.institution_id))\n # respond_to do |format|\n # format.html...
[ "0.73537326", "0.7352264", "0.7268515", "0.72282994", "0.72114074", "0.71845347", "0.71679664", "0.7158521", "0.710344", "0.7101997", "0.7088416", "0.7079916", "0.7067728", "0.70452297", "0.70452297", "0.7043303", "0.7028819", "0.6987697", "0.6986541", "0.6985189", "0.6983685...
0.0
-1
2/2/18 For the create view of Question
def create @question = Question.new(question_params) if @question.save redirect_to @question else render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_question\n question_hash = Adapter.quiz_api(difficulty) #use adapter method, with difficulty passes into the url as a variable, to gnerate a new list of questions.\n new_question = Question.new #make a new question instance\n new_question.save #save now so we can store the question's id in the ...
[ "0.7519609", "0.75106835", "0.74289626", "0.7391346", "0.7369596", "0.7337808", "0.73211575", "0.73211575", "0.73211575", "0.73211575", "0.72971386", "0.72914726", "0.726377", "0.72340584", "0.72183514", "0.72008836", "0.7200441", "0.7192316", "0.71858835", "0.7183339", "0.71...
0.7381879
4
2/19/18 For the destroy function of Question
def destroy @question = Question.find(params[:id]) if @question.destroy redirect_to root_path else redirect to :back #CHANGE end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @question = Question.find(:all)\n @question.each do |q|\n q.destroy\n end\n end", "def destroy_questions\n self.questions.each(&:destroy)\n end", "def destroy\n @four_choice_question.destroy\n end", "def destroy\n @questionable = @question.questionable\n @question.d...
[ "0.7726066", "0.7641156", "0.7432579", "0.73741627", "0.7370981", "0.7361136", "0.73227483", "0.7290173", "0.72016174", "0.71961963", "0.71937144", "0.7072315", "0.7051009", "0.70396125", "0.70328414", "0.70328414", "0.70328414", "0.70328414", "0.70328414", "0.70328414", "0.7...
0.6825549
54
2/19/18 For the edit function of Question
def edit @question = Question.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; e...
[ "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "0.7213549", "...
0.6710534
35
2/19/18 For the update function of Question
def update @question = Question.find(params[:id]) if @question.update(question_params) redirect_to @question else render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n # Do not support updating an answer for now\n # Once you have answered there is no return\n end", "def update\n @question.update\n @cancel.update\n end", "def update\n @question.statement = params[:question][:statement]\n unless @question.online\n @question.level = (...
[ "0.75935906", "0.7198468", "0.7089072", "0.69683665", "0.69644535", "0.69125086", "0.6899008", "0.6874783", "0.68617135", "0.6860329", "0.6800914", "0.6800914", "0.6800914", "0.6800914", "0.6800914", "0.6800914", "0.6800914", "0.6800914", "0.676321", "0.6747726", "0.67383796"...
0.0
-1
2/2/18 For the parameters when finding the data
def question_params params.require(:question).permit(:title, :content, :user_id, :tag_list, :image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def get_parameters; end", "def get_parameters; end", "def parameters\n data[:parameters]\n end", "def...
[ "0.6258974", "0.6258974", "0.6258974", "0.6258974", "0.6258974", "0.6258974", "0.6258974", "0.6258974", "0.60440075", "0.60440075", "0.6000896", "0.5859263", "0.5770278", "0.5770278", "0.573404", "0.573404", "0.573404", "0.573404", "0.573404", "0.573404", "0.573404", "0.573...
0.0
-1
SSH channel and subsystem is used for input
def sniff(ip, port, user, passwd) puts "sniffing #{ip} port #{port} as #{user} with password #{passwd}..." #Add SSH fingerprint mismatch exception handling. begin Net::SSH.start(ip, user, :port=>port, :password=>passwd, :timeout=>6, :non_interactive=>true) do |session| session.open_channel do |channel| channel[:data] = "" @flag_close_channel = false device_object = nil channel.request_pty do |ch, success| raise "Error requsting pty" unless success # Use this method unless it is a CLI #ch.send_channel_request("shell") do |ch, success| #raise "Error opening shell" unless success #end # need Netconf subsystem channel.subsystem("netconf") do |ch, success| raise "Error requesting netconf subsystem." unless success end end channel.on_data do |ch, data| #STDOUT.print data channel[:data] << data end channel.on_process do |ch| if @flag_close_channel == false and channel[:data].size > 0 and channel[:data].include?("hello") log_puts "Found [#{ip}] has Netconf response." #@@sniffer_ip_found_ary << ip hellomsg = channel[:data] #$input_array << "[" + ip + "]" + hellomsg log_puts "[#{ip}] has Netconf response [#{hellomsg}]" #decode hello message and create DeviceObject device_object = DeviceObject.decode_hello_msg("[" + ip + "]" + hellomsg) #initial device for plugin NCPlugins.set_device device_object #check mode mode = device_object.get_mode req = nil if mode.eql? "e5-400" or mode.eql? "e5-312" req = NCPlugins.get_close_str puts "It is [#{mode}]. And to send request: #{req}" else #entrance id setting msgid = $ENTRANCE_ID puts "entrance id is: #{msgid}" plugin = NCPlugins.get_plugin msgid req = plugin.get_req puts "[main] suppose to send #{req}" end channel[:data] = "" ch.send_data req elsif channel[:data].size > 0 and !channel[:data].include?("</rpc-reply>") puts "Netconf message is not end yet, keep waiting ..." elsif @flag_close_channel == false and channel[:data].size > 0 puts "in Channel..." result = channel[:data] log_puts "[#{ip}] has Netconf response [#{result}]" msgid = NCPlugins.parse_msgid result puts "[main] msgid is: #{msgid}" if msgid != $MESSAGE_ID_END plugin = NCPlugins.get_plugin msgid req = plugin.parse_send result puts "[main] suppose to send #{req}" channel[:data] = "" ch.send_data req else puts "[main] end Netconf, start writing device object to database" device_object.to_mongo @flag_close_channel = true end puts "out Channel..." puts "" end end channel.on_extended_data do |ch, type, data| STDOUT.print "Error: #{data}\n" end channel.on_request("exit-status") do |ch,data| puts "in on_request exit-status" exit_code = data.read_long end channel.on_request("exit-signal") do |ch, data| puts "in on_request exit-signal" exit_signal = data.read_long end channel.on_eof do |ch| puts "remote end is done sending data" end channel.on_close do |ch| puts "channel is closing!" end session.loop end #Session end end #Net end rescue Net::SSH::HostKeyMismatch => e # The rescue block is used to ignore the change in key and still login using ssh log_puts "[HostKeyMismatch for #{ip}] remembering new key: #{e.fingerprint}" e.remember_host! retry end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def playGame()\n\n @@running = true\n setInput(nil)\n ipt = \"chompedinput\"\n\n broadcast(\"logging in ...\")\n\n # Login to ec2, start SSH session\n Net::SSH.start(@@host, @@user, password: @@password) do |session|\n\n broadcast(\"logged in!\")\n broadcast(\"obtaining ...
[ "0.6471644", "0.63398546", "0.63398546", "0.63398546", "0.63398546", "0.6222919", "0.621333", "0.6148723", "0.6129247", "0.6110679", "0.6107967", "0.6067817", "0.60210294", "0.59949255", "0.5984284", "0.5979406", "0.597711", "0.5964736", "0.5931965", "0.5908741", "0.58811307"...
0.55898684
33
the format to output the results to. csv, html or json initialize the class with the folders to be compared
def initialize(folder1, folder2, options) @folder1 = folder1 @folder2 = folder2 @format = options['output'] @filehash = Hash.new validate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_results()\n\t\t case @format\n when \"csv\"\n display_results_csv\n when \"html\"\n display_results_html\n when \"json\"\n display_results_json\n else\n display_results_csv\n end\n end", "def display_results_html\n\t\t outpu...
[ "0.705106", "0.6380039", "0.63412815", "0.5904171", "0.588825", "0.581183", "0.57799095", "0.5753269", "0.57449913", "0.56899107", "0.56528103", "0.5604", "0.5603192", "0.555062", "0.5531744", "0.5433114", "0.54047817", "0.5390146", "0.5379359", "0.5375154", "0.53746164", "...
0.57919663
6
Validates the input ensuring the arguments are both valid folders
def validate if(folder1==nil) || (folder1=="") || !Dir.exists?(folder1) puts "a valid folder path is required as argument 1" exit end if(folder2==nil) || (folder2=="") || !Dir.exists?(folder2) puts "a valid folder path is required as argument 2" exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate!(args)\n [:base, :overlay, :target].each do |required|\n unless(args[required])\n raise ArgumentError.new \"Missing required argument: #{required}\"\n end\n unless(File.directory?(args[required]))\n raise TypeError.new \"Provided argument is not ...
[ "0.80346936", "0.703748", "0.6962529", "0.67105854", "0.66292995", "0.66292995", "0.6475623", "0.63416195", "0.6258386", "0.6249252", "0.6135183", "0.6093451", "0.6089377", "0.607116", "0.60453135", "0.60304064", "0.60129565", "0.6004054", "0.600174", "0.600174", "0.5955444",...
0.8152829
0
Iterates through the folders and creates a FileHashResults object containing the results of the comparisson
def compare Dir.foreach(@folder1) do |item| begin next if item == '.' or item == '..' fullfilename = File.expand_path(@folder1, item) the_hash = Digest::MD5.hexdigest(File.read(File.join(File.expand_path(@folder1), item))) item = item.downcase filedata = FileHashResults.new(item, the_hash, nil) @filehash[item] = filedata rescue #puts "Skipped:#{item.inspect}" end end Dir.foreach(@folder2) do |item| begin next if item == '.' or item == '..' the_hash = Digest::MD5.hexdigest(File.read(File.join(@folder2, item))) item = item.downcase if(@filehash[item]==nil) filedata = FileHashResults.new(item, nil, the_hash) @filehash[item] = filedata next end @filehash[item.downcase].file_hash2 = the_hash rescue #puts "Skipped:#{item.inspect}" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_directories(files, diffs)\n files.sort!\n\n # Initialize those hashes, where each key will map to hash, in wich\n # each key maps to an array:\n # {\n # key1: {\n # },\n # key2: {\n # },\n # }\n ...
[ "0.6494348", "0.6469005", "0.6227331", "0.61791724", "0.6111044", "0.608219", "0.59486777", "0.59466", "0.59420794", "0.58912766", "0.5876381", "0.58716017", "0.5826885", "0.58238536", "0.579105", "0.5789758", "0.5773774", "0.57712543", "0.57467204", "0.57425696", "0.57400185...
0.7782791
0
print the contents of the FileHashResults object standard out in the format specified. Default is csv
def display_results() case @format when "csv" display_results_csv when "html" display_results_html when "json" display_results_json else display_results_csv end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_results_csv\n\t\t\tputs \"FileName,#{@folder1},#{@folder2},Are Equal\"\n\t\t\t@filehash.each{ |key, value| puts \"#{value.file_name},#{value.file_hash1},#{value.file_hash2}, #{value.file_hash1==value.file_hash2}\" }\n\t\tend", "def csv_print_to_file\n CSV.open(\"metadata_output.csv\", \"w\") do ...
[ "0.7094945", "0.6454346", "0.6386411", "0.63826597", "0.6281754", "0.6262427", "0.61870795", "0.613396", "0.601881", "0.601293", "0.59704024", "0.5956355", "0.5904153", "0.5858907", "0.5857018", "0.58467036", "0.57773006", "0.5739883", "0.57352793", "0.57286245", "0.5725277",...
0.51675576
93
Prints the results to standard out in the csv format specified.
def display_results_csv puts "FileName,#{@folder1},#{@folder2},Are Equal" @filehash.each{ |key, value| puts "#{value.file_name},#{value.file_hash1},#{value.file_hash2}, #{value.file_hash1==value.file_hash2}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_csv_results\n FileUtils.mkdir_p(\"data\")\n File.open(\"data/results.csv\", \"w\") do |f|\n @data.sort_by{|id, values| values[\"sum_dose\"]}.each do |id, values|\n f.puts \"%s\\t%d\\t%.4f\" % [id, values[\"ddays\"], dose_unit(values[\"sum_dose\"])]\n end\n end\n end", "def di...
[ "0.7508897", "0.71852744", "0.71739876", "0.68336344", "0.68317205", "0.67588836", "0.6715114", "0.6709287", "0.6645529", "0.6638067", "0.65208703", "0.646378", "0.6455704", "0.63969064", "0.63803554", "0.63803554", "0.6336371", "0.6333699", "0.63259965", "0.6296545", "0.6288...
0.59156734
59
Prints the results to standard out in the csv format specified.
def display_results_html output ="<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title></title></head><body>" output.concat("<table><thead><tr><td>FileName</td></tr><tr><td>#{@folder1}</td></tr><tr><td>#{@folder2}</td></tr><tr><td>Equal</td></tr></thead>") @filehash.each{ |key, value| output.concat("<tbody><tr><td>#{value.file_name}</td></tr><tr><td>#{value.file_hash1}</td></tr><tr><td>#{value.file_hash2}</td></tr><tr><td>#{value.file_hash1==value.file_hash2}</td></tr>")} output.concat("</tbody></table></body></html>") puts output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_csv_results\n FileUtils.mkdir_p(\"data\")\n File.open(\"data/results.csv\", \"w\") do |f|\n @data.sort_by{|id, values| values[\"sum_dose\"]}.each do |id, values|\n f.puts \"%s\\t%d\\t%.4f\" % [id, values[\"ddays\"], dose_unit(values[\"sum_dose\"])]\n end\n end\n end", "def di...
[ "0.7508897", "0.71852744", "0.71739876", "0.68336344", "0.68317205", "0.67588836", "0.6715114", "0.6709287", "0.6645529", "0.6638067", "0.65208703", "0.646378", "0.6455704", "0.63969064", "0.63803554", "0.63803554", "0.6336371", "0.6333699", "0.63259965", "0.6296545", "0.6288...
0.0
-1
Prints the results to standard out in the csv format specified.
def display_results_json puts @filehash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_csv_results\n FileUtils.mkdir_p(\"data\")\n File.open(\"data/results.csv\", \"w\") do |f|\n @data.sort_by{|id, values| values[\"sum_dose\"]}.each do |id, values|\n f.puts \"%s\\t%d\\t%.4f\" % [id, values[\"ddays\"], dose_unit(values[\"sum_dose\"])]\n end\n end\n end", "def di...
[ "0.7508897", "0.71852744", "0.71739876", "0.68336344", "0.68317205", "0.67588836", "0.6715114", "0.6709287", "0.6645529", "0.6638067", "0.65208703", "0.646378", "0.6455704", "0.63969064", "0.63803554", "0.63803554", "0.6336371", "0.6333699", "0.63259965", "0.6296545", "0.6288...
0.0
-1
Resolve the ip address. Will ensure that the resolved ip matches the appropriate ip type.
def resolve! Resolv.each_address(host) do |address| return @ip = address if address =~ pattern end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(node)\n begin\n Timeout::timeout(@timeout) do\n Resolv.each_address(host) do |ip|\n if ip =~ Resolv::IPv4::Regex\n @ip ||= ip\n break\n end\n end\n raise Resolv::ResolvError unless @ip\n end\n @resolved...
[ "0.730296", "0.7246984", "0.65939146", "0.649287", "0.63087636", "0.62946826", "0.6254777", "0.6239175", "0.62378436", "0.6165181", "0.61564314", "0.61564314", "0.6078404", "0.6070736", "0.6031215", "0.6031215", "0.59586394", "0.5937297", "0.59208643", "0.58991814", "0.585640...
0.7324238
0
GET /todo_lists GET /todo_lists.json
def index if user_signed_in? @todo_lists = TodoList.where(:user_id => current_user.id).order("created_at DESC") @others_lists = TodoList.where.not(:user_id => current_user.id).where(:private => false).order("created_at DESC") @types = ["star_border", "star"] @favorites = current_user.favorites @ids = [] @favorites.each do |fav| @ids << fav.id end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @todo_lists = TodoList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todo_lists }\n end\n end", "def get_list(id)\n record \"/todos/list/#{id}\"\n end", "def index\n @todos = @list.todos\n render json: @todos\n end", "de...
[ "0.77932733", "0.7712436", "0.7672927", "0.752435", "0.7513934", "0.7509121", "0.7488965", "0.747368", "0.7381777", "0.7369394", "0.7347438", "0.7339883", "0.73212737", "0.73175246", "0.7316859", "0.73104763", "0.73002625", "0.72688675", "0.72077155", "0.7187174", "0.71818423...
0.0
-1
GET /todo_lists/1 GET /todo_lists/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list(id)\n record \"/todos/list/#{id}\"\n end", "def show\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end", "def show\n @todo_list = TodoList.find(params[:id])\n\n respond_to ...
[ "0.779323", "0.77329946", "0.7691963", "0.76492095", "0.76379734", "0.7608537", "0.7558616", "0.75585264", "0.7527111", "0.7525896", "0.74494135", "0.7403249", "0.7378161", "0.73493075", "0.7292186", "0.72267556", "0.7223838", "0.7219479", "0.7199965", "0.7175481", "0.7173940...
0.0
-1
POST /todo_lists POST /todo_lists.json
def create @todo_list = current_user.todo_lists.build(todo_list_params) @todo_list.unique_id = Time.now.to_f respond_to do |format| if @todo_list.save format.html { redirect_to root_path, notice: 'Lista criada com sucesso.' } format.json { render :show, status: :created, location: @todo_list } else format.html { render :new } format.json { render json: @todo_list.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @todo_list = TodoList.new(params[:todo_list])\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to @todo_list, :notice=>\"Todo list was successfully created.\" }\n format.json { render :json=>@todo_list, :status=>:created, :location=>@todo_list }\n ...
[ "0.7702233", "0.76956373", "0.76944226", "0.76051915", "0.7541543", "0.74640495", "0.74340224", "0.74240375", "0.7419789", "0.7383239", "0.73806715", "0.73765284", "0.73494655", "0.73381454", "0.7326727", "0.731613", "0.72531617", "0.7205625", "0.7171424", "0.7163397", "0.714...
0.7354166
12
PATCH/PUT /todo_lists/1 PATCH/PUT /todo_lists/1.json
def update respond_to do |format| if @todo_list.update(todo_list_params) format.html { redirect_to root_path, notice: 'Todo list was successfully updated.' } format.json { render :show, status: :ok, location: @todo_list } else format.html { render :edit } format.json { render json: @todo_list.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to list_todo_path(@list, @todo), notice: 'Todo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { rende...
[ "0.7537625", "0.7508705", "0.7444292", "0.7431681", "0.7429661", "0.7425529", "0.7329846", "0.73193794", "0.7306446", "0.72675025", "0.72618306", "0.72281075", "0.72043365", "0.7204142", "0.7199845", "0.7177073", "0.71536154", "0.71365017", "0.7072489", "0.7051926", "0.700768...
0.7173038
16
DELETE /todo_lists/1 DELETE /todo_lists/1.json
def destroy @todo_list.destroy respond_to do |format| format.html { redirect_to todo_lists_url, notice: 'Todo list was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end", "def destroy\n @todo_list = TodoList.find(params[:id])\n @todo_list.destroy\n\n respond_to do |format|\n format.html { redirect_to todo_lists_url }\n format.json { head :ok }\n end\n end", "def destroy\n @todo_list ...
[ "0.8001536", "0.790574", "0.7905642", "0.79003954", "0.7814487", "0.78143466", "0.7681469", "0.7669056", "0.76582783", "0.7630115", "0.7625297", "0.7585526", "0.75475115", "0.75326294", "0.7526081", "0.7525262", "0.7525262", "0.75067693", "0.75058055", "0.7487393", "0.7484237...
0.74413264
22
Use callbacks to share common setup or constraints between actions.
def set_todo_list @todo_list = TodoList.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 todo_list_params params.require(:todo_list).permit(:description, :completed, :private, tasks_attributes: [:title, :description, :completed, :_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.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
location on the submitting machine. Providing all this to each dataset allows your submit description files and dags to have all they need in one spot when submitting to the condor daemons
def build_provisions(run_directory, data_directory, whitelist, blacklist) Scarcity::Submission.new do # declare where runs happen and where data comes from # and indicate that we gather default provisions accordingly # This will not need to change in almost all cases. runs_in run_directory pulls_from data_directory, :only => whitelist, :except => blacklist gathers_provisions :zip_data => true # Declare other goods that will be provided to each dataset at run time. provides :from => 'app/executables', :to => :each_dataset do file '<%= base_name %>.py', :chmod => 0755 end provides :from => 'app/scripts', :to => :each_dataset do file 'prejob.py', :chmod => 0755 file 'postjob.py', :chmod => 0755 end provides :from => 'app/submits', :to => :each_dataset do file '<%= base_name %>.submit' end provides :from => 'lib/submits', :to => :each_dataset do file 'null.submit' end # You might also declare goods to be provided to the segment as a whole # provides :from => 'lib/submits', :to => :segment do # file 'null.submit' # end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location_submissions\n\t\t\n\tend", "def submit\n @name = params[:name]\n @bigframe_home = params[:bigframe_home]\n @hadoop_home = params[:hadoop_home]\n @tpchds_local = params[:tpchds_local]\n @data_volume = params[:data_volume]\n @data_variety_rel = params[:relational]\n @data_variety_...
[ "0.5679659", "0.55662924", "0.55534256", "0.5321995", "0.527773", "0.5233825", "0.5210623", "0.5181009", "0.5145766", "0.5142632", "0.51420563", "0.5133481", "0.5130681", "0.5129974", "0.5123658", "0.5115926", "0.51064086", "0.510578", "0.5085892", "0.50516057", "0.5050885", ...
0.58389574
0
arr2 = [1, 4, 5, 7, 1, 10, 2]
def windowed_max_range(arr, w) # o(n^2) current_max_range = 0 arr.each_index do |i| window = arr[i...i+w] max = window.max min = window.min if max - min > current_max_range current_max_range = max - min end end current_max_range end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(arr1, arr2)\n index2 = 0\n result = []\n\n arr1.each do |value|\n while index2 < arr2.size && arr2[index2] <= value\n result << arr2[index2]\n index2 += 1\n end\n result << value\n end\n result.concat(arr2[index2..-1])\nend", "def merge(arr1, arr2)\n arr2_index = 0\n result = ...
[ "0.66981393", "0.65450764", "0.6541703", "0.6536763", "0.64206266", "0.64125854", "0.63686943", "0.6330685", "0.6306899", "0.6305898", "0.6305898", "0.62669694", "0.6245632", "0.6241851", "0.62168497", "0.6212903", "0.62018627", "0.6198903", "0.6193823", "0.61903584", "0.6189...
0.0
-1
Assume there is a ~/.aws/credentials file with a valid format
def current_environment read_environment_from_cache end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_aws_credential_file!\n Chef::Log.debug \"Using AWS credential file at #{aws_cred_file_location}\"\n raise ArgumentError, \"The provided --aws_credential_file (#{aws_cred_file_location}) cannot be found on disk.\" unless File.exist?(aws_cred_file_location)\n\n # File format:\n # AWS...
[ "0.7834452", "0.71360564", "0.71302944", "0.68969643", "0.66937494", "0.66923875", "0.6642867", "0.6580941", "0.6574255", "0.65724087", "0.6543034", "0.6512473", "0.63963324", "0.63800514", "0.63800514", "0.62051314", "0.6104175", "0.6104175", "0.6076052", "0.60508364", "0.60...
0.0
-1
shows error message if any attr is missing return false if any attr is missing to exit the program
def validate_vars errors = instance_variables.map do |var| next unless instance_variable_get(var).to_s.empty? "Cannot find #{var} key, check your YAML config file." end.compact puts errors.join("\n") if errors errors.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkAttributeRequirements\n if @valid_attributes.empty?\n @error_text = \"No valid attributes found\"\n return false\n elsif (@mandatory_attributes_from_db & @valid_attributes) != @mandatory_attributes_from_db\n missing_attr = @mandatory_attributes_from_db - (@mandatory_attribut...
[ "0.6713666", "0.6558621", "0.6551735", "0.6509358", "0.64396054", "0.63207525", "0.63165987", "0.6310485", "0.63087267", "0.62562406", "0.62494665", "0.624292", "0.6133219", "0.613097", "0.6108231", "0.605879", "0.6049731", "0.6029217", "0.6023162", "0.602138", "0.6021315", ...
0.0
-1
Borrowed from jwt rubygem. Hopefully this will be provided by openssl rubygem in the future.
def formatted_signature(signature) n = (verify_key_length.to_f / BYTE_LENGTH).ceil if signature.size == n * 2 r = signature[0..(n - 1)] s = signature[n..-1] OpenSSL::ASN1::Sequence.new([r, s].map { |int| OpenSSL::ASN1::Integer.new(OpenSSL::BN.new(int, 2)) }).to_der else signature end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jwt_key\n 'ec6a8b69ae22049f900af9bd9f14ffb4dc6937f69575ab49b4df2d28364055b8'\n end", "def hmac; end", "def sign_key; end", "def generate_jwt(pem_key, expiration = nil)\n payload = {\n 'sub': 123,\n 'username': 'mail@example.com',\n 'exp': expiration || Time.now.to_i + 4 * 3600\n }\n JWT.e...
[ "0.6865938", "0.6815192", "0.66543496", "0.6603328", "0.6595409", "0.65530574", "0.65530574", "0.65376586", "0.65088344", "0.6480197", "0.6440067", "0.6378723", "0.6372079", "0.63465834", "0.6324598", "0.63198715", "0.6312581", "0.6224201", "0.6185443", "0.61818403", "0.61693...
0.0
-1
GET /hotsales GET /hotsales.json
def index @hotsales = Hotsale.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sales = @saleService.all_to_json().as_json;\n end", "def index\n @sales = Sale.all\n\n render json: @sales\n end", "def index\n @pre_sales = PreSale.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pre_sales }\n end\n end", ...
[ "0.7468419", "0.7337246", "0.6819928", "0.6695187", "0.6685312", "0.6677875", "0.65796465", "0.6558189", "0.65230215", "0.6478909", "0.64445794", "0.63889426", "0.63703984", "0.6330632", "0.6329012", "0.6313408", "0.62879246", "0.628755", "0.62797946", "0.62743205", "0.627432...
0.7240358
3
GET /hotsales/1 GET /hotsales/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sales = @saleService.all_to_json().as_json;\n end", "def index\n @sales = Sale.all\n\n render json: @sales\n end", "def index\n @hotsales = Hotsale.all\n end", "def index\n @hotsales = Hotsale.all\n end", "def index\n @pre_sales = PreSale.all\n\n respond_to do |format|...
[ "0.73017037", "0.72465885", "0.714865", "0.714865", "0.6801523", "0.66948473", "0.66765994", "0.6636716", "0.6584605", "0.6532446", "0.65266657", "0.6520222", "0.6519836", "0.6499092", "0.64703435", "0.6444699", "0.6427199", "0.6395034", "0.6394217", "0.6394217", "0.6381924",...
0.0
-1
POST /hotsales POST /hotsales.json
def create @hotsaleall= Hotsale.all @hotsale = Hotsale.new(hotsale_params) @purchases= Purchase.all respond_to do |format| @purchases.each do |purchase| if purchase.property_id == @hotsale.property_id && purchase.week == @hotsale.fecha @mensaje='la propiedad ya esta reservada en esa fecha' format.html { render :new } @hotsale.repetido = 0 end end @hotsaleall.each do |hotsaleall| if hotsaleall.property_id == @hotsale.property_id && hotsaleall.fecha == @hotsale.fecha @mensaje='ya hay un hotsale para esta propiedad' format.html { render :new } @hotsale.repetido = 0 end end if @hotsale.fecha< (Time.now + 6.month) && @hotsale.fecha > Time.now && @hotsale.fecha.strftime("%a") == 'Mon' if @hotsale.save format.html { redirect_to @hotsale, notice: 'Hotsale ha sido creado' } format.json { render :show, status: :created, location: @hotsale } else format.html { render :new } format.json { render json: @hotsale.errors, status: :unprocessable_entity } end else if @hotsale.fecha.strftime("%a") != 'Mon' @mensaje='El comienzo de la semana del hotsale debe ser Lunes' format.html { render :new } else @mensaje='La fecha no se encuentra dentro de los seis meses siguiente' format.html { render :new } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @hotsale = Hotsale.new(hotsale_params)\n\n respond_to do |format|\n if @hotsale.save\n format.html { redirect_to @hotsale, notice: 'Hotsale was successfully created.' }\n format.json { render :show, status: :created, location: @hotsale }\n else\n format.html { rend...
[ "0.68950635", "0.63491434", "0.61559856", "0.6097831", "0.60627306", "0.5956521", "0.5951598", "0.5951598", "0.58763707", "0.5870272", "0.5866416", "0.58081686", "0.5802295", "0.5802295", "0.5802295", "0.57995284", "0.57919484", "0.57547134", "0.5747867", "0.5746918", "0.5730...
0.5604579
36
PATCH/PUT /hotsales/1 PATCH/PUT /hotsales/1.json
def update respond_to do |format| if @hotsale.update(hotsale_params) format.html { redirect_to @hotsale, notice: 'Hotsale ha sido actualizado' } format.json { render :show, status: :ok, location: @hotsale } else format.html { render :edit } format.json { render json: @hotsale.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @supermarket = Supermarket.find(params[:id]) \n respo...
[ "0.6486159", "0.6338161", "0.6276153", "0.6234231", "0.62069696", "0.6103487", "0.5979383", "0.5976853", "0.5976592", "0.59620446", "0.5958341", "0.59101504", "0.5904021", "0.58922166", "0.58861035", "0.58861035", "0.5870417", "0.58619195", "0.586019", "0.5857157", "0.5849706...
0.6268827
3
DELETE /hotsales/1 DELETE /hotsales/1.json
def destroy @hotsale.destroy respond_to do |format| format.html { redirect_to hotsales_url, notice: 'Hotsale ha sido eliminado' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n d...
[ "0.6806309", "0.67451596", "0.67275894", "0.6705791", "0.6705122", "0.66872597", "0.6647613", "0.6647613", "0.6634332", "0.6631515", "0.6631515", "0.6631515", "0.6631515", "0.6630416", "0.6622253", "0.66187334", "0.66115767", "0.6606254", "0.6606254", "0.6586338", "0.6582284"...
0.70498973
0
Use callbacks to share common setup or constraints between actions.
def set_hotsale @hotsale = Hotsale.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 hotsale_params params.require(:hotsale).permit(:nombre, :precio, :preciohot, :fecha, :property_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.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Mounts weeler at mount_location location. E.g. mount_weeler_at "root" do weeler_resources :posts, include_in_weeler_menu: true end
def mount_weeler_at mount_location, options={}, &block Weeler.mount_location_namespace = mount_location.gsub("/", "").to_sym scope mount_location do namespace :weeler, :path => nil do mount_configuration_controllers weeler_resources :static_sections resources :seos, :only => [:update] root :to => "home#index" get "/home/about" get "/content", to: "content#index" get "/administration", to: "administration#index" get "/configuration", to: "configuration#index" add_concerns yield if block_given? end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mount! app\n return if mounted?\n @__e__app = app\n\n # Important - expand_formats! should run before expand_setups!\n expand_formats!\n expand_setups!\n generate_routes!\n lock!\n\n @__e__mounted = true\n end", "def mount_path; end", "def mount(root, handler, long_call = false, *a...
[ "0.57960397", "0.57589513", "0.5745601", "0.5734042", "0.57002026", "0.55326855", "0.54898417", "0.5446066", "0.5429816", "0.51993126", "0.5149646", "0.5144631", "0.50699735", "0.50632805", "0.5036165", "0.50163937", "0.49899802", "0.49774396", "0.49526083", "0.49526083", "0....
0.8084528
0
Ordable route concern for dynamic sorting and removing image
def add_concerns concern :orderable do collection do post :order end end concern :imageable do member do get "remove_image" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort\r\n ContentImage.sort(params[:content_image])\r\n render :nothing => true\r\n end", "def sort\n order = params[:image]\n Image.order(order)\n render :text => order.inspect\n end", "def sort_iso_img_grid\n assert_privileges(\"miq_request_edit\")\n return unless load_edit(\"prov_e...
[ "0.7103544", "0.6924379", "0.6244418", "0.62423056", "0.61356497", "0.60923153", "0.6040875", "0.6020136", "0.59898394", "0.59510136", "0.59379226", "0.59304285", "0.5914734", "0.58743656", "0.58741814", "0.5835534", "0.5816325", "0.5813589", "0.5806975", "0.5803411", "0.5768...
0.52627563
70
GET /operations GET /operations.json
def index @operations = Operation.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @operations = Operation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations }\n end\n end", "def operations\n @client.operations\n end", "def list_operations()\n\t\treturn @service.operations\n\tend", "def sh...
[ "0.7518595", "0.73352146", "0.7276129", "0.68853235", "0.6803943", "0.66043514", "0.65868527", "0.6445878", "0.6413695", "0.6413695", "0.6413695", "0.6413695", "0.6413695", "0.63378066", "0.6328888", "0.63009214", "0.6288903", "0.6201535", "0.61838377", "0.6170096", "0.614820...
0.6996508
5
GET /operations/1 GET /operations/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @operations = Operation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @operations }\n end\n end", "def show\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.jso...
[ "0.71960646", "0.7177337", "0.6668231", "0.65932965", "0.65932965", "0.65932965", "0.65056217", "0.6498619", "0.6300512", "0.62807286", "0.6204183", "0.61876047", "0.6171547", "0.61273587", "0.6039129", "0.60162014", "0.5975667", "0.59515774", "0.5810405", "0.5810405", "0.578...
0.0
-1
POST /operations POST /operations.json
def create @operation = Operation.new(operation_params) respond_to do |format| if @operation.save format.html { redirect_to admin_operations_path, notice: 'Operation was successfully created.' } format.json { render action: 'show', status: :created, location: @operation } else format.html { render action: 'new' } format.json { render json: @operation.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @operation = Operation.new(operation_params)\n\n respond_to do |format|\n if @operation.save\n format.html { redirect_to @operation, notice: 'Operation was successfully created.' }\n format.json { render :show, status: :created, location: @operation }\n else\n form...
[ "0.69685686", "0.69662464", "0.6702171", "0.6382377", "0.629233", "0.6223203", "0.620414", "0.61645526", "0.61255604", "0.60816777", "0.607579", "0.6048692", "0.60432595", "0.59870857", "0.596099", "0.5938973", "0.586401", "0.5860937", "0.5854129", "0.58242995", "0.58242065",...
0.70383805
0
PATCH/PUT /operations/1 PATCH/PUT /operations/1.json
def update respond_to do |format| if @operation.update(operation_params) format.html { redirect_to admin_operations_path, notice: 'Operation was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @operation.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @operations = args[:operations] unless args[:operations].nil?\n end", "def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { h...
[ "0.66260177", "0.66218334", "0.66207176", "0.6610916", "0.654779", "0.6515128", "0.6502088", "0.6477106", "0.64205074", "0.6383883", "0.6294126", "0.626478", "0.62470454", "0.6232619", "0.6205973", "0.61811674", "0.6171809", "0.6171809", "0.6072728", "0.6072728", "0.6056517",...
0.66305596
0
DELETE /operations/1 DELETE /operations/1.json
def destroy @operation.destroy respond_to do |format| format.html { redirect_to admin_operations_url, notice: 'Operation destroyed' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @operation.destroy\n respond_to do |format|\n format.html { redirec...
[ "0.75761575", "0.72412795", "0.72412795", "0.7191369", "0.71525544", "0.7145271", "0.70628536", "0.69841754", "0.69350606", "0.6921928", "0.6920555", "0.6911783", "0.6905933", "0.6898121", "0.6892818", "0.6869681", "0.6868791", "0.6867351", "0.6845507", "0.6845507", "0.684550...
0.7284256
1
Use callbacks to share common setup or constraints between actions.
def set_operation @operation = Operation.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 operation_params params.require(:operation).permit(:alias, :name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
building the results is a destructive process we will need two trees, and this is easier than trying to copy one because the nodes have pointers everywhere
def parse html return if html.nil? @fragment = Nokogiri::HTML.fragment(html) @fragment_copy = Nokogiri::HTML.fragment(html) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat(nodes); end", "def build\n\t\t\tfifo_q = Array.new\n\t\n\t\t\t# Set the failures for the nodes coming out of the root node.\n\t\t\t@root.get.each_pair do |item, node|\n\t\t\t\tnode.failure = @root\n\t\t\t\tfifo_q.push node\n\t\t\tend\n\n\t\t\t# Set the failures in breadth-first search order\n\t\t\t# u...
[ "0.6285667", "0.62744313", "0.62532127", "0.61927176", "0.61105335", "0.60964197", "0.6070974", "0.59581035", "0.5922886", "0.5911566", "0.59048766", "0.58389527", "0.5819457", "0.5808401", "0.5751167", "0.573875", "0.5731506", "0.5728733", "0.57097065", "0.57030284", "0.5700...
0.0
-1
simply remove nodes after the search term is found
def first_part text found = false preorder_traverse @fragment do |node| if found then node.remove elsif node.text? then if not node.text.index(text).nil? then found = true update_content node, text, :keep_left end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unset( search_nodes )\n return apply(search_nodes)\n end", "def remove_node\n cspsearchpath.delete(@label)\n end", "def deleting(word, previous = [])\n return if word.size == 0\n node = find(word, @root)\n case active_path?(node)\n when false\n previous << word[-1]\n ...
[ "0.6830866", "0.6507956", "0.62820333", "0.62730473", "0.6263972", "0.6178266", "0.61459017", "0.6138284", "0.61095756", "0.6051949", "0.59941804", "0.5991498", "0.5952998", "0.5868398", "0.58629096", "0.58221114", "0.57922363", "0.5788696", "0.57717776", "0.5760604", "0.5755...
0.0
-1
do a post order traversal of the dom deleting nodes as you go until you find the target, then stop
def second_part text postorder_traverse @fragment_copy do |node| if node.text? then if not node.text.index(text).nil? then update_content node, text, :keep_right return node end end node.remove end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_all(xpath); end", "def ref_cleanup(xmldoc)\n xmldoc.xpath(\"//p/ref\").each do |r|\n parent = r.parent\n parent.previous = r.remove\n end\n end", "def remove_finished_children\n # We call #to_a to get a copy of children, since we will remove\n ...
[ "0.60711044", "0.58655196", "0.57102835", "0.55811304", "0.5491231", "0.54844606", "0.5459548", "0.54476297", "0.5434917", "0.5416393", "0.54146814", "0.5404374", "0.53876245", "0.5286174", "0.5275497", "0.5271728", "0.52137876", "0.52078813", "0.5206405", "0.52062815", "0.52...
0.0
-1
first the first occurance of text in html text nodes
def find text preorder_traverse @fragment do |node| if node.text? then if not node.text.index(text).nil? then return node end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_first_text(xhtml)\n texts = extract_text_from_elements(xhtml)\n texts.empty? ? '' : texts[0]\n end", "def first_text\n first_ele static_text_class\n end", "def first_text\n first_ele TEXT_VIEW\n end", "def search1(doc)\n doc.search('.subtext > span:first-child').map { |s...
[ "0.7787677", "0.7376269", "0.71102214", "0.6951076", "0.6895414", "0.67904395", "0.67206556", "0.6693962", "0.6375008", "0.6214877", "0.6155256", "0.6118518", "0.5996468", "0.59710264", "0.59528756", "0.592107", "0.591246", "0.5875623", "0.58730525", "0.5819037", "0.5813181",...
0.6733458
6
take a block and a node
def postorder_traverse node, &block if node.children.count > 0 then node.children.each do |child| postorder_traverse(child, &block) end end block.call(node) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_node; end", "def block_node; end", "def block_node=(_); end", "def parse_block(*_arg0); end", "def node(name, ref, *args, &block); end", "def insert(node, &block); end", "def insert(node, &block); end", "def context(nodes, &block); end", "def iterating_block?(node); end", "def each_node...
[ "0.75207937", "0.75207937", "0.72801477", "0.64374626", "0.6326567", "0.6286031", "0.6286031", "0.61554724", "0.6154269", "0.61400616", "0.61134595", "0.6089411", "0.6057309", "0.6037786", "0.5964558", "0.59345484", "0.59345484", "0.5921424", "0.5888082", "0.5874809", "0.5874...
0.0
-1
take a block and a node
def preorder_traverse node, &block block.call(node) if node.children.count > 0 then node.children.each do |child| preorder_traverse(child, &block) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_node; end", "def block_node; end", "def block_node=(_); end", "def parse_block(*_arg0); end", "def node(name, ref, *args, &block); end", "def insert(node, &block); end", "def insert(node, &block); end", "def context(nodes, &block); end", "def iterating_block?(node); end", "def each_node...
[ "0.75207937", "0.75207937", "0.72801477", "0.64374626", "0.6326567", "0.6286031", "0.6286031", "0.61554724", "0.6154269", "0.61400616", "0.61134595", "0.6089411", "0.6057309", "0.6037786", "0.5964558", "0.59345484", "0.59345484", "0.5921424", "0.5888082", "0.5874809", "0.5874...
0.0
-1
See Pyapns2::Clientnotify, with the exception this version prefills in the app_id.
def notify(token, notification = nil) client.notify app_id, token, notification end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_airbrake(exception)\n # tested with airbrake 4.3.5 and 5.0.5\n if defined?(Airbrake)\n if(Airbrake.respond_to?(:notify_or_ignore))\n env['airbrake.error_id'] = Airbrake.notify_or_ignore(exception, airbrake_request_data) # V4\n else\n # V5\n notice = Airbrake::Rack::N...
[ "0.6332651", "0.6031704", "0.5758019", "0.5718261", "0.5663755", "0.5604428", "0.55759513", "0.5527063", "0.5504611", "0.54988724", "0.548763", "0.54675853", "0.5467477", "0.5463076", "0.545508", "0.5414666", "0.54052407", "0.54052407", "0.54020387", "0.53936505", "0.53856105...
0.5971026
2
See Pyapns2::Clientfeedback, with the exception this version prefills in the app_id.
def feedback client.feedback app_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedback(app_id)\n raise ArgumentError, \"app_id must be provided\" unless app_id\n @xmlrpc.call_to_ruby('feedback', app_id)\n rescue Rapuncel::Response::Exception => e\n raise Error.new e.message\n end", "def notify_airbrake(exception)\n # tested with airbrake 4.3.5 and 5.0.5\n if defined?...
[ "0.7102749", "0.55603343", "0.55571926", "0.5386742", "0.5336717", "0.5331416", "0.5190438", "0.5124543", "0.5118105", "0.5097105", "0.50917196", "0.5042811", "0.501214", "0.49912286", "0.49870384", "0.496412", "0.4961325", "0.4961325", "0.49505922", "0.49349612", "0.49267787...
0.67319715
1
Takes an app id and returns the list of feedback from pyapns.
def feedback(app_id) raise ArgumentError, "app_id must be provided" unless app_id @xmlrpc.call_to_ruby('feedback', app_id) rescue Rapuncel::Response::Exception => e raise Error.new e.message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedback\n client.feedback app_id\n end", "def get_apn_feedback\n apple_feedback = get_pushmeup_apn_feedback.sort_by{|f| f[:timestamp]}\n apple_feedback.reduce({}){|feedback_hash, array_value|\n feedback_hash.merge({array_value[:token] => array_value[:timestamp]})\n }\n e...
[ "0.6343253", "0.6119709", "0.59329194", "0.5585297", "0.5432993", "0.523322", "0.51711994", "0.5054705", "0.50495034", "0.5045411", "0.50369096", "0.49715233", "0.4964603", "0.4964603", "0.49412003", "0.49400392", "0.49278122", "0.4919569", "0.4875732", "0.48657173", "0.48654...
0.67045623
0
GET /kind/:kind_id/fields GET /kind/:kind_id/fields.xml
def index @fields = @kind.fields respond_to do |format| format.html # index.html.erb format.xml { render :xml => @fields } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end", "def new\n @field = Field.new\n @field.kind = @kind\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @field }\n end\n end", "def show_fields(**par...
[ "0.63538903", "0.6310725", "0.6255191", "0.5996835", "0.5996835", "0.58680886", "0.58305484", "0.57969993", "0.57600236", "0.56537604", "0.55938077", "0.55905503", "0.5538235", "0.5521766", "0.5509145", "0.5466365", "0.5464367", "0.544456", "0.544456", "0.544456", "0.5441983"...
0.766918
0
GET /kind/:kind_id/fields/1 GET /kind/:kind_id/fields/1.xml
def show @field = Field.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @field } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fields = @kind.fields\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fields }\n end\n end", "def new\n @field = Field.new\n @field.kind = @kind\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { re...
[ "0.7427069", "0.6435071", "0.61419165", "0.57520497", "0.57198423", "0.56881636", "0.5595131", "0.5579345", "0.5550442", "0.5536267", "0.5531342", "0.552539", "0.55099964", "0.5454952", "0.54374987", "0.5434919", "0.5416664", "0.5393826", "0.5390619", "0.53791124", "0.5344257...
0.6206381
3
GET /kind/:kind_id/fields/new GET /kind/:kind_id/fields/new.xml
def new @field = Field.new @field.kind = @kind respond_to do |format| format.html # new.html.erb format.xml { render :xml => @field } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @field = Field.new(params[:field])\n @field.kind = @kind\n\n respond_to do |format|\n if @field.save\n format.html { redirect_to([@kind, @field], :notice => t(:field_created)) }\n format.xml { render :xml => @field, :status => :created, :location => @field }\n else\n ...
[ "0.7295998", "0.6900582", "0.6746322", "0.6746322", "0.6644341", "0.659617", "0.65531486", "0.65420866", "0.64810026", "0.64587015", "0.64295167", "0.6419314", "0.641132", "0.639601", "0.635049", "0.633429", "0.6328785", "0.63262665", "0.6324993", "0.62722766", "0.6225048", ...
0.8143767
0
POST /kind/:kind_id/fields POST /kind/:kind_id/fields.xml
def create @field = Field.new(params[:field]) @field.kind = @kind respond_to do |format| if @field.save format.html { redirect_to([@kind, @field], :notice => t(:field_created)) } format.xml { render :xml => @field, :status => :created, :location => @field } else format.html { render :action => "new" } format.xml { render :xml => @field.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fields = @kind.fields\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fields }\n end\n end", "def new\n @field = Field.new\n @field.kind = @kind\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { re...
[ "0.65220857", "0.6430846", "0.5597896", "0.53388554", "0.527552", "0.5271662", "0.5270734", "0.5254163", "0.5209557", "0.517314", "0.5172917", "0.51676124", "0.51391816", "0.51322985", "0.5132024", "0.51267904", "0.51097035", "0.51064765", "0.5040456", "0.5024929", "0.5008372...
0.67230237
0
PUT /kind/:kind_id/fields/1 PUT /kind/:kind_id/fields/1.xml
def update @field = Field.find(params[:id]) respond_to do |format| if @field.update_attributes(params[:field]) format.html { redirect_to([@kind, @field], :notice => t(:field_updated)) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @field.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @kind = Kind.find(params[:id])\n\n respond_to do |format|\n if @kind.update_attributes(params[:kind])\n format.html { redirect_to @kind, notice: 'Ki...
[ "0.59844965", "0.59694123", "0.596906", "0.5841591", "0.5617589", "0.5558636", "0.5556938", "0.55258816", "0.5522507", "0.54920954", "0.5473853", "0.54623663", "0.54189456", "0.540179", "0.540179", "0.540179", "0.540179", "0.540179", "0.540179", "0.5382544", "0.53787357", "...
0.6395153
0
DELETE /kind/:kind_id/fields/1 DELETE /kind/:kind_id/fields/1.xml
def destroy @field = Field.find(params[:id]) @field.destroy respond_to do |format| format.html { redirect_to(kind_fields_url(@kind)) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n field_id = params[:id].to_s.split(/_/).last.to_i\n @field = Field.find(field_id)\n\n ActiveRecord::Base.transaction do\n @field.destroy\n end\n\n respond_to do |format|\n format.h...
[ "0.6738011", "0.654856", "0.6535496", "0.6535496", "0.63867986", "0.6386408", "0.6352135", "0.6322042", "0.6290764", "0.6266561", "0.62588984", "0.62319887", "0.62174934", "0.6214824", "0.621464", "0.61971396", "0.6194464", "0.6162853", "0.61606157", "0.6141362", "0.6138027",...
0.7730304
0
Use callbacks to share common setup or constraints between actions.
def set_static_game_datum @static_game_datum = StaticGameDatum.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 static_game_datum_params params.fetch(:static_game_datum, {}) 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