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
Check if the booking deposit can be paid
def can_pay_deposit? conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit'))) if self.status == :pending_confirmation (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and ((!expired? and payment_cadence_allowed?) or force_allow_payment) elsif self.status == :confirmed # Confirmed in the back-office without payment (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and self.total_pending > 0 else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_pay_pending?\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n conf_payment_pending ...
[ "0.77239037", "0.7569773", "0.7422755", "0.73755723", "0.7339481", "0.73014724", "0.72930986", "0.72819316", "0.7277613", "0.7249772", "0.72377115", "0.7196021", "0.71829253", "0.71771604", "0.71770436", "0.7128008", "0.7121361", "0.70882684", "0.7068571", "0.70556414", "0.70...
0.832738
0
Check if the booking pending amout can be paid
def can_pay_pending? conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit'))) conf_payment_pending = SystemConfiguration::Variable.get_value('booking.allow_pending_payment', 'false').to_bool if (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and conf_payment_pending and self.status != :cancelled self.total_paid > 0 else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paid?\n date_paid_out.present?\n end", "def paid_in_full?\n !payment_outstanding?\n end", "def is_pending?\n generated_at.nil? && !paid_on.nil?\n end", "def can_supply?\n payment_received? || payment_on_account?\n end", "def paid?\n status == PAID\n end", "def can_pay_depo...
[ "0.71702313", "0.71526426", "0.7109992", "0.7084684", "0.70435095", "0.6993429", "0.6967501", "0.696737", "0.6962636", "0.6962589", "0.69588023", "0.69563323", "0.69521564", "0.6946697", "0.69341993", "0.6931443", "0.688302", "0.68753105", "0.6861397", "0.6861395", "0.6832474...
0.7590212
0
Check if the booking total can be paid
def can_pay_total? conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool conf_payment_total = (['total','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit'))) if self.status == :pending_confirmation (conf_payment_enabled or force_allow_payment) and conf_payment_total and self.total_paid == 0 and ((!expired? and payment_cadence_allowed?) or force_allow_payment) elsif self.status == :confirmed # Confirmed in the back-office without payment (conf_payment_enabled or force_allow_payment) and conf_payment_total and self.total_paid == 0 and self.total_pending > 0 else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_pay_pending?\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n conf_payment_pending ...
[ "0.7412474", "0.7411622", "0.73245823", "0.7309448", "0.72949857", "0.72554713", "0.7233095", "0.72233987", "0.7153269", "0.7052865", "0.7051206", "0.7038335", "0.69835436", "0.69825155", "0.69233483", "0.6890057", "0.6832605", "0.68203557", "0.6803191", "0.67923677", "0.6786...
0.8055018
0
Check if the customer can pay for the reservation
def can_pay? can_pay_deposit? or can_pay_pending? or can_pay_total? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_customer\n unless @reservation.customer == current_customer\n redirect_to reservations_url, notice: 'No touchy!'\n # edit this?\n end\n end", "def payment_cadence_allowed?\n begin\n config_payment_cadence = SystemConfiguration::Variable.get_value('bookin...
[ "0.73681736", "0.7097883", "0.7003465", "0.69067246", "0.6870688", "0.6852519", "0.6709813", "0.6664991", "0.66600484", "0.65997064", "0.65389895", "0.6434996", "0.6374458", "0.63284856", "0.63112056", "0.6293332", "0.6253697", "0.6211267", "0.6205412", "0.6202804", "0.61818"...
0.6615674
9
Get the deposit amount
def booking_deposit booking_amount end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deposit(deposit_amt = 0)\n @balance = @balance + deposit_amt\n return @balance\n end", "def deposit(amount)\n @balance += amount\n return @balance\n end", "def deposit(deposit_amount)\n if deposit_amount < 0\n puts \"Invalid deposit amount entered.\"\n else\n ...
[ "0.8238116", "0.79073524", "0.78594273", "0.7852941", "0.78444284", "0.78444284", "0.7841072", "0.77286685", "0.77254146", "0.7686303", "0.76397145", "0.76017696", "0.75142", "0.74730194", "0.74319214", "0.741211", "0.74033374", "0.7400073", "0.7299513", "0.7299513", "0.72994...
0.6744286
71
Get a list of the other people involved in the contract (extracted from resources)
def contract_other_people result = [] booking_line_resources.each do |resource| result << { :name => resource.resource_user_name, :surname => resource.resource_user_surname, :document_id => resource.resource_user_document_id, :phone => resource.resource_user_phone, :email => resource.resource_user_email } if resource.resource_user_name != customer_name and resource.resource_user_surname != customer_surname if resource.pax == 2 result << { :name => resource.resource_user_2_name, :surname => resource.resource_user_2_surname, :document_id => resource.resource_user_2_document_id, :phone => resource.resource_user_2_phone, :email => resource.resource_user_2_email } if resource.resource_user_2_name != customer_name and resource.resource_user_2_surname != customer_surname end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def involved_people\n involved_people_ids.collect{|user_id| User.find(user_id)}\n end", "def involved_people\n # [self.user, self.answerers, self.commenters].flatten.uniq\n [self.user].flatten.uniq\n end", "def my_clients\n self.client_cars.map do |car|\n car.owner\n end\n end", "def g...
[ "0.6893433", "0.6450095", "0.6368445", "0.6293375", "0.62438333", "0.6202781", "0.61728823", "0.6167317", "0.6148839", "0.61203325", "0.6117037", "0.60939777", "0.60792786", "0.6050543", "0.603209", "0.6017737", "0.59924114", "0.59899044", "0.5989361", "0.5986904", "0.5968545...
0.65476793
1
Get the charge item detail
def charge_item_detail "#{date_from.strftime('%d/%m/%Y')} - #{date_to.strftime('%d/%m/%Y')}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_charge\n @charge\n end", "def retrieve(params = {})\n req = WebPay::ChargeIdRequest.create(params)\n raw_response = @client._request(:get, 'charges' + '/' + req.id.to_s, req)\n WebPay::ChargeResponse.new(raw_response)\n end", "def catalog_item\n item_unit.catalog_item\n end", "def c...
[ "0.68254", "0.6320458", "0.6301813", "0.61443526", "0.61334497", "0.61334497", "0.61334497", "0.6102466", "0.60901093", "0.6078", "0.60380334", "0.5972841", "0.59606665", "0.59571135", "0.59571135", "0.59308916", "0.5897722", "0.58737415", "0.58735317", "0.5870851", "0.584944...
0.0
-1
Creates an online charge
def create_online_charge!(charge_payment, charge_payment_method_id) if total_pending > 0 and charge_payment_method = Payments::PaymentMethod.get(charge_payment_method_id.to_sym) and not charge_payment_method.is_a?Payments::OfflinePaymentMethod and !([:deposit, :pending, :total].find_index(charge_payment.to_sym)).nil? amount = case charge_payment.to_sym when :deposit booking_deposit when :total total_cost when :pending total_pending end charge = new_charge!(charge_payment_method_id, amount) if amount > 0 save return charge end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_charge\n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => Deal.find(current_consumer.orders.last[:deal_id]).price.to_i * 100,\n ...
[ "0.7203495", "0.71276355", "0.7066049", "0.70205635", "0.6999604", "0.69953424", "0.6966712", "0.68556285", "0.6849291", "0.6794063", "0.67895603", "0.6786372", "0.67256474", "0.6707521", "0.66697544", "0.6664877", "0.66551316", "0.6653614", "0.6647449", "0.6601269", "0.65839...
0.7578193
0
Confirms the booking A booking can only be confirmed if it's pending confirmation and contains a done charge
def confirm if status == :pending_confirmation and not charges.select { |charge| charge.status == :done }.empty? transaction do self.status = :confirmed self.save # Assign available stock assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool # Create newsfeed ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking', action: 'confirm_booking', identifier: self.id.to_s, description: BookingDataSystem.r18n.t.confirmed_booking) end send_booking_confirmation_notifications else p "Could not confirm booking #{id} #{status}" end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirming?\n self.status == 'confirming'\n end", "def confirm!\n self.pending = false\n self.save\n self.createDebts\n end", "def is_confirmed?\n return self.status == Erp::Reservations::Reservation::STATUS_CONFIRMED\n end", "def confirmable?\n status.to_sym.in...
[ "0.7393467", "0.72894025", "0.72890913", "0.7191981", "0.7173776", "0.7113949", "0.70914084", "0.7046285", "0.69909847", "0.6982988", "0.69735354", "0.69726926", "0.6832937", "0.6818922", "0.6803567", "0.6802363", "0.67948097", "0.6790354", "0.67571694", "0.67345583", "0.6699...
0.73184466
1
Confirm the booking without checking the charges
def confirm! if status == :pending_confirmation transaction do update(:status => :confirmed) # Assign available stock assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool # Create newsfeed ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking', action: 'confirm_booking', identifier: self.id.to_s, description: BookingDataSystem.r18n.t.confirmed_booking) end send_booking_confirmation_notifications end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm\n if status == :pending_confirmation and\n not charges.select { |charge| charge.status == :done }.empty?\n transaction do\n self.status = :confirmed\n self.save\n # Assign available stock\n assign_available_stock if SystemConfiguration::Var...
[ "0.76281", "0.7298967", "0.7282391", "0.72769725", "0.72663724", "0.7261435", "0.72515655", "0.72482556", "0.7206465", "0.7116592", "0.7087301", "0.7085152", "0.69981986", "0.69981986", "0.6993488", "0.6960853", "0.69397485", "0.6935702", "0.6929306", "0.68695295", "0.6848645...
0.73611575
1
Deliver the item to the customer
def pickup_item if status == :confirmed transaction do update(:status => :in_progress) # Create newsfeed ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking', action: 'pickup_item', identifier: self.id.to_s, description: BookingDataSystem.r18n.t.picked_up_item) end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sold\n @item = item\n @buyer = buyer\n @greeting = \"Hi\"\n @name = item.owner.name\n\n mail to: @buyer.email\n end", "def reserved(item, buyer)\n @item = item\n @buyer = buyer\n @greeting = \"Hi\"\n @name = item.owner.name\n\n mail to: @buyer.email\n end", "def deliver\n ...
[ "0.6572996", "0.6489564", "0.63517064", "0.6332906", "0.63278157", "0.62956756", "0.62924033", "0.62888145", "0.62794787", "0.6273726", "0.62712324", "0.62676555", "0.62548035", "0.6252488", "0.62453747", "0.6237728", "0.622305", "0.6174322", "0.6171453", "0.61652535", "0.616...
0.6168281
19
The item is returned from the customer
def return_item if status == :in_progress transaction do update(:status => :done) # Create newsfeed ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking', action: 'return_item', identifier: self.id.to_s, description: BookingDataSystem.r18n.t.returned_item) end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item; @item; end", "def item; @item; end", "def catalog_item\n item_unit.catalog_item\n end", "def item;\n @item;\n end", "def fox_item\n @item\n end", "def item\n fetch('sword_art_online.item')\n end", "def item; end", "def item; end", "def item; end", "def item; ...
[ "0.7015587", "0.7015587", "0.69706696", "0.68646383", "0.6729861", "0.66472006", "0.6618122", "0.6618122", "0.66180795", "0.66180795", "0.66180795", "0.65629905", "0.65586215", "0.65019906", "0.64987123", "0.6434899", "0.6417495", "0.6385974", "0.6362479", "0.63599175", "0.63...
0.63634
18
Cancels a booking A booking can only be cancelled if it isn't already cancelled
def cancel unless status == :cancelled transaction do if total_paid > 0 update(:status => :cancelled, :payment_status => :refunded, :total_paid => 0, :total_pending => total_cost) else update(:status => :cancelled) end # Create newsfeed ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking', action: 'cancel_booking', identifier: self.id.to_s, description: BookingDataSystem.r18n.t.canceled_booking) charges.each do |charge| charge.refund end end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_booking\n @booking = Booking.find(params[:id])\n if @booking.booking_date > Time.now\n if params[:cancellation_message].strip == \"\" || params[:cancellation_message].nil?\n flash[:danger] = \"Message needs to be specified before cancelling a booking.\"\n redirect_to booking_pat...
[ "0.7473922", "0.72661614", "0.71906024", "0.7122314", "0.7105095", "0.7061529", "0.705622", "0.6979841", "0.6960039", "0.6880848", "0.686187", "0.6853294", "0.6839435", "0.6792208", "0.6786324", "0.6769495", "0.67596406", "0.67408955", "0.6723544", "0.66924024", "0.6688775", ...
0.7310761
1
Gets the payment method instance
def payment_method if payment_method_id.nil? return nil else @payment_method ||= Payments::PaymentMethod.get(payment_method_id.to_sym) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_method\n Zapi::Models::PaymentMethod.new\n end", "def payment_method\n @payment_method ||= Gateway::AdyenHPP.last # find(params[:merchantReturnData])\n end", "def payment_method\n @payment_method ||= PAYMENT_METHOD[mapping_for(:payment_method)]\n end", "def p...
[ "0.79170084", "0.77542", "0.77419406", "0.77419406", "0.7611124", "0.7611124", "0.71781945", "0.7165474", "0.70644796", "0.70008755", "0.6835799", "0.6629894", "0.6629894", "0.6546507", "0.6373272", "0.6281328", "0.6276946", "0.6230121", "0.6199808", "0.6198017", "0.61825365"...
0.7860746
1
Get a newsfeed summary
def newsfeed_summary items = [] extras = [] booking_lines.each do |booking_item| items << {item_id: booking_item.item_id, item_unit_cost: booking_item.item_unit_cost, item_cost: booking_item.item_cost, quantity: booking_item.quantity, product_deposit_unit_cost: booking_item.product_deposit_unit_cost, product_deposit_cost: booking_item.product_deposit_cost} end booking_extras.each do |booking_extra| extras << {extra_id: booking_extra.extra_id, extra_unit_cost: booking_extra.extra_unit_cost, extra_cost: booking_extra.extra_cost, quantity: booking_extra.quantity} end {date_from: date_from, time_from: time_from, date_to: date_to, time_to: time_to, days: days, date_to_price_calculation: date_to_price_calculation, items: items, extras: extras, status: status, item_cost: item_cost, extras_cost: extras_cost, time_from_cost: time_from_cost, time_to_cost: time_to_cost, pickup_place_cost: pickup_place_cost, return_place_cost: return_place_cost, driver_age_cost: driver_age_cost, total_cost: total_cost, total_paid: total_paid, total_pending: total_pending, booking_amount: booking_amount, product_deposit_cost: product_deposit_cost, driver_age_deposit: driver_age_deposit, total_deposit: total_deposit} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def news_feed\n begin\n client = Feedlr::Client.new(oauth_access_token: ENV['FEEDLY_OAUTH_ACCESS_TOKEN'])\n @latest_list = {}\n client.user_unread_counts.unreadcounts.each do |unread_articles|\n next if unread_articles['count'] == 0\n unread_artic...
[ "0.7351462", "0.69124395", "0.674393", "0.6711683", "0.65778476", "0.65491587", "0.6514772", "0.6510166", "0.6499382", "0.6493504", "0.648183", "0.64705163", "0.64505017", "0.63795763", "0.63602805", "0.6326933", "0.6323274", "0.6300581", "0.6296649", "0.6292102", "0.626545",...
0.0
-1
Automatic resource assignation Assign available stock to unassigned items
def assign_available_stock stock_detail, category_occupation = BookingDataSystem::Booking.categories_availability(self.rental_location_code, self.date_from, self.time_from, self.date_to, self.time_to, nil, { origin: 'booking', id: self.id }) #p "stock_detail: #{stock_detail.inspect}" #p "category_occupation: #{category_occupation.inspect}" transaction do booking_lines.each do |booking_line| booking_line.booking_line_resources.each do |booking_line_resource| if booking_line_resource.booking_item_reference.nil? p "assign_available_stock -- #{booking_line_resource.booking_item_reference} -- available: #{category_occupation[booking_line.item_id][:available_stock].inspect} -- available_assignable: #{category_occupation[booking_line.item_id][:available_assignable_stock].inspect}" if booking_item_reference = category_occupation[booking_line.item_id][:available_assignable_stock].first and !booking_item_reference.nil? booking_line_resource.assign_resource(booking_item_reference) category_occupation[booking_line.item_id][:available_assignable_stock].delete_at(0) end end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def review_assigned_stock\n\n automatic_assignation = SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n\n # Search availability\n product_search = ::Yito::Model::Booking::BookingCategory.search(self.rental_location_code,\n ...
[ "0.7266336", "0.63621277", "0.6335894", "0.5972539", "0.59010535", "0.589307", "0.58032095", "0.5785485", "0.57713777", "0.5699437", "0.5645995", "0.5630188", "0.5609678", "0.56092834", "0.5554395", "0.55434406", "0.55139226", "0.55033726", "0.5480936", "0.5475732", "0.546020...
0.7307276
0
Review the assigned stock when the user changes dates
def review_assigned_stock automatic_assignation = SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool # Search availability product_search = ::Yito::Model::Booking::BookingCategory.search(self.rental_location_code, self.date_from, self.time_from, self.date_to, self.time_to, self.days, { locale: self.customer_language, full_information: true, product_code: nil, web_public: false, sales_channel_code: self.sales_channel_code, apply_promotion_code: self.promotion_code.nil? ? false : true, promotion_code: self.promotion_code, include_stock: true, ignore_urge: {origin: 'booking', id: self.id} }) free_resources = product_search.inject([]) do |result, item| result.concat(item.resources) end p "free_resources: #{free_resources}" self.booking_line_resources.each do |booking_line_resource| if !booking_line_resource.booking_item_reference.nil? # Assigned resource if free_resources.index(booking_line_resource.booking_item_reference).nil? # Not found if product = product_search.select { |item| item.code == booking_line_resource.booking_line.item_id }.first if product.availability and product.resources.size > 0 if automatic_assignation p "booking : #{self.id} reassigned #{product.resources.first} instead of #{booking_line_resource.booking_item_reference}" booking_line_resource.assign_resource(product.resources.first) product.resources.delete_at(0) end else booking_line_resource.clear_assignation p "booking : #{self.id} clear assignation #{booking_line_resource.booking_item_reference} -- not free resources" end else p "booking : #{self.id} #{booking_line_resource.booking_item_reference} product #{booking_line_resource.booking_line.item_id} not found" end else p "booking: #{self.id} kept: #{booking_line_resource.booking_item_reference}" end else # Not assigned resource if automatic_assignation if product = product_search.select { |item| item.code == booking_line_resource.booking_line.item_id }.first if product.availability and product.resources.size > 0 p "booking : #{self.id} assigned #{product.resources.first}" booking_line_resource.assign_resource(product.resources.first) product.resources.delete_at(0) end end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_change\n\n\t\tprint \"\\n\\n\\t\\tAre You Confirm(y/n)\"\n\t\toption=gets.chomp\n\n\t\tif option==\"y\" or option==\"Y\"\n\t#fetch product id from inline products\n\t\t\tstatement12=@connection.prepare(\"select p_id from inline_products where card_no=?\")\n\t\t\tstatement12.execute(@card_no)\n\n\t\t\twhi...
[ "0.59674954", "0.59114957", "0.5874424", "0.5855901", "0.58518076", "0.5802699", "0.5801529", "0.57877094", "0.5773821", "0.5752372", "0.5711676", "0.56911236", "0.5684132", "0.56174636", "0.56086046", "0.55959946", "0.5590705", "0.5589145", "0.5588578", "0.5571124", "0.55644...
0.59561086
1
Creates a new charge for the booking
def new_charge!(charge_payment_method_id, charge_amount) charge_attributes = {:date => Time.now, :amount => charge_amount, :payment_method_id => charge_payment_method_id, :currency => SystemConfiguration::Variable.get_value('payments.default_currency', 'EUR')} charge_attributes.merge!({:sales_channel_code => self.sales_channel_code}) unless self.sales_channel_code.nil? charge = Payments::Charge.create(charge_attributes) self.charges << charge return charge end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_charge\n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => Deal.find(current_consumer.orders.last[:deal_id]).price.to_i * 100,\n ...
[ "0.77415955", "0.7432597", "0.73316073", "0.73241645", "0.7313967", "0.7229694", "0.71893215", "0.7153402", "0.7110705", "0.7079751", "0.7068746", "0.705473", "0.7021151", "0.6995541", "0.69856536", "0.6976054", "0.69731796", "0.695204", "0.69108915", "0.68591934", "0.6853852...
0.71304506
8
Creates a new business event to notify a booking has been created
def create_new_booking_business_event! BusinessEvents::BusinessEvent.fire_event(:new_booking, {:booking_id => id}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_booking(day)\n new_booking = Booking.create(host_id: self.id,day: day)\n puts \"A new booking has been created for #{self.name} on #{day}.\"\n new_booking.assign_waiter\n puts \"#{new_booking.waiter.name} has been assigned to #{self.name}'s booking'.\"\n end", "def new_b...
[ "0.7034003", "0.68559456", "0.673945", "0.6640861", "0.6639718", "0.6595187", "0.65837765", "0.65764546", "0.6536383", "0.64803624", "0.64762026", "0.6461766", "0.64547074", "0.6437413", "0.6420073", "0.6388647", "0.637463", "0.63629454", "0.6360032", "0.6359874", "0.635931",...
0.88472605
0
Service Centre Time Stamp
def scts ( @opts[:time].strftime("%y%m%d%H%M%S") + sprintf( "%02d", (@opts[:time].gmt_offset / 60 / 15) ) ).semi_octet_encode.hex_to_bin end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_time\n service_time = 0\n @solution.each { |route| service_time += route.service_time }\n return service_time\n end", "def start_time\n return \"1530\";\n end", "def start_time; end", "def estimatedEndServerTime \n \"estimatedEndServerTime\" \n end", "def service_time\n...
[ "0.6426098", "0.60841286", "0.59627527", "0.5955021", "0.59412915", "0.58554095", "0.5806211", "0.5772122", "0.57588917", "0.5731494", "0.5723821", "0.5710334", "0.570296", "0.5700884", "0.56989187", "0.56966424", "0.56910115", "0.5681131", "0.5677619", "0.56383485", "0.56288...
0.0
-1
The binary packed form of this SMS DELIVER PDU
def octets smsc_info_octets.size.chr + smsc_info_octets + sms_deliver_octets end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_bytes\n # set defaults\n self.sender ||= :pc\n self.receiver ||= 1\n\n bytes = []\n\n bytes.concat [0x00] * 5 # start of command\n bytes.concat [0x01] # <SOH>\n bytes.concat self.sender.to_bytes ...
[ "0.6911873", "0.6669017", "0.6626716", "0.65624595", "0.64836615", "0.63940847", "0.6380135", "0.63192767", "0.63184017", "0.630388", "0.62953985", "0.6242438", "0.62378156", "0.61738247", "0.6157832", "0.61432916", "0.614171", "0.6101147", "0.6093212", "0.6093212", "0.609321...
0.56251615
55
First octet of the SMSDELIVER PDU
def sms_deliver_first_octet octet = 0 octet |= 0x04 unless @opts[:more_to_send] octet |= 0x80 if @opts[:has_udh] octet.chr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sms_submit_first_octet\n octet = 1\n octet |= 0x80 if @opts[:has_udh]\n octet.chr\n end", "def checksum_char\n packed_orcid[-1]\n end", "def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n end", "def header_udp package_number, file_size...
[ "0.7446263", "0.5782127", "0.5691159", "0.5513082", "0.5322141", "0.5280775", "0.5257198", "0.5247528", "0.52464557", "0.5217796", "0.51832944", "0.5173526", "0.51660067", "0.51660067", "0.51503825", "0.51340896", "0.5132467", "0.5132467", "0.5130073", "0.51197314", "0.510031...
0.8444852
0
The binary packed form of this SMS SUBMIT PDU
def octets smsc_info_octets.size.chr + smsc_info_octets + sms_submit_octets end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sms_submit_first_octet\n octet = 1\n octet |= 0x80 if @opts[:has_udh]\n octet.chr\n end", "def packed()\n body = @action.chr + \n @priv_lvl.chr + \n @authen_type.chr + \n @service.chr + \n @user_len.chr + \n ...
[ "0.66339695", "0.654129", "0.6532408", "0.6480997", "0.64502573", "0.63297874", "0.63162136", "0.6246156", "0.6244411", "0.6221561", "0.6205741", "0.6178397", "0.61204624", "0.6103811", "0.6076311", "0.59693813", "0.59247416", "0.58979005", "0.58969444", "0.5885584", "0.58837...
0.5614626
37
First octet of the SMSSUBMIT PDU
def sms_submit_first_octet octet = 1 octet |= 0x80 if @opts[:has_udh] octet.chr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sms_deliver_first_octet\n octet = 0\n octet |= 0x04 unless @opts[:more_to_send]\n octet |= 0x80 if @opts[:has_udh]\n octet.chr\n end", "def checksum_char\n packed_orcid[-1]\n end", "def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n ...
[ "0.77627903", "0.6038064", "0.5575904", "0.53578866", "0.5307828", "0.52707964", "0.5261338", "0.52596617", "0.5253976", "0.52508795", "0.5176297", "0.5164403", "0.5132549", "0.5123281", "0.5093337", "0.506514", "0.5060142", "0.5048549", "0.5047724", "0.50351167", "0.5029047"...
0.8202668
0
rubocop:enable Metrics/AbcSize rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def two_child_delete(node) next_highest = find_next_highest(node.right) # Will two ever be called? case number_of_children(next_highest) when 0 then zero_child_delete(next_highest) when 1 then one_child_delete(next_highest) when 2 then two_child_delete(next_highest) end next_highest.left = node.left next_highest.right = node.right if node == @root @root = next_highest else parent, direction = find_parent(node) case direction when 'left' parent.left = next_highest when 'right' parent.right = next_highest end end node.data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def implementation; end", "def implementation; end", "def refutal()\n end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def strategy; end", "def offences_by; end", "def used?; end", "def custo...
[ "0.75931484", "0.6315773", "0.6259313", "0.6259313", "0.6173916", "0.61273223", "0.60750544", "0.60750544", "0.60750544", "0.60750544", "0.593516", "0.589957", "0.58881646", "0.5856633", "0.5856633", "0.5806071", "0.58057946", "0.5797108", "0.5797108", "0.57851094", "0.569873...
0.0
-1
Consider the following "magic" 3gon ring, filled with the numbers 1 to 6, and each line adding to nine. (4) \ (3) / \ (1)(2)(6) / (5) Working clockwise, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3. It is possible to complete the ring with four different totals: 9, 10, 11, and 12. There are eight solutions in total. Total Solution Set 9 4,2,3; 5,3,1; 6,1,2 9 4,3,2; 6,2,1; 5,1,3 10 2,3,5; 4,5,1; 6,1,3 10 2,5,3; 6,3,1; 4,1,5 11 1,4,6; 3,6,2; 5,2,4 11 1,6,4; 5,4,2; 3,2,6 12 1,5,6; 2,6,4; 3,4,5 12 1,6,5; 3,5,4; 2,4,6 By concatenating each group it is possible to form 9digit strings; the maximum string for a 3gon ring is 432621513. Using the numbers 1 to 10, and depending on arrangements, it is possible to form 16 and 17digit strings. What is the maximum 16digit string for a "magic" 5gon ring? ( ) \ ( ) ( ) / \ / ( ) ( ) / \ / ( ) ( )( )( ) \ ( )
def solve( n = 16 ) max = 0 (1..10).each do |a| (1..10).each do |b| next if b == a (1..10).each do |c| next if c == b || c == a (1..10).each do |d| next if d == c || d == b || d == a (1..10).each do |e| next if e == d || e == c || e == b || e == a rotate = 3*[a, b, c, d, e].each_with_index.min[1] (1..10).each do |f| next if f == e || f == d || f == c || f == b || f == a (1..10).each do |g| next if g == f || g == e || g == d || g == c || g == b || g == a t = a + f + g (1..10).each do |h| next if h == g || h == f || h == e || h == d || h == c || h == b || h == a next unless t == b + g + h (1..10).each do |i| next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a next unless t == c + h + i (1..10).each do |j| next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a next unless t == d + i + j && t == e + j + f s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f] rotate.times {s.push s.shift} s = s.join next if n != s.length max = [max, s.to_i].max end end end end end end end end end end max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_rings\n shortc = (0..9).collect{|i| i unless @longc.include?(i) }.compact\n raise DataError if shortc.nil?\n long = @longc.collect{|i| (0..9).collect{|j| i*10+j } }.flatten\n raise DataError if long.nil?\n @shortc = shortc.dup\n\n word = @full_key.dup\n word.scan(/./) do ...
[ "0.5834196", "0.57636845", "0.5740921", "0.56558305", "0.5580554", "0.53503", "0.53409725", "0.5324064", "0.5303507", "0.5271845", "0.5238958", "0.5226239", "0.51714593", "0.5138234", "0.51071286", "0.50892365", "0.5084717", "0.5080561", "0.5047886", "0.5039495", "0.5011326",...
0.6129414
0
The xpath to the collection that the item belongs to (relative path from the item node)
def collection_xpath "ancestor::#{Ead::Collection.root_xpath}[1]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection_path(path = nil)\n if path.nil?\n @collection_path ||= root_element.to_s.pluralize\n else\n @collection_path = path\n @element_path = \"#{path}/:id\"\n end\n end", "def collection_path(query_options = nil)\n self.element_nam...
[ "0.6477119", "0.6439781", "0.6269458", "0.6230092", "0.6051657", "0.60326385", "0.59166074", "0.59166074", "0.5883368", "0.5876971", "0.58339953", "0.5778686", "0.57173204", "0.57012594", "0.57012594", "0.5697165", "0.56501657", "0.5554814", "0.55504006", "0.55465263", "0.551...
0.8035267
0
Map the name of the field to its xpath within the EAD xml
def fields_map { id: 'did/unitid[@label = "Reference"]', title: 'did/unittitle', repository: 'did/repository', extent: 'did/physdesc/extent', access: 'accessrestrict[not(@type="status")]', description: 'scopecontent', dates: 'did/unitdate', language: 'did/langmaterial/language', dates_normal: 'did/unitdate/@normal', collection_id: "#{collection_xpath}/#{Ead::Collection.fields_map[:id]}", collection_title: "#{collection_xpath}/#{Ead::Collection.fields_map[:title]}", } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_field_locator(key)\n if @fieldname[key]\n \"#{@locator}//*[contains(@#{@fieldname[key][0]},'#{@fieldname[key][1]}')]#{@fieldname[key][2].nil? ? '/input' : @fieldname[key][2]}\"\n else\n \"#{@locator}//*[//label[text()='#{key}']/@for and contains(@id,//label[text()='#{key}']/...
[ "0.65666956", "0.63425505", "0.6143762", "0.60459554", "0.5931894", "0.5918803", "0.5914235", "0.5914235", "0.5824393", "0.5680059", "0.56172603", "0.5613063", "0.56026775", "0.55908275", "0.555583", "0.5554948", "0.55258775", "0.54869545", "0.54633963", "0.5427086", "0.54034...
0.6097549
3
Overridden from the Commits::CreateService, to skip some validations we don't need: validate_on_branch! Not needed, the patches are applied on top of HEAD if the branch did not exist validate_branch_existence! Not needed because we continue applying patches on the branch if it already existed, and create it if it did not exist.
def validate! validate_patches! validate_new_branch_name! if new_branch? validate_permissions! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_patch(repo_path, commit, branch)\n `(cd \"#{repo_path}\" && git format-patch --stdout #{commit}..#{branch})`\n end", "def create_branch\n check_current_repo\n exists = `git branch --list #{branch}`.squish == branch\n if exists\n `git checkout #{branch}`\n else\n `git checkout master` unl...
[ "0.611919", "0.6078425", "0.6057751", "0.59711015", "0.5941705", "0.5710461", "0.56812805", "0.56613743", "0.549618", "0.5488865", "0.5466211", "0.5461446", "0.5394179", "0.53802186", "0.53684247", "0.5359292", "0.530741", "0.527453", "0.52670574", "0.52559674", "0.52417594",...
0.6238832
0
roles are :admin, :manager
def has_role?(role_sym) roles.any? { |r| r.name.underscore.to_sym == role_sym } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roles\n roles_as_editor + roles_as_reviewer + role_as_admin\n end", "def role\n admin ? \"admin\" : \"user\"\n end", "def is_admin?\n role == \"manager\"\n end", "def roles\n roles_from_users\n end", "def role; end", "def role; end", "def admin?\n role == 1\n end", "def tr...
[ "0.73713624", "0.72589946", "0.7237377", "0.71920156", "0.7160014", "0.7160014", "0.71256924", "0.7113591", "0.709414", "0.7067906", "0.70607483", "0.7048391", "0.7037206", "0.7037206", "0.7036369", "0.7026779", "0.70034355", "0.6991391", "0.69902664", "0.69831204", "0.697524...
0.0
-1
this resource forces itself to run at compile_time
def after_created return unless compile_time Array(action).each do |action| run_action(action) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main\n super\n return self\n end", "def exec\n super\n end", "def compile!\n raise NotImplementedError\n end", "def regenerator; end", "def run; new.run; end", "def run\n super\n end", "def run\n super\n end", "def compile\n end", "def onCompile\n end", ...
[ "0.61323965", "0.60312074", "0.6000105", "0.59993094", "0.5967604", "0.59609103", "0.59609103", "0.5853844", "0.585312", "0.5841339", "0.5832365", "0.58277166", "0.5800191", "0.5800191", "0.5799184", "0.5799184", "0.57721496", "0.57673275", "0.57605636", "0.57605636", "0.5734...
0.0
-1
When this Setting is represented as a String, simply print the name of its key. Used in the admin interface.
def to_s self.key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setting_name\n return @setting_name\n end", "def setting_name=(value)\n @setting_name = value\n end", "def to_s\n key.to_s\n end", "def key=(value)\n @key = value.to_s\n end", "def key\n \"#{@type}{#{@title}}]\"\n end",...
[ "0.71273166", "0.6503651", "0.6407226", "0.639565", "0.6206805", "0.6160009", "0.6142328", "0.61282295", "0.60950196", "0.60897976", "0.6071091", "0.6047425", "0.5939664", "0.5932435", "0.59103364", "0.5894701", "0.5883266", "0.5883266", "0.58699375", "0.5849034", "0.5849034"...
0.62042284
5
This is here so that we can stub it for tests
def driver(machine) machine.provider.driver end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def stub_implementation; end", "def spec; end", "def spec; end", "def implementation; end", "def implementation; end", "def private_method\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def __mock_reset; end", "def wrapper; end"...
[ "0.71987396", "0.68693316", "0.66892827", "0.66892827", "0.63200283", "0.63200283", "0.6246571", "0.623995", "0.623995", "0.623995", "0.623995", "0.6238131", "0.62268996", "0.6219374", "0.61678934", "0.6127506", "0.6124777", "0.610721", "0.610721", "0.610721", "0.610721", "...
0.0
-1
share_folders sets up the shared folder definitions on the VirtualBox VM. The transient parameter determines if we're FORCING transient or not. If this is false, then any shared folders will be shared as nontransient unless they've specifically asked for transient.
def share_folders(machine, folders, transient) defs = [] warn_user_symlink = false folders.each do |id, data| hostpath = data[:hostpath] if !data[:hostpath_exact] hostpath = Vagrant::Util::Platform.cygwin_windows_path(hostpath) end enable_symlink_create = true if ENV['VAGRANT_DISABLE_VBOXSYMLINKCREATE'] enable_symlink_create = false end unless data[:SharedFoldersEnableSymlinksCreate].nil? enable_symlink_create = data[:SharedFoldersEnableSymlinksCreate] end warn_user_symlink ||= enable_symlink_create # Only setup the shared folders that match our transient level if (!!data[:transient]) == transient defs << { name: os_friendly_id(id), hostpath: hostpath.to_s, transient: transient, SharedFoldersEnableSymlinksCreate: enable_symlink_create, automount: !!data[:automount] } end end if warn_user_symlink display_symlink_create_warning(machine.env) end driver(machine).share_folders(defs) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_folders(prefix, folders)\n folders.each do |type, local_path, remote_path|\n if type == :host\n env[:machine].config.vm.share_folder(\n \"v-#{prefix}-#{self.class.get_and_update_counter(:shared_folder)}\",\n remote_path, local_path, :nfs => c...
[ "0.7165208", "0.71175003", "0.703601", "0.701515", "0.6822502", "0.6428833", "0.64015514", "0.6398474", "0.639077", "0.6074324", "0.59500736", "0.5934675", "0.58135176", "0.5727957", "0.56429344", "0.56343734", "0.5577921", "0.5522186", "0.5503319", "0.5501793", "0.54735935",...
0.78720707
0
GET /corges GET /corges.json
def index @corges = Corge.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end", "def index\n @corridas = Corrida.all\n end", "def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render js...
[ "0.63470995", "0.62195367", "0.617979", "0.6128525", "0.61189437", "0.6065697", "0.60179573", "0.5977875", "0.5962381", "0.5959897", "0.5937151", "0.59276474", "0.59276474", "0.5923053", "0.5845671", "0.5845671", "0.5820548", "0.581278", "0.58037454", "0.5792899", "0.57905966...
0.72953016
0
GET /corges/1 GET /corges/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @corges = Corge.all\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n ...
[ "0.6984698", "0.62942857", "0.62764513", "0.6176944", "0.6114283", "0.6114174", "0.6107863", "0.6076276", "0.606047", "0.60452455", "0.60430896", "0.6013479", "0.60030353", "0.59864277", "0.5963865", "0.5963865", "0.59325236", "0.59208673", "0.5903059", "0.5895059", "0.588011...
0.0
-1
POST /corges POST /corges.json
def create @corge = Corge.new(corge_params) respond_to do |format| if @corge.save format.html { redirect_to @corge, notice: 'Corge was successfully created.' } format.json { render :show, status: :created, location: @corge } else format.html { render :new } format.json { render json: @corge.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corge_params\n params.require(:corge).permit(:name)\n end", "def create\n @corrida = Corrida.new(corrida_params)\n\n respond_to do |format|\n if @corrida.save\n format.html { redirect_to @corrida, notice: 'Corrida creada satisfactoriamente.' }\n format.json { render :show, st...
[ "0.59962296", "0.59616214", "0.5871873", "0.58151084", "0.575999", "0.57137275", "0.56561214", "0.56377673", "0.5621923", "0.5568752", "0.5567557", "0.55247456", "0.5519409", "0.5519409", "0.5500358", "0.54935706", "0.54596233", "0.54401773", "0.5435543", "0.54309547", "0.541...
0.7052685
0
PATCH/PUT /corges/1 PATCH/PUT /corges/1.json
def update respond_to do |format| if @corge.update(corge_params) format.html { redirect_to @corge, notice: 'Corge was successfully updated.' } format.json { render :show, status: :ok, location: @corge } else format.html { render :edit } format.json { render json: @corge.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch!\n request! :patch\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @co...
[ "0.64154375", "0.6351106", "0.6295332", "0.62868214", "0.62499166", "0.61793506", "0.6168222", "0.61063755", "0.6093066", "0.60413516", "0.60275793", "0.60275793", "0.60257787", "0.6016393", "0.6016393", "0.6005643", "0.5965719", "0.59573233", "0.59201616", "0.5909054", "0.58...
0.6542406
0
DELETE /corges/1 DELETE /corges/1.json
def destroy @corge.destroy respond_to do |format| format.html { redirect_to corges_url, notice: 'Corge was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.d...
[ "0.7128475", "0.69731814", "0.692412", "0.6811231", "0.6755315", "0.6734383", "0.668921", "0.6675679", "0.66432357", "0.66184175", "0.6609678", "0.6604296", "0.6587218", "0.65670615", "0.65572315", "0.6554401", "0.65389055", "0.6528616", "0.65230715", "0.65127593", "0.6481415...
0.6810181
4
Use callbacks to share common setup or constraints between actions.
def set_corge @corge = Corge.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 corge_params params.require(:corge).permit(: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.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954",...
0.0
-1
Remembers a user in the database for use in persistent sessions.
def remember self.remember_token = User.new_token update_attribute(:remember_digest, User.digest(remember_token)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end", "def change_password\n @user = User.find_by_id(session[:remember_token])\n end", "def set_user\n zeus = User.find(@zeus_user.id)\n ...
[ "0.68847036", "0.65202016", "0.6288528", "0.6221299", "0.6220095", "0.6177217", "0.6141952", "0.61285347", "0.61285347", "0.6122638", "0.6121868", "0.6121868", "0.61191475", "0.6094944", "0.6088155", "0.6087507", "0.6085413", "0.6080089", "0.6078", "0.6067664", "0.604671", ...
0.0
-1
Returns true if the given token matches the digest.
def authenticated?(attribute, token) digest = send("#{attribute}_digest") return false if digest.nil? BCrypt::Password.new(digest).is_password?(token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticated?(digest, token)\n digest = send(\"#{digest}_digest\")\n # Use metaprogramming to select the appropriate token attribute based on\n # the parameter digest.\n return false if digest.nil? # Digest does not exist in the database.\n BCrypt::Password.new(digest).is_password?(token)\n ...
[ "0.78424853", "0.76170635", "0.7406786", "0.72879815", "0.7143585", "0.71428716", "0.71428716", "0.7028208", "0.6984801", "0.6964507", "0.6905196", "0.6859846", "0.6843323", "0.6824065", "0.67973304", "0.67884517", "0.67749035", "0.676529", "0.6751168", "0.67464095", "0.67436...
0.6717869
67
Sets the password reset attributes.
def create_reset_digest self.reset_token = User.new_token update_attribute(:reset_digest, User.digest(reset_token)) update_attribute(:reset_sent_at, Time.zone.now) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_reset_password_instructions(attributes={})\n send_instructions_for(:reset_password, attributes)\n end", "def set_password_reset\n\t\tself.code = SecureRandom.urlsafe_base64\n\t\tself.expires_at = 4.hours.from_now\n\t\tself.save!\n\tend", "def attempt_set_password(params)\n p = {}\n ...
[ "0.7047396", "0.69583577", "0.6818595", "0.6749292", "0.6737656", "0.670031", "0.6676551", "0.66730624", "0.66577595", "0.66103", "0.66103", "0.66103", "0.66103", "0.66103", "0.66103", "0.66103", "0.66103", "0.66103", "0.66103", "0.66103", "0.66103", "0.66103", "0.66103",...
0.0
-1
Sends password reset email.
def send_password_reset_email UserMailer.password_reset(self).deliver_now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_password_reset_email\n\t\tUserMailer.password_reset(id, self.reset_token).deliver_later\n \tend", "def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end", "def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end", "de...
[ "0.8790497", "0.86796135", "0.86796135", "0.8663904", "0.86629623", "0.86629623", "0.86629623", "0.86629623", "0.86629623", "0.86629623", "0.86629623", "0.86629623", "0.86629623", "0.86587805", "0.8652506", "0.8650495", "0.8648778", "0.8633209", "0.8633209", "0.8633209", "0.8...
0.0
-1
Returns true if a password reset has expired.
def password_reset_expired? reset_sent_at < 2.hours.ago end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_reset_expired?\n reset_sent_at < Settings.timeout_reset_password.hours.ago\n end", "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "def password_reset_expired?\n reset_sent_at < 2.hours.ago # password reset sent earlier than two hours ago.\n end", "def password...
[ "0.8866848", "0.8742425", "0.87405956", "0.869067", "0.86877984", "0.86600757", "0.86578995", "0.86572534", "0.86572534", "0.86572534", "0.86572534", "0.86572534", "0.86572534", "0.86572534", "0.86572534", "0.8651915", "0.8649047", "0.86207587", "0.8620148", "0.86081725", "0....
0.8554209
94
Converts email to all lowercase.
def downcase_email self.email = email.downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downcase_email\n\t email.downcase!\n\t end", "def downcase_email\n email.downcase!\n end", "def lowercase_email\n email.downcase! if email.present?\n end", "def downcase_email\n email.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def do...
[ "0.8380517", "0.8339932", "0.8242504", "0.82153374", "0.82153374", "0.82153374", "0.82153374", "0.8192566", "0.8161937", "0.8131639", "0.8121609", "0.8112856", "0.80987734", "0.80987734", "0.80987734", "0.80724174", "0.80567265", "0.80567265", "0.80567265", "0.80567265", "0.7...
0.78521395
82
Creates and assigns the activation token and digest.
def create_activation_digest self.activation_token = User.new_token self.activation_digest = User.digest(activation_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_activation_digest\n # Create the token and digest.\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end", "def create_activation_digest\n self.activation_token = Golfer.new_token\n self.activation_digest = Golfer.digest(activati...
[ "0.862457", "0.8615071", "0.86041135", "0.8602518", "0.85908353", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.85580...
0.85576075
50
Each positive becomes negatives, and the negatives become positives. Example: invert([1,2,3,4,5]) == [1,2,3,4,5] invert([1,2,3,4,5]) == [1,2,3,4,5] invert([]) == []
def invert(list) list.map(&:-@) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invert() end", "def invert(list)\n for i in 0..list.length-1\n list[i] *= -1 unless list[i] == 0\n end\n list\nend", "def invert\n end", "def invert; end", "def invert(lst)\n lst.map { |l| l * -1 }\nend", "def invert\n clone.invert!\n end", "def inverted; invert = true; ...
[ "0.8216031", "0.8209784", "0.8086013", "0.8079641", "0.75552654", "0.74231195", "0.7415183", "0.71985203", "0.71985203", "0.71360767", "0.70899934", "0.7080607", "0.69695216", "0.6854817", "0.6851409", "0.67544425", "0.66636896", "0.6633999", "0.6596399", "0.6563194", "0.6561...
0.7033052
12
shamelessly copied from Attributor::Model's validate :(
def validate(context = Attributor::DEFAULT_ROOT_CONTEXT) self.validate_attributes(context) + self.validate_requirements(context) + self.validate_keys(context) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid; end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def validator; end", "def validation; end", "def validation; end", "def validated?; end", "def validate!; end", "def validate!; end", "def validate!; end", "def validated; end", "def s...
[ "0.769751", "0.7644486", "0.7644486", "0.7644486", "0.7644486", "0.76244146", "0.7558795", "0.7558795", "0.74614805", "0.7420527", "0.7420527", "0.7420527", "0.73779964", "0.73723406", "0.73279124", "0.7247092", "0.7247092", "0.721926", "0.721926", "0.721926", "0.7177926", ...
0.0
-1
Takes the large amount of words from enable.txt and puts them into an array.
def generate_words ret = [] File.open('enable.txt').each do |line| new_line = line # We don't care for the new line character in the game of hangman. new_line = new_line.delete("\n") ret << new_line end return ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_word_array(plaintext_file)\n ary = File.read(plaintext_file).split(\" \").map do |word|\n word.downcase.gsub(/[^a-z]/, '')\n end\n return ary\n end", "def make_word_array\n @word_array = @word.chars.to_a\n end", "def ReadFromFile()\n wordArray = Array.new\n File.open(\"...
[ "0.717489", "0.69008476", "0.6771478", "0.6706544", "0.655736", "0.65365916", "0.64903337", "0.6388426", "0.6384112", "0.62930053", "0.62885255", "0.6285146", "0.6282907", "0.62576824", "0.6254661", "0.62236595", "0.62172484", "0.6209299", "0.61543673", "0.6131502", "0.612953...
0.70223576
1
Takes the words and letters, and fills in any blanks where the player has guessed the corresponding letter.
def create_display(word, letters) word.upcase.split("").map{|letter| letters.include?(letter) ? letter : "_"}.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_blanks(guess)\n i = 0\n guess.upcase!\n \n for i in 0..@word.length\n if(@word[i] == guess)\n @ingame_word[i] = guess\n end\n end\n \n end", "def guess\n\t\tcollect_words_of_length\n\t\tputs \"Already guessed letters by computer: #{@guessed_letters}\"\n\t\t@guessing_l...
[ "0.8030223", "0.73112017", "0.7293939", "0.72506785", "0.72426426", "0.72198737", "0.7198893", "0.7102638", "0.70366716", "0.70021063", "0.69717604", "0.6960101", "0.69416106", "0.69377536", "0.69310033", "0.69167846", "0.69167846", "0.69117683", "0.68700564", "0.68588656", "...
0.0
-1
Returns a random word of given length.
def get_word(difficulty) WORDS.select{|word| word.length == difficulty}.sample end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_word(length = 5)\n rand(36**length).to_s(36)\nend", "def random_word(length = 5)\n rand(36**length).to_s(36)\nend", "def random_word(length = 5)\n rand(36**length).to_s(36)\nend", "def random_word(length = 5)\n rand(36**length).to_s(36)\nend", "def random_word(length = 5)\r\n rand(36**lengt...
[ "0.84693503", "0.84693503", "0.84693503", "0.84693503", "0.8430573", "0.78741527", "0.7869236", "0.7831082", "0.76977676", "0.76804626", "0.7618315", "0.75942045", "0.7447319", "0.74397594", "0.74290323", "0.7405521", "0.73856324", "0.7370271", "0.73659974", "0.73459643", "0....
0.69198245
50
We only want to show missed guesses. Correct guesses fill in blanks.
def get_letters(game) game.letters.split("").reject{|letter| game.word.upcase.include?(letter)}.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_incorrect_guesses\n if @wrong_guesses.empty?\n puts 'No wrong guesses so far.'\n else\n print 'Wrong guesses: '\n @wrong_guesses.each do |letter|\n print \"#{letter} \"\n end\n end\n end", "def missed_guesses\n guesses - secret\n end", ...
[ "0.762013", "0.74467987", "0.724803", "0.72179246", "0.7198251", "0.7141737", "0.7125729", "0.7107198", "0.7037825", "0.6866382", "0.68460834", "0.6839875", "0.67576563", "0.6675528", "0.6641852", "0.66290575", "0.6564303", "0.65564233", "0.6541777", "0.6514425", "0.65141416"...
0.0
-1
returns the extracted attributes
def extract_attributes(options) options = options.dup sanitize_attributes! options return options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attribs\n\t\t@attributes\n\tend", "def attributes\n data[:attributes]\n end", "def get_attributes\n\t\t\t@@attributes\n\t\tend", "def attributes\n @attrs\n end", "def attributes\n node[1]\n end", "def attributes\n @attrs.keys\n end", "def result_attrs\n ...
[ "0.77775615", "0.7687929", "0.76682675", "0.75343263", "0.745978", "0.74416125", "0.74309826", "0.7428409", "0.7398744", "0.7387386", "0.73380387", "0.73207706", "0.73207706", "0.73207706", "0.7306254", "0.72699434", "0.72699434", "0.72501284", "0.7241372", "0.72379386", "0.7...
0.0
-1
Converting PDF to PNG
def convert_to_png(input_pdf, output_file) pdf = Magick::ImageList.new(input_pdf) { self.density = 200 } pdf.write(output_file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_png_file\n to_pdf_file do |pdf_path|\n Dir.mktmpdir(ident) do |output_directory|\n png_path = File.join(output_directory, ident + '.png')\n system convert, *CONVERT_OPTIONS, pdf_path, png_path\n raise PNGConversionFailed, self unless File.exist?(png_path)\n\n yield png_pa...
[ "0.7990437", "0.7990437", "0.7455685", "0.73444676", "0.70385474", "0.6745083", "0.66779184", "0.6619678", "0.65929914", "0.6436064", "0.64334553", "0.6424127", "0.6393544", "0.6364619", "0.636226", "0.6321953", "0.63161117", "0.62945926", "0.62856066", "0.62802726", "0.62650...
0.80366373
0
Adding QR and label to the PNG
def embed_info(input_file, qr, label, x_coord, y_coord) img_template = ChunkyPNG::Image.from_file(input_file) img_label = ChunkyPNG::Image.from_file(label) img_template.compose!(qr, x_coord, y_coord) img_template.compose!(img_label, x_coord + 255, y_coord) rename_file = input_file[5..-1] img_template.save("./out-pdf" + rename_file.gsub(".png", "-e.png"), :fast_rgba) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customQRcode(inputStr) \n qrcode = RQRCode::QRCode.new(inputStr).as_png(fill: 'white', color: 'black', file: 'abc.png')\n avatar = ChunkyPNG::Image.from_file('abc.png')\n\n # alogo.png being the logo file\n badge = ChunkyPNG::Image.from_file('alogo.png')\n\n print(\"height of backgound:\")\n ...
[ "0.6841074", "0.6600583", "0.648238", "0.6459222", "0.6205056", "0.6163537", "0.6123644", "0.6105584", "0.60976434", "0.605441", "0.60269684", "0.600911", "0.59682494", "0.59326553", "0.5844691", "0.5822871", "0.5822212", "0.5819533", "0.5799611", "0.57883227", "0.5639229", ...
0.72884035
0
This method can be used to manually link an asset to an acts_as_asset_box object in tests or otherwise. The object needs to be saved afterward so that the Effective::Attachment is saved (and the association is saved). For example: class User < ActiveRecord::Base acts_as_asset_box :avatar end asset = Effective::Asset.new(...) user = User.new user.add_to_asset_box(:avatar, asset) user.save
def add_to_asset_box(box, *items) box = (box.present? ? box.to_s : 'assets') boxes = box.pluralize items = [items].flatten.compact if items.present? && items.any? { |obj| !obj.kind_of?(Effective::Asset) } raise ArgumentError.new('add_to_asset_box expects one or more Effective::Assets, or an Array of Effective::Assets') end if box == boxes # If we're adding to a pluralized box, we want to add our attachment onto the end pos = attachments.select { |attachment| attachment.box == boxes }.last.try(:position).to_i + 1 else # If we're adding to a singular box, we want our attachments to be on the front pos = attachments.to_a.find { |attachment| attachment.box == boxes }.try(:position).to_i # Push all the attachments forward attachments.each { |att| att.position = (att.position + items.length) if att.box == boxes } end # Build the attachments items.each_with_index do |item, x| attachment = self.attachments.build(:position => (pos+x), :box => boxes) attachment.attachable = self attachment.asset = item end attachments.to_a.sort_by! { |attachment| attachment.position } true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_asset(asset)\n @al_asset_group.addAsset(asset.al_asset)\n end", "def replace_in_asset_box(box, original, overwrite)\n box = (box.present? ? box.to_s : 'assets')\n boxes = box.pluralize\n\n unless original.present? && original.kind_of?(Effective::Asset)\n raise ArgumentError.new(\"se...
[ "0.59958315", "0.591706", "0.5861354", "0.585009", "0.5838892", "0.5830588", "0.58007914", "0.574539", "0.5729792", "0.57199323", "0.57139134", "0.57139134", "0.57139134", "0.57139134", "0.57139134", "0.5713662", "0.5691047", "0.56537646", "0.56528217", "0.56219596", "0.55910...
0.6592163
0
The idea here is that if you want to replace an Asset with Another one the Attachment should keep the same order, and only the asset should change
def replace_in_asset_box(box, original, overwrite) box = (box.present? ? box.to_s : 'assets') boxes = box.pluralize unless original.present? && original.kind_of?(Effective::Asset) raise ArgumentError.new("second parameter 'original' must be a single Effective::Asset") end unless overwrite.present? && overwrite.kind_of?(Effective::Asset) raise ArgumentError.new("third parameter 'overwrite' must be a single Effective::Asset") end attachment = attachments.to_a.find { |attachment| attachment.box == boxes && attachment.asset == original } if attachment.present? attachment.asset = overwrite true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attachments=(atts)\n atts.each do |attachment|\n if attachment[:id].blank?\n assets.build(attachment)\n else\n asset = assets.detect { |a| a.id == attachment[:id].to_i }\n end\n end \n end", "def attachments=(atts)\n atts.each do |attachment|\n if atta...
[ "0.643875", "0.643875", "0.643875", "0.62014973", "0.6148074", "0.6073106", "0.6014712", "0.5892195", "0.5852202", "0.5842588", "0.5816639", "0.5796355", "0.579346", "0.57925165", "0.5738554", "0.573294", "0.57108814", "0.5708745", "0.56917125", "0.5674313", "0.56742686", "...
0.62589985
3
GET /categorias GET /categorias.xml
def index @categorias = Categoria.all render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @categoria }\n end\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_...
[ "0.72283757", "0.71945757", "0.7177252", "0.7153631", "0.7050157", "0.69263774", "0.6774943", "0.6774943", "0.6733263", "0.66775686", "0.66651005", "0.66271794", "0.65211666", "0.6519954", "0.65158314", "0.6501833", "0.65004635", "0.64850336", "0.64470303", "0.6445966", "0.64...
0.60398114
61
GET /categorias/1 GET /categorias/1.xml
def show @categoria = Categoria.find(params[:id]) render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @categoria }\n end\n end", "def show\n @categorie = Categorie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.7399808", "0.7348526", "0.7199413", "0.7140249", "0.7123604", "0.6955834", "0.6884985", "0.6744509", "0.67371166", "0.67371166", "0.6718285", "0.6694846", "0.66844916", "0.66489154", "0.6621761", "0.66137236", "0.6571206", "0.6562739", "0.6535613", "0.65296334", "0.6525568...
0.59865767
80
GET /categorias/new GET /categorias/new.xml
def new @categoria = Categoria.new render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @categoria = Categoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categoria }\n end\n end", "def new\n @categorie = Categorie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @...
[ "0.8011857", "0.7973562", "0.76708585", "0.7604195", "0.75416946", "0.7535757", "0.7527842", "0.7506779", "0.7506779", "0.7506779", "0.7506779", "0.74995226", "0.73789954", "0.73566127", "0.7352715", "0.7341118", "0.7319352", "0.73068666", "0.72666264", "0.72245824", "0.72180...
0.0
-1
POST /categorias POST /categorias.xml
def create @categoria = Categoria.new(params[:categoria]) @categoria.save render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @categoria = Categoria.new(params[:categoria])\n\n respond_to do |format|\n if @categoria.save\n format.html { redirect_to(@categoria, :notice => 'Categoria was successfully created.') }\n format.xml { render :xml => @categoria, :status => :created, :location => @categoria }\...
[ "0.6862586", "0.6590919", "0.65094566", "0.64892834", "0.64460474", "0.64096075", "0.6382734", "0.63805395", "0.63495296", "0.6313089", "0.6302909", "0.6281733", "0.6280484", "0.6273162", "0.61718816", "0.6160843", "0.61356336", "0.6130856", "0.6122228", "0.6065811", "0.60546...
0.6120936
19
PUT /categorias/1 PUT /categorias/1.xml
def update @categoria = Categoria.find(params[:id]) @categoria.update_attributes(params[:categoria]) render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to(@categoria, :notice => 'Categoria was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { r...
[ "0.64637995", "0.64177734", "0.6321944", "0.6200256", "0.61829925", "0.6158552", "0.6155", "0.6077612", "0.6077381", "0.60663885", "0.60466534", "0.60452926", "0.6043278", "0.59627056", "0.59571594", "0.5948168", "0.59155476", "0.5880841", "0.5867612", "0.5793297", "0.5789349...
0.61866885
4
DELETE /categorias/1 DELETE /categorias/1.xml
def destroy @categoria = Categoria.find(params[:id]) @categoria.destroy render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to(categorias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sotto_categoria = SottoCategoria.find(params[:id])\n @sotto_categoria.destroy\...
[ "0.7456869", "0.7338694", "0.7269316", "0.7077798", "0.7077549", "0.6984513", "0.6962401", "0.6935845", "0.69218147", "0.6914239", "0.6899787", "0.68952084", "0.68887645", "0.6827869", "0.68030685", "0.6753074", "0.67503566", "0.6694553", "0.6681873", "0.6673184", "0.66689396...
0.676915
15
expect params to contains :user_id and :password
def same?(params) User.find(params[:user_id]).play(PasswordRole) { |user| user.same_password?(params[:password]) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_login_user(params)\n params[\"username\"] and params[\"password\"] and params[\"password\"] == params[\"password_2\"]\n end", "def needs_password?(_user, params)\n params[:password].present?\n end", "def needs_password?(user, params)\n params[:user][:password].present?\n end"...
[ "0.68228", "0.6799073", "0.67758244", "0.6723033", "0.67219085", "0.67154354", "0.6656731", "0.6626029", "0.65810585", "0.6552616", "0.6549736", "0.6545567", "0.6542523", "0.65306014", "0.652747", "0.65269256", "0.65230554", "0.6505147", "0.6493071", "0.6486702", "0.6458946",...
0.61068135
54
Create a new invite. Invites are used to easily assign permissions to users that have not been created in your identity provider yet. Create the invite with an email address, and then when the user accepts the invite they will automatically get the permissions assigned here. Invites automatically expire after 7 days. GRANT: Existing Resource Permissions
def create_invite(body, opts = {}) create_invite_with_http_info(body, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invite\n invitation_service.invite(invitation_params)\n end", "def create\n @invite = Invite.new(params[:invite])\n @user = current_user\n @user.invites << @invite\n @candidate = current_user.candidate\n @invites = Invite.scoped\n respond_to do |format|\n if @user.save\n Inv...
[ "0.72895694", "0.72450614", "0.723932", "0.7176643", "0.7171015", "0.71017706", "0.7101135", "0.70703065", "0.70638525", "0.705793", "0.7006286", "0.7001383", "0.69997764", "0.69701993", "0.69580555", "0.69172996", "0.6878265", "0.68745875", "0.6874258", "0.687258", "0.686493...
0.717928
3
Create a new invite. Invites are used to easily assign permissions to users that have not been created in your identity provider yet. Create the invite with an email address, and then when the user accepts the invite they will automatically get the permissions assigned here. Invites automatically expire after 7 days. GRANT: Existing Resource Permissions
def create_invite_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AccessRecordsApi.create_invite ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling AccessRecordsApi.create_invite" end # resource path local_var_path = '/v1/invites' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) return_type = opts[:return_type] auth_names = opts[:auth_names] || ['oauth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: AccessRecordsApi#create_invite\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invite\n invitation_service.invite(invitation_params)\n end", "def create\n @invite = Invite.new(params[:invite])\n @user = current_user\n @user.invites << @invite\n @candidate = current_user.candidate\n @invites = Invite.scoped\n respond_to do |format|\n if @user.save\n Inv...
[ "0.72893924", "0.7245443", "0.7238903", "0.71809554", "0.7177222", "0.7170125", "0.71011484", "0.7100823", "0.7070124", "0.7063711", "0.7057566", "0.70063084", "0.70027465", "0.69993883", "0.69706637", "0.69584507", "0.691582", "0.6880296", "0.68755704", "0.6875006", "0.68727...
0.0
-1
Create a new access record. Specify user roles for specific resources. (Records have a maximum size of ~100KB) GRANT: Existing Resource Permissions
def create_record(body, opts = {}) data, _status_code, _headers = create_record_with_http_info(body, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @role = Role.new(params[:role])\n\n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n ...
[ "0.62391347", "0.6155647", "0.6149349", "0.60890406", "0.60890406", "0.6049418", "0.596781", "0.5906402", "0.5895294", "0.5879419", "0.5873123", "0.5852282", "0.5831472", "0.5831472", "0.5831472", "0.5817623", "0.57973975", "0.5780442", "0.5768214", "0.5758071", "0.5744974", ...
0.0
-1
Create a new access record. Specify user roles for specific resources. (Records have a maximum size of ~100KB) GRANT: Existing Resource Permissions
def create_record_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AccessRecordsApi.create_record ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling AccessRecordsApi.create_record" end # resource path local_var_path = '/v1/records' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/links+json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) return_type = opts[:return_type] || 'InlineResponse2008' auth_names = opts[:auth_names] || ['oauth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: AccessRecordsApi#create_record\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @role = Role.new(params[:role])\n\n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n ...
[ "0.62388754", "0.6154905", "0.6148854", "0.6088107", "0.6088107", "0.6048771", "0.5967404", "0.59059346", "0.5894298", "0.5878693", "0.58722794", "0.5851369", "0.5830816", "0.5830816", "0.5830816", "0.58172214", "0.5797833", "0.57808113", "0.5767634", "0.57582104", "0.5743777...
0.0
-1
Accept an invite. Accepts an invite by claiming this invite by this user. The user token used for this request will gain the permissions associated with the invite.
def respond_to_invite(invite_id, opts = {}) data, _status_code, _headers = respond_to_invite_with_http_info(invite_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accept_invite(event)\n invite = Invite.where(user: self, event: event)\n invite.accept if invite.present?\n end", "def accept_invite(_token)\n # stub\n end", "def accept_invite_for_user(user)\n invite = Invite.find(session[:invite_id])\n res = invite.accepted_by(user)\n sess...
[ "0.74937326", "0.7298384", "0.719964", "0.7134459", "0.7055844", "0.70169866", "0.69845456", "0.6864185", "0.68258464", "0.6790967", "0.6692605", "0.66518146", "0.6597154", "0.65640604", "0.65415305", "0.6540954", "0.65200675", "0.6518139", "0.65137213", "0.65040386", "0.6475...
0.0
-1
Accept an invite. Accepts an invite by claiming this invite by this user. The user token used for this request will gain the permissions associated with the invite.
def respond_to_invite_with_http_info(invite_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AccessRecordsApi.respond_to_invite ...' end # verify the required parameter 'invite_id' is set if @api_client.config.client_side_validation && invite_id.nil? fail ArgumentError, "Missing the required parameter 'invite_id' when calling AccessRecordsApi.respond_to_invite" end # resource path local_var_path = '/v1/invites/{inviteId}'.sub('{' + 'inviteId' + '}', invite_id.to_s) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/links+json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] return_type = opts[:return_type] || 'InlineResponse2009' auth_names = opts[:auth_names] || ['oauth2'] data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: AccessRecordsApi#respond_to_invite\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accept_invite(event)\n invite = Invite.where(user: self, event: event)\n invite.accept if invite.present?\n end", "def accept_invite(_token)\n # stub\n end", "def accept_invite_for_user(user)\n invite = Invite.find(session[:invite_id])\n res = invite.accepted_by(user)\n sess...
[ "0.74924856", "0.7299142", "0.7197603", "0.7133861", "0.70544857", "0.7015128", "0.6982791", "0.6862516", "0.6824624", "0.6790592", "0.6692522", "0.6650796", "0.6596699", "0.6563922", "0.6540936", "0.65394574", "0.6520397", "0.65165055", "0.6513518", "0.65030396", "0.6474167"...
0.0
-1
check_class_collision :suffix => "Guard"
def create_guard_files template 'guard.yml', File.join('app', 'guards', class_path, "#{plural_file_name}_guard.yml") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard; end", "def findExactClassMatch(name)\n fname = name.tr(':', '_')\n return ClassIndex.classExists?(fname)\n end", "def log_collision?(method_key); end", "def can_get_class?(klass); true; end", "def class_verify(method_name, &block)\n internal_verify method_name, :class, &block\n en...
[ "0.60813993", "0.5919187", "0.5904683", "0.58677995", "0.58315337", "0.56909555", "0.5656631", "0.5656631", "0.5614948", "0.5603237", "0.5603237", "0.55934", "0.55865425", "0.5521983", "0.5501401", "0.54965097", "0.5488982", "0.548432", "0.5475275", "0.5472386", "0.5453785", ...
0.0
-1
TODO should be coming from the actual generator
def actions ['index', 'show', 'new', 'create', 'edit', 'update', 'destroy'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generators; end", "def generators; end", "def generate; end", "def generate; end", "def kid_generator=(_arg0); end", "def kid_generator=(_arg0); end", "def private; end", "def generators=(_arg0); end", "def next() end", "def next() end", "def generate\n end", "def next()\n \n ...
[ "0.7211842", "0.7211842", "0.7205717", "0.7205717", "0.67960846", "0.67960846", "0.67883706", "0.67850184", "0.6691665", "0.6691665", "0.66841656", "0.66198134", "0.66198134", "0.645406", "0.6437494", "0.6437494", "0.6426655", "0.63522255", "0.63522255", "0.63522255", "0.6344...
0.0
-1
Make sure there are conversation member objects for all users, if there is a converation associated with the availability
def ensure_conversation_members convo = Conversation.where(availability_id: id).first if convo convo.conversation_members.create(user: user, admin: admin) if convo.conversation_members.where(user: user).first.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_members\n conversation_members << conversation_members.new(user_id: owner_id, is_admin: true)\n errors.add(:base, \"Required two members to create a 1 to 1 conversation.\") if !is_group_conversation? && ((new_members || []) + [owner_id]).delete_empty.map(&:to_i).uniq.count < 2\n end", "def matc...
[ "0.729364", "0.6941028", "0.642962", "0.61134404", "0.6092712", "0.5966249", "0.59593415", "0.5949759", "0.58129275", "0.57753706", "0.5758085", "0.57269907", "0.5718913", "0.56717086", "0.5667335", "0.56633604", "0.5657858", "0.56547564", "0.5653306", "0.56416035", "0.563821...
0.81174755
0
Helper method for index (entries report)
def projects_select_id_equals(form, projects, options = {}) form.select :project_id_equals, to_form_select(projects), {:include_blank => ''}, options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n entries\n end", "def entries() end", "def index\n @entries = Entry.all.first(100)\n end", "def entries; end", "def entries; end", "def entries; end", "def entries; end", "def index\n @entries = Entry.all\n end", "def index\n @entries = Entry.all\n end", "def index\n ...
[ "0.72572833", "0.68080205", "0.67651093", "0.66690856", "0.66690856", "0.66690856", "0.66690856", "0.663722", "0.663722", "0.663722", "0.663722", "0.663722", "0.663722", "0.6526663", "0.65069526", "0.6497923", "0.64651275", "0.64585555", "0.64503837", "0.6396074", "0.63930583...
0.0
-1
Extract information a form select method
def to_form_select(projects) projects.collect do |p| [project_identifier(p), p.id] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def general_info_for_select\n\t\t\n\tend", "def select\n self[:select]\n end", "def select\n self[:select]\n end", "def request_select\n end", "def selected_options; end", "def selected_options; end", "def select\r\n assert_exists\r\n if(@how == :text)\r\n ...
[ "0.74126214", "0.6693555", "0.65767956", "0.64595145", "0.6389998", "0.6389998", "0.63827854", "0.62509686", "0.6145999", "0.60712993", "0.6002207", "0.6001721", "0.6000942", "0.5970604", "0.5953623", "0.59536016", "0.58647096", "0.58526754", "0.58336025", "0.5826986", "0.581...
0.0
-1
Extract projects grouped by past usage
def grouped_project_select(projects, f) # Get the projects from the last month that entries were created for project_ids = current_user.entries.where("entries.updated_at >= ?", 1.month.ago).collect { |e| e.project.id } # Calculate the frequency of each project_id ( i.e. {1=>3, 3=>1} ) frequency = project_ids.inject(Hash.new(0)) { |h,v| h[v] += 1; h } # Get the four most frequently used projects uniq_project_ids = project_ids.sort_by { |v| frequency[v] }.uniq[0..4] recent_projects = uniq_project_ids.collect { |id| Project.find id } unless recent_projects.empty? selected_value = f.object.read_attribute(:project_id) group = [['recent projects',to_form_select(recent_projects)], ['all projects',to_form_select(projects)]] return grouped_options_for_select(group, selected_value) else return to_form_select(projects) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_costs(proj)\n Issue.cross_project_scope(proj, 'descendants')\n .select('spent_on, SUM(hours) AS sum_hours')\n .where(\"#{SQL_COM}\")\n .joins(:time_entries)\n .group(:spent_on)\n .collect { |issue| [issue.spent_on.to_date, issue.sum_hours] }\n end", "def projects_tracked\...
[ "0.6025148", "0.6023157", "0.5930333", "0.5871557", "0.58174956", "0.57934046", "0.5599396", "0.55827934", "0.55292153", "0.55023515", "0.548608", "0.5479459", "0.5471032", "0.5459164", "0.54110545", "0.54101455", "0.5404307", "0.5394533", "0.53763855", "0.5373604", "0.536656...
0.55176175
9
Truncated project identifier (shortname & part of the description)
def project_identifier(p, length=26) truncate([p.shortname, p.description].join(" - "), :length => length) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project\n params['project'].gsub('_', '-')\n end", "def project_code\n name[PROJECT_CODE_FORMAT]\n end", "def human_readable_identifier_columns\n { :project => :title }\n end", "def issue_project_key(issue_key)\n issue_key.split('-').length > 1 ? issue_key : [current_project, iss...
[ "0.6781715", "0.67052704", "0.67012584", "0.66370595", "0.6630924", "0.6616949", "0.6499973", "0.6499973", "0.64954233", "0.6383891", "0.63314784", "0.63314784", "0.6283354", "0.62602586", "0.61938053", "0.61930984", "0.61930984", "0.61857486", "0.6175822", "0.61634725", "0.6...
0.8665244
0
Display an edit link if the entry belongs to the logged in user
def display_edit_link(entry) if entry.user == current_user link_to (image_tag 'edit.png'), edit_entry_path(entry) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\tif !current_user || !is_this_user\n\t\t\tredirect_to user_path(params[:id])\n\t\tend\n\tend", "def edit\n redirect_to root_url and return unless current_user\n @user = current_user\n end", "def edit\n @link = Link.find(params[:id])\n if current_user && current_user.id == @link.user_i...
[ "0.7747033", "0.77255124", "0.7623171", "0.75936306", "0.7589883", "0.7566778", "0.7557951", "0.75435805", "0.75338274", "0.7476841", "0.74598885", "0.745371", "0.74381214", "0.74332947", "0.7411412", "0.7408872", "0.7392097", "0.7390147", "0.73885334", "0.73715466", "0.73715...
0.8464309
1
Clear memoization of current Rails view context
def clear_view_context! @view_context = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memoize_cache_clear\n __memoize_cache__.clear\n self\n end", "def clear_memo!\n self.class.clear_memo!\n end", "def clear_cache; end", "def cached_view_context(engine=nil)\n @_view_context_cache ||= clean_view_context(engine)\n end", "def clear_cache\n Rails.cache...
[ "0.7628447", "0.7552689", "0.70722526", "0.68942016", "0.6855714", "0.6817796", "0.6798768", "0.6784006", "0.67039216", "0.67039216", "0.66853476", "0.6646149", "0.66436756", "0.66424215", "0.663637", "0.66239196", "0.6605847", "0.65911293", "0.6589311", "0.6560514", "0.65325...
0.7548436
2
Method for generating random answers
def get_fortune randomNo = 1 + rand(6) #Assign answer based on random generated number case randomNo when 1 $prediction = "yes" when 2 $prediction = "no" when 3 $prediction = "maybe" when 4 $prediction = "hard to tell. Try again" when 5 $prediction = "unlikely" when 6 $prediction = "unknown" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_question\n a = rand(11)\n b = rand(11)\n \"#{a} + #{b}\"\nend", "def response\n\t\tputs @answers[rand(@answers.length - 1)]\n\tend", "def nostalgia; return rand end", "def generate_question\n @a = random_number\n @b = random_number\n # This switches number @a and number @b unless the...
[ "0.7661684", "0.75157726", "0.74123496", "0.73010904", "0.7287952", "0.7259745", "0.7259745", "0.7110437", "0.70483404", "0.7044553", "0.70096964", "0.6986043", "0.69858426", "0.69725984", "0.6960512", "0.6958729", "0.6933637", "0.69323105", "0.6932305", "0.690425", "0.690425...
0.0
-1
This method displays the 8ball greeting message
def say_greeting greeting = "\t\t Welcome to the Virtual Crazy 8-Ball" + "game\n\n\n\n\n\n\n\n\n\n\n\n\nPress Enter to " + "continue. \n\n: " print greeting end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def say_greeting\r\n\t\tgreeting = \"\\t\\t Welcome to the Virtual Crazy 8-Ball\" +\r\n\t\t\"game\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\" +\r\n\t\t\"Instructions: Choose Yes or No to play the 8-Ball game!\\n\" +\r\n\t\t\"When prompted enter your question you wish to be answered.\" +\r\n\t\t\"\\n\\nPress Enter to ...
[ "0.7891879", "0.7854491", "0.7714376", "0.7610312", "0.73397166", "0.73242253", "0.73223925", "0.73130685", "0.73130685", "0.723672", "0.71722794", "0.7148418", "0.71469826", "0.7139801", "0.71132606", "0.71123356", "0.71054554", "0.7099234", "0.7090951", "0.70695657", "0.705...
0.77863616
2
This method displays the 8ball's primary query
def get_question question = "Type your question and press the Enter key. \n\n: " print question end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @company = Company.find(params[:id])\n @battalion = Battalion.find(params[:battalion_id])\n @platoon = @company.platoons.find(:all, :order => \"name\")\n @attached = Platoon.all(:conditions => [\"attached_id = ?\", @company.id]) \n @cc = @company.users.find_by_position('Company Commander'...
[ "0.6221995", "0.6126506", "0.6114389", "0.60690343", "0.6054597", "0.60230786", "0.5985664", "0.5912711", "0.58772236", "0.58672947", "0.58382326", "0.576831", "0.57635915", "0.57472026", "0.57434106", "0.5725923", "0.5721576", "0.572008", "0.57035613", "0.56962", "0.56850857...
0.0
-1
This method displays the 8Ball answers
def tell_fortunte() print "The answer is " + $prediction + ". \n\n: " end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printAnswersOnScreen()\n $lblAnswerA['text'] = $arrAnswerA[$intQuestionOnScreen - 1]\n $lblAnswerB['text'] = $arrAnswerB[$intQuestionOnScreen - 1]\n $lblAnswerC['text'] = $arrAnswerC[$intQuestionOnScreen - 1]\n $lblAnswerD['text'] = $arrAnswerD[$intQuestionOnScreen - 1]\nend", "def show_results\n \"Co...
[ "0.70927536", "0.6929494", "0.6770509", "0.6709515", "0.6563886", "0.64535654", "0.6423195", "0.6374562", "0.6358129", "0.63447046", "0.6330961", "0.63275844", "0.63164616", "0.6279243", "0.6265438", "0.62381554", "0.6204886", "0.6204032", "0.61965394", "0.6192038", "0.615271...
0.5823955
56
This method displays the 8Ball's closing message
def say_goodbye goodbye = "Thanks for playing the Virtual Crazy" + "8-Ball game!\n\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n render :text => \"\"\n end", "def display_exiting!(text)\n # create goodbye message\n # display welformatted conclusion message\n system \"clear\"\n msg = colorize(\" #{text.upcase} \", $font_colors[:cyan])\n puts \"\\n#{msg.center(77)}\\n\\n\"\n end", "def exit_message \n\t\t\t...
[ "0.69671255", "0.6763087", "0.6676317", "0.66350883", "0.65484244", "0.65371776", "0.64729494", "0.64665544", "0.6461354", "0.6434946", "0.64239174", "0.6419925", "0.63768274", "0.6365045", "0.6340856", "0.6336895", "0.63305795", "0.6293799", "0.628748", "0.627408", "0.627219...
0.6500486
6
GET /time_entries/1 GET /time_entries/1.json
def show @time_entry = TimeEntry.with_deleted.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @time_entry } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_entry(id)\n object_from_response(:get, \"time_entries/#{id}\", \"time-entry\")\n end", "def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end", "def show\n ...
[ "0.77521336", "0.73136413", "0.73136413", "0.7217499", "0.70982444", "0.6872235", "0.68646127", "0.67675847", "0.6759258", "0.6735705", "0.6676323", "0.6657675", "0.66207683", "0.65407354", "0.65407354", "0.65407354", "0.65218467", "0.65060836", "0.6497595", "0.64793575", "0....
0.6820346
7
GET /time_entries/new GET /time_entries/new.json
def new @time_entry = TimeEntry.new respond_to do |format| format.html # new.html.erb format.json { render json: @time_entry } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @timeentry = Timeentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timeentry }\n end\n end", "def new\n @breadcrumb = 'create'\n @time_record = TimeRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\...
[ "0.8126846", "0.7353966", "0.7299263", "0.7299263", "0.7299263", "0.7253368", "0.72042024", "0.72020304", "0.7170777", "0.7146488", "0.71185404", "0.7105599", "0.7057156", "0.7050364", "0.70374864", "0.7030023", "0.7016586", "0.69981337", "0.69804966", "0.69349265", "0.693223...
0.81166846
1
POST /time_entries POST /time_entries.json
def create @time_entry = TimeEntry.new(params[:time_entry]) respond_to do |format| if @time_entry.save format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' } format.json { render json: @time_entry, status: :created, location: @time_entry } else format.html { render action: "new" } format.json { render json: @time_entry.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @time_entry = TimeEntry.new(time_entry_params)\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render :show, status: :created, location: @time_entry }\n else\n ...
[ "0.68343043", "0.6712649", "0.6527376", "0.6447198", "0.6244007", "0.6134587", "0.60852724", "0.60672057", "0.60656595", "0.60399216", "0.60342395", "0.60342395", "0.60342395", "0.60196835", "0.5990483", "0.59879977", "0.5944488", "0.5915659", "0.5913398", "0.59126556", "0.58...
0.67901087
2
PUT /time_entries/1 PUT /time_entries/1.json
def update @time_entry = TimeEntry.with_deleted.find(params[:id]) respond_to do |format| if @time_entry.update_attributes(params[:time_entry]) format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @time_entry.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_time_entry(options = {})\n object_from_response(:put, \"time_entries/#{id}\", \"time-entry\", \"time-entry\" => options)\n end", "def update\n @time_entry = current_firm.all_time_entries.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time...
[ "0.7478914", "0.7118419", "0.70100623", "0.70100623", "0.6880569", "0.68370557", "0.67725605", "0.6664436", "0.6664436", "0.65417147", "0.64945656", "0.6365598", "0.6312165", "0.6244404", "0.6226513", "0.61583453", "0.6137555", "0.613613", "0.613613", "0.613613", "0.6127134",...
0.68071777
6
DELETE /time_entries/1 DELETE /time_entries/1.json
def destroy @time_entry = TimeEntry.with_deleted.find(params[:id]) @time_entry.destroy respond_to do |format| format.html { redirect_to time_entries_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n ...
[ "0.7719302", "0.7719302", "0.76278114", "0.7478545", "0.7295813", "0.7199814", "0.7171503", "0.7127114", "0.71220833", "0.70302796", "0.7028067", "0.6914805", "0.68997574", "0.688539", "0.6842422", "0.6842422", "0.680404", "0.67957485", "0.6791183", "0.6777039", "0.67686486",...
0.77798426
0
Use callbacks to share common setup or constraints between actions.
def set_content @content = Content.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 content_params params.require(:user_submitted_content).permit(:caption, :credit, :data, :email, :note, :status, :collection_id) 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.7122858", "0.70540553", "0.69476545", "0.6902004", "0.6735809", "0.671776", "0.668886", "0.66776645", "0.66611695", "0.6555913", "0.6527077", "0.64584446", "0.64516115", "0.64500964", "0.64474493", "0.6435065", "0.6413185", "0.6413185", "0.6391701", "0.6380101", "0.6380101...
0.0
-1
Ctor Takes the context the code should be executed in. If no argument is provided, defaults to the top level
def initialize c = TOPLEVEL_BINDING @context = c @level = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(context)\n @context = context\n end", "def initialize(context = nil)\n @context = context\n super\n end", "def initialize(context)\n super()\n self.context = context\n end", "def initialize(*args, &block)\n super(*args)\n instance_exec(_context, &block)\n ...
[ "0.7444922", "0.7405872", "0.74044156", "0.7384364", "0.7366791", "0.7314573", "0.72918016", "0.72918016", "0.72360545", "0.7202545", "0.7051236", "0.70468146", "0.70468146", "0.7040164", "0.70030266", "0.6969994", "0.69412035", "0.6810217", "0.6680081", "0.6680081", "0.66800...
0.6791291
18
Runs a string given in input as Ruby code or buffers it if the command is incomplete Test against level or input to check if the command has been executed
def run str @input ||= '' @level += str.scan(LEVEL_UP).length @level -= str.scan(/(^|\s)end($|\s)/).length # Will probably fail with a character chain @input += str + "\n" if @level <= 0 tmp = input reset eval tmp, context end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_cmd(input); end", "def run_cmd(input)\n return @session.process(input,false)\n end", "def run_cmd(input)\n return self.process(input,false)\n end", "def execute_ruby(cmd, inp)\n begin\n cmd = Shellwords.shellsplit(cmd)\n rescue ArgumentError\n return \"command parse error: `#{...
[ "0.7114369", "0.644145", "0.6441347", "0.6322234", "0.6249415", "0.60236907", "0.6014585", "0.60128856", "0.6012476", "0.59657735", "0.5920252", "0.5905936", "0.58889264", "0.58597136", "0.58594006", "0.5851312", "0.58317167", "0.582933", "0.58111656", "0.5752191", "0.5741972...
0.6703683
1
You should implement your methods in this file. Feel free to use the debugger when you get stuck.
def largest_prime_factor(num) prime_factors = [] (2..num).each do |n| prime_factors << n if prime?(n) && num % n == 0 end prime_factors[-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def bug\n end", "def zuruecksetzen()\n end", "def how_it_works\r\n end", "def probers; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def ...
[ "0.723076", "0.70461094", "0.70461094", "0.68131787", "0.6735109", "0.6716413", "0.66916907", "0.6681833", "0.6681833", "0.6681833", "0.6681833", "0.6681833", "0.6681833", "0.6681833", "0.6681833", "0.6681833", "0.66373926", "0.66153497", "0.66153497", "0.66153497", "0.661534...
0.0
-1
Convert to Mageo::Vector3DInternal. Nondestructive.
def internal_coordinates(axes) raise TypeError unless axes.is_a?(Mageo::Axes) axes = axes.to_a Mageo::Vector3DInternal[ *(Malge::SimultaneousEquations.cramer(axes.transpose, self)) ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_v\n Vector3.new(@x, @y, @z)\n end", "def extract_vector3d!\n a = self\n if false and a.length == 0 then raise \"Expected vector coordinates\"\n elsif a.length >= 4 and a[0].kind_of? Numeric and a[1].kind_of? Numeric and a[2].kind_of? Numeric and\n a[3].kind_of? Numeric\n r...
[ "0.74591273", "0.7320771", "0.662637", "0.66214997", "0.6420188", "0.6403938", "0.6389244", "0.6369424", "0.6358574", "0.6340584", "0.63063663", "0.6258038", "0.6202645", "0.6149618", "0.60862565", "0.60812837", "0.605214", "0.6031478", "0.6011893", "0.59837896", "0.59815454"...
0.49684286
95
Change the self.class to Vector3DInternal, Keeping the values of coordinates.
def to_v3di axes = Mageo::Axes.new( [ [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0] ]) internal_coordinates(axes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_vector3d!\n a = self\n if false and a.length == 0 then raise \"Expected vector coordinates\"\n elsif a.length >= 4 and a[0].kind_of? Numeric and a[1].kind_of? Numeric and a[2].kind_of? Numeric and\n a[3].kind_of? Numeric\n return Vector3d.new(a.slice!(0, 4))\n elsif a.length...
[ "0.6806776", "0.6799487", "0.6781586", "0.6776835", "0.643764", "0.6394869", "0.630048", "0.62811965", "0.6267737", "0.61981755", "0.61275744", "0.6087561", "0.6051534", "0.60235906", "0.60121703", "0.5996678", "0.5996045", "0.5970442", "0.5935952", "0.59139884", "0.5907834",...
0.5544594
50
Return size, always 3.
def size return 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n 4\n end", "def size; @size end", "def size\n @length / 4\n end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; e...
[ "0.8232413", "0.80479515", "0.8037623", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", "0.7920683", ...
0.894307
0
Get the exterior product.
def exterior_product(vec) self.class.exterior_product(self, vec) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part_of_product\n if @related_material\n @related_material.part_of_products.first\n end\n end", "def base_product\n product_num\n end", "def product\n Product.find_by_outer_id(outer_id) || Product.find_by_num_iid(num_iid)\n end", "def por_extenso\n Extenso.por_extenso(self)...
[ "0.6379086", "0.6274137", "0.6236722", "0.6161754", "0.5983231", "0.5828853", "0.57838136", "0.5726747", "0.571657", "0.56586814", "0.5651687", "0.56505424", "0.56427383", "0.55954325", "0.55954325", "0.5546749", "0.54802054", "0.5415928", "0.5413329", "0.54127514", "0.539460...
0.6473815
0