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 |
|---|---|---|---|---|---|---|
Never trust parameters from the scary internet, only allow the white list through. | def organization_params
params.require(:organization).permit(:company_name,:company_code,:copy_right,:session_time_out,:facebook_url,:google_analyitcs,:twitter_url,:google_url,:central_time,:opening_hour, :opening_day, :closing_hour, :closing_day, :youtube, :linked_in, :pinterest, org_addresses_attributes: [:id, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
def create if signed_in_with_facebook? banker = Banker.from_omniauth(env["omniauth.auth"]) session[:user_id]= banker.id redirect_to banker_path(banker) else banker = Banker.find_by_banker_email(params[:banker_email]) if banker && banker.authenticate(params[:password]) session[:user_id] = banker.id flash[:notice] = "You... | def destroy
session[:user_id] = nil
flash[:notice] = "You have been signed out."
redirect_to root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createF\r\n user = User.omniauth(env['omniauth.auth'])\r\n session[:user_id] = user.id\r\n Action.create(info: current_user.username + ' has logged in using facebook.', user_email: current_user.email)\r\n redirect_to user\r\n end",
"def create\n #Create user instance\n @use... | [
"0.7690317",
"0.7585825",
"0.7579807",
"0.741191",
"0.7381806",
"0.7373816",
"0.7372198",
"0.73613864",
"0.73546827",
"0.73500377",
"0.7330853",
"0.7311239",
"0.73062986",
"0.72571105",
"0.7226174",
"0.71912503",
"0.7179709",
"0.71629757",
"0.71334356",
"0.7108407",
"0.710481... | 0.0 | -1 |
GET /cta_ctes GET /cta_ctes.json | def index
@cta_ctes = CtaCte.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cta = Cta.all\n end",
"def set_cta_cte\n @cta_cte = CtaCte.find(params[:id])\n end",
"def index\n @ctos = Cto.all\n end",
"def index\n @cts = Ct.all\n end",
"def set_cta\n @cta = cta.find(params[:id])\n end",
"def list_tenants_for_circle(args = {}) \n get(\"/tenan... | [
"0.6766735",
"0.6536953",
"0.61619496",
"0.6160475",
"0.6144055",
"0.61351055",
"0.61277616",
"0.60599494",
"0.60330796",
"0.6006532",
"0.59637034",
"0.5902809",
"0.5875919",
"0.58559465",
"0.58408",
"0.58312565",
"0.5806932",
"0.5750383",
"0.56878304",
"0.56671757",
"0.56534... | 0.7110192 | 0 |
GET /cta_ctes/1 GET /cta_ctes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cta_ctes = CtaCte.all\n end",
"def index\n @cta = Cta.all\n end",
"def set_cta_cte\n @cta_cte = CtaCte.find(params[:id])\n end",
"def set_cta\n @cta = cta.find(params[:id])\n end",
"def create\n @cta = Cta.new(cta_params)\n\n respond_to do |format|\n if @cta.... | [
"0.70399994",
"0.6825169",
"0.67215693",
"0.6432064",
"0.62761617",
"0.6240526",
"0.613184",
"0.61086094",
"0.6076107",
"0.6064877",
"0.59285164",
"0.5918199",
"0.58655304",
"0.58410215",
"0.57680374",
"0.57646877",
"0.56842613",
"0.5670593",
"0.56594473",
"0.56501085",
"0.56... | 0.0 | -1 |
POST /cta_ctes POST /cta_ctes.json | def create
@cta_cte = CtaCte.new(cta_cte_params)
respond_to do |format|
if @cta_cte.save
format.html { redirect_to @cta_cte, notice: 'Se creo correctamente.' }
format.json { render :show, status: :created, location: @cta_cte }
else
format.html { render :new }
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @cta = Cta.new(cta_params)\n\n respond_to do |format|\n if @cta.save\n format.html { redirect_to @cta, notice: 'cta was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cta }\n else\n format.html { render action: 'new' }\... | [
"0.6988885",
"0.68833303",
"0.66639024",
"0.6642157",
"0.6459567",
"0.62548745",
"0.62467664",
"0.6194473",
"0.60483253",
"0.58805376",
"0.58160996",
"0.5760595",
"0.57507014",
"0.57424766",
"0.5725609",
"0.57031035",
"0.5630633",
"0.5601686",
"0.54903114",
"0.5482138",
"0.54... | 0.72541827 | 0 |
PATCH/PUT /cta_ctes/1 PATCH/PUT /cta_ctes/1.json | def update
respond_to do |format|
if @cta_cte.update(cta_cte_params)
format.html { redirect_to @cta_cte, notice: 'Cta cte was successfully updated.' }
format.json { render :show, status: :ok, location: @cta_cte }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @cta.update(cta_params)\n format.html { redirect_to @cta, notice: 'cta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cta.errors, status: :... | [
"0.7178427",
"0.67674005",
"0.65616006",
"0.649103",
"0.6470003",
"0.6425526",
"0.62084883",
"0.6124629",
"0.6115476",
"0.60421103",
"0.5930012",
"0.5886875",
"0.5882646",
"0.5861724",
"0.58495075",
"0.5808336",
"0.5807825",
"0.58050156",
"0.5803656",
"0.5793464",
"0.5789125"... | 0.731992 | 0 |
DELETE /cta_ctes/1 DELETE /cta_ctes/1.json | def destroy
@cta_cte.destroy
respond_to do |format|
format.html { redirect_to cta_ctes_url, notice: 'Cta cte was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cta = Cta.find(params[:id])\n @cta.destroy\n\n respond_to do |format|\n format.html { redirect_to ctas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cta.destroy\n respond_to do |format|\n format.html { redirect_to cta_url }\n format.j... | [
"0.77006453",
"0.7628499",
"0.7336905",
"0.7226581",
"0.7162616",
"0.70822024",
"0.69282967",
"0.67165726",
"0.66642845",
"0.66407293",
"0.6627936",
"0.6607832",
"0.6587206",
"0.6537619",
"0.6533707",
"0.6526938",
"0.64694285",
"0.64670694",
"0.6437052",
"0.64359057",
"0.6434... | 0.7618939 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_cta_cte
@cta_cte = CtaCte.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 cta_cte_params
params.require(:cta_cte).permit(:matriculacion_id, :nro_cta_cte)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
GET /citizens/1 GET /citizens/1.json | def show
@breadcrumbs = [["Home", root_url], [@citizen.to_s, "/citizens/#{@citizen.id}"]]
@projects = Project.for_citizen(@citizen)
@facilities = Facility.for_citizen(@citizen)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def show\n render json: @citation\n end",
"def show\n render json: @citation\n end",
"def index\n @civil_citations = CivilCitation.all\n end",
"def list_citizens\n\t\tputs \"\"\n\t\t@citizens.each do |citizen|\n\t... | [
"0.7533668",
"0.69480485",
"0.69480485",
"0.67914915",
"0.6541264",
"0.65179116",
"0.6389982",
"0.63654846",
"0.6364497",
"0.6320285",
"0.6315062",
"0.62882805",
"0.6287679",
"0.62779695",
"0.6261184",
"0.6240621",
"0.62233716",
"0.62089026",
"0.619365",
"0.6183692",
"0.61608... | 0.5769289 | 68 |
POST /citizens POST /citizens.json | def create
@citizen = Citizen.new(citizen_params)
@citizen.credits = 1000
unless current_user
@user = User.new(email: params[:email], password: params[:password], password_confirmation: params[:password_confirmation])
unless @user.save
respond_to do |format|
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def create\n @civil_citation = CivilCitation.new(civil_citation_params)\n\n respond_to do |format|\n if @civil_citation.save\n format.html { redirect_to @civil_citation, notice: 'Civil citation was successfully cr... | [
"0.6442044",
"0.62185484",
"0.59085095",
"0.5822771",
"0.5801595",
"0.5800005",
"0.57639503",
"0.57601225",
"0.57312685",
"0.5723714",
"0.56715757",
"0.56303275",
"0.56303275",
"0.56181085",
"0.55882895",
"0.55800843",
"0.5579112",
"0.5566575",
"0.5532915",
"0.55213076",
"0.5... | 0.0 | -1 |
PATCH/PUT /citizens/1 PATCH/PUT /citizens/1.json | def update
respond_to do |format|
if @citizen.update(citizen_params)
format.html { redirect_to @citizen, notice: 'Profession changed.' }
format.json { render :show, status: :ok, location: @citizen }
else
format.html { render :edit }
format.json { render json: @citizen.err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entit... | [
"0.66898173",
"0.6478291",
"0.63882166",
"0.63801754",
"0.6374047",
"0.6277703",
"0.62680304",
"0.6264005",
"0.62571484",
"0.62459874",
"0.624298",
"0.62174743",
"0.6205402",
"0.6182202",
"0.61635023",
"0.6159197",
"0.6153063",
"0.6152455",
"0.6135286",
"0.6133851",
"0.611842... | 0.64340967 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_citizen
@citizen = Citizen.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 citizen_params
params.require(:citizen).permit(:email, :password, :email_notifications, :daily_updates, :instant_updates, :home_district_id, :current_profession_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
This method is called, when worker is loaded for the first time | def create(args = nil)
# Connects to the xmpp-client that is used for sending xmpp-messages
@send_client = connect(@@send_client_info)
# Connect to xmpp-client that is used for receiving messages that are then turn into http-requests
@receive_client = connect(@@receive_client_info)
runMessageRe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_worker\n nil\n end",
"def before_starting_workers\n end",
"def worker_begin(worker)\n end",
"def worker_initial_config\n\n end",
"def register_worker\n super\n\n puts \"Fifo Startup - Updating worker list\"\n manager.request_refresh\n end",
... | [
"0.73301125",
"0.69821256",
"0.6937131",
"0.69204175",
"0.68393767",
"0.6770436",
"0.67000234",
"0.66387206",
"0.64745826",
"0.64380574",
"0.63842744",
"0.6331857",
"0.63178164",
"0.63178164",
"0.62865925",
"0.6264595",
"0.62359416",
"0.62359416",
"0.6231937",
"0.62260705",
"... | 0.0 | -1 |
General method for connecting to xmppserver | def connect(client_info)
begin
client = nil
puts "XMPP Connecting to jabber server " + client_info[:host] + ":" + client_info[:port].to_s
puts "XMPP Account " + client_info[:id]
client.close if client != nil
#full_id = "#{client_info[:id]}@#{client_info[:host]}"
jid = Jabber... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(jid, host, port, timeout)\n # Create connection to specific server\n @connection = Xmpp2s::Connection.new(jid, host, port, timeout)\n end",
"def connect\n client.connect(config.host, config.port)\n client.auth(config.password)\n client.send(Jabber::Presence.new.set_type(:avai... | [
"0.6925999",
"0.67407614",
"0.6693163",
"0.65647227",
"0.65532696",
"0.6491738",
"0.6475261",
"0.6412864",
"0.626863",
"0.6267199",
"0.6238911",
"0.61804545",
"0.616728",
"0.6157813",
"0.6157813",
"0.6119708",
"0.6114899",
"0.61099833",
"0.6099769",
"0.60798335",
"0.6046802",... | 0.6480254 | 6 |
SEND: XMPP General method for sending xmppmessages. Notce! clientparameter contains the client that is used to send the message, not the client that is receving the message | def sendMessage(args, client = @send_client)
jabmsg = Jabber::Message::new(args[:receiver], args[:message]).set_type(:chat).set_id('1')
begin
Timeout::timeout(10) do
client.send(jabmsg)
puts "XMPP TO: " + args[:receiver].to_s
puts "XMPP MESSAGE: " + args[:message].to_s
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_message(message); end",
"def send_message(message); end",
"def send_msg(conn,args)\n p = @app.get_client(conn) #pega objeto Player da lista de clientes\n unless p.nil?\n @app.broadcast(Message.new('chat','txt',\n {'author' => CGI::escapeHTML(p.to_s), 'msg' => CGI::escapeHTML(args... | [
"0.6530843",
"0.6530843",
"0.64775795",
"0.64474255",
"0.61949897",
"0.6178032",
"0.6167656",
"0.616258",
"0.614283",
"0.6111387",
"0.6029982",
"0.60292256",
"0.6010723",
"0.59718424",
"0.59715956",
"0.5936464",
"0.58512276",
"0.5835966",
"0.57869095",
"0.5765655",
"0.5762083... | 0.6621806 | 0 |
General method for sending XML stanzas. Ignores warning, which prevents sending further stanzas.. | def sendStanza(client_info, xml)
Thread.new{
client = connect(client_info)#Client.new(JID.new(client_info[:id]))
#client.connect
#client.auth(client_info[:psword])
#client.send(Jabber::Presence.new.set_type(:available))
begin
Timeout::timeout(5) {
client.send_with_id(xml)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_xml(xml)\n connection.ProcessRequest(session, xml)\n rescue => e\n puts \"ERROR processing request:\\n#{xml}\"\n raise # Reraises the original error, only this way we got the xml output\n end",
"def xml?; end",
"def xml?; end",
"def send_request( xml )\n write( xm... | [
"0.6322605",
"0.61638576",
"0.61638576",
"0.6095486",
"0.6079925",
"0.60325825",
"0.60082626",
"0.5888975",
"0.5869322",
"0.57792896",
"0.5704799",
"0.5702801",
"0.569711",
"0.56082654",
"0.5586002",
"0.55767334",
"0.55663306",
"0.55534667",
"0.5531707",
"0.5528327",
"0.54919... | 0.5550901 | 18 |
Handles xmpp2restmessages that are received. | def handleMessage(msg)
if msg != nil and msg.type == :chat and msg.body #and msg.from == @@visualRESTmain
#puts "#{msg.from}:"
#puts "#{msg.body.strip}"
puts "Validating.."
begin
doc = XML::Document.string(msg.body)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_msgs\n end",
"def receive_msg msg\n # stub, overwrite this in your handler\n end",
"def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transacti... | [
"0.64893013",
"0.602477",
"0.5796106",
"0.5658078",
"0.55917823",
"0.55594623",
"0.55490136",
"0.5509176",
"0.54918",
"0.5485523",
"0.54762375",
"0.5471524",
"0.54709697",
"0.5459718",
"0.5413442",
"0.5410259",
"0.53884965",
"0.53739774",
"0.53625333",
"0.53532904",
"0.534015... | 0.65637827 | 0 |
Method for creating resource/resources. Uses HTTP PUT to localhost | def createResouce(doc, msg_from)
begin
puts "Creating"
path = ""
params = {}
headers = {}
context, path = findContext(doc, path)
# Adding the actual parameters according the context
if context
# if devic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_resource object\n object.save\n end",
"def create_method\n :http_put\n end",
"def create_method\n :http_put\n end",
"def create_resource(object)\n object.save\n end",
"def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.pa... | [
"0.7142516",
"0.69711924",
"0.69711924",
"0.69163203",
"0.66665673",
"0.66231376",
"0.66028607",
"0.6592469",
"0.65916693",
"0.65768826",
"0.65709394",
"0.6566654",
"0.6535224",
"0.64721227",
"0.64693516",
"0.6466178",
"0.6459854",
"0.6427114",
"0.6424738",
"0.63955224",
"0.6... | 0.0 | -1 |
Method for updating resource/resources. Uses HTTP POST to localhost | def updateResouce(doc, msg_from)
begin
puts "Updating"
path = ""
params = {}
headers = {}
context, path = findContext(doc, path)
if context == :user
params = {}
elsif context == :user_group
params = {}
elsif context == :user_de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n Neo4j::Transaction.run do\n @q_resource = QResource.find(params[:id])\n @q_resource.update_attributes!(params[:q_resource])\n respond_to do |format|\n if @q_resource.update_attributes(params[:q_resource])\n format.html { redirect_to @q_resource, :notice => 'Q resource... | [
"0.69357383",
"0.69275326",
"0.688172",
"0.68410254",
"0.68391937",
"0.68375593",
"0.67935365",
"0.6768655",
"0.6768655",
"0.67604905",
"0.67561096",
"0.6727665",
"0.6712872",
"0.66921514",
"0.66727555",
"0.66365135",
"0.66365135",
"0.66297424",
"0.66297424",
"0.66293293",
"0... | 0.0 | -1 |
Method for deleting resource/resources. Uses HTTP DELETE to localhost | def deleteResource(doc, msg_from)
begin
puts "Deleting"
path = ""
params = {}
headers = {}
context, path = findContext(doc, path)
# Deleting member from group
if context == :user_group_member
params = {}
else
raise Exception.new("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete()\n @api.do_request(\"D... | [
"0.8035308",
"0.8035308",
"0.8000145",
"0.8000145",
"0.8000145",
"0.8000145",
"0.79449946",
"0.79022586",
"0.7855769",
"0.78429794",
"0.7739762",
"0.76964545",
"0.766878",
"0.76525885",
"0.76525885",
"0.7582538",
"0.7556191",
"0.7556191",
"0.7555317",
"0.75451154",
"0.7536944... | 0.0 | -1 |
Finds context from xml, adds parts to path and returns the both results | def findContext(doc, path)
context = nil
# If user-element is given -> context is user-based, otherwise context is system-based
if doc.find_first('//xmpp2rest/user')
puts "User context"
username = (doc.find_first('//xmpp2rest/user').attributes.get_attribute("username")) ? doc.find... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_xml_common(ent, node)\n REXML::XPath.each(node, \"./ctx:identifier\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"}) do |id|\n ent.add_identifier(id.get_text.value) if id and id.has_text?\n end\n\n priv = REXML::XPath.first(node, \"./ctx:private-data\", {\"ctx\" => \"info:ofi/fmt:xml:x... | [
"0.56314456",
"0.55916697",
"0.5503099",
"0.542548",
"0.51419705",
"0.5080171",
"0.50422806",
"0.50086486",
"0.50027657",
"0.50007904",
"0.49485382",
"0.49271888",
"0.49271888",
"0.4908697",
"0.48717603",
"0.48561013",
"0.48391455",
"0.47899863",
"0.47889015",
"0.47503296",
"... | 0.62768525 | 0 |
Parses filerights for specific file and translates those to that kind of form that vR understands | def parseFilerights(doc, params, path)
fullpath = doc.find_first('//xmpp2rest/user/device/filerights').attributes.get_attribute('fullpath') ? doc.find_first('//xmpp2rest/user/device/filerights').attributes.get_attribute('fullpath').value : nil
if not fullpath
raise Exception.new('No fullpath given for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_files!(files, type) \n files.each do |file|\n @file = file\n @type = type\n parsed = \"\"\n @dirnames = Base.get_namespace(file,type) # directories after the app/type/ directory\n \n namespaces = LANGUAGES.collect do |lang|\n if type == 'views... | [
"0.6228739",
"0.6201583",
"0.6196791",
"0.61641735",
"0.61623263",
"0.6088503",
"0.6051854",
"0.5990033",
"0.5845432",
"0.5765242",
"0.5764606",
"0.57329243",
"0.57281166",
"0.5727516",
"0.56519943",
"0.55870897",
"0.5545938",
"0.5501342",
"0.5455212",
"0.5451437",
"0.5447954... | 0.51546496 | 56 |
Parses dev_type and password from xml | def parseDeviceData(doc, params)
dev_type = (doc.find_first('//xmpp2rest/user/device/dev_type')) ? doc.find_first('//xmpp2rest/user/device/dev_type').content : nil
password = (doc.find_first('//xmpp2rest/user/device/password')) ? doc.find_first('//xmpp2rest/user/device/password').content : nil
if no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_user!\n login_xml = Hpricot.XML(self.login_token) \n item = (login_xml/:login).first\n self.login_type = item[\"type\"]\n self.login_id = (item/:login_id).inner_html\n self.name = (item/:name).inner_html\n self.email = (item/:email).inner_html\n self.expires_at = (item/:expires_at).i... | [
"0.5899146",
"0.56406736",
"0.5602265",
"0.55816984",
"0.5552967",
"0.54880935",
"0.5461128",
"0.5451781",
"0.5427604",
"0.5340531",
"0.523414",
"0.5094814",
"0.5083051",
"0.50740397",
"0.5004393",
"0.49906373",
"0.49274254",
"0.49213305",
"0.489434",
"0.4878623",
"0.48465493... | 0.6075635 | 0 |
Parses user's real name and password from xml | def parseUserData(doc, params)
real_name = (doc.find_first('//xmpp2rest/user/real_name')) ? doc.find_first('//xmpp2rest/user/real_name').content : nil
password = (doc.find_first('//xmpp2rest/user/password')) ? doc.find_first('//xmpp2rest/user/password').content : nil
if not real_name or not passwo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_user(xml) \n login = xml.root.get_elements('User').first.text \n password = xml.root.get_elements('Password').first.text \n self.current_user = User.authenticate(login, password) \n end",
"def parse_user!\n login_xml = Hpricot.XML(self.login_token) \n item = (login_xml/:login).first\n ... | [
"0.7280819",
"0.6717548",
"0.6440668",
"0.64326435",
"0.62647784",
"0.61255336",
"0.6028679",
"0.60228026",
"0.5913789",
"0.58559626",
"0.57994854",
"0.5770675",
"0.57188374",
"0.5694992",
"0.5691342",
"0.56799215",
"0.56663",
"0.5658985",
"0.558933",
"0.55221325",
"0.5511334... | 0.66017085 | 2 |
Parses device's online status, and the possible status elements that are given | def parseOnlineStatus(doc, params, path)
status = {}
doc.find('//xmpp2rest/user/device/online/status').each do |status_element|
status_key = (status_element.attributes.get_attribute("status_key")) ? status_element.attributes.get_attribute("status_key").value : nil
if not status_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_online_status(status)\n case status\n when :available, :online\n @notification_server.chg \"NLN\", 0\n when :busy\n @notification_server.chg \"BSY\", 0\n when :idle\n @notification_server.chg \"IDL\", 0\n when :brb, :be_right_back\n @notification_server.chg \"BRB\", 0\n ... | [
"0.62053114",
"0.61316156",
"0.5951072",
"0.58885884",
"0.58121955",
"0.5796551",
"0.5788164",
"0.5777459",
"0.57056564",
"0.5694479",
"0.56859666",
"0.56562823",
"0.5655947",
"0.5637627",
"0.5549555",
"0.55483246",
"0.5544901",
"0.5540149",
"0.55320114",
"0.54901993",
"0.545... | 0.735458 | 0 |
Parses the userspecific metadata from xml to visualREST form. List of updated files is returned, so that xml can contain many metadata changes for different files | def parseUpdatedMetadata(doc, params, path)
path += "/files"
listOfUpdatedFiles = Array.new
doc.find('//user/device/files/file').each do |file|
fullpath = (file.attributes.get_attribute("fullpath")) ? file.attributes.get_attribute("fullpath").value : nil
version = "not_found"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metadata_xml\n Nokogiri::XML(original_file.content)\n end",
"def parse_photo_request_reponse_xml\n logger.debug('PARSING FILES.')\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n begin\n doc = Nokogiri::XML.parse(File.open(file)) { |xml| xml.noblanks }\n ... | [
"0.6386808",
"0.6291768",
"0.62225085",
"0.60652304",
"0.6039805",
"0.6015787",
"0.59605604",
"0.58678955",
"0.5758944",
"0.57544965",
"0.573245",
"0.57027555",
"0.566653",
"0.56462985",
"0.5641608",
"0.5640055",
"0.5623967",
"0.5616245",
"0.5562989",
"0.5547797",
"0.5529505"... | 0.7655701 | 0 |
Parses filelist and translates it to visualREST form | def parseFileslist(doc, params, path)
prev_commit_hash = (doc.find_first('//xmpp2rest/user/device/files/prev_commit_hash') ? doc.find_first('//xmpp2rest/user/device/files/prev_commit_hash').content : nil)
commit_hash = (doc.find_first('//xmpp2rest/user/device/files/commit_hash')) ? doc.find_first('//xmp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_list\n end",
"def index\n @file_list = UploadedFileList.find(params[:uploaded_file_list_id])\n @file_list_items = @file_list.file_list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @file_list_items }\n end\n end",
"def... | [
"0.6782541",
"0.64948356",
"0.63992697",
"0.6367416",
"0.6338561",
"0.62984675",
"0.62974167",
"0.62750435",
"0.6228616",
"0.6228616",
"0.60483444",
"0.60082644",
"0.5988064",
"0.59854835",
"0.59854835",
"0.5980261",
"0.59727013",
"0.59727013",
"0.59587497",
"0.5948371",
"0.5... | 0.59396434 | 20 |
General method for first sending http to visualREST and then returning the response to xmppclient that sent the xmpp2rest message | def httpAndNotify(path, params, msg_from, method)
message = ""
begin
m = ""
if method == :get
m = "GET"
elsif method == :post
m = "POST"
elsif method == :put
m = "PUT"
elsif method == :delete
m = "DELETE"
else
raise Exception.new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_send_action\n http = http_inst\n req = http_post\n Response.new http.request req\n end",
"def request\n self.response = prepare_response(http_communication.content)\n end",
"def send_request; end",
"def execute\n\n case @template[:payload][:method]\n when... | [
"0.6685027",
"0.66773605",
"0.65325016",
"0.62631613",
"0.61380297",
"0.6074409",
"0.60246587",
"0.6010596",
"0.60056424",
"0.5995534",
"0.59726405",
"0.59530205",
"0.5920722",
"0.59037554",
"0.58551",
"0.58340186",
"0.5832804",
"0.58209467",
"0.5817091",
"0.57810426",
"0.575... | 0.6777497 | 0 |
before_action :signed_in_correct_user_or_admin, only: %i(show end_tasks) | def index
@users = User.all.page(params[:page]).order(code: :asc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n # Restrict access\n check_if_admin unless @task.user_id == @person.id || @task.state == 'open'\n end",
"def edit\n get_current_user\n if @user.tasks.include?(task) #If the task they want to edit belongs to them\n task\n else #If the task they want to edit does NOT belong to them\n... | [
"0.6764606",
"0.665086",
"0.6645536",
"0.6511329",
"0.6490249",
"0.6485678",
"0.6480702",
"0.64467883",
"0.64385444",
"0.64013124",
"0.6382952",
"0.6374303",
"0.63432145",
"0.6333825",
"0.6331927",
"0.63145214",
"0.6275861",
"0.6267144",
"0.6258642",
"0.62436444",
"0.6240719"... | 0.0 | -1 |
Search for organizations via External APIs | def search_externally(search_term:)
return [] unless search_term.present? && search_term.length > 2
orgs = externals_search(search_term: search_term)
prepare(search_term: search_term, records: orgs)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_organizations(options = nil)\n require_relative 'telerivet/organization'\n self.cursor(Organization, get_base_api_path() + \"/organizations\", options)\n end",
"def index\n @organizations = Organization.by_query(params[:q])\n end",
"def index\n if search_params \n logger.... | [
"0.7734928",
"0.77025133",
"0.7374608",
"0.73630416",
"0.7336602",
"0.733185",
"0.72774506",
"0.72478324",
"0.7152148",
"0.7109227",
"0.71009266",
"0.71008855",
"0.7051551",
"0.7033463",
"0.7033463",
"0.69626904",
"0.6902262",
"0.68927705",
"0.6872008",
"0.67987955",
"0.67959... | 0.0 | -1 |
Search for organizations in the local DB only | def search_locally(search_term:)
return [] unless search_term.present? && search_term.length > 2
orgs = local_search(search_term: search_term)
prepare(search_term: search_term, records: orgs)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @organizations = Organization.by_query(params[:q])\n end",
"def query_organizations(options = nil)\n require_relative 'telerivet/organization'\n self.cursor(Organization, get_base_api_path() + \"/organizations\", options)\n end",
"def find_organizations\n Organization.all\n ... | [
"0.70058477",
"0.6952957",
"0.6885733",
"0.66673684",
"0.66656864",
"0.65583754",
"0.65322286",
"0.6488152",
"0.6473589",
"0.64543575",
"0.64014906",
"0.6392004",
"0.619959",
"0.61935896",
"0.6176346",
"0.6119627",
"0.6112824",
"0.6112727",
"0.6079618",
"0.5991687",
"0.597908... | 0.5400889 | 97 |
Determines whether or not the 2 names match (ignoring parenthesis text) | def exact_match?(name1:, name2:)
return false unless name1.present? && name2.present?
a = name_without_alias(name: name1.downcase)
b = name_without_alias(name: name2.downcase)
a == b
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def names_match?(n1, style1, n2, style2)\n f1 = style1 == :short ? n1.first : n1.firstname\n m1 = style1 == :short ? n1.middle : n1.middlename\n l1 = style1 == :short ? n1.last : n1.lastname\n \n f2 = style2 == :short ? n2.first : n2.firstname\n m2 = style2 == :short ? n2.middle : n2.... | [
"0.72339934",
"0.72310805",
"0.68644345",
"0.6822717",
"0.67379135",
"0.66431665",
"0.6568806",
"0.65048754",
"0.6489231",
"0.6485371",
"0.6330591",
"0.6263789",
"0.62537646",
"0.6161135",
"0.61080587",
"0.6083597",
"0.6083597",
"0.6080111",
"0.60179526",
"0.6011076",
"0.6006... | 0.7354697 | 0 |
Removes the parenthesis portion of the name. For example: "Foo College (foo.edu)" > "Foo College" | def name_without_alias(name:)
return '' if name.blank?
name.split(' (')&.first&.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_name\n name.gsub(/\\(.*?\\)/, \"\").gsub(/(.*)/, \"\").strip\n end",
"def name_filter\n self.gsub(/[^a-zA-Z\\s\\-\\(\\)]/, '')\n end",
"def cleanup_firstname(name)\n name.gsub(/^Dean(\\w+)/) { |s| \"DeAn#{$1}\" }\n end",
"def clean_name(name)\n if name.present?\n ... | [
"0.7359029",
"0.71358466",
"0.6829798",
"0.6827434",
"0.670028",
"0.6634049",
"0.6571017",
"0.65043586",
"0.6491759",
"0.6455967",
"0.6449051",
"0.64332825",
"0.64114606",
"0.6396182",
"0.63892615",
"0.63799095",
"0.63573664",
"0.6332352",
"0.6326359",
"0.632394",
"0.6301046"... | 0.74420595 | 0 |
Prepares all of the records for the view. Records that are Org models get converted over to a hash, all other records (e.g. from the ROR API) are expected to already be in the appropriate hash format. | def prepare(search_term:, records:)
return [] unless search_term.present? && records.present? && records.is_a?(Array)
array = []
records.map do |rec|
item = rec.is_a?(Org) ? OrgSelection::OrgToHashService.to_hash(org: rec) : rec
array << evaluate(search_term: search_term, re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare\n model.tap do |p|\n p.identifier = set_identifiers\n p.meta = set_meta\n p.text = set_text\n p.status = COMPLETED_STATUS\n p.authored = set_date\n p.author = set_author\n p.subject = set_subject\n p.questi... | [
"0.58589375",
"0.5785718",
"0.5683079",
"0.55321085",
"0.5511057",
"0.54135317",
"0.54135317",
"0.5404786",
"0.5402465",
"0.5366928",
"0.53584087",
"0.53435737",
"0.53381556",
"0.5328095",
"0.5327253",
"0.52591956",
"0.52518874",
"0.5238703",
"0.52359915",
"0.52140564",
"0.52... | 0.48099366 | 88 |
Removes any duplicates by comparing the sort names and ids | def deduplicate(records:)
return [] unless records.present? && records.is_a?(Array)
out = []
found = []
records.each do |rec|
next if found.include?(rec[:sort_name]) || found.include?(rec[:id])
found << rec[:sort_name]
found << rec[:id] if rec[:id].present... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duplicates\n @duplicates = Duplicate.all\n @duplicates.sort! do |x, y|\n diff = (x.person.last_name || '') <=> y.person.last_name\n if diff == 0\n (x.person.first_name || '') <=> y.person.first_name\n else\n diff\n end\n end\n end",
"def eliminate_duplicates\n m... | [
"0.58871746",
"0.5852777",
"0.5831081",
"0.5724807",
"0.57106245",
"0.56934",
"0.5622929",
"0.5622929",
"0.5603035",
"0.55947965",
"0.55722135",
"0.5550381",
"0.55066276",
"0.5505039",
"0.5504047",
"0.55018365",
"0.5463947",
"0.5435217",
"0.5431193",
"0.5418625",
"0.5398014",... | 0.6992698 | 0 |
Resorts the results returned from ROR so that any exact matches appear at the top of the list. For example a search for `Example`: Example College Example University University of Example Universidade de Examplar Another College that ROR has a matching alias for | def sort(array:)
return [] unless array.present? && array.is_a?(Array)
# Sort the results by score + weight + name
array.sort do |a, b|
# left = [a[:weight], a[:score], a[:sort_name]]
# right = [b[:weight], b[:score], b[:sort_name]]
[a[:weight], a[:sort_name]] <=> ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n# @entries = Entry.order('lower(de)')\n @q = Entry.order('lower(de)').ransack(params[:q])\n @entries = @q.result(distinct: true)\n end",
"def index\n @search = Item.search(params[:q])\n @search.sorts = 'name asc' if @search.sorts.empty?\n @items = @search.result\n if params[:q].... | [
"0.6249512",
"0.6168122",
"0.6114023",
"0.6104411",
"0.6058657",
"0.6015114",
"0.5997423",
"0.59867585",
"0.5979311",
"0.5901349",
"0.58862895",
"0.5880042",
"0.5857006",
"0.5837778",
"0.5794448",
"0.5746807",
"0.5734639",
"0.5702542",
"0.569788",
"0.56967205",
"0.5684417",
... | 0.0 | -1 |
Score and weigh the record | def evaluate(search_term:, record:)
return record unless record.present? && search_term.present?
# Score and weigh each of the record
scr = score(search_term: search_term, item_name: record[:name])
wght = weigh(search_term: search_term, item_name: record[:name])
record.merge(sco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score; end",
"def score\n w = 0.3\n time = diff_time()\n sum_goods = goods()\n sum_bads = bads()\n total = sum_goods + sum_bads\n (w * sum_goods * (sum_goods/total.to_f)**3 * (total/time)).floor\n end",
"def score\n end",
"def weighted_score\n score * metric.weight\n end",
"de... | [
"0.7224903",
"0.71238506",
"0.7085753",
"0.7076665",
"0.7016866",
"0.69296193",
"0.69030803",
"0.688458",
"0.6864584",
"0.6842152",
"0.676423",
"0.668734",
"0.66705614",
"0.6663542",
"0.66558486",
"0.66500556",
"0.66377425",
"0.6627817",
"0.66207755",
"0.66207236",
"0.6614873... | 0.0 | -1 |
Call the base service's compare_strings | def score(search_term:, item_name:)
return 99 unless search_term.present? && item_name.present?
Text::Levenshtein.distance(search_term.downcase, item_name.downcase)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_strings(str1, str2)\n\tif str1 > str2\n\tp true\n else \n \tp false\n \tend\n end",
"def str_cmp(str1, str2)\n return if !str1.is_a?(String) || !str2.is_a?(String)\n\n puts str1.downcase == str2.downcase\n end",
"def test_compare_string_overlap_defs\n v1 = Vertex.new(\"speech\", 2, 1, 0,... | [
"0.628744",
"0.58778334",
"0.58395046",
"0.58195734",
"0.578447",
"0.57586896",
"0.57297695",
"0.5725279",
"0.5725279",
"0.5573547",
"0.5542165",
"0.5541122",
"0.5444125",
"0.54302084",
"0.5377373",
"0.53132224",
"0.52854174",
"0.5228747",
"0.52013123",
"0.5180788",
"0.516169... | 0.0 | -1 |
Weighs the result. The lower the weight the closer the match | def weigh(search_term:, item_name:)
return 3 unless search_term.present? && item_name.present?
return 0 if item_name.downcase.start_with?(search_term.downcase)
return 1 if item_name.downcase.include?(search_term.downcase)
2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weighted_score\n score * metric.weight\n end",
"def weight\n num_motions.zero? ? 0.5 : total_score.fdiv(max_score)\n end",
"def weight_results(results)\n weights = Hash.new { |hash, key| hash[key] = 0 }\n\n results.each do |set|\n set.each do |item|\n weights[item.name] += item.hi... | [
"0.66198456",
"0.6503539",
"0.64279974",
"0.63668936",
"0.6362549",
"0.61802655",
"0.61461353",
"0.6085469",
"0.6041074",
"0.6032602",
"0.6021423",
"0.59821606",
"0.5982013",
"0.59791476",
"0.59709305",
"0.59617853",
"0.5958512",
"0.5928692",
"0.59035957",
"0.58983785",
"0.58... | 0.5456155 | 81 |
Discard any results that are not valid matches | def filter(array:)
return [] unless array.present? && array.is_a?(Array)
array.select do |hash|
# If the natural language processing score is <= 25 OR the
# weight is less than 1 (starts with or includes the search term)
hash.fetch(:score, 0) <= 25 || hash.fetch(:weight, 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discard_results; end",
"def bad_results\n select {|r| !r.success }\n end",
"def remove_bad_ident_matches(matches)\n passed_matches = []\n matches.each do |m|\n next if (m[\"match_type\"] == \"content_body\" &&\n m[\"matched_content\"] == \"(?-mix:Drupal)\... | [
"0.7056375",
"0.6887419",
"0.64285785",
"0.6253239",
"0.6132595",
"0.60482556",
"0.60134697",
"0.5984454",
"0.5968486",
"0.59532243",
"0.59215206",
"0.5915017",
"0.5915017",
"0.5892299",
"0.5818769",
"0.5793794",
"0.57728416",
"0.5759925",
"0.57533646",
"0.57144713",
"0.56981... | 0.0 | -1 |
take num iterate from 2 to num if num % i except itself == 0 (num not prime) | def prime?(arg)
return false if arg <= 1
return true if arg == 2
result = true
(3..arg).to_a.each_with_index{|num, idx|result = false if arg % (idx+1) == 0 && (idx+1) != 1}
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anti_prime?(num)\n counter = count_divisors(num)\n counters = []\n \n (1...num).each do |i|\n if i.even? #unnecessary to add .even\n counters << count_divisors(i)\n end\n end\n counters.each do |c| \n if c > counter\n return false\n end\n e... | [
"0.7694735",
"0.7465949",
"0.7435972",
"0.7435799",
"0.74183923",
"0.7408947",
"0.7406797",
"0.73996305",
"0.73884374",
"0.7370166",
"0.7369542",
"0.7346348",
"0.73429775",
"0.73429775",
"0.7338101",
"0.7337987",
"0.7335078",
"0.7313099",
"0.729924",
"0.7285141",
"0.7279839",... | 0.0 | -1 |
gets the gallery's paintings | def paintings
Painting.all.select do |painting|
painting.gallery == self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def galleries\n paintings.map {|p| p.gallery}\n end",
"def galleries\n paintings.map {|painting| painting.gallery}\n end",
"def gallaries\n paintings.map{|paint| paint.gallery}\n\n end",
"def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end",
"def galleries... | [
"0.81684786",
"0.8124278",
"0.8102787",
"0.8054186",
"0.8054186",
"0.8054186",
"0.79500747",
"0.78035414",
"0.7781781",
"0.767967",
"0.75492215",
"0.7461465",
"0.73917866",
"0.73008287",
"0.7253058",
"0.7183398",
"0.71794134",
"0.68692607",
"0.68281126",
"0.6762081",
"0.67161... | 0.7800964 | 8 |
get list of artists that have painting at a specific Gallery "this gallery's painting's artists" | def artists
paintings.map do |painting|
painting.artist
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_artists_by_gallery\n paintings = Painting.all.select { |painting| painting.gallery == self }\n # paintings.map { |painting| painting.artist }\n end",
"def all_artists\n match = Painting.all.select{|painting| painting.gallery == self}\n match.map{|painting| painting.artist}\nend",
"def galleri... | [
"0.82587236",
"0.7819621",
"0.7671706",
"0.75349677",
"0.75148106",
"0.73957235",
"0.73018986",
"0.73010355",
"0.72804374",
"0.71971923",
"0.7041863",
"0.7041745",
"0.7031225",
"0.70260906",
"0.7005577",
"0.6979754",
"0.6979754",
"0.6964527",
"0.6954761",
"0.6954761",
"0.6954... | 0.7270354 | 9 |
get list of names of artists that have paintings at a specific gallery | def artist_names
artists.map do |artist|
artist.name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_artists_by_gallery\n paintings = Painting.all.select { |painting| painting.gallery == self }\n # paintings.map { |painting| painting.artist }\n end",
"def all_artist_names_by_gallery\n all_artists_by_gallery.map do |artist|\n # artist.name == Painting.artist.name\n artist.name\n e... | [
"0.8241752",
"0.8048409",
"0.7944162",
"0.79265964",
"0.77202994",
"0.76342756",
"0.74595004",
"0.7348064",
"0.7300484",
"0.7174687",
"0.7153732",
"0.7144178",
"0.712818",
"0.7112033",
"0.71035296",
"0.70786947",
"0.7078453",
"0.7041957",
"0.7014401",
"0.7004169",
"0.7004169"... | 0.592989 | 68 |
get combined years of experience of all artists at a specific gallery | def total_years
all_years = artists.map do |artist|
artist.years_active
end
all_years.inject(:+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_artist_experience\n sum = 0\n all_artists_by_gallery.map do |artist|\n artist.years_active == Painting.artist.years_active\n sum += artist.years_active\n end\n end",
"def artists_years_experienced\n years = self.all_artists.inject(0){|sum, artist| sum + artist.years_active}\nend",
... | [
"0.7192972",
"0.6713446",
"0.66727674",
"0.6149172",
"0.6092315",
"0.6054275",
"0.59626925",
"0.5913976",
"0.5886037",
"0.58797723",
"0.58524334",
"0.58416635",
"0.58244646",
"0.57938164",
"0.5738189",
"0.57098246",
"0.5699748",
"0.5679076",
"0.5664378",
"0.5627878",
"0.56245... | 0.66978794 | 2 |
check absolute_path to modify result of roo | def filelist
puts_message "filelist start"
user = current_user
request = params[:request].force_encoding("UTF-8")
puts_message "Requested Path: " + params[:request]
if user and check_existance_of_path(request)
if request == nil
@file_names = 'error'
elsif request_is_di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absolute?(path); end",
"def absolute?\n #%r{\\A/} =~ @path ? true : false\n @absolute\n end",
"def absolute?(path) \n p = get(path) \n File.absolute_path(p, \".\") == p # rbx\n end",
"def absolute?(path)\n !relative?(path)\n end",
"def filepathFromAbsOrRel(absOrRel)... | [
"0.67208964",
"0.6140665",
"0.6049132",
"0.5910716",
"0.5876765",
"0.585822",
"0.5823163",
"0.5760523",
"0.57229203",
"0.57116807",
"0.56376535",
"0.5616725",
"0.56144226",
"0.561005",
"0.55938894",
"0.55535156",
"0.5550321",
"0.5520811",
"0.5497348",
"0.54955393",
"0.5472382... | 0.0 | -1 |
used at filelist for checking existance of the path | def check_existance_of_path(path)
if not path == nil
question = absolute_path(path)
File.exists?(question)
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_exists?(path)\n end",
"def exists? path\n end",
"def dir_entry_exists(path)\n files = session.fs.dir.entries(path)\n rescue\n return nil\n else\n return path\n end",
"def file_exists\n end",
"def exist; File.exist?(@fname); end",
"def file_exists?(path)\n result = trans... | [
"0.74588364",
"0.728752",
"0.7119643",
"0.708352",
"0.7076002",
"0.7004982",
"0.7000389",
"0.69686973",
"0.6967655",
"0.69388616",
"0.69117033",
"0.69080496",
"0.68946534",
"0.6868135",
"0.68278956",
"0.6822494",
"0.68002117",
"0.6799188",
"0.67985564",
"0.6773333",
"0.676322... | 0.63119924 | 84 |
used at filelist to check if the path is directory | def request_is_directory?(path)
question = absolute_path(path)
File.directory?(question)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_directory?(path)\n end",
"def dir?(path)\n begin\n ftype(path) == 'directory'\n rescue\n false\n end\n end",
"def is_dir?(path)\n File.directory? path\n end",
"def directory?(path)\n ::File.directory?(prefixed(path))\n end",
"def directory?() end",
... | [
"0.851354",
"0.8282389",
"0.8221535",
"0.8108917",
"0.81001294",
"0.80213964",
"0.79840255",
"0.7953734",
"0.7929424",
"0.7922404",
"0.7878948",
"0.784482",
"0.78399867",
"0.7838868",
"0.7821373",
"0.7798368",
"0.7789099",
"0.7705314",
"0.77013385",
"0.7696799",
"0.7674249",
... | 0.7826849 | 14 |
used at filelist to check if the path is file | def request_is_file?(path)
question = absolute_path(path)
File.file?(question)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_path?(file); end",
"def file?(path)\n ftype(path) == 'file' rescue false\n end",
"def is_file?(path)\n ::File.file? abspath(path)\n end",
"def file?(file_path)\n nlst(file_path)[0] == file_path\n end",
"def fileType path\n\t\tif File.ftype(path) == 'file'\n\t\t\ttrue\n\t\te... | [
"0.829204",
"0.813953",
"0.80105364",
"0.78895223",
"0.77341706",
"0.7730412",
"0.76720345",
"0.76512516",
"0.7628814",
"0.7602517",
"0.7580916",
"0.74773574",
"0.746706",
"0.7458751",
"0.74476606",
"0.7376391",
"0.73536134",
"0.7338268",
"0.73375356",
"0.7328583",
"0.7297866... | 0.77345496 | 4 |
used at filelist to get file list in requested dir | def fire_the_list(path)
@output = <<-END
END
dir = absolute_path(path).force_encoding("UTF-8")
begin
@file_names = Dir.entries(dir)
@file_names.each do |file|
file = file.force_encoding("UTF-8")
# puts_message "테스트 아웃풋 : " + file
end
rescue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_list\n end",
"def filelist\n puts_message \"filelist start\" \n\n user = current_user\n\n request = params[:request].force_encoding(\"UTF-8\")\n puts_message \"Requested Path: \" + params[:request]\n \n if user and check_existance_of_path(request) \n if request == nil\n ... | [
"0.7770089",
"0.7699185",
"0.7581297",
"0.7458646",
"0.74257815",
"0.7382408",
"0.73160386",
"0.7254566",
"0.7238712",
"0.7222619",
"0.7137586",
"0.71201164",
"0.70518506",
"0.70416987",
"0.7031159",
"0.7002606",
"0.6925008",
"0.6905666",
"0.6897562",
"0.6893239",
"0.68620247... | 0.64210105 | 77 |
used at filelist inorder to send file info if requested path is file | def send_file_info(last, path)
if not last == nil
user = current_user
path = path.force_encoding("UTF-8")
@file_names = "#{path.split('/').last}" + "\n"
@access_url = "#{HOSTING_URL}" + "/user_files/"+ "#{user.userid}" + path.force_encoding("UTF-8")
else
@f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requested_file(request_line)\r\n # ... implementation details to be discussed later ...\r\nend",
"def index\n \n \n\n if params[:file]\n @file = params[:file] \n p @file\n @path = \"/home/session[:user_name]/#{@file}\"\n @path.to_s.gsub!('\\.\\.' , '')\n if File.directory?(@path... | [
"0.67169935",
"0.65137047",
"0.6421977",
"0.6369916",
"0.6365445",
"0.6277567",
"0.62718534",
"0.62718534",
"0.62718534",
"0.62718534",
"0.62718534",
"0.62718534",
"0.62572217",
"0.61724484",
"0.6093924",
"0.607562",
"0.6065342",
"0.6034502",
"0.60303706",
"0.602736",
"0.6008... | 0.71248126 | 0 |
This method is used in mlayout mtransfer bundle | def ftp_access
if User.authenticate(:userid => params[:userid], :password => params[:passwd])
user = current_user
login = params[:userid]
pass = params[:passwd]
@result =
"OK\n"+
# "graphicartshub.com\n"+
"localhost:3000\n"+
"#{login}\n"+
"#{pass}\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout=(_arg0); end",
"def _implied_layout_name; end",
"def layouts=(_arg0); end",
"def layouts=(_arg0); end",
"def _layout(*_arg0); end",
"def render_layout(output, layout, info); end",
"def set_layout\n @layoutme = 1\n end",
"def private; end",
"def layout_children\n \n end",
"def... | [
"0.6045859",
"0.5993231",
"0.5767561",
"0.5767561",
"0.57594866",
"0.56796145",
"0.56620485",
"0.5642632",
"0.5607424",
"0.5530591",
"0.5530591",
"0.5405211",
"0.5405211",
"0.5405211",
"0.53949887",
"0.5357703",
"0.533215",
"0.5306358",
"0.5233174",
"0.52320945",
"0.5227634",... | 0.0 | -1 |
This method is used for pureftp | def ftp_auth
if User.authenticate(:userid => params[:login], :password => params[:password])
# if http_authenticate(params[:userid], params[:password])
user = current_user
@output = <<-END
auth_ok:1
uid:#{483}
gid:#{483}
dir:#{user_files_root(user)}
end
END... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info(msg)\n $tftplog.info('tftp+') { msg }\nend",
"def transport; end",
"def transport; end",
"def transport; end",
"def passthru\n\n end",
"def passthru\n super\n end",
"def passthru\n super\n end",
"def passive; end",
"def send_sms_otp\n super\n OtpJob.perform_later([sel... | [
"0.5563596",
"0.55307704",
"0.55307704",
"0.55307704",
"0.54764324",
"0.54035825",
"0.54035825",
"0.53675056",
"0.5361363",
"0.52927464",
"0.5266216",
"0.52370155",
"0.51949364",
"0.5183847",
"0.5182394",
"0.51768565",
"0.51662713",
"0.515754",
"0.5129298",
"0.508577",
"0.508... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_unit_of_measure
@unit_of_measure = UnitOfMeasure.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def unit_of_measure_params
params.require(:unit_of_measure).permit(:unit_id, :unit_description, :unit_status, :created_by, :updated_by)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Performs multiple GETs with varying positions to ensure all results are returned. | def get_with_size_and_position path, opts = {}
size = opts[:size] || 200
position = opts[:position] || 0
results = []
loop do
params = { size: size, position: position }.merge(opts)
new_results = get(path, params)
results += new_results
break if new_results.length < size
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_multiple(end_point, req_number, params = nil)\n switch_concurrent_connection\n responses = []\n connection.in_parallel do\n req_number.times do |n_req|\n responses << connection.get do |req|\n req.url end_point\n req.headers['Authentication'] = ENV['API_... | [
"0.6492552",
"0.64920807",
"0.6214615",
"0.6069374",
"0.6048831",
"0.59112245",
"0.5844754",
"0.5786728",
"0.57799435",
"0.5749339",
"0.5748032",
"0.57214844",
"0.5710721",
"0.5708137",
"0.5655505",
"0.5641281",
"0.5615102",
"0.5585795",
"0.5558468",
"0.5541175",
"0.55171484"... | 0.5643923 | 15 |
oids: [oid1..oidn, 0, 10] | def bulk(host, community, oids)
non_repeaters = oids.pop
max_repetitions = oids.pop
SNMP::Manager.open(:Host => host, :Version => :SNMPv2c,
:Community => community) do |manager|
response = manager.get_bulk(non_repeaters, max_repetitions, oids)
response.each_varbind do |varbind|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monograph_noid(args = {})\n case\n when args.include?(:identifier)\n identifier_list = [ args[:identifier] ]\n when args.include?(:identifier_list)\n identifier_list = args[:identifier_list]\n else\n return \"\"\n end\n\n # Attempt to retrieve the NOID for the... | [
"0.58635765",
"0.56626195",
"0.55519456",
"0.54572594",
"0.5432282",
"0.53824097",
"0.53824097",
"0.5335087",
"0.530432",
"0.52738667",
"0.5272184",
"0.5243117",
"0.52010584",
"0.51807654",
"0.51766354",
"0.5161552",
"0.5151859",
"0.5151859",
"0.5151151",
"0.5127559",
"0.5120... | 0.0 | -1 |
Sends a progress update Inputs: percentage Integer Optional description, this could be displayed to the user e.g. Resizing image | def progress(percentage, description = nil)
reply({:progress => percentage, :description => description}, {:message_type => 'progress'})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(percentage,text=nil)\n @progressBar.text = text.to_s if text\n @progressBar.fraction = percentage.to_f\n end",
"def progress()\n percent = (($ops / $total_ops) * 100).floor\n if (percent <= 99)\n $progress.progress = percent\n $ops += 1\n else\n $progress.finish\n end\nend",
... | [
"0.7638601",
"0.70924854",
"0.70458984",
"0.6957239",
"0.694144",
"0.69105506",
"0.69105506",
"0.69105506",
"0.69105506",
"0.69105506",
"0.68811923",
"0.6865555",
"0.68185127",
"0.67870325",
"0.6713462",
"0.66508126",
"0.6617774",
"0.66099554",
"0.6544198",
"0.6544198",
"0.64... | 0.7824124 | 0 |
Vissza adja a targyak metszetet es kulonbsegeit Ex.: [metszet: ['alma', 'korte'], first_min_second: ['eper', 'dinnye'], second_min_first: ['paprika', 'szilva']] ` | def search(first_class, second_class)
metszet = []
first_min_second = []
first_class[:descr].split(',').each do |first_word|
if second_class[:descr].include? first_word
metszet << first_word
else
first_min_second << first_word
end
end
{metszet: metszet, first_min_second: first_min_seco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value\n end",
"def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend",
"def smaller(restaurant_menu)\n mas_barato = restaurant_menu.min_b... | [
"0.6052818",
"0.60511017",
"0.60249376",
"0.59781986",
"0.59098923",
"0.5891975",
"0.5880396",
"0.58195144",
"0.5782108",
"0.57514155",
"0.5725051",
"0.5711587",
"0.5710335",
"0.57090104",
"0.5703805",
"0.56968045",
"0.5686153",
"0.56567943",
"0.5651337",
"0.5651116",
"0.5649... | 0.0 | -1 |
Returns an array of all Sites on this server. | def sites
request('/web_properties.json').map do |site_data|
Site.new self, site_data['uid'], site_data['name']
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sites\n @sites ||= []\n end",
"def list_sites\n r = execute(make_xml('SiteListingRequest'))\n arr = []\n if r.success\n r.res.elements.each('SiteListingResponse/SiteSummary') do |site|\n arr << SiteSummary.new(site.attributes['id'].to_i,\n ... | [
"0.79550517",
"0.75706774",
"0.7404982",
"0.73523974",
"0.7344159",
"0.72628427",
"0.726271",
"0.72118706",
"0.715131",
"0.7027575",
"0.6935593",
"0.6933538",
"0.69090635",
"0.6908051",
"0.6905695",
"0.68975306",
"0.6896117",
"0.68200284",
"0.6817967",
"0.6814397",
"0.6782456... | 0.6828741 | 17 |
Returns the Site with the given UID. This method does a server request, to get additional property data. | def site(uid)
site_data = request("/web_properties/#{uid}.json")
Site.new self, site_data['uid'], site_data['name']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sites\n request('/web_properties.json').map do |site_data|\n Site.new self, site_data['uid'], site_data['name']\n end\n end",
"def get(uid)\n raise '`get` method by ID is not supported for this resource.'\n end",
"def collect_site_details\n site = fetch('site','1')\n @site... | [
"0.61289465",
"0.5512622",
"0.5508035",
"0.5489653",
"0.5458613",
"0.54338104",
"0.5417794",
"0.53828555",
"0.538107",
"0.5327955",
"0.5324578",
"0.53003526",
"0.5295587",
"0.5248692",
"0.5243255",
"0.52392995",
"0.5217557",
"0.5206366",
"0.52001184",
"0.5194564",
"0.5186917"... | 0.7929458 | 0 |
GET /likes Mostra todos os likes | def index
@likes = Like.all
render json: @likes, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @likes = Like.all\n end",
"def index\n @likes = Like.all\n end",
"def likes(options = {})\n urn = options.delete(:urn)\n path = \"/socialActions/#{urn}/likes\"\n get(path, options)\n end",
"def set_likes\n @likes = likes.find(params[:id])\n end",
"def index\n ... | [
"0.7544764",
"0.7544764",
"0.7470378",
"0.7364153",
"0.7342139",
"0.7328079",
"0.73216075",
"0.7293337",
"0.7274337",
"0.72464454",
"0.7214664",
"0.72048587",
"0.7202439",
"0.709546",
"0.7057871",
"0.7054916",
"0.70053536",
"0.6981248",
"0.6981153",
"0.6978274",
"0.69717467",... | 0.76030463 | 0 |
GET /likes/post/:post_id Mostra os likes no post com id especificada | def postlikes
render json: @likes.length, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_like\n @like = @post.likes.find(params[:id])\n end",
"def set_postlike\n @likes = Like.where(post_id: params[:post_id])\n end",
"def like\n if params[:post_id]\n likeable = Comment.find(params[:id])\n what = \"Comment\"\n else\n likeable = Post.find(params[:id])\n ... | [
"0.8234097",
"0.80984473",
"0.78978914",
"0.7893642",
"0.77559596",
"0.7590796",
"0.7499532",
"0.7495343",
"0.7479169",
"0.7467275",
"0.7420498",
"0.7377292",
"0.7176533",
"0.7163907",
"0.7161006",
"0.7128411",
"0.7097083",
"0.7084104",
"0.7073139",
"0.706473",
"0.7061988",
... | 0.67525333 | 47 |
POST /likes Cria uma novo like | def create
@like = Like.new(like_params)
if @like.save
render json: @like, status: 201
else
render json: @like.errors, status: 422
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @todo_like = Todo::Like.new(todo_like_params)\n @todo_user.likes << @todo_like\n\n if @todo_like.save\n render :show, status: :created\n else\n render_error @todo_like, status: :unprocessable_entity\n end\n end",
"def create_likes\n end",
"def create_likes\n end",
"de... | [
"0.7900827",
"0.7732767",
"0.7732767",
"0.7732767",
"0.76260436",
"0.7599984",
"0.75862503",
"0.7556556",
"0.75392485",
"0.7472199",
"0.7468491",
"0.74646026",
"0.7463974",
"0.74619645",
"0.7436752",
"0.7429093",
"0.74265635",
"0.7389417",
"0.730357",
"0.7277512",
"0.72712845... | 0.7355309 | 18 |
Retorna os likes de uma postagem | def set_postlike
@likes = Like.where(post_id: params[:post_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def likes\n @likes ||= raw[\"tumblr\"][\"posts\"][\"post\"].collect do |raw_like|\n if raw_like[\"type\"] == \"regular\"\n title = raw_like[\"regular_title\"]\n body = raw_like[\"regular_body\"]\n type = \"text\"\n photo_url = nil\n elsif raw_lik... | [
"0.75862193",
"0.7520074",
"0.7430563",
"0.73953044",
"0.7333139",
"0.730347",
"0.7298561",
"0.728033",
"0.7273957",
"0.72500753",
"0.71765",
"0.71490127",
"0.70991594",
"0.7067435",
"0.7062808",
"0.7060086",
"0.70351255",
"0.7033932",
"0.70124876",
"0.6990421",
"0.69760317",... | 0.69821304 | 20 |
GET /invites GET /invites.json | def index
@invites = Invite.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n ... | [
"0.7958046",
"0.79423165",
"0.79423165",
"0.79423165",
"0.7743506",
"0.76207006",
"0.7491129",
"0.7401899",
"0.72615576",
"0.72603977",
"0.723915",
"0.70882404",
"0.70795256",
"0.70176214",
"0.7009148",
"0.7004193",
"0.6997959",
"0.69858664",
"0.68600833",
"0.6813469",
"0.680... | 0.7668945 | 9 |
GET /invites/1 GET /invites/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites ... | [
"0.76881135",
"0.76881135",
"0.76881135",
"0.74298084",
"0.7380879",
"0.7380879",
"0.7380879",
"0.7380879",
"0.7380879",
"0.7368029",
"0.7330251",
"0.7071977",
"0.70695776",
"0.70695776",
"0.70695776",
"0.70695776",
"0.7046284",
"0.6990816",
"0.69736195",
"0.6952758",
"0.6948... | 0.0 | -1 |
POST /invites POST /invites.json | def create
@invite = Invite.new(invite_params)
@invite.sender_id = current_user.id
if @invite.save
#if the user already exists
if @invite.recipient != nil
#send a notification email
InviteMailer.existing_user_invite(@invite).deliver
#Add the user to the user group
@invite.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@ema... | [
"0.69848865",
"0.6835423",
"0.665867",
"0.6657357",
"0.66251135",
"0.6613855",
"0.66080153",
"0.6599364",
"0.6599364",
"0.6599364",
"0.65854967",
"0.6575549",
"0.65548944",
"0.65405744",
"0.65033305",
"0.64781004",
"0.64531684",
"0.64299184",
"0.6427502",
"0.6420567",
"0.6420... | 0.0 | -1 |
PATCH/PUT /invites/1 PATCH/PUT /invites/1.json | def update
respond_to do |format|
if @invite.update(invite_params)
format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @invite.errors, status... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n format.html { redirect_to @invite, notice: (t 'invite.update') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.6908473",
"0.68849975",
"0.68849975",
"0.68849975",
"0.6831984",
"0.66649175",
"0.6607221",
"0.6544699",
"0.65013003",
"0.65013003",
"0.65013003",
"0.65013003",
"0.64827174",
"0.6470114",
"0.6402051",
"0.6368439",
"0.63679135",
"0.6360231",
"0.6336215",
"0.6326225",
"0.631... | 0.6591822 | 8 |
DELETE /invites/1 DELETE /invites/1.json | def destroy
@invite.destroy
respond_to do |format|
format.html { redirect_to invites_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @invite = Invite.find(params[:id])\n @invite.destroy\n\n respond_to do |format|\n format.html { redirect_to invites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invite = Invite.find(params[:id])\n @invite.destroy\n\n respond_to do |format|\n... | [
"0.7668476",
"0.7668476",
"0.7668476",
"0.7668476",
"0.7457771",
"0.72055924",
"0.7199649",
"0.7199649",
"0.7199649",
"0.7199649",
"0.7193738",
"0.71763223",
"0.7166482",
"0.7079448",
"0.70431536",
"0.70200104",
"0.6986385",
"0.6942255",
"0.6895627",
"0.6848635",
"0.6829932",... | 0.7420519 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_invite
@invite = Invite.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 invite_params
params.require(:invite).permit(:email, :sender_id, :recipient_id, :token)
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 |
TODO: If no original_stock_location given, return a stock item according to some priority of the regular stock locations, instead of just the first one we find. | def stock_item(variant_id, user_id = nil, original_stock_location_id = nil)
return super(variant_id) unless reserved_items?
raise(
UserRequiredArgumentError,
Spree.t(:user_id_required_for_reserved_stock_location)
) unless user_id.present?
items = stock_items.where(variant_id: variant_id, use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stock(item_id)\n stocks.find {|st| st.item_id === item_id }\n end",
"def lookup_stock(name)\n return StockQuote::Stock.quote(name)\nend",
"def lowest_stock # A refactoriser via méthode SQL, on peut faire beaucoup plus court\n # Pour chaque produit récupérer la remaining quantity\n # Vérifier si cett... | [
"0.62543505",
"0.614009",
"0.5910705",
"0.5881634",
"0.5777033",
"0.5772522",
"0.5648893",
"0.56396985",
"0.5593023",
"0.555641",
"0.5554408",
"0.5550677",
"0.5539887",
"0.5474278",
"0.5446111",
"0.5444322",
"0.5389466",
"0.52754205",
"0.5259013",
"0.52447337",
"0.52430665",
... | 0.6792954 | 0 |
Generate a token by looping and ensuring it does not already exist. | def generate_token
loop do
token = SecureRandom.base64(44).tr("+/=", "xyz").first(16).upcase
break token unless self.class.where(:token => token).first
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_token\n self.token ||= loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless self.class.exists?(token: random_token)\n end\n end",
"def create_token\n if self.token.nil?\n self.token = loop do\n random_token = \"BON-#{S... | [
"0.8182951",
"0.8116123",
"0.8088196",
"0.8055456",
"0.7933969",
"0.7831086",
"0.77418095",
"0.7670257",
"0.7660368",
"0.76479715",
"0.7604471",
"0.7512626",
"0.74904776",
"0.7487344",
"0.74511945",
"0.7429373",
"0.7429373",
"0.723246",
"0.721048",
"0.7197418",
"0.7140266",
... | 0.8035977 | 4 |
show instance of model | def specific_show(model, id)
model.find(id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n ... | [
"0.77140474",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767937",
"0.767... | 0.0 | -1 |
provides the institution_id from the authentication block | def auth_inst_id
auth[:institution_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def institution_id\n\t\tif organisation.nil?\n\t\t\treturn nil\n\t\telse\n\t\t\treturn organisation.root.id\n\t\tend\n\tend",
"def institution\n @institution ||= Institutions.institutions[institution_code.to_sym]\n end",
"def institution\n @institution ||= Institutions.institutions[institution_code.to_s... | [
"0.72608656",
"0.68392867",
"0.68392867",
"0.64460135",
"0.64351135",
"0.6403331",
"0.6301779",
"0.62198377",
"0.6191585",
"0.6138439",
"0.6019603",
"0.6018182",
"0.59983885",
"0.59951633",
"0.59127873",
"0.59085804",
"0.5883133",
"0.58764386",
"0.5867963",
"0.5702741",
"0.56... | 0.8112613 | 0 |
provides the user_id from the authentication block | def auth_user_id
auth[:user_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id\n @raw['user']['id']\n end",
"def user_id\n # The user id can't be handled by the method_missing magic from\n # OctocatHerder::Base, since the id method returns the object\n # id.\n @raw['id']\n end",
"def user_id\n instance_variable_get(:@prepared_argument... | [
"0.7645467",
"0.7389681",
"0.7312701",
"0.7123653",
"0.71005976",
"0.7092453",
"0.7092453",
"0.7092453",
"0.7092453",
"0.7092453",
"0.7092453",
"0.7083815",
"0.70586646",
"0.70318735",
"0.7011396",
"0.69800925",
"0.696835",
"0.696835",
"0.696835",
"0.696835",
"0.696835",
"0... | 0.7673672 | 0 |
check existence of auth params | def auth_params_exist
auth.key?(:user_id) && auth.key?(:api_key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_for_params_auth?; end",
"def valid_for_params_auth?\n params_authenticatable? && valid_params_request? &&\n valid_params? && with_authentication_hash(:params_auth, params_auth_hash)\n end",
"def valid_params?\n params_auth_hash.is_a?(Hash)\n end",
"def is_empty_para... | [
"0.816638",
"0.77417094",
"0.7450934",
"0.74055743",
"0.7396229",
"0.737999",
"0.72717565",
"0.70791",
"0.7000566",
"0.6939553",
"0.6935825",
"0.6845076",
"0.6775781",
"0.6733712",
"0.6727407",
"0.6726336",
"0.6710135",
"0.67016196",
"0.66966575",
"0.66760284",
"0.6672235",
... | 0.8768393 | 0 |
returns a hash of only the search parameters that apply to the specific model being queried | def model_search_params(model, params)
cols = model.column_names
params.reject { |k, _v| !cols.include?(k) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_query_params\n out = {}\n search_attributes.each do |val|\n out[val.field] = self.send(val.field) unless self.send(val.field).blank?\n end\n\n out\n end",
"def fetch_custom_search_params; end",
"def search_params\n params.fetch(:search, {})\n end",
"def search_pa... | [
"0.79279274",
"0.7138219",
"0.7130279",
"0.7130279",
"0.7130279",
"0.69336075",
"0.6910689",
"0.6885791",
"0.6873534",
"0.6815955",
"0.681338",
"0.6802341",
"0.67571557",
"0.6730063",
"0.670062",
"0.6698462",
"0.6678437",
"0.66590023",
"0.6657164",
"0.665496",
"0.6647552",
... | 0.75259227 | 1 |
to install specific streams and profiles: $ dnf module install modulename:stream/profile $ dnf module install perl:5.24/minimal if unspecified, they will be defaulted (see [d] param in dnf module list output) | def install
# ensure we start fresh (remove existing stream)
uninstall unless [:absent, :purged].include?(@property_hash[:ensure])
args = @resource[:name].dup
case @resource[:ensure]
when true, false, Symbol
# pass
else
args << ":#{@resource[:ensure]}"
end
args << "/#{@resou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n args = @resource[:name]\n # ensure we start fresh (remove existing stream)\n uninstall unless [:absent, :purged].include?(@property_hash[:ensure])\n case @resource[:ensure]\n when true, false, Symbol\n # pass\n else\n args << \":#{@resource[:ensure]}\"\n end\n if @re... | [
"0.6378302",
"0.58142465",
"0.5811897",
"0.5429503",
"0.5412068",
"0.53860205",
"0.5375154",
"0.5346813",
"0.5346813",
"0.5322329",
"0.53153825",
"0.53139937",
"0.5310551",
"0.530886",
"0.5297804",
"0.52954435",
"0.5291388",
"0.5283234",
"0.52825147",
"0.52732813",
"0.5236966... | 0.69993186 | 0 |
Configure knapsack report Setup variables Fetch latest report | def configure!
ENV["KNAPSACK_TEST_FILE_PATTERN"] ||= "qa/specs/features/**/*_spec.rb"
ENV["KNAPSACK_REPORT_PATH"] = report_path
Knapsack.logger = QA::Runtime::Logger.logger
download_report
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_report_settings!\n\n #set up default values\n self.network_perf = true\n self.network_perf = true\n self.route_perf_t = true\n self.route_tt_t = true\n self.route_perf_c = true\n self.route_tt_c = true\n self.duration = 86400\n\n #These are used for ScaterPlots and ScatterG... | [
"0.5656863",
"0.5396806",
"0.53540295",
"0.52948236",
"0.52855825",
"0.5277777",
"0.5212641",
"0.5191116",
"0.51815605",
"0.5153086",
"0.511975",
"0.51102775",
"0.5089693",
"0.5089693",
"0.50691193",
"0.5059716",
"0.50484574",
"0.5037243",
"0.50289696",
"0.50271183",
"0.50063... | 0.6904296 | 0 |
Download knapsack report from gcs bucket | def download_report
logger.debug("Downloading latest knapsack report for '#{report_name}' to '#{report_path}'")
file = client.get_object(BUCKET, report_file)
File.write(report_path, file[:body])
rescue StandardError => e
ENV["KNAPSACK_REPORT_PATH"] = FALLBACK_REPORT
logger.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_benchmark_output\n if !ApplicationController.fire_cloud_client.services_available?('GoogleBuckets')\n head 503 and return\n end\n\n requested_file = ApplicationController.gcs_client.execute_gcloud_method(:get_workspace_file, 0, @user_workspace.namespace,\n ... | [
"0.63311225",
"0.59666455",
"0.5818391",
"0.57888836",
"0.551008",
"0.51703316",
"0.5161123",
"0.51274544",
"0.5125504",
"0.5040815",
"0.5039935",
"0.50388086",
"0.49987504",
"0.49857906",
"0.49622244",
"0.49592185",
"0.49359795",
"0.492353",
"0.49170744",
"0.4903087",
"0.489... | 0.6491717 | 0 |
Rename and move new regenerated report to a separate folder used to indicate report name | def move_regenerated_report
return unless ENV["KNAPSACK_GENERATE_REPORT"] == "true"
tmp_path = "tmp/knapsack/#{report_name}"
FileUtils.mkdir_p(tmp_path)
# Use path from knapsack config in case of fallback to master_report.json
knapsack_report_path = Knapsack.report.report_path
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generatedReportFolder\n currentData, currentTime = DateTime.now.strftime(\"%Y_%m_%d %H_%M\").split(' ')\n path = \"#{$ROOT}/../output\"\n creatFolder(path)\n path += \"/#{currentData}\"\n creatFolder(path)\n path += \"/#{currentTime}\"\n creatFolder(path)\n path\n end",
"def new_file... | [
"0.6160137",
"0.6125244",
"0.6013985",
"0.58310205",
"0.58233744",
"0.57581466",
"0.57088715",
"0.56791013",
"0.5672969",
"0.56674683",
"0.56530285",
"0.56306183",
"0.5624512",
"0.55690086",
"0.5519024",
"0.5510288",
"0.5503708",
"0.5496041",
"0.5495401",
"0.54946774",
"0.548... | 0.70011115 | 0 |
Merge and upload knapsack report to gcs bucket Fetches all files defined in glob and uses parent folder as report name | def upload_report(glob)
reports = Pathname.glob(glob).each_with_object(Hash.new { |hsh, key| hsh[key] = [] }) do |report, hash|
next unless report.extname == ".json"
hash[report.parent.basename.to_s].push(report)
end
return logger.error("Glob '#{glob}' did not contain any va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_files_in_buckets\n @files.each do |file|\n place_file_in_buckets(file)\n end\n end",
"def process_workspace_bucket_files(files)\n # first mark any files that we already know are study files that haven't changed (can tell by generation tag)\n files_to_remove = []\n files... | [
"0.6140814",
"0.58546835",
"0.57979655",
"0.57714075",
"0.5493003",
"0.5478963",
"0.53091407",
"0.52255744",
"0.5213097",
"0.51806384",
"0.51462024",
"0.51106644",
"0.50835323",
"0.5065028",
"0.50629234",
"0.5041598",
"0.5039722",
"0.5033797",
"0.4996107",
"0.49708122",
"0.49... | 0.7857947 | 0 |
Base path of knapsack report | def report_base_path
@report_base_path ||= "knapsack"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pathBaseSummary()\n return \"#{@resultBaseDir}/#{getConf(:basenameSummary)}\" ;\n end",
"def base_path\n super.concat \"/application_plans/#{application_plan['id']}/metrics/#{metric['id']}/limits\"\n end",
"def app_thinning_size_report_path\n Gym.cache[:app_thinning_size_report] ||= ... | [
"0.66301197",
"0.6129114",
"0.60752475",
"0.6011144",
"0.59272826",
"0.5903291",
"0.58584666",
"0.582792",
"0.57376164",
"0.5731664",
"0.57311064",
"0.568675",
"0.56706345",
"0.56676203",
"0.5614115",
"0.55870783",
"0.55824566",
"0.5579267",
"0.55567247",
"0.5550666",
"0.5541... | 0.853375 | 0 |
Report name Infer report name from ci job name Remove characters incompatible with gcs bucket naming from job names like ee:instanceparallel | def report_name
@report_name ||= ENV["CI_JOB_NAME"].split(" ").first.tr(":", "-")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_name\n @job_name ||= QA::Runtime::Env.ci_job_name&.gsub(%r{ \\d{1,2}/\\d{1,2}}, '')\n end",
"def trim_job_name(job_name)\n job_name = job_name.gsub('grid-', '');\n job_name = job_name.gsub('store-', '');\n job_name = job_name.gsub('sphere-', '');\n job_name = job_name.gsub('-public-de... | [
"0.7248338",
"0.6820897",
"0.6768887",
"0.67313915",
"0.63627213",
"0.6267965",
"0.6105949",
"0.60516924",
"0.5920085",
"0.5904481",
"0.58996475",
"0.5779933",
"0.5767508",
"0.57361823",
"0.5682957",
"0.567658",
"0.5672096",
"0.5666553",
"0.56558",
"0.5650843",
"0.56354606",
... | 0.7777293 | 0 |
clean the tree, for example, eliminates sequence that have only one child (use the child directly). | def clean_tree(branch)
branch.children = branch.children.inject(Children.new(branch)) do |r, c|
cc = if c.name == 'sequence' and c.children.size == 1
c.children.first
else
c
end
r << clean_tree(cc)
end
branch
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tree\n @root = nil # In ruby it will be taken care by garbage collector\n end",
"def clean_children\n\n return unless @children\n\n @children.each do |child_fei|\n #next unless child.is_a?(FlowExpressionId)\n get_expression_pool.remove(child_fei)\n end\n end",
"de... | [
"0.7100007",
"0.705259",
"0.6893871",
"0.68154705",
"0.66956043",
"0.6646522",
"0.66318303",
"0.6615858",
"0.6603389",
"0.6541945",
"0.65344673",
"0.6487312",
"0.64776355",
"0.64569944",
"0.6451546",
"0.64353853",
"0.64272636",
"0.64166486",
"0.6415475",
"0.6396895",
"0.63621... | 0.7773698 | 0 |
Open and parse the JSON config file | def read_config(config_file)
begin
file = File.read(config_file)
parsed_config = JSON.parse(file)
rescue
abort("ERROR: Error parsing configuration file #{config_file}. " \
'Does it exist and is it valid JSON?')
end
parsed_config
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse\n checkArguments\n configContent = File.read(ARGV[0])\n @config = JSON.parse(configContent)\n checkConfig\n end",
"def parse_config_file\n JSON.parse(File.read(CONFIG_FILE))\n rescue Errno::ENOENT\n abort \"#{CONFIG_FILE} does not exist\"\n rescue Errno::EACCES\n abort \"#{CONFI... | [
"0.7949474",
"0.7935256",
"0.74392104",
"0.7391881",
"0.7321118",
"0.72972506",
"0.7231015",
"0.7159862",
"0.71275073",
"0.71275073",
"0.7069737",
"0.7067277",
"0.7067277",
"0.7042999",
"0.7042999",
"0.70193017",
"0.69817924",
"0.69806206",
"0.6866703",
"0.6750629",
"0.671720... | 0.76957047 | 2 |
Configuration blocks allow for lists of remote hosts, those are split into seperate configuration blocks here | def split_multi_remotehost_config_blocks(config_block)
split_config = []
config_block['remoteHost'].each do |single_remote_host|
# Clone the block containing the multiple remote hosts
config_block_for_single_remote_host = config_block.clone
# And replace them with a single remote host
config_block_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_config(parsed_config)\n final_config = []\n parsed_config.each do |config_block|\n # Skip any blocks that are explicitely not enabled\n next if config_block.key?('enabled') && !config_block['enabled']\n if config_block['remoteHost'].instance_of? Array\n final_config += split_multi_remot... | [
"0.7338561",
"0.70764697",
"0.6782281",
"0.65633124",
"0.65633124",
"0.65633124",
"0.654711",
"0.63554907",
"0.63472986",
"0.63418674",
"0.63418674",
"0.63105065",
"0.6256475",
"0.62415254",
"0.6212775",
"0.61521417",
"0.60444057",
"0.60348874",
"0.60348874",
"0.6033988",
"0.... | 0.7541265 | 0 |
Do some processing on the config file | def process_config(parsed_config)
final_config = []
parsed_config.each do |config_block|
# Skip any blocks that are explicitely not enabled
next if config_block.key?('enabled') && !config_block['enabled']
if config_block['remoteHost'].instance_of? Array
final_config += split_multi_remotehost_confi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_config_file(path)\n RFlow.logger.info \"Processing config file (#{Dir.getwd}) '#{path}'\"\n load path\n end",
"def read_config_file; end",
"def process_config src, file_name\n ConfigProcessor.new(@tracker).process_config src, file_name\n end",
"def process_configuration... | [
"0.7245451",
"0.72063315",
"0.71218544",
"0.69191295",
"0.6660201",
"0.6607126",
"0.6557703",
"0.6541967",
"0.65008277",
"0.6435856",
"0.64324546",
"0.6400171",
"0.6371877",
"0.6361896",
"0.63294077",
"0.6314053",
"0.62986827",
"0.6270945",
"0.6264758",
"0.62597334",
"0.62301... | 0.0 | -1 |
Start a watch thread | def start_watch(source_path, remote_path, remote_host, rsync_options,
watch_id, post_sync_command = nil)
loop do
# fswatch options:
# -1: exit after one iteration
# -r: recurse
# -L: follow symlinks
# --event Updated/Removed/Created: only shows events that signify change
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_watcher\n Thread.new{ loop{ watcher_cycle }}\n end",
"def start_watching\n @thread = Thread.new{ \n while true\n self.scan_now\n sleep @autoscan_delay\n end\n }\n end",
"def watch\n start_watch\n end",
"def watch!\n start_wa... | [
"0.8071916",
"0.7824669",
"0.7782203",
"0.7703943",
"0.7517338",
"0.74257773",
"0.7293041",
"0.71746475",
"0.71254134",
"0.6934898",
"0.6845798",
"0.68199307",
"0.6794759",
"0.6777712",
"0.6588963",
"0.65659827",
"0.6536238",
"0.651477",
"0.64946926",
"0.646983",
"0.64641637"... | 0.63439465 | 25 |
Returns an image tag for a Google Maps image with the GPS polyline of the activity. | def polyline_image(polyline, size = 150, color = "blue")
image_tag(polyline_map_url(polyline, size, color),
alt: "Activity map")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_image location, width=500, height=275, zoom=15\n image_tag(\"http://maps.googleapis.com/maps/api/staticmap?center=#{location.latitude},#{location.longitude}&zoom=#{zoom}&size=#{width}x#{height}&markers=color:blue%7Clabel:1%7C#{location.latitude},#{location.longitude}&sensor=false\", :class => \"map_imag... | [
"0.6824514",
"0.65281117",
"0.64669037",
"0.631032",
"0.5903551",
"0.58798385",
"0.58798385",
"0.58798385",
"0.578538",
"0.56194264",
"0.55652374",
"0.5491314",
"0.5479745",
"0.5470793",
"0.54530746",
"0.5445605",
"0.54446155",
"0.54302865",
"0.53642136",
"0.5344973",
"0.5337... | 0.7739354 | 0 |
Detect if the event can spot the player and move to the player with direction relative detection | def player_spotted_directional?(up: nil, down: nil, left: nil, right: nil)
case $game_map.events[@event_id].direction
when 2
return player_spotted?(down || up || left || right || 1)
when 8
return player_spotted?(up || down || left || right || 1)
when 4
return player_spotted?(left || ri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pbEventFacesPlayer?(event,player,distance)\n return false if distance<=0\n # Event can't reach player if no coordinates coincide\n return false if event.x!=player.x && event.y!=player.y\n deltaX = (event.direction==6) ? 1 : (event.direction==4) ? -1 : 0\n deltaY = (event.direction==2) ? 1 : (event.directi... | [
"0.7021321",
"0.6991838",
"0.6953156",
"0.672192",
"0.6523583",
"0.65051264",
"0.6491392",
"0.6436279",
"0.6388089",
"0.63589907",
"0.63353544",
"0.631899",
"0.62984306",
"0.6284852",
"0.6279198",
"0.62755275",
"0.62330383",
"0.6228724",
"0.6228079",
"0.62206763",
"0.6218944"... | 0.68240285 | 3 |
Detect the player in a specific direction | def detect_player(nb_pas, direction)
return false if $game_switches[Yuki::Sw::Env_Detection]
c = $game_map.events[@event_id]
dx = $game_player.x - c.x
dy = $game_player.y - c.y
case direction
when :right, 6
return (dy == 0 && dx >= 0 && dx <= nb_pas)
when :down, 2
return (dx == 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def di(x); $game_player.directionalInput == x; end",
"def turn_to_player\n diffx = @x - $game.player.x\n diffy = @y - $game.player.y\n down = diffy < 0\n left = diffx > 0\n right = diffx < 0\n up = diffy > 0\n if down\n @direction = 2\n elsif up\n @direction ... | [
"0.69039494",
"0.67745876",
"0.6509103",
"0.64658564",
"0.64279443",
"0.63223827",
"0.6275695",
"0.62329936",
"0.6192447",
"0.6164574",
"0.6164574",
"0.6159311",
"0.61554235",
"0.6108618",
"0.6068152",
"0.6058643",
"0.6058213",
"0.6039256",
"0.6033777",
"0.60277975",
"0.60205... | 0.7166496 | 0 |
Detect the player in a rectangle around the event | def detect_player_rect(nx, ny)
return false if $game_switches[Yuki::Sw::Env_Detection]
c = $game_map.events[@event_id]
dx = ($game_player.x - c.x).abs
dy = ($game_player.y - c.y).abs
return (dx <= nx && dy <= ny)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onalg_player_has_moved(player,color, start_x, start_y, end_x, end_y)\r\n if player != @alg_player\r\n \r\n end\r\n end",
"def player_push_button(event)\n if ((event.x - 180)**2 + (event.y - 810)**2).abs <= 8100\n @player_playing = 0\n elsif ((event.x - 1180)**2 + (event.y - 810)**2).... | [
"0.67386544",
"0.6657943",
"0.6456209",
"0.64166856",
"0.61822844",
"0.61503327",
"0.61353695",
"0.6100163",
"0.6041976",
"0.60358363",
"0.6006808",
"0.600609",
"0.59700865",
"0.59470993",
"0.59283006",
"0.59061223",
"0.5899723",
"0.58703464",
"0.5866658",
"0.58552366",
"0.58... | 0.74727374 | 0 |
Delete the current event forever | def delete_this_event_forever
$env.set_event_delete_state(@event_id)
$game_map.events[@event_id]&.erase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gcdelete_event\n cal_event = Event.find_by(gamecall_tag: self.id)\n cal_event.destroy if cal_event\n end",
"def delete\n MoxiworksPlatform::Event.delete(self.to_hash)\n end",
"def destroy\r\n @event.destroy\r\n end",
"def purge\n i = 0\n debug \"Purge events on GCal... \"\n ... | [
"0.70878845",
"0.7075776",
"0.6887765",
"0.6740551",
"0.6656339",
"0.6656339",
"0.6656339",
"0.6639906",
"0.6573895",
"0.6548764",
"0.6521256",
"0.6423632",
"0.6387505",
"0.638528",
"0.63606566",
"0.63352406",
"0.6332292",
"0.63229036",
"0.63029516",
"0.6264226",
"0.6249685",... | 0.8512633 | 0 |
Wait for the end of the movement of this particular character | def wait_character_move_completion(event_id = @event_id)
@move_route_waiting = true
@move_route_waiting_id = event_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_player\n wait_character_move_completion 0\n end",
"def update\n if button_down? Gosu::Button::KbEscape then\n do_exit\n end\n if @waiting then\n @waiting = @waiting - (Gosu::milliseconds - @time)\n @time = Gosu::milliseconds\n if @waiting.to_i <= 0 then... | [
"0.7760461",
"0.62054217",
"0.6096826",
"0.59877986",
"0.59877986",
"0.5973073",
"0.5861543",
"0.585147",
"0.5762579",
"0.5747054",
"0.570506",
"0.5692232",
"0.5672972",
"0.56296563",
"0.56163204",
"0.55777335",
"0.55704474",
"0.5537389",
"0.5530464",
"0.5530464",
"0.5518111"... | 0.69585085 | 1 |
Detect if a specified tile (in layer 3) is in the specified zone | def detect_invalid_tile(x, y, width, height, tile_id)
ox = Yuki::MapLinker.get_OffsetX
oy = Yuki::MapLinker.get_OffsetY
rangex = (x + ox)...(x + ox + width)
rangey = (y + oy)...(y + oy + height)
gm = $game_map
return rangex.any? { |tx| rangey.any? { |ty| gm.get_tile(tx, ty) == tile_id } }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isInTile?(x,y)\r\n if @inclusive\r\n return iTile(x,y)\r\n else\r\n return xTile(x,y)\r\n end\r\n end",
"def contains_point(x,y,z)\n behind = true\n @planes.each{|p|\n behind = (0 >= p.distance_to_point(x,y,z))\n break if not behind\n }\n retu... | [
"0.6646575",
"0.65451014",
"0.653145",
"0.63563967",
"0.6271914",
"0.6222354",
"0.61680907",
"0.61251426",
"0.60486346",
"0.5990904",
"0.59853154",
"0.5950763",
"0.5950763",
"0.5943452",
"0.59415495",
"0.5940451",
"0.5887857",
"0.5885925",
"0.58771425",
"0.5876625",
"0.585437... | 0.5781004 | 25 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.