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 |
|---|---|---|---|---|---|---|
this gets hit from router.js (Backbone file) when users go to the campaign show page. It gets the call's info (id, name of person getting called etc) and calls call.twilio_token which grabs a Twilio token to enable the phone call feature. | def get_token
campaign_id = Campaign.find(params[:id]).id
call = Call.new
call.campaign_id = campaign_id
call.target_name = call.campaign.target_name
call.twilio_token
render :json => call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive_browser_call\n campaign_id = params[:campaign_id].to_i\n Sharelink.add_clicker(campaign_id, session[:referrer_id], current_user) if session[:referrer_id]\n Call.create(:campaign_id => campaign_id, :user_id => params[:id], :twilio_id => params[:CallSid])\n outbound_call = Campaign.outbound_c... | [
"0.7000736",
"0.69468904",
"0.6515898",
"0.63296115",
"0.6260934",
"0.61694604",
"0.6165208",
"0.60936093",
"0.60778415",
"0.60763824",
"0.6073871",
"0.6007957",
"0.6004113",
"0.59794843",
"0.59730244",
"0.59730244",
"0.5971385",
"0.5971385",
"0.5971385",
"0.5971385",
"0.5971... | 0.7506637 | 0 |
this post request to campaignsvoice runs when people click "call" and the Twilio.Device.connect(params); runs in call_view.js | def receive_browser_call
campaign_id = params[:campaign_id].to_i
Sharelink.add_clicker(campaign_id, session[:referrer_id], current_user) if session[:referrer_id]
Call.create(:campaign_id => campaign_id, :user_id => params[:id], :twilio_id => params[:CallSid])
outbound_call = Campaign.outbound_call_instr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makecall\n \n client = Twilio::REST::Client.new(TWILIO_CONFIG['sid'], TWILIO_CONFIG['token'])\n @call = client.account.calls.create(\n :from => TWILIO_CONFIG['from'], # From your Twilio number\n :to => '+19493228496', # To any number\n # Fetch instructions from this URL when the call... | [
"0.69411314",
"0.66999894",
"0.66271985",
"0.66021514",
"0.6596931",
"0.6574954",
"0.65593463",
"0.65318483",
"0.6421681",
"0.63513774",
"0.63333327",
"0.6320324",
"0.63044125",
"0.63004017",
"0.6268951",
"0.6236291",
"0.6203554",
"0.61854273",
"0.6176981",
"0.61693263",
"0.6... | 0.6886206 | 1 |
when call is done, Twilio calls this asynchronously | def callback
twilio_id = params[:CallSid]
call = Call.where('twilio_id = ?', twilio_id).first
call.get_recording_info(twilio_id, params[:CallDuration], params[:AnsweredBy])
render :json => 'callback success'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call\n advance until done?\n end",
"def call_next_provider(call_job)\n contact = get_next_uncontacted(call_job)\n\n if contact.nil?\n #if it gets here terminate CallJob. No more contacts exist\n call_job.delay.make_callback(\"done\")\n call_job.status = :done\n call_job.... | [
"0.65883744",
"0.6342525",
"0.6041293",
"0.60308194",
"0.5962899",
"0.59543",
"0.5949708",
"0.59036994",
"0.58987236",
"0.5893896",
"0.5858706",
"0.57543284",
"0.57334423",
"0.57231086",
"0.5631108",
"0.5628138",
"0.5627173",
"0.5626427",
"0.56246674",
"0.56218827",
"0.562009... | 0.6593023 | 0 |
Flag de entrega con factor de verificacion (3= Orden entregada ,2= Orden en reparto ,1= Orden rechazada, 0= Solicitud de orden). enum order_status: [:pending, :rejected, :in_route, :deliver] | def order_status(order_status)
stat_name = ''
if order_status == 'deliver'
stat_name = 'Entregada'
elsif order_status == 'in_route'
stat_name = 'Reparto'
elsif order_status == 'rejected'
stat_name = 'Rechazada'
elsif order_status == 'pending'
stat_name = 'Pendiente'
elsif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_status\n unless order.draft?\n errors.add(:order_status, 'An line_item can only be edited while in the DRAFT status')\n end\n end",
"def determine_state(order)\n\n return 'canceled' if order.canceled?\n return 'pending' unless order.can_ship?\n\n return 'shipped' if shipped?\... | [
"0.70303786",
"0.68036956",
"0.6794666",
"0.67559856",
"0.6723999",
"0.6689366",
"0.6572515",
"0.65648365",
"0.6358558",
"0.6327546",
"0.63099897",
"0.6275959",
"0.62653416",
"0.6202061",
"0.6151016",
"0.6139053",
"0.6128957",
"0.6126017",
"0.6098462",
"0.6093593",
"0.6060522... | 0.7140815 | 0 |
def order_status(order_status) stat_name = '' if order_status == 3 stat_name = 'Entregada' elsif order_status == 2 stat_name = 'Reparto' elsif order_status == 1 stat_name = 'Rechazada' elsif order_status == 0 stat_name = 'Pendiente' elsif order_status.nil? stat_name = 'No tiene estado' end stat_name end | def payment_methods(paymentmethod_id)
pay_methods = ''
if paymentmethod_id == 1
pay_methods = 'Crédito'
elsif paymentmethod_id == 2
pay_methods = 'Débito'
elsif paymentmethod_id == 3
pay_methods = 'Efectivo'
elsif paymentmethod_id == 4
pay_methods = 'Efectivo y Crédito'
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_status(order_status)\n stat_name = ''\n if order_status == 'deliver'\n stat_name = 'Entregada'\n elsif order_status == 'in_route'\n stat_name = 'Reparto'\n elsif order_status == 'rejected'\n stat_name = 'Rechazada'\n elsif order_status == 'pending'\n stat_name = 'Pendie... | [
"0.9066203",
"0.7279731",
"0.7183244",
"0.71030694",
"0.7019642",
"0.6977688",
"0.69640577",
"0.6933983",
"0.68725586",
"0.67737675",
"0.67191315",
"0.66920745",
"0.6653128",
"0.6648507",
"0.66405976",
"0.6627173",
"0.65887463",
"0.65827006",
"0.65692914",
"0.65448344",
"0.65... | 0.0 | -1 |
permite leitura e mudanca dos atributos. attr_reader :texto_ingles, :texto_portugues permite leitura, mas nao permite mudanca attr_writer :texto_ingles, :texto_portugues permite mudar o atributo, mas nao permite leitura construtor | def initialize(texto_portugues, texto_ingles)
@texto_portugues = texto_portugues
@texto_ingles = texto_ingles
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_atributos\n\n unless @pre.nil?\n @pre[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@pre[:valor][key],campo:'precio')\n end\n end\n\n unless @compraAtributo.nil?\n @compraAtributo[:llave].each do |key,value|\n ... | [
"0.5805983",
"0.5556325",
"0.548707",
"0.5407093",
"0.5402527",
"0.5398367",
"0.5394611",
"0.5388135",
"0.537642",
"0.5309526",
"0.53079724",
"0.5234692",
"0.5234692",
"0.52032596",
"0.5143533",
"0.5137933",
"0.5101958",
"0.5087598",
"0.5080689",
"0.5079072",
"0.50705343",
... | 0.5568775 | 1 |
GET /challenge_grades/1 GET /challenge_grades/1.json | def show
@title = "View Team Challenge Score"
@challenge_grade = ChallengeGrade.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @challenge_grade }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @title = \"Grade a Team Challenge\"\n @challenge_grade = ChallengeGrade.new\n @teams = Team.all\n @challenges = Challenge.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge_grade }\n end\n end",
"def show\n render json: @gra... | [
"0.7144152",
"0.6699043",
"0.6683995",
"0.66762406",
"0.66288424",
"0.64661795",
"0.64519703",
"0.63809806",
"0.6322779",
"0.6252886",
"0.6216254",
"0.6195138",
"0.6195077",
"0.61908686",
"0.6164698",
"0.6159022",
"0.6159022",
"0.6159022",
"0.6159022",
"0.61057353",
"0.609621... | 0.71364534 | 1 |
GET /challenge_grades/new GET /challenge_grades/new.json | def new
@title = "Grade a Team Challenge"
@challenge_grade = ChallengeGrade.new
@teams = Team.all
@challenges = Challenge.all
respond_to do |format|
format.html # new.html.erb
format.json { render json: @challenge_grade }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @grade = Grade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grade }\n end\n end",
"def new\n @grade = Grade.new\n\n respond_to do |format|\n format.html { render :layout => false }\n format.json { render json: @grade }\n ... | [
"0.7997332",
"0.7800682",
"0.7591431",
"0.7529949",
"0.75183856",
"0.75119215",
"0.7316954",
"0.7229705",
"0.7229705",
"0.7223461",
"0.71997404",
"0.7189268",
"0.7156643",
"0.71341753",
"0.7103",
"0.7082756",
"0.707991",
"0.7069981",
"0.7045638",
"0.7045638",
"0.7023929",
"... | 0.7962431 | 1 |
POST /challenge_grades POST /challenge_grades.json | def create
@challenge_grade = ChallengeGrade.new(params[:challenge_grade])
respond_to do |format|
if @challenge_grade.save
format.html { redirect_to @challenge_grade, notice: 'Challenge score was successfully created.' }
format.json { render json: @challenge_grade, status: :created, locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @grade = Grade.new(grade_params)\n\n if @grade.save\n render json: @grade, status: :created, location: @grade\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end",
"def create\n @final_grade = FinalGrade.new(final_grade_params)\n\n respond_to d... | [
"0.67470974",
"0.6641036",
"0.65218073",
"0.6444364",
"0.64058787",
"0.64007235",
"0.637068",
"0.630617",
"0.6152625",
"0.6137831",
"0.6128319",
"0.61211514",
"0.6100903",
"0.60843134",
"0.6083335",
"0.60673827",
"0.60655445",
"0.6063215",
"0.6015071",
"0.6001584",
"0.5975557... | 0.7268904 | 0 |
PUT /challenge_grades/1 PUT /challenge_grades/1.json | def update
@challenge_grade = ChallengeGrade.find(params[:id])
respond_to do |format|
if @challenge_grade.update_attributes(params[:challenge_grade])
format.html { redirect_to @challenge_grade, notice: 'Challenge score was successfully updated.' }
format.json { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @grade = Grade.find(params[:id])\n\n if @grade.update(grade_params)\n head :no_content\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end",
"def update\n @grade = Grade.find(params[:id])\n if @grade.update_attributes(params[:grade])\n res... | [
"0.71634835",
"0.7042108",
"0.6733449",
"0.6575392",
"0.6574765",
"0.6574601",
"0.655367",
"0.6549785",
"0.64713854",
"0.64515543",
"0.6442938",
"0.6410684",
"0.6330813",
"0.63080865",
"0.62903285",
"0.62903285",
"0.6251503",
"0.6232575",
"0.6230737",
"0.6215384",
"0.6197863"... | 0.74496967 | 0 |
DELETE /challenge_grades/1 DELETE /challenge_grades/1.json | def destroy
@challenge_grade = ChallengeGrade.find(params[:id])
@challenge_grade.destroy
respond_to do |format|
format.html { redirect_to challenge_grades_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @criterion_grade.destroy\n respond_to do |format|\n format.html { redirect_to criterion_grades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grade.destroy\n respond_to do |format|\n format.html { redirect_to grades_url }\n format.json { h... | [
"0.7474334",
"0.7437565",
"0.7426156",
"0.74139714",
"0.72641027",
"0.72189426",
"0.71845406",
"0.7182398",
"0.7152137",
"0.71287507",
"0.70907944",
"0.7077441",
"0.7071525",
"0.70634717",
"0.70360476",
"0.7029539",
"0.70250684",
"0.69841695",
"0.6960523",
"0.69443065",
"0.69... | 0.79843456 | 0 |
If user's session has an old Cart object that stores items in Array rather than a Hash (see 587), regenerate the Cart. TODO: Remove in ~2015, when nobody could conceivably run the old app? | def make_cart_compatible
return if session[:cart].items.is_a? Hash
session[:cart] = Cart.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cart\n session[:cart] ||= []\n end",
"def cart\n session[:cart] ||= []\n end",
"def cart\n session[:cart] ||= []\n end",
"def cart\n session[:cart] ||= []\n end",
"def update_cart(new_cart)\n cookies[:cart] ={value: JSON.generate(new_cart), expires_in: 7.days}\n cookies[:cart]\n ... | [
"0.6652246",
"0.6652246",
"0.6652246",
"0.6652246",
"0.6626434",
"0.6607896",
"0.6499213",
"0.64844936",
"0.6463475",
"0.64497423",
"0.64361346",
"0.6434733",
"0.64297384",
"0.642417",
"0.642417",
"0.6382758",
"0.6374674",
"0.6352676",
"0.63021505",
"0.6301432",
"0.6287181",
... | 0.7665631 | 0 |
check to see if the guest user functionality is disabled | def guests_disabled?
!AppConfig.check(:enable_guests)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disabled?\n user.nil?\n end",
"def guest?\n false\n end",
"def check_guest_user\n # This will return true always, but it is checked just in case.\n result = current_user.is_guest?\n\n if (!result)\n # If it doesn't meet the minimum privilege level, redirect.\n flash[:error] = t(\... | [
"0.7771079",
"0.7499157",
"0.7226293",
"0.71338475",
"0.7127565",
"0.7087442",
"0.70619863",
"0.7035203",
"0.70311874",
"0.70233774",
"0.6973893",
"0.6963245",
"0.69094366",
"0.6907473",
"0.69015664",
"0.6842631",
"0.67993534",
"0.6730353",
"0.6724126",
"0.6712364",
"0.669948... | 0.8238905 | 0 |
check to see if we should skip authentication; either looks to see if the Devise controller is running or if we're utilizing one of the guest accessible routes with guests disabled | def skip_authentication?
devise_controller? ||
(%w[update_cart empty_cart terms_of_service]
.include?(params[:action]) && !guests_disabled?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip_authentication?\n true\n end",
"def needs_authenticate_user?\n except_actions = %w[index show print]\n !except_actions.include?(action_name)\n end",
"def do_not_check_authorization?\n respond_to?(:devise_controller?) ||\n respond_to?(:home_controller?)\n end",
"def needs_aut... | [
"0.7477009",
"0.70825285",
"0.7021003",
"0.70135266",
"0.6882819",
"0.6860573",
"0.6858344",
"0.68491703",
"0.6789575",
"0.67692477",
"0.67654634",
"0.6760711",
"0.6757835",
"0.6714915",
"0.6704414",
"0.67035574",
"0.67035574",
"0.67035574",
"0.66979176",
"0.6685971",
"0.6667... | 0.8041706 | 0 |
runs update cart and then reloads the javascript for the dates in sidebar | def reload_catalog_cart
update_cart
respond_to do |format|
format.js { render template: 'cart_js/cart_dates_reload' }
# guys i really don't like how this is rendering a template for js,
# but :action doesn't work at all
format.html { render partial: 'reservations/cart_dates' }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ajax_refresh\n\t\trender(file: 'sales/ajax_reload.js.erb')\n\tend",
"def update \n render partial: theme_presenter.page_template_path('products/accessories/update'), format: [:js]\n end",
"def update\n # Update cart button via AJAX\n if request.xhr?\n @order.update(order_params)\n ... | [
"0.63533604",
"0.613327",
"0.61073",
"0.59745306",
"0.59374833",
"0.591938",
"0.5877307",
"0.5870341",
"0.58556455",
"0.57945216",
"0.5778432",
"0.5708169",
"0.57023096",
"0.5661413",
"0.56581646",
"0.5651514",
"0.56441563",
"0.56335825",
"0.5630554",
"0.5624199",
"0.55897063... | 0.74462444 | 0 |
if user is logged in, return current_user, else return guest_user | def current_or_guest_user
current_user ? current_user : guest_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_or_guest_user\n if current_user\n transfer_session_to_logged_in_user if session[:guest_user_id].present?\n current_user\n else\n guest_user\n end\n end",
"def current_or_guest_user\n if user_signed_in? then current_user else guest_user end\n end",
"def current_or_gu... | [
"0.8972952",
"0.8930773",
"0.8852469",
"0.86944926",
"0.8534383",
"0.8534383",
"0.8513854",
"0.845738",
"0.84183973",
"0.84030294",
"0.8402608",
"0.83995146",
"0.83995146",
"0.8399097",
"0.8397302",
"0.83784276",
"0.83763546",
"0.8369605",
"0.83655804",
"0.8356414",
"0.835641... | 0.8652075 | 4 |
find guest_user object associated with the current session, creating one as needed | def guest_user
@cached_guest ||= create_guest_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guest_user\n User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user\n end",
"def guest_user\n User.find(session[:guest_user_id].nil? ? session[:guest_user_id] = creat... | [
"0.84715164",
"0.8453672",
"0.8435647",
"0.83511376",
"0.82579863",
"0.822325",
"0.822325",
"0.8216984",
"0.81852436",
"0.8162358",
"0.80786884",
"0.8055749",
"0.8014602",
"0.7946996",
"0.7937647",
"0.7863053",
"0.77854323",
"0.7781128",
"0.775504",
"0.77040786",
"0.7694754",... | 0.80273193 | 12 |
allow CanCanCan to use the guest user when we're not logged in | def current_ability
@current_ability ||= Ability.new(current_or_guest_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guest_user(_user)\n if RuntimeConfig.vote_signin_active?\n can :access, :sessions\n end\n end",
"def guest\n can :read, ActiveAdmin::Page, name: \"Dashboard\"\n can [:read, :update], User, id: user.id\n end",
"def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to u... | [
"0.7609695",
"0.74368846",
"0.7133512",
"0.705442",
"0.7048588",
"0.6904492",
"0.6874608",
"0.6859903",
"0.68524545",
"0.68165493",
"0.6813419",
"0.68063116",
"0.6777315",
"0.6773203",
"0.67579496",
"0.67424655",
"0.67374593",
"0.67374593",
"0.67374593",
"0.67305416",
"0.6723... | 0.627739 | 99 |
activate and deactivate are overridden in the users controller because users are activated and deactivated differently | def deactivate
authorize! :deactivate, :items
# Finds the current model (EM, EI, Category)
@items_class2 = ClassFromString.equipment!(params[:controller])
.find(params[:id])
# Deactivate the model you had originally intended to deactivate
@items_class2.destroy
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate_user(user)\n user.status_id=0\n user.save\n end",
"def activate\n @user = User.find(params[:id])\n @user.activate\n redirect_to :back\n end",
"def activate\n @this_user.update_attributes(:active => true)\n redirect_to :controller => 'user', :action => 'view', :display_name =... | [
"0.71173775",
"0.70752394",
"0.706709",
"0.7055459",
"0.70531446",
"0.7010294",
"0.6968719",
"0.6961901",
"0.69187963",
"0.6862701",
"0.6853291",
"0.6814242",
"0.68035084",
"0.67845803",
"0.67628485",
"0.67152786",
"0.6714463",
"0.66922337",
"0.66922337",
"0.66922337",
"0.668... | 0.0 | -1 |
modify redirect after signing in | def after_sign_in_path_for(user)
# CODE FOR CAS LOGIN --> NEW USER
if ENV['CAS_AUTH'] && current_user && current_user.id.nil? &&
current_user.username
# store username in session since there's a request in between
session[:new_username] = current_user.username
new_user_path
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_in_and_redirect(resource_or_scope, *args); end",
"def sign_in_and_redirect!\n set_user_session_from_oauth\n set_user_cookie\n\n url = if params[:state] == \"popup\"\n Exvo::Helpers.auth_uri + \"/close_popup.html\"\n elsif params[:state] # if not popup then an url\n params[:state]\n... | [
"0.76753217",
"0.74070597",
"0.7394188",
"0.7394188",
"0.73198503",
"0.7214013",
"0.70900536",
"0.70900536",
"0.7028589",
"0.7000169",
"0.6983606",
"0.69817126",
"0.6974262",
"0.6957619",
"0.69574463",
"0.69482607",
"0.6938339",
"0.69325745",
"0.6880934",
"0.6865663",
"0.6864... | 0.67359483 | 38 |
Builds the enum from string | def build_from_hash(value)
# We do not validate that the value is one of the enums set in the OpenAPI
# file because we want to be able to add to our list of enums without
# breaking this client library.
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = NewOrResale.... | [
"0.66046983",
"0.6548398",
"0.65373033",
"0.6528928",
"0.64598405",
"0.6446511",
"0.64443517",
"0.6443306",
"0.6406087",
"0.6405894",
"0.6379518",
"0.6374375",
"0.6367104",
"0.6359485",
"0.63550735",
"0.6346857",
"0.63404876",
"0.6319777",
"0.63088304",
"0.6306753",
"0.630022... | 0.63046414 | 29 |
attach a callback to one category of OSC messages | def bind_trigger(category, callee)
category_match = /\/#{category.to_s}\/(.*)/i
@log.info "Binding OSC category '#{category}' to callee #{callee}"
@osc_server.add_method category_match do |message|
args = category_match.match(message.address)[1].split("/")
address = args.shift
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_ctcp(msg, callback)\n @ctcp_callbacks.add(msg.to_s.upcase, callback)\n end",
"def onmessage(&blk); super; end",
"def subscribe(&onMessage) # block\n end",
"def ontopic(topic, msg)\n\n component = topic[/\\w+$/]\n\n method_name = \"on_#{component}_message\".to_sym\n\n @plugins.eac... | [
"0.5745908",
"0.5707585",
"0.5706446",
"0.5696754",
"0.56472075",
"0.5597818",
"0.5558206",
"0.5545235",
"0.5537286",
"0.549737",
"0.5484938",
"0.54650927",
"0.5456759",
"0.54562503",
"0.54387945",
"0.54323727",
"0.5422713",
"0.54158926",
"0.53947717",
"0.53917897",
"0.536871... | 0.6323097 | 0 |
send an outbound OSC message | def send_trigger(args)
address = "/#{args[:category]}/#{args[:key]}"
values = args[:values]
@log.debug "Sending OSC message #{address}=#{values}"
@osc_client.send(OSC::Message.new(address, values.join))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sock_send io, msg\n msg = \"#{msg}\\0\"\n log msg\n io.send msg, 0\n end",
"def send_msg(message, *args)\n # Fix in ruby osc gem\n args = args.map { |a|\n case a\n when true then 1\n when false then 0\n else\n a\n end\n }\n\n case mess... | [
"0.6532206",
"0.6497993",
"0.6400285",
"0.6351966",
"0.63437515",
"0.6333672",
"0.618131",
"0.6116487",
"0.609765",
"0.6017706",
"0.60013294",
"0.59699744",
"0.5966147",
"0.5959534",
"0.5938679",
"0.593641",
"0.593194",
"0.59018576",
"0.58965784",
"0.5882659",
"0.5881505",
... | 0.60013103 | 11 |
Deploy the template to a resource group | def deploy
# ensure the resource group is created
params = @client.model_classes.resource_group.new.tap do |rg|
rg.location = 'westus'
end
@client.resource_groups.create_or_update(@resource_group, params)
# build the deployment from a json file template from parameters
template = File.rea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy\n cmd = \"deploy #{@resource[:source]} --name=#{@resource[:name]}#{runtime_name_param_with_space_or_empty_string}\"\n if @resource[:runasdomain]\n cmd = append_groups_to_cmd(cmd, @resource[:servergroups])\n end\n cmd = \"#{cmd} --force\" if force_deploy?\n display_lines 100\n brin... | [
"0.63654363",
"0.63364846",
"0.6320054",
"0.62354946",
"0.6070788",
"0.60051376",
"0.5967438",
"0.59007996",
"0.58686477",
"0.58184904",
"0.57575315",
"0.56897527",
"0.566211",
"0.56438226",
"0.5639251",
"0.5608544",
"0.5607679",
"0.5591284",
"0.5543396",
"0.5523804",
"0.5504... | 0.64192224 | 0 |
delete the resource group and all resources within the group | def destroy
@client.resource_groups.delete(@resource_group)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_resource_group(group_name)\n cmdline = Schott::AzureCLI::Commandlines.delete_resource_group(group_name)\n sh(cmdline)\n end",
"def delete(name)\n return unless resource_group?(name)\n\n info \"deleting the resource group: #{name}\"\n @client.resource_groups.delete(nam... | [
"0.7767466",
"0.7734826",
"0.7663411",
"0.74816626",
"0.74426234",
"0.73741555",
"0.7172875",
"0.7099843",
"0.7099843",
"0.7051083",
"0.7047197",
"0.69757587",
"0.6969423",
"0.6937527",
"0.69148386",
"0.68955475",
"0.6854094",
"0.68467414",
"0.6830523",
"0.6803937",
"0.679321... | 0.85976183 | 0 |
If you override this to change this path, please report it on the trailblazer/chat gitter channel, so we can find out best practices. | def translation_path
self.class.translation_path or self.class.controller_path.gsub("/", ".")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path; super; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def path; end",
"def ... | [
"0.70003855",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255",
"0.66015255"... | 0.0 | -1 |
GET /asientos/1 GET /asientos/1.json | def show
@asiento = Asiento.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @asiento }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\r\n ... | [
"0.6876067",
"0.68296695",
"0.68144566",
"0.678391",
"0.67683583",
"0.67624706",
"0.6738726",
"0.67040914",
"0.67040914",
"0.67040914",
"0.6697986",
"0.66918164",
"0.6687373",
"0.66843396",
"0.6682243",
"0.6680887",
"0.66802233",
"0.66802233",
"0.6667076",
"0.6653527",
"0.664... | 0.7079815 | 0 |
GET /asientos/new GET /asientos/new.json | def new
if params[:asiento]
@cuenta = params[:asiento][:cuentum_id]
elsif params[:cuentum_id]
@cuenta = params[:cuentum_id]
else
@cuenta = 1
end
@asiento = Asiento.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @asiento }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n... | [
"0.7601024",
"0.75981385",
"0.7574677",
"0.75746286",
"0.75476456",
"0.7539602",
"0.75200146",
"0.7502539",
"0.7501609",
"0.74877435",
"0.74850285",
"0.74642694",
"0.7458132",
"0.74462205",
"0.74383885",
"0.7435985",
"0.74296415",
"0.74150604",
"0.7410492",
"0.74043894",
"0.7... | 0.0 | -1 |
POST /asientos POST /asientos.json | def create
@asiento = Asiento.new(params[:asiento])
respond_to do |format|
if @asiento.save
format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }
format.json { render :json => @asiento, :status => :created, :location => @asiento }
else
format.html { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @asiento_de_servicio = AsientoDeServicio.new(asiento_de_servicio_params)\n\n respond_to do |format|\n if @asiento_de_servicio.save\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully created.' }\n format.json { render :show, status: ... | [
"0.6656537",
"0.6623295",
"0.66133624",
"0.6604382",
"0.65665084",
"0.6549814",
"0.6462758",
"0.6450483",
"0.6422279",
"0.6413744",
"0.6411165",
"0.6408491",
"0.6394333",
"0.6392687",
"0.6385258",
"0.6342003",
"0.6334107",
"0.6323287",
"0.6320211",
"0.6312363",
"0.6305237",
... | 0.71089894 | 0 |
PUT /asientos/1 PUT /asientos/1.json | def update
@asiento = Asiento.find(params[:id])
respond_to do |format|
if @asiento.update_attributes(params[:asiento])
format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }
format.json { head :ok }
else
format.html { render :action => "edit" }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n ... | [
"0.6556405",
"0.6551441",
"0.6497666",
"0.64903224",
"0.6445712",
"0.6405379",
"0.63792807",
"0.6349046",
"0.6307455",
"0.6307455",
"0.6299395",
"0.62968403",
"0.62780756",
"0.6273915",
"0.6272544",
"0.6265299",
"0.6231454",
"0.6218707",
"0.6216442",
"0.61881596",
"0.61867595... | 0.67034554 | 0 |
DELETE /asientos/1 DELETE /asientos/1.json | def destroy
@asiento = Asiento.find(params[:id])
@asiento.destroy
respond_to do |format|
format.html { redirect_to asientos_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { r... | [
"0.7383831",
"0.73422056",
"0.72715914",
"0.721942",
"0.7215976",
"0.7191839",
"0.71890056",
"0.71890056",
"0.71884936",
"0.7174156",
"0.71736294",
"0.71696514",
"0.7166055",
"0.7157929",
"0.7152389",
"0.71520364",
"0.7150671",
"0.7145297",
"0.71365464",
"0.7130121",
"0.71275... | 0.74778503 | 0 |
Will need to be an ajax call | def create
num = params['number-of-records'].to_i
if (!num.is_a? Numeric) || (num < 1)
@errors = { number_of_records: "Not a valid number" }
render :new and return
end
queue_creation(num)
flash[:notice] = 'success'
render :new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xhr?; end",
"def xhr_script; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def non_xhr_javascript_respon... | [
"0.68746495",
"0.6768978",
"0.6437153",
"0.6437153",
"0.6437153",
"0.6437153",
"0.6437153",
"0.6437153",
"0.6437153",
"0.6437153",
"0.6437153",
"0.6437153",
"0.6437153",
"0.6416998",
"0.63489425",
"0.60939336",
"0.60662454",
"0.6063672",
"0.6039254",
"0.6020568",
"0.5993914",... | 0.0 | -1 |
Return an unused ipaddress to the pool of free ips. | def release
requires :ip
raise Fog::Errors::Error.new('You can\'t release a ip that is attached to a server') if attached?
service.ip_release(
:ipaddress => identity
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unused_ip args = {}\n # first check if we already have a record for this host\n # if we do, we can simply reuse the same ip address.\n if args[:mac] and r=has_mac?(args[:mac], :all) and valid_range(args).include?(r.ip)\n logger.debug \"Found an existing dhcp record #{r}, reusing...\"\n ... | [
"0.68634725",
"0.65382165",
"0.63145036",
"0.63127816",
"0.6061067",
"0.5905453",
"0.5880741",
"0.5867372",
"0.5830078",
"0.58112174",
"0.5773094",
"0.57569003",
"0.57483476",
"0.5669865",
"0.56631786",
"0.56385463",
"0.5593454",
"0.5554141",
"0.5536858",
"0.55311227",
"0.550... | 0.48840737 | 76 |
Add an ipadress to the server. | def attach(server)
requires :ip
server = server.serverid if server.is_a?(Fog::Compute::Glesys::Server)
raise Fog::Errors::Error.new("Ip is already attached to a server, #{serverid}") unless serverid.nil?
data = service.ip_add(
:ipaddress => identity,
:serv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_ip(vid, ip = nil)\n perform_request(action: 'vserver-addip', vserverid: vid, ipv4addr: ip)\n returned_parameters['ipaddress']\n end",
"def add_ip(vid)\n perform_request(:action => 'vserver-addip', :vserverid => vid)\n end",
"def add_ip(ip)\n @ips << L3::Misc.ipv42long(ip)\n end... | [
"0.7570505",
"0.7546323",
"0.71972823",
"0.6719164",
"0.65939975",
"0.64902294",
"0.62588936",
"0.6233921",
"0.6212587",
"0.62070584",
"0.6196137",
"0.61878836",
"0.61852574",
"0.6143915",
"0.6118642",
"0.60786575",
"0.6033782",
"0.59621525",
"0.5862306",
"0.5857953",
"0.5856... | 0.6330424 | 6 |
Remove an ip from the server | def remove(options = {})
requires :ip
raise Fog::Errors::Error.new('Ip is not attached to a server.') if serverid.nil?
data = service.ip_remove({:ipaddress => ip}.merge!(options)).body["response"]["details"]
merge_attributes data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_ip(ip)\n send_req({a: :nul, key: ip})\n end",
"def del_ip(vid, ip_address)\n perform_request(:action => 'vserver-delip', :vserverid => vid, :ipaddr => ip_address)\n end",
"def del_ip(vid, ip_address)\n perform_request(action: 'vserver-delip', vserverid: vid, ipaddr: ip_address)\... | [
"0.837271",
"0.775697",
"0.7640873",
"0.7242323",
"0.7193714",
"0.6915873",
"0.68353343",
"0.6731975",
"0.66588897",
"0.6559205",
"0.6512272",
"0.64879537",
"0.6466169",
"0.64426416",
"0.64295506",
"0.64095753",
"0.64095753",
"0.63255733",
"0.62750745",
"0.62750745",
"0.62750... | 0.778231 | 1 |
Remove the ip from a server and release it | def destroy
requires :ip
remove(:release => true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_server( host, port )\n server = get_server( host, port )\n Penctl.update_server( @pen, server[:slot], :address => '0.0.0.0', :port => 0 )\n !server_in_pool? host, port\n end",
"def release\n requires :ip\n raise Fog::Errors::Error.new('You can\\'t release a ip that is attac... | [
"0.7610677",
"0.7224442",
"0.713073",
"0.693812",
"0.68630564",
"0.6768808",
"0.670111",
"0.66640794",
"0.6643888",
"0.6471791",
"0.6366675",
"0.6281625",
"0.62719125",
"0.6230515",
"0.6224022",
"0.6161802",
"0.6161802",
"0.6161802",
"0.61339664",
"0.60984176",
"0.60871845",
... | 0.7327958 | 1 |
Changing properties for this resource Change the email address for a particular user. | def email
connect
user = self.class.query('CMD_API_SHOW_USER_CONFIG',
:user => resource[:username]
)
return user["email"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user_email\n @user_email = UserEmail.find(params[:id])\n end",
"def email_set(address)\n self.email.set address\n end",
"def email_address=(value)\n @email_address = value\n end",
"def email_address=(value)\n @email_address = value\n ... | [
"0.7011558",
"0.69448566",
"0.6941896",
"0.6941896",
"0.69344735",
"0.69210446",
"0.6893802",
"0.688534",
"0.688534",
"0.68703854",
"0.68378115",
"0.6835706",
"0.67494833",
"0.6688317",
"0.6665663",
"0.66523445",
"0.66434675",
"0.66299486",
"0.6592412",
"0.64995426",
"0.64768... | 0.0 | -1 |
Change the password for the admin user. | def password
connect
password = self.class.query('CMD_API_VERIFY_PASSWORD',
:user => resource[:username],
:passwd => resource[:password]
)
if password["valid"] == "1"
return resource[:password]
else
return "********"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_password\n @admin.password = Admin.get_encrypted_password(@new_password, @login_salt_d)\n @admin.save!\n end",
"def change_password!(password)\n json = JSON.generate(:changePassword => { :adminPass => password })\n @compute.connection.req('POST', \"/servers/#{@id}/action\"... | [
"0.8285566",
"0.82437265",
"0.80358446",
"0.7843077",
"0.7824117",
"0.77160263",
"0.76276034",
"0.7516271",
"0.7495775",
"0.7483594",
"0.7474742",
"0.74624413",
"0.74271274",
"0.74269277",
"0.741125",
"0.73941094",
"0.7355444",
"0.7343207",
"0.73274547",
"0.7319717",
"0.72867... | 0.0 | -1 |
Deletes the file that was uploaded, unless it's an UploadedFile. | def _upload(io, delete: delete_raw?, **options)
super(io, delete: delete, **options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(uploaded_file, context)\n uploaded_file.delete\n end",
"def delete(uploaded_file, context = {})\n _delete(uploaded_file, context)\n uploaded_file\n end",
"def _delete(uploaded_file, context)\n remove(uploaded_file, context)\n end",
"def dele... | [
"0.80114794",
"0.7912727",
"0.7889189",
"0.78675556",
"0.76353604",
"0.7580685",
"0.7566495",
"0.75007904",
"0.74702793",
"0.746301",
"0.73980886",
"0.72938734",
"0.72689754",
"0.7256384",
"0.7233531",
"0.7231319",
"0.7183192",
"0.7181554",
"0.716378",
"0.71576625",
"0.712539... | 0.0 | -1 |
GET /suppliers/1 GET /suppliers/1.xml | def show
@supplier = Supplier.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @supplier }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @catalogs_supply = Catalogs::Supply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalogs_supply }\n end\n end",
"def show\n @warehouse_supplier = WarehouseSupplier.find(params[:id])\n\n respond_to do |format|\n ... | [
"0.6660948",
"0.66276795",
"0.65977484",
"0.65465385",
"0.6439535",
"0.6365285",
"0.6342151",
"0.6323493",
"0.630529",
"0.6245441",
"0.6223902",
"0.6223902",
"0.6223902",
"0.617391",
"0.61704326",
"0.6157607",
"0.61438644",
"0.61083007",
"0.61058295",
"0.6095027",
"0.6094453"... | 0.7136735 | 1 |
POST /suppliers POST /suppliers.xml | def create
@supplier = Supplier.new(params[:supplier])
respond_to do |format|
if @supplier.save
format.html {
redirect_to(medicines_url)
}
format.xml { render :xml => @supplier, :status => :created, :location => @supplier }
else
format.html { render :action... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @supplier = Supplier.new(params[:supplier])\n \n respond_to do |format|\n if @supplier.save\n flash.now[:notice] = 'Supplier was successfully created.'\n format.html { redirect_to(suppliers_path) }\n format.xml { render :xml => @supplier, :status => :created, :locat... | [
"0.66206014",
"0.6446516",
"0.62613267",
"0.61770946",
"0.6125736",
"0.61216307",
"0.6079917",
"0.60690737",
"0.6047322",
"0.6028054",
"0.6008493",
"0.5885715",
"0.5875238",
"0.58715147",
"0.5847204",
"0.57826024",
"0.57712686",
"0.5752866",
"0.5734006",
"0.5703061",
"0.56898... | 0.6129488 | 4 |
PUT /suppliers/1 PUT /suppliers/1.xml | def update
@supplier = Supplier.find(params[:id])
respond_to do |format|
if @supplier.update_attributes(params[:supplier])
format.html {
redirect_to(medicines_url)
}
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @pagetitle = \"Edit supplier\"\n \n @supplier = Supplier.find(params[:id])\n\n respond_to do |format|\n if @supplier.update_attributes(params[:supplier])\n format.html { redirect_to(@supplier, :notice => 'Supplier was successfully updated.') }\n format.xml { head :ok }\... | [
"0.6662371",
"0.6547709",
"0.6525773",
"0.65177065",
"0.6401195",
"0.6172407",
"0.61698604",
"0.61642784",
"0.61593014",
"0.6123787",
"0.6121013",
"0.6095022",
"0.60845506",
"0.6034941",
"0.6033795",
"0.6014588",
"0.5997061",
"0.59880537",
"0.5981467",
"0.5955426",
"0.5949045... | 0.64906967 | 4 |
DELETE /suppliers/1 DELETE /suppliers/1.xml | def destroy
@supplier = Supplier.find(params[:id])
@supplier.destroy
respond_to do |format|
format.html { redirect_to(suppliers_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @supplier = Supplier.find(params[:id])\n \n # Erase supplier id for products from supplier\n products = Product.find(:all, :conditions => {:supplier_id => @supplier[:id]})\n \n for product in products\n product.supplier_id = nil\n product.save\n end\n \n @company ... | [
"0.6820624",
"0.66658115",
"0.6604435",
"0.65774745",
"0.65617216",
"0.6550284",
"0.64589226",
"0.64329237",
"0.6420457",
"0.63684416",
"0.63623995",
"0.63248175",
"0.63070196",
"0.63054174",
"0.62671995",
"0.62368345",
"0.62368345",
"0.62368345",
"0.62364316",
"0.6231228",
"... | 0.71366525 | 0 |
GET /procategories GET /procategories.json | def index
if user_signed_in?
procategory = Procategory.all.order(ddc: :asc).first
@procategories = paginate(procategory.cousin)
else
redirect_to projects_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_ba... | [
"0.6579501",
"0.64657307",
"0.6441868",
"0.6398581",
"0.62898004",
"0.6222949",
"0.6195408",
"0.6189549",
"0.6169855",
"0.6131386",
"0.6089713",
"0.6030071",
"0.6012406",
"0.59991485",
"0.59766626",
"0.5922549",
"0.5915776",
"0.5886919",
"0.5885034",
"0.5866742",
"0.5856876",... | 0.0 | -1 |
GET /procategories/1 GET /procategories/1.json | def show
# @procategories = active_procategories_follow_ddc_level(@procategory.level)
# @procategories = paginate(@procategory.cousin)
@procategories = @procategory.cousin
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_ba... | [
"0.6556859",
"0.6373739",
"0.6313001",
"0.62521076",
"0.621967",
"0.6169489",
"0.60641193",
"0.60497004",
"0.60064006",
"0.6005007",
"0.5992968",
"0.59577316",
"0.5937739",
"0.5937366",
"0.591767",
"0.58852243",
"0.5861452",
"0.5849132",
"0.5843688",
"0.58413255",
"0.5821703"... | 0.57681614 | 31 |
POST /procategories POST /procategories.json | def create
@procategory = Procategory.new(procategory_params)
respond_to do |format|
if @procategory.save
format.html { redirect_to @procategory, notice: 'Procategory was successfully created.' }
format.json { render :show, status: :created, location: @procategory }
else
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend",
"def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n json_create(cat... | [
"0.6171143",
"0.5915709",
"0.56955636",
"0.5481805",
"0.5460977",
"0.54219675",
"0.5404319",
"0.53936297",
"0.5333039",
"0.53169835",
"0.52751696",
"0.52530235",
"0.52274287",
"0.52234846",
"0.5213772",
"0.5209188",
"0.51990515",
"0.51988107",
"0.5140524",
"0.5108111",
"0.508... | 0.0 | -1 |
PATCH/PUT /procategories/1 PATCH/PUT /procategories/1.json | def update
respond_to do |format|
if @procategory.update(procategory_params)
format.html { redirect_to @procategory, notice: 'Procategory was successfully updated.' }
format.json { render :show, status: :ok, location: @procategory }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n json_update(category,category_params, Category)\n end",
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @pcategory = Pcategory.find(params[:id])\n\n respond_to do |format|\n ... | [
"0.66494465",
"0.6370149",
"0.6079169",
"0.5850971",
"0.5845074",
"0.58146465",
"0.5726418",
"0.56935775",
"0.5691445",
"0.56820154",
"0.5664894",
"0.5642891",
"0.56157166",
"0.55997586",
"0.55948627",
"0.5586168",
"0.55762523",
"0.5575931",
"0.5570004",
"0.5567352",
"0.55618... | 0.5355495 | 53 |
DELETE /procategories/1 DELETE /procategories/1.json | def destroy
@procategory.destroy
respond_to do |format|
format.html { redirect_to procategories_url_url, notice: 'Procategory was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_category(name)\n data_array = JSON.parse(File.read(File_path))\n category_item = find_category(name)\n data_array.delete(category_item)\n File.open(File_path, 'w') { |f| f.write(data_array.to_json) }\nend",
"def destroy\n @pcategory = Pcategory.find(params[:id])\n @pcategory.destroy\n\n r... | [
"0.66628754",
"0.63809294",
"0.6289484",
"0.61632216",
"0.61484766",
"0.61474234",
"0.6109296",
"0.60619235",
"0.6057195",
"0.60384226",
"0.60311556",
"0.6030224",
"0.60195154",
"0.6010547",
"0.59986514",
"0.59968346",
"0.5980978",
"0.59760076",
"0.59703696",
"0.5951126",
"0.... | 0.5753137 | 69 |
Use callbacks to share common setup or constraints between actions. | def set_procategory
@procategory = Procategory.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 procategory_params
params.require(:procategory).permit(:name, :description, :ddc, :status)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /todos GET /todos.js GET /todos.json | def index
get_collections
respond_to do |format|
format.html # index.html.erb
format.json { render json: @todos }
format.js {}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n todo = Todo.find_by_id(params[:id])\n render json: todo.todos\n end",
"def index\n @todos = Todo.all\n json_response(@todos)\n end",
"def index\n @todos = @list.todos\n render json: @todos\n end",
"def index\n @todos = Todo.all\n render json: @todos\n ... | [
"0.7711774",
"0.76359534",
"0.75982624",
"0.7541758",
"0.7378283",
"0.73303777",
"0.7316665",
"0.7248222",
"0.71930677",
"0.7184554",
"0.7171585",
"0.71711046",
"0.71310836",
"0.7122729",
"0.7122729",
"0.70604014",
"0.70405",
"0.7021408",
"0.6992203",
"0.69629776",
"0.692925"... | 0.7534198 | 4 |
GET /todos/1 GET /todos/1.js GET /todos/1.json | def show
## Creating the todo object
@todo = Todo.find(params[:id])
respond_to do |format|
format.html { get_collections and render :action => :index }
format.json { render json: @todo }
format.js {}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n todo = Todo.find_by_id(params[:id])\n render json: todo.todos\n end",
"def show\n puts params[:id]\n render json: Todo.find(params[:id])\n end",
"def index\n \n get_collections\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json... | [
"0.7422701",
"0.73975724",
"0.72320676",
"0.7164145",
"0.7089211",
"0.7089211",
"0.7083907",
"0.7060265",
"0.70389956",
"0.70335346",
"0.70272255",
"0.70086104",
"0.6980802",
"0.6912677",
"0.6891824",
"0.6859551",
"0.683808",
"0.675159",
"0.6725206",
"0.6714177",
"0.6711252",... | 0.70064133 | 12 |
GET /todos/new GET /todos/new.json | def new
## Intitializing the todo object
@todo = Todo.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @todo }
format.js {}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @todo = @list.todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end... | [
"0.82534343",
"0.81317174",
"0.81317174",
"0.81317174",
"0.81317174",
"0.81317174",
"0.79331213",
"0.7730152",
"0.76484275",
"0.75629133",
"0.7425094",
"0.7378634",
"0.7375036",
"0.73503995",
"0.7332033",
"0.73296523",
"0.725736",
"0.72228205",
"0.72228205",
"0.7193309",
"0.7... | 0.76528966 | 8 |
POST /todos POST /todos.js POST /todos.json | def create
## Creating the todo object
@todo = Todo.new(params[:todo])
## Validating the data
@todo.valid?
respond_to do |format|
if @todo.errors.blank?
# Saving the todo object
@todo.save
# Setting the flash message
message = trans... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @todo = Todo.new(todo_params)\n if @todo.save\n render json: @todo, status: :created, location: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @todo = Todo.create(todo_params)\n render json: @todo\n end",
... | [
"0.7419653",
"0.73879904",
"0.73402685",
"0.7291297",
"0.72202003",
"0.71341187",
"0.71293116",
"0.7117117",
"0.7102709",
"0.70781934",
"0.70047367",
"0.69874334",
"0.69500446",
"0.69064474",
"0.69064474",
"0.69064474",
"0.68629444",
"0.6857681",
"0.68404657",
"0.6820593",
"0... | 0.63162595 | 47 |
PUT /todos/1 PUT /todos/1.js PUT /todos/1.json | def update
## Fetching the todo
@todo = Todo.find(params[:id])
## Updating the @todo object with params
@todo.update_attributes(params[:todo])
## Validating the data
@todo.valid?
respond_to do |format|
if @todo.errors.blank?
# Saving the todo object
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n ... | [
"0.7131997",
"0.6981046",
"0.695444",
"0.68479663",
"0.6833454",
"0.67436075",
"0.65949714",
"0.6583433",
"0.6571116",
"0.6482909",
"0.6447444",
"0.64456993",
"0.6406033",
"0.6378308",
"0.6331252",
"0.6331252",
"0.6326825",
"0.63094217",
"0.629192",
"0.6283139",
"0.6266731",
... | 0.0 | -1 |
DELETE /todos/1 DELETE /todos/1.js DELETE /todos/1.json | def destroy
## Fetching the todo
@todo = Todo.find(params[:id])
respond_to do |format|
## Destroying the todo
@todo.destroy
# Fetch the todos to refresh ths list and details box
get_collections
@todo = @todos.first
# Setting the flash message
mess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end",
"d... | [
"0.74516624",
"0.74004596",
"0.7392175",
"0.7346793",
"0.732748",
"0.7305443",
"0.7291463",
"0.7291463",
"0.7277803",
"0.7243324",
"0.7231177",
"0.7210547",
"0.7194423",
"0.7167435",
"0.71627825",
"0.7143053",
"0.71104544",
"0.7108961",
"0.70782995",
"0.7057364",
"0.7054111",... | 0.66952527 | 77 |
This challenge took me 1 hours. Pseudocode 1. Iterate through the input array. 2. Use an if/else statement to substitute number as "Fizz" when it is multiple of 3. Check it by using a modulus equation. 3. Use an if/else statement to substitute number as "Buzz" when it is multiple of 3. Check it by using a modulus equat... | def super_fizzbuzz(array)
buzz_array = []
array.each do |x|
if x % 3 == 0 && x % 5 != 0
buzz_array.push("Fizz")
elsif x % 3 != 0 && x % 5 == 0
buzz_array.push("Buzz")
elsif x % 3 == 0 && x % 5 == 0
buzz_array.push("FizzBuzz")
else
buzz_array.push(x)
end
end
p buzz_arr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def super_fizzbuzz(array)\n length = array.length\n # print length\n i = 0\n while i < length\n if (array[i] % 3 == 0 && array[i] % 5 != 0)\n array[i] = \"Fizz\"\n elsif (array[i] % 5 == 0) && (array[i] % 3 != 0)\n array[i] = \"Buzz\"\n elsif (array[i] % 3 == 0) && (array[i] % 5 == 0)\n ... | [
"0.81140435",
"0.8055787",
"0.80475193",
"0.8004973",
"0.7975439",
"0.79099756",
"0.7909396",
"0.78928286",
"0.7876684",
"0.7860937",
"0.7859097",
"0.78410774",
"0.7836504",
"0.7830062",
"0.782719",
"0.77665246",
"0.77621436",
"0.77590877",
"0.77429444",
"0.77393895",
"0.7722... | 0.75762516 | 44 |
super_fizzbuzz([30, 9, 11, 5, 2, 1, 15]) Refactored Solution | def super_fizzbuzz(array)
array.map! do |x|
if x % 3 == 0 && x % 5 != 0
x = "Fizz"
elsif x % 3 != 0 && x % 5 == 0
x = "Buzz"
elsif x % 3 == 0 && x % 5 == 0
x = "FizzBuzz"
else
x
end
end
p array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def super_fizzbuzz(array)\n\tarray.map do |num| #got rid of the ! that I had in the original solution. There's no need to alter the underlying array here.\n\t\tif num % 15 == 0\n\t\t\t\"FizzBuzz\"\n\t\telsif num % 5 == 0\n\t\t\t\"Buzz\"\n\t\telsif num % 3 == 0\n\t\t\t\"Fizz\"\n\t\telse\n\t\t\tnum\n\t\tend\n\tend\n... | [
"0.816183",
"0.8149792",
"0.8129115",
"0.8128166",
"0.8120666",
"0.8110446",
"0.8107032",
"0.80678904",
"0.805571",
"0.8040294",
"0.8018086",
"0.7990148",
"0.79723036",
"0.79563147",
"0.794545",
"0.79410136",
"0.79362303",
"0.79306674",
"0.79306674",
"0.7927501",
"0.7926866",... | 0.0 | -1 |
Callback from unit of work | def persist_new(entity)
raise NotImplementedError, "Abstract method"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback\n end",
"def callback\n\n end",
"def callbacks; end",
"def callbacks; end",
"def callback\n\tend",
"def done; end",
"def on_success(&block); end",
"def run_completed\n end",
"def do_work\n end",
"def callback=(_arg0); end",
"def run() end",
"def executor; end",
"def... | [
"0.76312315",
"0.75260466",
"0.70943034",
"0.70943034",
"0.7090197",
"0.6913173",
"0.68382806",
"0.6834737",
"0.6807393",
"0.67519",
"0.6710687",
"0.668136",
"0.668136",
"0.668136",
"0.65567505",
"0.65285856",
"0.6525994",
"0.6521277",
"0.6467666",
"0.6427604",
"0.6427604",
... | 0.0 | -1 |
Create a new NetServer | def initialize
@j_del = org.vertx.java.platform.impl.JRubyVerticleFactory.vertx.createNetServer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_server\n\n end",
"def create_server\n raise NotImplementedError, \"Implement #{__callee__} in #{self.class.to_s}\"\n end",
"def create_server\n\t\treturn Hglib::Server.new( self.path.to_s )\n\tend",
"def create_net_server(options=nil)\n if !block_given? && options == nil\n ret... | [
"0.7544173",
"0.75138646",
"0.7405136",
"0.7283611",
"0.6891656",
"0.6885358",
"0.6847751",
"0.6823103",
"0.68155944",
"0.67189777",
"0.67054754",
"0.66682875",
"0.6663761",
"0.665142",
"0.6589348",
"0.6586139",
"0.65718955",
"0.6493628",
"0.637414",
"0.6337562",
"0.63375354"... | 0.56071675 | 68 |
Instruct the server to listen for incoming connections. | def listen(port, host = "0.0.0.0", &hndlr)
@j_del.listen(port, host, ARWrappedHandler.new(hndlr) {|j_del| self})
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listen\n #Start listening for input.\n start_listen\n\n #Start listening for errors.\n start_listen_errors\n end",
"def start_listening\n # We don't want to spawn an extra listener\n return if Thread === @ioloop_thread\n\n # Don't listen if socket is dead\n return if @dead_socket\n\n... | [
"0.74713737",
"0.73607373",
"0.7308152",
"0.7301355",
"0.71778655",
"0.70803076",
"0.70011437",
"0.69936836",
"0.69761854",
"0.69114417",
"0.6887569",
"0.68759584",
"0.6869655",
"0.6835304",
"0.6751885",
"0.66875535",
"0.6653641",
"0.66257",
"0.66123855",
"0.661057",
"0.65710... | 0.0 | -1 |
Close the server. The handler will be called when the close is complete. | def close(&hndlr)
@j_del.close(ARWrappedHandler.new(hndlr))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close #:nodoc:\n @server.shutdown\n end",
"def close\n @server.close if @server\n @accept_thread.kill if @accept_thread\n @accept_thread = nil\n end",
"def close\n handler.close\n end",
"def close(handler)\n puts '! Connection closed' if handler.bot.debug\n exi... | [
"0.8024808",
"0.750885",
"0.73952436",
"0.7316583",
"0.70426106",
"0.7014021",
"0.6897552",
"0.6895027",
"0.68874156",
"0.67862636",
"0.6735101",
"0.6675819",
"0.6632647",
"0.65886104",
"0.65763664",
"0.6473579",
"0.64713335",
"0.6466356",
"0.64616174",
"0.64507043",
"0.64276... | 0.0 | -1 |
Create a new NetClient | def initialize
@j_del = org.vertx.java.platform.impl.JRubyVerticleFactory.vertx.createNetClient
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_net_client(options=nil)\n if !block_given? && options == nil\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createNetClient, []).call(),::Vertx::NetClient)\n elsif options.class == Hash && !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:... | [
"0.7215478",
"0.64537585",
"0.63463",
"0.6291206",
"0.62472284",
"0.62472284",
"0.62472284",
"0.6093936",
"0.6076479",
"0.60676557",
"0.6019179",
"0.59623754",
"0.59620136",
"0.5911892",
"0.5908667",
"0.59062445",
"0.5900308",
"0.5900251",
"0.5884371",
"0.5882312",
"0.5860536... | 0.5541616 | 46 |
Set the reconnect attempts | def reconnect_attempts=(val)
@j_del.setReconnectAttempts(val)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconnect_attempts(val = nil)\n if val\n @j_del.setReconnectAttempts(val)\n self\n else\n @j_del.getReconnectAttempts\n end\n end",
"def setup_reconnect\n delay = @reconnect_manager.get_next_reconnect_delay(@last_status_code)\n\n if delay == -1\n execute_call... | [
"0.78517187",
"0.7324485",
"0.7285085",
"0.7074972",
"0.6946568",
"0.6852686",
"0.6771611",
"0.67085654",
"0.66398823",
"0.65441066",
"0.6501099",
"0.6480224",
"0.6480224",
"0.6480224",
"0.6480224",
"0.6480224",
"0.6480224",
"0.6480224",
"0.6409908",
"0.6359454",
"0.633161",
... | 0.8185114 | 0 |
Set or Get the reconnect attempts for a fluent API | def reconnect_attempts(val = nil)
if val
@j_del.setReconnectAttempts(val)
self
else
@j_del.getReconnectAttempts
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconnect_attempts=(val)\n @j_del.setReconnectAttempts(val)\n self\n end",
"def connect_retry_period\n NewRelic::CONNECT_RETRY_PERIODS[connect_attempts] || NewRelic::MAX_RETRY_PERIOD\n end",
"def reconnect\n close_connection\n with_retries do\n open_connection\... | [
"0.79198396",
"0.69169426",
"0.6683842",
"0.6558507",
"0.65125614",
"0.6429182",
"0.64144564",
"0.64109707",
"0.6409685",
"0.6363412",
"0.6362276",
"0.6338827",
"0.6312624",
"0.6277107",
"0.62641513",
"0.62323576",
"0.6159004",
"0.61071384",
"0.6075393",
"0.6029167",
"0.60268... | 0.78938055 | 1 |
Set the reconnect interval | def reconnect_interval=(val)
@j_del.setReconnectInterval(val)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconnect_interval(val = nil)\n if val\n @j_del.setReconnectInterval(val)\n self\n else\n @j_del.getReconnectInterval\n end\n end",
"def increase_reconnect_delay\n\n @reconnect_delay *= @parameters[:back_off_multiplier] if @parameters[:use_exponential_back_off]\n ... | [
"0.7988873",
"0.7396856",
"0.7059088",
"0.6973456",
"0.69716585",
"0.69019485",
"0.6843532",
"0.6843532",
"0.6808737",
"0.6736302",
"0.67169523",
"0.6714892",
"0.66141",
"0.66141",
"0.66141",
"0.65751255",
"0.655817",
"0.6553726",
"0.6553726",
"0.65262794",
"0.6504657",
"0.... | 0.8426762 | 0 |
Set or Get the reconnect interval for a fluent API | def reconnect_interval(val = nil)
if val
@j_del.setReconnectInterval(val)
self
else
@j_del.getReconnectInterval
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconnect_interval=(val)\n @j_del.setReconnectInterval(val)\n self\n end",
"def retry_interval\n @options[:retry_interval]\n end",
"def retry_interval\n @retry_interval ||= options[:retry_interval] || RETRY_INTERVAL\n end",
"def increase_reconnect_delay\n\n @reconnec... | [
"0.7890576",
"0.734678",
"0.7102234",
"0.6914537",
"0.6568153",
"0.64668643",
"0.6283856",
"0.62293357",
"0.62181073",
"0.62181073",
"0.62181073",
"0.6128212",
"0.6042708",
"0.6004401",
"0.5946881",
"0.5892632",
"0.586785",
"0.58567524",
"0.58040136",
"0.57732517",
"0.5766353... | 0.77804065 | 1 |
Set the connect timeout | def connect_timeout=(val)
@j_del.setConnectTimeout(val)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connecttimeout=(value)\n Curl.set_option(:connecttimeout, value_for(value, :int), handle)\n end",
"def setconnectiontimeout(timeout)\r\n setvalue(@@CONNECTION_TIMEOUT, timeout)\r\n end",
"def connecttimeout_ms=(value)\n Curl.set_option(:connecttimeout_ms, value_for(value, :int), hand... | [
"0.8465598",
"0.83829916",
"0.8313694",
"0.8260736",
"0.8033517",
"0.8021386",
"0.79782677",
"0.7954914",
"0.7954914",
"0.79349846",
"0.7767765",
"0.7506242",
"0.7309485",
"0.7291669",
"0.72588366",
"0.7254527",
"0.71991545",
"0.71975833",
"0.7154245",
"0.7111544",
"0.7103478... | 0.8416819 | 1 |
Set or Get the connect timeout for a fluent API | def connect_timeout(val = nil)
if val
@j_del.setConnectTimeout(val)
self
else
@j_del.getConnectTimeout
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connecttimeout=(value)\n Curl.set_option(:connecttimeout, value_for(value, :int), handle)\n end",
"def connecttimeout_ms=(value)\n Curl.set_option(:connecttimeout_ms, value_for(value, :int), handle)\n end",
"def connect_timeout=(new_timeout)\n if new_timeout && new_timeout.to_f... | [
"0.78490144",
"0.76198554",
"0.76061916",
"0.75837",
"0.75143427",
"0.744378",
"0.7369447",
"0.7366798",
"0.7298129",
"0.7235218",
"0.7192151",
"0.7192151",
"0.7166564",
"0.7048084",
"0.69746876",
"0.69746876",
"0.6955558",
"0.6912605",
"0.68721944",
"0.6861425",
"0.6830905",... | 0.7631517 | 1 |
Close the NetClient. Any open connections will be closed. | def close
@j_del.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n client.close\n @client = nil\n end",
"def close\n @client.close\n end",
"def close\n @client.close\n end",
"def close\n # Close the HTTP client:\n @client.close if @client\n end",
"def close\n # Close the HTTP client:\n @client.close if @clien... | [
"0.7501825",
"0.71817017",
"0.71817017",
"0.71360564",
"0.71360564",
"0.7074259",
"0.7072454",
"0.7036677",
"0.68077654",
"0.6793897",
"0.6783677",
"0.6774452",
"0.67010623",
"0.667316",
"0.6670166",
"0.6559774",
"0.6559774",
"0.65196437",
"0.63934964",
"0.6368603",
"0.635362... | 0.0 | -1 |
Upgrade channel to use SSL/TLS. Be aware that for this to work SSL must be configured. | def ssl
raise 'An handler must be provided' unless block_given?
@j_del.ssl InternalHandler.new(Proc.new)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upgrade_to_ssl\n if block_given?\n @j_del.java_method(:upgradeToSsl, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling upgrade_to_ssl()\"\n end",
"def ssl_cipher\n super\n end",... | [
"0.66194737",
"0.61186314",
"0.61093163",
"0.59823006",
"0.59615266",
"0.59594643",
"0.5958939",
"0.59222287",
"0.59222287",
"0.5902987",
"0.5879948",
"0.58755434",
"0.58755434",
"0.58652633",
"0.5821984",
"0.5821984",
"0.58126485",
"0.5791846",
"0.5771001",
"0.5771001",
"0.5... | 0.5127809 | 98 |
Returns true if NetSocket is SSL/TSL Encrypted. | def ssl?
@j_del.isSsl
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ssl?\n @transport_mode == '~'\n end",
"def ssl?\n !!(@socket.respond_to?(:context) && @socket.context)\n end",
"def ssl?\n ssl\n end",
"def ssl?\n return @ssl\n end",
"def ssl_enabled?\n\t\t\tssl && ssl_on\n\t\tend",
"def ssl?\n ssl.present?\n end",
"def ssl?... | [
"0.74304277",
"0.7359251",
"0.69981796",
"0.69185925",
"0.6877914",
"0.67965317",
"0.67712367",
"0.6752146",
"0.6646166",
"0.66149485",
"0.66149485",
"0.6546838",
"0.65355694",
"0.6527511",
"0.6472938",
"0.64627504",
"0.64627504",
"0.645857",
"0.64524007",
"0.64524007",
"0.64... | 0.65039605 | 14 |
Write a String to the socket. The handler will be called when the string has actually been written to the wire. | def write_str(str, enc = "UTF-8")
@j_del.write(str, enc)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(string)\n log :write, string\n @socket << string\n end",
"def write(string)\n @handle.write(string)\n end",
"def write str = \"\"\n @socket.write str + \"\\r\\n\"\n end",
"def write s\n raise RuntimeError, \"No socket\" unless @socket\n @socket.puts s += \"\\r\\n\... | [
"0.8154875",
"0.7725843",
"0.7561091",
"0.7460509",
"0.7412435",
"0.73816305",
"0.7093631",
"0.7048358",
"0.6903895",
"0.67870027",
"0.67554075",
"0.67315274",
"0.67063844",
"0.66943616",
"0.6674588",
"0.6652917",
"0.65700346",
"0.65248317",
"0.6507544",
"0.6506353",
"0.64557... | 0.0 | -1 |
Set a closed handler on the socket. | def close_handler(&hndlr)
@close_handler = hndlr
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_handler(&hndlr)\n @close_handler = hndlr;\n end",
"def shutdown_handler\n self.close unless self.closed?\n @sockets = []\n end",
"def set_end_handler(handler)\n @end_handler = handler\n end",
"def connection_closed(handler, reason=nil)\n logger.info [\"Connection to Vo... | [
"0.66443086",
"0.65206826",
"0.62995523",
"0.62606466",
"0.62123",
"0.61916214",
"0.61725134",
"0.6159241",
"0.61465263",
"0.61465263",
"0.6146057",
"0.613373",
"0.6112695",
"0.6087801",
"0.6030287",
"0.6016364",
"0.5993069",
"0.58895296",
"0.5843519",
"0.5841491",
"0.5771258... | 0.65000844 | 2 |
Tell the kernel to stream a file directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to stream files. | def send_file(file_path, &block)
if block.given?
@j_del.sendFile(file_path, ARWrappedHandler.new(block))
else
@j_del.sendFile(file_path)
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stream!\n @scratch.open(\"original\") { |file| yield file }\n end",
"def file_stream\n @file_stream ||= File.open(@file_path, \"rb\")\n end",
"def serve_file!\n ::File.open(file, \"r\") do | stream |\n serve_stream! stream, nil\n end\n end",
"def send_file(... | [
"0.63136196",
"0.6186494",
"0.61836493",
"0.61453116",
"0.6116233",
"0.61157954",
"0.60996825",
"0.6044728",
"0.6016067",
"0.59707457",
"0.5878318",
"0.58573806",
"0.5838263",
"0.58158684",
"0.5769728",
"0.5713491",
"0.5688666",
"0.56564426",
"0.5651768",
"0.5637673",
"0.5580... | 0.0 | -1 |
Return the Addrinfo to which the remote end of the socket is bound | def remote_address
if !@remote_addr
@remote_addr = Addrinfo.tcp(@j_del.remoteAddress().getAddress().getHostAddress(), @j_del.remoteAddress().getPort())
end
@remote_addr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sockaddr\n Socket.unpack_sockaddr_in(get_sockname).reverse\n end",
"def remote_address\n socket_address\n rescue Exception => e\n log_error('Could not infer remote address', e)\n nil\n end",
"def get_internal_ip_address\r\n sock = UDPSocket.new\r\n sock.connect('1.0.0.1',... | [
"0.76105297",
"0.7137577",
"0.69222265",
"0.6921774",
"0.68990123",
"0.68956214",
"0.682014",
"0.68077785",
"0.6725786",
"0.66536564",
"0.6604539",
"0.65393436",
"0.6510957",
"0.64901054",
"0.6484406",
"0.6407223",
"0.63636154",
"0.6340149",
"0.6291862",
"0.62453943",
"0.6224... | 0.5711236 | 68 |
Return the Addrinfo to which the local end of the socket is bound | def local_address
if !@local_addr
@local_addr = Addrinfo.tcp(@j_del.localAddress().getAddress().getHostAddress(), @j_del.localAddress().getPort())
end
@local_addr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sockaddr\n Socket.unpack_sockaddr_in(get_sockname).reverse\n end",
"def get_internal_ip_address\r\n sock = UDPSocket.new\r\n sock.connect('1.0.0.1', 1) #@igd_location.split('//').last.split('/').first.split(':').first\r\n return sock.addr.last\r\n rescue Exception\r\n return \"127.0.0.1\... | [
"0.7512188",
"0.6888722",
"0.6797162",
"0.6793369",
"0.6761839",
"0.66971684",
"0.6594219",
"0.6558707",
"0.65508544",
"0.65171224",
"0.65126777",
"0.6510816",
"0.6466497",
"0.6451215",
"0.6444485",
"0.63891023",
"0.63576496",
"0.6350145",
"0.63257205",
"0.623396",
"0.6226731... | 0.6255826 | 19 |
handles transcribed phone call message | def voice
reminder = Reminder.find(params[:id])
response = Twilio::TwiML::Response.new do |r|
r.Say 'This is a reminder message from the Remmyo service.',:voice => 'alice'
r.Say reminder.message, :voice => 'alice'
r.Say 'End of message.',:voice => 'man'
# r.Play 'http://linode.rabasa.com... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transcribe\n @call = Call.find(params[:id])\n @call.update_attribute :transcription_text, params[:TranscriptionText] || @call.transcription_text\n @call.update_attribute :transcription_status, params[:TranscriptionStatus] || @call.transcription_status\n \n render \"calls/twiml/recording/#{@call.... | [
"0.6381646",
"0.62731284",
"0.61604893",
"0.6155124",
"0.60213643",
"0.6006404",
"0.5954353",
"0.59402245",
"0.5824653",
"0.5810165",
"0.5756539",
"0.5725397",
"0.5686085",
"0.56682014",
"0.56232035",
"0.55690485",
"0.5543561",
"0.5541354",
"0.5528622",
"0.5520668",
"0.549090... | 0.0 | -1 |
need an index and a show page for wep n stuff. | def display
# Don't no why i thought i would need that. or if i need this.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end"... | [
"0.6854851",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",
"0.68540376",... | 0.0 | -1 |
Does this organisation have published content items of the given type? | def content_type?(content_type)
org_id = content_item.organisation.id
published_item_count = ContentItem.published_content_items_of_type_with_owning_org(content_type, org_id).count
published_item_count > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_item_content?(content)\n # TODO Stubbed - Requires definition and implementation\n end",
"def has_item_content?(content)\n # TODO Stubbed - Requires definition and implementation\n end",
"def published?\n [:public, :private].include?(self.status)\n end",
"def published_with_in... | [
"0.67797935",
"0.6742154",
"0.6736214",
"0.6658382",
"0.6587805",
"0.6554986",
"0.6547005",
"0.6518523",
"0.64980876",
"0.64980876",
"0.64630103",
"0.6434859",
"0.64320725",
"0.6424216",
"0.6413571",
"0.64019686",
"0.63964224",
"0.6378093",
"0.63576",
"0.63529676",
"0.6341612... | 0.86652637 | 0 |
Find the sum of all the multiples of 3 or 5 below 1000. | def Contained_Multiples(num1, num2)
product_collection = []
num1_multiplier = 1
num2_multiplier = 1
#multiply each by an increasing number until the product is larger than 1000
#place each of those products into a product collection
while num1 * num1_multiplier < 1000
product_collection << num1 * num1_multip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_sum_of_multiples_of_3_and_5_below_1000\n answer = 0\n for number in 1...1000\n answer += number if number % 3 == 0 || number % 5 == 0\n end\n answer\nend",
"def multiples_of_3_and_5\r\n total = 0\r\n (3...1000).each do |x|\r\n if x % 3 == 0 || x % 5 == 0\r\n # puts x\r\n total += x... | [
"0.8999699",
"0.8057348",
"0.80413264",
"0.7974684",
"0.7917786",
"0.79057515",
"0.78980875",
"0.78503156",
"0.7841568",
"0.7795457",
"0.77842164",
"0.77759385",
"0.7768338",
"0.7664244",
"0.7653686",
"0.76314574",
"0.76302135",
"0.7606942",
"0.76028085",
"0.75978535",
"0.757... | 0.0 | -1 |
GET /airlines GET /airlines.json | def index
@airlines = Airline.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def airlines(params={})\n perform_get('/airlines.xml', params)\n end",
"def airline\n fetch('aircraft.airline')\n end",
"def airline(id)\n perform_get(\"/airlines/#{id}.xml\")\n end",
"def show\n @airport = Airport.find(params[:id])\n @airlines = Aircompany.where(airport_id:... | [
"0.83804333",
"0.7430847",
"0.74280876",
"0.7240063",
"0.7162618",
"0.7042473",
"0.6843603",
"0.6685308",
"0.66804296",
"0.6649045",
"0.6613043",
"0.6503348",
"0.6372683",
"0.6365957",
"0.6365241",
"0.6361967",
"0.63155437",
"0.6284272",
"0.62060976",
"0.62029415",
"0.6177053... | 0.7634638 | 1 |
GET /airlines/1 GET /airlines/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def airlines(params={})\n perform_get('/airlines.xml', params)\n end",
"def airline(id)\n perform_get(\"/airlines/#{id}.xml\")\n end",
"def index\n @airlines = Airline.all\n end",
"def index\n @airlines = Airline.all\n end",
"def show\n @airport = Airport.find(params[:id])\n @... | [
"0.7988908",
"0.76110774",
"0.74477124",
"0.74477124",
"0.74226344",
"0.73654467",
"0.7105206",
"0.7041135",
"0.69724625",
"0.6936921",
"0.6819236",
"0.678618",
"0.6729849",
"0.6714291",
"0.66565025",
"0.66060793",
"0.6533331",
"0.6335597",
"0.6310361",
"0.6245347",
"0.619539... | 0.0 | -1 |
POST /airlines POST /airlines.json | def create
@airline = Airline.new(airline_params)
respond_to do |format|
if @airline.save
@user = User.create(:email=>params[:airline][:users][:email],:password=>params[:airline][:users][:password],:password_confirmation=>params[:airline][:users][:password],:airline_id=>@airline.id)
@... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @airline = Airline.new(airline_params)\n\n if @airline.save\n json_response(@airline.decorate.as_json(airplanes_details: true),\n :created)\n else\n json_response(@airline.errors, :unprocessable_entity)\n end\n e... | [
"0.7654577",
"0.6734232",
"0.671528",
"0.6631541",
"0.6496707",
"0.6376125",
"0.62579066",
"0.6225376",
"0.62176466",
"0.61957586",
"0.61957586",
"0.61439544",
"0.61247516",
"0.6041241",
"0.59856683",
"0.595942",
"0.5950083",
"0.5872129",
"0.58558995",
"0.584203",
"0.58340734... | 0.5929594 | 17 |
PATCH/PUT /airlines/1 PATCH/PUT /airlines/1.json | def update
respond_to do |format|
if @airline.update(airline_params)
format.html { redirect_to @airline, notice: 'Airline was successfully updated.' }
format.json { render :show, status: :ok, location: @airline }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @airline.update(airline_params)\n json_response(@airline.decorate.as_json(airplanes_details: true),\n :ok)\n else\n json_response(@airline.errors, :unprocessable_entity)\n end\n end",
"def update\n @airline = Airl... | [
"0.7437721",
"0.68906915",
"0.6804831",
"0.6656472",
"0.65429044",
"0.641312",
"0.6386863",
"0.6335779",
"0.63250136",
"0.63206613",
"0.6302367",
"0.6301702",
"0.630065",
"0.630065",
"0.630065",
"0.630065",
"0.630065",
"0.629753",
"0.6290762",
"0.6270923",
"0.62555873",
"0.... | 0.74112666 | 1 |
DELETE /airlines/1 DELETE /airlines/1.json | def destroy
@airline.destroy
respond_to do |format|
format.html { redirect_to airlines_url, notice: 'Airline was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @airline = Airline.find(params[:id])\n @airline.destroy\n\n respond_to do |format|\n format.html { redirect_to(airlines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @airlin = Airlin.find(params[:id])\n @airlin.destroy\n\n respond_to do |format|\n ... | [
"0.7590089",
"0.7214357",
"0.7075674",
"0.69410926",
"0.6903776",
"0.68871665",
"0.68871665",
"0.68871665",
"0.68871665",
"0.6869531",
"0.6868837",
"0.68521655",
"0.683103",
"0.68064207",
"0.68064207",
"0.68055904",
"0.67806286",
"0.67565656",
"0.6741658",
"0.67236483",
"0.67... | 0.76008946 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_airline
@airline = Airline.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.6165422",
"0.60457647",
"0.5946384",
"0.5916027",
"0.58905005",
"0.583495",
"0.5777223",
"0.56995213",
"0.56995213",
"0.56532377",
"0.5621348",
"0.5422839",
"0.54118705",
"0.54118705",
"0.54118705",
"0.53935355",
"0.5379617",
"0.53577393",
"0.53407264",
"0.53398263",
"0.53... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def airline_params
#params.require(:airline).permit( :airline_name, user_attributes: [:email] )
params.require(:airline).permit(:airline_name,:airline_address,:country,:contact_person_name,:contact_person_address,:contact_person_email,:contact_number,:iata_code,:caa_license,:user_id,:year_in_service,:airli... | {
"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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
id_change_map contains information how simulations ids should be updated we need to iterate through existing simulations and update them | def update_simulations(id_change_map)
Rails.logger.debug("Size of new ids: #{id_change_map.size}")
simulation_runs.where({}, {sort: { id: -1 }}).each do |simulation_run|
new_simulation_id = id_change_map[simulation_run.index]
Rails.logger.debug("Simulation id: #{simulation_run.index} -> #{new_simu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_option_ids(attrs_in, opt_map)\n qopts = attrs_in['question_options_attributes']\n qopts.each_pair do |_, attr_hash|\n old_id = attr_hash['id']\n new_id = opt_map[old_id]\n attr_hash['id'] = new_id\n end\n attrs_in\n end",
"def change_names(map, names, target... | [
"0.577878",
"0.5697412",
"0.5629351",
"0.561962",
"0.53792465",
"0.5352094",
"0.53397596",
"0.5338653",
"0.5326888",
"0.5316984",
"0.5283133",
"0.52157307",
"0.51845086",
"0.51588565",
"0.513903",
"0.5136634",
"0.51184624",
"0.51143265",
"0.51074404",
"0.51052433",
"0.5101445... | 0.8384055 | 0 |
Example options: parent_class_names: %w(Group), child_class_names: %w(Group User) | def has_neo4j_ancestry(options)
link_class_name = 'Neo4jAncestry::Link'
# Links (direct relationships between objects) are stored
# via ActiveRecord in the mysql database. (The neo4j database contains only
# redundant information and is used for fast queries.)
#
has_ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_class_name\n options[:parent] || \"Umanage::User\"\n end",
"def parent_class_name\n options[:parent] || determine_default_parent_class\n end",
"def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n ... | [
"0.6363014",
"0.60000813",
"0.5511754",
"0.54829425",
"0.5457315",
"0.53219473",
"0.53117675",
"0.5294638",
"0.52733284",
"0.5261036",
"0.51994956",
"0.5173889",
"0.5164614",
"0.51255226",
"0.5114314",
"0.5112777",
"0.50831044",
"0.50757205",
"0.5049916",
"0.50468105",
"0.502... | 0.519316 | 11 |
Attributes to copy over to the neo4j database. Example: attributes_to_copy_to_neo4j :name, :email | def attributes_to_copy_to_neo4j(*keys)
@attribute_keys_to_copy_to_neo4j = [] unless defined?(@attribute_keys_to_copy_to_neo4j)
@attribute_keys_to_copy_to_neo4j += keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:year] = self.year\n\t\tattrs[:age] = self.age\n\t\tattrs[:amount] = self.amount\n\t\tattrs[:rate] = self.rate\n\n\t\tattrs\n\tend",
"def attribute_keys_to_copy_to_neo4j\n self.class.instance_variable_get :@attribute_keys_to_copy_to_neo4j\n end",
"def co... | [
"0.7099481",
"0.69106305",
"0.6910031",
"0.6888065",
"0.68736875",
"0.6823265",
"0.6800811",
"0.6791908",
"0.67037046",
"0.6662614",
"0.6627632",
"0.659831",
"0.6572032",
"0.6542073",
"0.65272975",
"0.64738125",
"0.6468454",
"0.6466399",
"0.6339614",
"0.6292732",
"0.6282946",... | 0.6879978 | 4 |
The has_many method changes from Rails 3 to Rails 4. Since this gem supports both rails versions, this method is a wrapper. | def has_many_for_rails_3_and_4(association_name, conditions_hash, options)
if Rails.version.start_with? "4"
has_many(association_name, -> { where conditions_hash }, options)
elsif Rails.version.start_with? "3"
has_many(association_name, options.merge({conditions: conditions_hash}))
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_many(models)\n HasManyReflection.new models\nend",
"def has_many(name, options = {})\n options = HasManyOptions.new(name, self, options)\n define_method(name) do\n primary_key = self.id\n source_class = options.model_class\n source_class.where(options.foreign_key => primary_key)\n ... | [
"0.71218055",
"0.7112216",
"0.7065445",
"0.6957849",
"0.6943839",
"0.6902108",
"0.68973625",
"0.6853467",
"0.6849948",
"0.6819953",
"0.67785615",
"0.67583835",
"0.67387533",
"0.6720589",
"0.6631192",
"0.6600112",
"0.65490985",
"0.6490969",
"0.6482892",
"0.64666384",
"0.642108... | 0.6183744 | 38 |
=begin PROBLEM Input: Array Output: Array rules: Explicit rules: Write a method that rotates an array Moves the first element to the end of the array Original array should not be modified Do not use rotate or rotate! Implicit rules: A single element array should return the same array DATA STRUCTURE Array ALGORITHM Take... | def rotate_array(array)
array[1, array.size] << array[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_array(arr)\n\narr_new = arr.clone\narr_new.push(arr_new[0]).shift\narr_new\nend",
"def rotate_array(array)\n result = []\n array.each_with_index do |value, index|\n result.push(value) if index > 0\n end\n result.push(array[0])\n result\nend",
"def rotate_array(input_array)\n return input_ar... | [
"0.8461066",
"0.83848834",
"0.8370856",
"0.83222693",
"0.8316756",
"0.82905984",
"0.8289337",
"0.8288557",
"0.82879955",
"0.8284236",
"0.8259241",
"0.8242217",
"0.8241779",
"0.8241162",
"0.82072055",
"0.8189606",
"0.8182785",
"0.81824666",
"0.81824666",
"0.8167552",
"0.816281... | 0.8201132 | 15 |
checks the semantics of this AST | def check
@checker.check @program_node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _semantics_check(clazz, buffer)\n end",
"def handle_ast(ctx, ast)\n false\n end",
"def validate\n check_syntax\n end",
"def validate(model)\n # tree iterate the model, and call the checks for each element\n\n # While not strictly needed, here a check is made of the root (... | [
"0.66710854",
"0.63975304",
"0.63386923",
"0.62607515",
"0.6205319",
"0.61456144",
"0.5969322",
"0.59235036",
"0.58559215",
"0.5843761",
"0.58070326",
"0.573758",
"0.56909686",
"0.56330514",
"0.5585981",
"0.55339694",
"0.5531994",
"0.5529956",
"0.5529956",
"0.5498967",
"0.546... | 0.5731956 | 12 |
Helper method to temporarily set environment variables. | def with_environment(env)
save_vals = env.keys.collect { |k| [k, ENV[k.to_s]] }
begin
env.each { |k, v| ENV[k.to_s] = v }
yield
ensure
save_vals.each { |k, v| ENV[k.to_s] = v }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_and_set_environment\n check_env\n set_env\n end",
"def setenv(key, value)\n @setenv ||= {}\n @setenv[key] = value\n end",
"def env=(environment); end",
"def env=(environment); end",
"def set_env(env)\n current = Thread.current[ENVIRONMENT]\n Thread.cu... | [
"0.75467086",
"0.7158897",
"0.70524055",
"0.70524055",
"0.6901807",
"0.6889054",
"0.6854989",
"0.6834462",
"0.68008316",
"0.6781655",
"0.6734189",
"0.66984826",
"0.6697622",
"0.66448575",
"0.66258097",
"0.64833635",
"0.64431685",
"0.64394814",
"0.6438214",
"0.6420219",
"0.641... | 0.6113708 | 47 |
Access all the repositories stored. | def all
storage.map(&:repository)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repositories\n # TODO : merge with current data\n load_repos\n end",
"def repositories\n client.repositories(user_repo, @options)\n end",
"def repositories\n response = self.class.get('/repositories').body\n JSON.parse(response)\n end",
"def repos\n @repos ||= get(\"/repo... | [
"0.84609306",
"0.8225099",
"0.8086926",
"0.80252284",
"0.79366195",
"0.7870009",
"0.7863167",
"0.7702514",
"0.76854265",
"0.7673974",
"0.7659968",
"0.76295197",
"0.7573672",
"0.7539628",
"0.7518866",
"0.747013",
"0.7432434",
"0.7415489",
"0.73873174",
"0.73278236",
"0.7321285... | 0.7754723 | 7 |
Register a repository with the collection of Vedeu repositories. | def register(klass)
storage.add(klass) if klass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registered\n all.map do |repository|\n registered = repository.send(:registered)\n\n Vedeu.log(type: :store,\n message: \"Repository '#{repository.class.name}':\" \\\n \" #{registered.inspect}\".freeze)\n\n registered\n end\n end",... | [
"0.65018904",
"0.62614125",
"0.6118736",
"0.60983014",
"0.60117453",
"0.58386767",
"0.582913",
"0.5727964",
"0.5681436",
"0.5640452",
"0.5636788",
"0.5595138",
"0.55951124",
"0.55951124",
"0.55951124",
"0.55951124",
"0.5547938",
"0.5542421",
"0.5533951",
"0.54905576",
"0.5484... | 0.0 | -1 |
List all models stored in each registered repository. | def registered
all.map do |repository|
registered = repository.send(:registered)
Vedeu.log(type: :store,
message: "Repository '#{repository.class.name}':" \
" #{registered.inspect}".freeze)
registered
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_all_models\n # preload all models\n Dir.entries(\"#{Rails.root}/app/models\").each do |f|\n require(\"#{Rails.root}/app/models/\" + f) if f =~ /\\.rb$/\n end\n\n models = []\n\n # loop through them all in object space\n ObjectSpace.each_object { |o|\n if o.class == Class and o.... | [
"0.6987188",
"0.68389446",
"0.66506565",
"0.66506565",
"0.66208816",
"0.65707785",
"0.657064",
"0.65383947",
"0.6536335",
"0.65085906",
"0.64583826",
"0.642207",
"0.64135253",
"0.63503426",
"0.6296972",
"0.6285633",
"0.62818605",
"0.6274938",
"0.62736946",
"0.6229886",
"0.622... | 0.63014734 | 14 |
Remove all stored models from the repository. | def reset!
all.map { |repository| repository.send(:reset) }
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n @models.reverse_each(&:destroy_all)\n end",
"def destroy_all\n repositories.each {|name, repo| repo.destroy}\n end",
"def destroy_all\n all.each(&:destroy)\n end",
"def destroy_all\n all.each(&:destroy)\n end",
"def destroy_all\n all.ea... | [
"0.8098452",
"0.7151214",
"0.6995629",
"0.69897383",
"0.69470555",
"0.6931369",
"0.6842259",
"0.67999154",
"0.6772068",
"0.6763356",
"0.6742935",
"0.6722328",
"0.6717012",
"0.6698602",
"0.6639839",
"0.6636563",
"0.663024",
"0.66100764",
"0.6600334",
"0.6576107",
"0.6572879",
... | 0.0 | -1 |
Access to the storage for this repository. | def storage
@storage ||= Set.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage() @storage; end",
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n ... | [
"0.7292052",
"0.7292052",
"0.7292052",
"0.72772557",
"0.72708416",
"0.72708416",
"0.722778",
"0.71412784",
"0.71404445",
"0.71317834",
"0.68389195",
"0.6765088",
"0.6738446",
"0.6731216",
"0.6682957",
"0.667994",
"0.6630467",
"0.65857553",
"0.65407413",
"0.652966",
"0.651363"... | 0.5973205 | 71 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.