query stringlengths 7 9.5k | document stringlengths 10 1.07M | negatives listlengths 19 19 | metadata dict |
|---|---|---|---|
Swktch on / off marking on the current file or directory. | def toggle_mark
main.toggle_mark current_item
end | [
"def change_flag\n @flagged = !@flagged unless revealed?\n end",
"def mark!\n\t\t\t\t@marked = true\n\t\t\tend",
"def mark_current\n @mark = @current\n end",
"def toggle\n if on?\n off\n else\n on\n end\n end",
"def switch_flag\n\t\t@flag = !@flag\n\tend",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accept user input, and directly execute it as a Ruby method call to the controller. ==== Parameters +preset_command+ A command that would be displayed at the command line before user input. +default_argument+ A default argument for the command. | def process_command_line(preset_command: nil, default_argument: nil)
prompt = preset_command ? ":#{preset_command} " : ':'
command_line.set_prompt prompt
cmd, *args = command_line.get_command(prompt: prompt, default: default_argument).split(' ')
if cmd && !cmd.empty? && respond_to?(cmd)
ret = self.public_send cmd, *args
clear_command_line
ret
end
rescue Interrupt
clear_command_line
end | [
"def pre_cmd(input); end",
"def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend",
"def deliver(default = nil)\n # Design decision: the pre-prompt behavior\n # gets evaluated *once*, not every time the\n # user gets prompted... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert angle into radian | def to_rad(angle)
angle * Math::PI / 180
end | [
"def to_radian(r)\n r % 180.0 if r >= 180.0 || r <= -180.0\n r * Math::PI / 180.0\n end",
"def rad2rad(rad)\r\n remt(rad, PI2)\r\n end",
"def grados2radianes(alfa)\n\t\treturn ((alfa*Math::PI)/180)\n\tend",
"def radian(degree)\n degree*(Math::PI/180)\n end",
"def sec_to_rad(x)\n x... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /rows/1 GET /rows/1.xml | def show
@row = Row.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @row }
end
end | [
"def result2_data_rows(experiment_id, uri, table, columns)\n data_rows = []\n\n req = Net::HTTP::Post.new(uri.path)\n\n xml = REXML::Document.new\n request = xml.add_element('request', 'id' => 'foo')\n request.add_element('result').add_element('format').add_text('xml')\n query = request.add_element('query')\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serves predictions for the buyers | def predictions
raise "Err"
buyer_suggestions = PropertyBuyer.suggest_buyers(params[:str]).select([:id, :name, :image_url]).limit(20)
render json: buyer_suggestions, status: 200
end | [
"def predict\n\t\t@bio = Bio.where(:user_id => current_user.id).last \n\n\t\t# Game_date and @players transformed to JSON and send to API in order to fetch player predictions\n\t\t@game_date = params[:game_date]\n\t\t@players = params[:players] \n\n\t\t# API Returns player predictions\n\t\t\t#first look in databas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
buyer tracking history curl XGET H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4OCwiZXhwIjoxNTAzNTEwNzUyfQ.7zo4a8g4MTSTURpU5kfzGbMLVyYN_9dDTKIBvKLSvPo" ' | def tracking_history
buyer = user_valid_for_viewing?('Buyer')
if !buyer.nil?
events = Events::Track.where(buyer_id: buyer.id).order("created_at desc")
results = events.map do |event|
{
udprn: event.udprn,
hash_str: event.hash_str,
type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],
created_at: event.created_at,
tracking_id: event.id
}
end
render json: results, status: 200
else
render json: { message: 'Authorization failed' }, status: 401
end
end | [
"def get_withdrawal_history\n # body = {\n # cmd: \"get_withdrawal_history\"\n # }\n\n end",
"def send_return_history_request(attrs={})\n request = ReturnHistoryRequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))\n response = get(request.to_xml.to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get tracking stats for a buyer curl XGET H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0MywiZXhwIjoxNDg1NTMzMDQ5fQ.KPpngSimK5_EcdCeVj7rtIiMOtADL0o5NadFJi2Xs4c" " | def tracking_stats
buyer = @current_user
property_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).count
street_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:street_tracking]).count
locality_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:locality_tracking]).count
stats = {
type: (buyer.is_premium? ? 'Premium' : 'Standard'),
locality_tracking_count_limit: Events::Track::BUYER_LOCALITY_PREMIUM_LIMIT[buyer.is_premium.to_s],
street_tracking_count_limit: Events::Track::BUYER_STREET_PREMIUM_LIMIT[buyer.is_premium.to_s],
property_tracking_count_limit: Events::Track::BUYER_PROPERTY_PREMIUM_LIMIT[buyer.is_premium.to_s],
locality_tracking_count: locality_tracking_count,
property_tracking_count: property_tracking_count,
street_tracking_count: street_tracking_count
}
render json: stats, status: 200
end | [
"def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend",
"def buyer_profile_stats\n buyer_profile_stats = Enquiries::PropertyService.new(udprn: params[:udprn].to_i).buyer_profile_stats\n render json: buyer_profile_stats, status... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get tracking filters and find details of properties in type of tracking TODO: Net HTTP calls made with hardcoded hostnames to be removed TODO: tracking id should be returned or not? | def tracking_details
buyer = @current_user
type_of_tracking = (params[:type_of_tracking] || "property_tracking").to_sym
if type_of_tracking == :property_tracking
udprns = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).pluck(:udprn)
api = PropertySearchApi.new(filtered_params: {})
body = api.fetch_details_from_udprns(udprns)
render json: {property_details: body}, status: 200
else
if params["hash_str"].present?
body = Oj.load(Net::HTTP.get(URI.parse(URI.encode("http://52.66.124.42/api/v0/properties/search?hash_str=#{params['hash_str']}"))))
render json: {property_details: body}, status: 200
else
body = []
search_hashes = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[type_of_tracking]).pluck(:hash_str).compact
search_hashes.each do |search_hash|
### TODO: Fix this. Use internal methods rather than calling the api
body = Oj.load(Net::HTTP.get(URI.parse(URI.encode("http://api.prophety.co.uk/api/v0/properties/search?hash_str=#{search_hash}")))) + body
end
render json: {search_hashes: search_hashes, property_details: body}
end
end
end | [
"def trackers(query, type=nil)\n if type.nil?\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n if domain?(query)\n query = normalize_domain(query)\n end\n get('host-attributes/trackers', {'query' => query})\n else\n is_valid_with_error(__method__, [:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Edit tracking details curl XPOST H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0MywiZXhwIjoxNDg1NTMzMDQ5fQ.KPpngSimK5_EcdCeVj7rtIiMOtADL0o5NadFJi2Xs4c" " | def edit_tracking
buyer = @current_user
destroyed = Events::Track.where(id: params[:tracking_id].to_i).last.destroy
render json: { message: 'Destroyed tracking request' }, status: 200
end | [
"def update_guest_access_portal(args = {}) \n put(\"/guestaccess.json/gap/#{args[:portalId]}\", args)\nend",
"def update\n respond_to do |format|\n if @click_tracking.update(click_tracking_params)\n format.html { redirect_to @click_tracking, notice: 'Click tracking was successfully updated.' }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Info about the premium charges monthly curl XGET ' | def info_premium
render json: { value: (PropertyBuyer::PREMIUM_COST*100) }, status: 200
end | [
"def private_info symbol = 'USD'\n #res = post(\"/api/0/info.php\")\n res = post(\"https://mtgox.com/api/1/generic/private/info\")\n res[\"result\"] == \"success\" ? res[\"return\"] : res\n end",
"def credits()\n response = do_request(build_credits_xml())\n credit_elements = REXML:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new Response object for the given Net::SFTP::Request instance, and with the given data. If there is no :code key in the data, the code is assumed to be FX_OK. | def initialize(request, data={}) #:nodoc:
@request, @data = request, data
@code, @message = data[:code] || FX_OK, data[:message]
end | [
"def response_with_code(code, subcode)\n OpenStruct.new(name: code_name(code), code: code, subcode: subcode)\n end",
"def prepare_success_response(data)\n return {\n status: APIBase::SUCCESS_STATUS,\n data: data\n }\n end",
"def process_result(code, body... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns +true+ if the status code is FX_OK; +false+ otherwise. | def ok?
code == FX_OK
end | [
"def ok?\n 'ok' == status\n end",
"def ok?(code)\n OK_STATUS_CODES.include?(code)\n end",
"def is_ok?\n code == 200\n end",
"def ok?\n @status == 200\n end",
"def check\n @response = get_fixity_response_from_fedora\n status.match(\"SUCCESS\") ? true : false\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns +true+ if the status code is FX_EOF; +false+ otherwise. | def eof?
code == FX_EOF
end | [
"def eof?\n @io.eof?\n end",
"def eof?\n if @buffer.size > 0\n false\n else\n @io.eof?\n end\n end",
"def handle_eof?\n eof? && eof_callback?\n end",
"def eof_found?\n @eof_found\n end",
"def eof_flag\n @eof_flag\n end",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /polling_sessions/new GET /polling_sessions/new.json | def new
@polling_session = PollingSession.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @polling_session }
end
end | [
"def create\n @polling_session = PollingSession.new(params[:polling_session])\n\n respond_to do |format|\n if @polling_session.save\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }\n format.json { render json: @polling_session, status: :cre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /polling_sessions POST /polling_sessions.json | def create
@polling_session = PollingSession.new(params[:polling_session])
respond_to do |format|
if @polling_session.save
format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }
format.json { render json: @polling_session, status: :created, location: @polling_session }
else
format.html { render action: "new" }
format.json { render json: @polling_session.errors, status: :unprocessable_entity }
end
end
end | [
"def new\n @polling_session = PollingSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @polling_session }\n end\n end",
"def create_single_poll_session(poll_id,poll_sessions__course_id__,opts={})\n query_param_keys = [\n \n ]\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /polling_sessions/1 PUT /polling_sessions/1.json | def update
@polling_session = PollingSession.find(params[:id])
respond_to do |format|
if @polling_session.update_attributes(params[:polling_session])
format.html { redirect_to @polling_session, notice: 'Polling session was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @polling_session.errors, status: :unprocessable_entity }
end
end
end | [
"def update_single_poll_session(poll_id,id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /polling_sessions/1 DELETE /polling_sessions/1.json | def destroy
@polling_session = PollingSession.find(params[:id])
@polling_session.destroy
respond_to do |format|
format.html { redirect_to polling_sessions_url }
format.json { head :no_content }
end
end | [
"def destroy\n @session = @client.sessions.find(params[:id])\n @session.destroy\n respond_to do |format|\n format.html { redirect_to client_url(@client), notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n set_session\n\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract url from json and get files | def download
URI.extract(json, ['http', 'https']).each do |url|
get_asset(url)
end
json
end | [
"def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend",
"def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend",
"def extract_links(json)\n json[\"roots\"].collect do |key, children... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /solicitacao_tipos GET /solicitacao_tipos.json | def index
@solicitacao_tipos = SolicitacaoTipo.all
end | [
"def index\n @tipo_solicitudes = TipoSolicitude.all\n end",
"def get_tip\n request({ req: 'gettip'})\n end",
"def show\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def index\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /solicitacao_tipos/1 DELETE /solicitacao_tipos/1.json | def destroy
@solicitacao_tipo.destroy
respond_to do |format|
format.html { redirect_to solicitacao_tipos_url }
format.json { head :no_content }
end
end | [
"def destroy\n @solicitacao = Solicitacao.find(params[:id])\n @solicitacao.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitacaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tip_so = TipSo.find(params[:id])\n @tip_so.destroy\n\n respo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /u_sers/1 GET /u_sers/1.json | def show
@u_ser = USer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @u_ser }
end
end | [
"def index\n @u_sers = USer.all\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @use... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /u_sers/new GET /u_sers/new.json | def new
@u_ser = USer.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @u_ser }
end
end | [
"def new\n @u = U.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u }\n end\n end",
"def new\n @newse = Newse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newse }\n end\n end",
"def new\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /u_sers POST /u_sers.json | def create
@u_ser = USer.new(params[:u_ser])
respond_to do |format|
if @u_ser.save
format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }
format.json { render json: @u_ser, status: :created, location: @u_ser }
else
format.html { render action: "new" }
format.json { render json: @u_ser.errors, status: :unprocessable_entity }
end
end
end | [
"def create\n @u_ser = USer.new(u_ser_params)\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render :show, status: :created, location: @u_ser }\n else\n format.html { render :new }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /u_sers/1 PUT /u_sers/1.json | def update
@u_ser = USer.find(params[:id])
respond_to do |format|
if @u_ser.update_attributes(params[:u_ser])
format.html { redirect_to @u_ser, notice: 'U ser was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @u_ser.errors, status: :unprocessable_entity }
end
end
end | [
"def update\n respond_to do |format|\n if @u_ser.update(u_ser_params)\n format.html { redirect_to @u_ser, notice: 'U ser was successfully updated.' }\n format.json { render :show, status: :ok, location: @u_ser }\n else\n format.html { render :edit }\n format.json { render js... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /u_sers/1 DELETE /u_sers/1.json | def destroy
@u_ser = USer.find(params[:id])
@u_ser.destroy
respond_to do |format|
format.html { redirect_to u_sers_url }
format.json { head :no_content }
end
end | [
"def destroy\n @ussr = Ussr.find(params[:id])\n @ussr.destroy\n\n respond_to do |format|\n format.html { redirect_to ussrs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @u_sser.destroy\n respond_to do |format|\n format.html { redirect_to u_ssers_url, notic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns whether conversation has any associated unread posts | def any_unread? usr
@conv.posts.each do |post|
if post.unread?(usr) && post.recipient_id == usr.id
return true
end
end
return false
end | [
"def has_unread_messages?\n received_messages.count > 0\n end",
"def unread_submissions?\n unread_submissions > 0\n end",
"def unread_replies_for_post(post)\n return 0 unless unread_replies\n unread_replies.select{|k, _| post.thread_contains? k }.collect(&:last).flatten.size\n end",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets all posts in a convo to 'removed' | def remove_posts usr
@conv.posts.each do |post|
if usr.id == post.user_id
post.status = 'removed'
elsif usr.id == post.recipient_id
post.recipient_status = 'removed'
end
post.save
end
end | [
"def remove_posts usr\n ConversationProcessor.new(self).remove_posts usr\n end",
"def clear!\n @posts = nil\n end",
"def undelete_post(post_params)\n post_params[:delete] = [\"fm_published\"]\n update_post(post_params)\n end",
"def undelete_post(post_params)\n post_params[:delete] = ['fm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
mark all posts in a conversation | def mark_all_posts usr
return false if usr.blank?
@conv.posts.each do |post|
post.mark_as_read! for: usr if post
end
end | [
"def mark_all_posts usr\n ConversationProcessor.new(self).mark_all_posts usr\n end",
"def map_posts_to_conversations\n Post.order.reverse_order.each do |post|\n post.status = post.recipient_status = 'active'\n if post.conversation_id.nil?\n \n # finds if there is already an existing con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes an instance url:: URL to a BigBlueButton server (e.g. salt:: Secret salt for this server version:: API version: 0.7 (valid for 0.7, 0.71 and 0.71a) | def initialize(url, salt, version='0.7', debug=false)
@supported_versions = ['0.7','0.8']
@url = url
@salt = salt
@debug = debug
if version.nil?
@version = get_api_version
else
@version = version
end
unless @supported_versions.include?(@version)
raise BigBlueButtonException.new("BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}")
end
puts "BigBlueButtonAPI: Using version #{@version}" if @debug
end | [
"def initialize(url, salt, version='0.7', debug=false)\n @supported_versions = ['0.7', '0.8']\n @url = url\n @salt = salt\n @debug = debug\n @timeout = 10 # default timeout for api requests\n @request_headers = {} # http headers sent in all requests\n\n @version = version ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the url used to join the meeting meeting_id:: Unique identifier for the meeting user_name:: Name of the user password:: Password for this meeting used to set the user as moderator or attendee user_id:: Unique identifier for this user web_voice_conf:: Custom voiceextension for users using VoIP | def join_meeting_url(meeting_id, user_name, password,
user_id = nil, web_voice_conf = nil)
params = { :meetingID => meeting_id, :password => password, :fullName => user_name,
:userID => user_id, :webVoiceConf => web_voice_conf }
get_url(:join, params)
end | [
"def join_meeting_url(meeting_id, user_name, password, options={})\n valid_options = [:userID, :webVoiceConf]\n valid_options += [:createTime] if @version >= \"0.8\"\n options.reject!{ |k,v| !valid_options.include?(k) }\n\n params = { :meetingID => meeting_id, :password => password, :fullName =>... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true or false as to whether meeting is open. A meeting is only open after at least one participant has joined. meeting_id:: Unique identifier for the meeting | def is_meeting_running?(meeting_id)
hash = send_api_request(:isMeetingRunning, { :meetingID => meeting_id } )
hash[:running].downcase == "true"
end | [
"def meeting_running?(id)\n prepare()\n @api.is_meeting_running?(id)\n end",
"def meeting_running?(id)\n prepare\n @api.is_meeting_running?(id)\n end",
"def opened?\n opened_at.present?\n end",
"def appointment?\n !open && !close\n end",
"def is_meeting_running?(meeting_id, options... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
alias for summary also add descr shortcut?? | def desc() summary; end | [
"def summary\n definition \"Summary\"\n end",
"def summary; end",
"def summary_dl; @summary; end",
"def summary\n @summary\n end",
"def apply_summary; nil; end",
"def get_summary\n self.get_info('summary')\n end",
"def emi_summary\n end",
"def cut_description_to_summary\n sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We allow document series to be assigned directly on an edition for speed tagging | def document_series_ids=(ids)
raise(StandardError, 'cannot assign document series to an unsaved edition') unless persisted?
document.document_series_ids = ids
end | [
"def add_series\n @bib.series.each do |s|\n case s.type\n when \"journal\"\n @item.journal = s.title.title\n @item.number = s.number if s.number\n when nil then @item.series = s.title.title\n end\n end\n end",
"def index_suppressed(solr_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the width of the named style. +style_name+ defaults to the attribute's default_style. | def width(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
from_examination :@original_width
else
dimensions(style_name).at(0)
end
end | [
"def width(style_name='original')\n geometry(style_name).width.to_i\n end",
"def width(style=nil)\n dimensions(style)[:width]\n end",
"def style name\n Attribute.new \"style = %p\" % [name]\n end",
"def width\n if present?(options[:width])\n options[:width]\n\n elsif... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the height of the named style. +style_name+ defaults to the attribute's default_style. | def height(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
from_examination :@original_height
else
dimensions(style_name).at(1)
end
end | [
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def height(style=nil)\n dimensions(style)[:height]\n end",
"def css_style_height(height = '')\n height = height.to_s.as_css_size\n height.blank? ? '' : \"height:#{height};\"\n end",
"def height(name)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the aspect ratio of the named style. +style_name+ defaults to the attribute's default_style. | def aspect_ratio(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
original_width = from_examination(:@original_width)
original_height = from_examination(:@original_height)
original_width.to_f / original_height
else
w, h = *dimensions(style_name)
w.to_f / h
end
end | [
"def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end",
"def height(style_name=nil)\n style_name ||= reflection.default_s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the width and height of the named style, as a 2element array. | def dimensions(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
original_width = from_examination(:@original_width)
original_height = from_examination(:@original_height)
[original_width, original_height]
else
resize_dimensions(dimensions(:original), reflection.styles[style_name])
end
end | [
"def styles\n return @metadata[:styles]\n end",
"def generate_style_array\n styles = Array.new\n\n #extract the styles from the hash\n get_styles.each do |k,v|\n styles.push(v)\n end\n\n return styles\n end",
"def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[styl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the dimensions, as an array [width, height], that result from resizing +original_dimensions+ for the given +style+. | def resize_dimensions(original_dimensions, style)
if style.filled?
style.dimensions
else
original_aspect_ratio = original_dimensions[0].to_f / original_dimensions[1]
target_aspect_ratio = style.dimensions[0].to_f / style.dimensions[1]
if original_aspect_ratio > target_aspect_ratio
width = style.dimensions[0]
height = (width / original_aspect_ratio).round
else
height = style.dimensions[1]
width = (height * original_aspect_ratio).round
end
[width, height]
end
end | [
"def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NOM pvalue: Nominal p value; that is, the statistical significance of the enrichment score. The nominal p value is not adjusted for gene set size or multiple hypothesis testing; therefore, it is of limited use in comparing gene sets. | def nominal_p_value
@nominal_p_value ||= @fields[5].to_f
end | [
"def get_protein_probability(protein_node)\n\n\t\t#MS:1002403\n\t\tis_group_representative=(self.get_cvParam(protein_node,\"MS:1002403\")!=nil)\n\t\tif is_group_representative\n\t\t\treturn \tself.get_cvParam(protein_node.parent,\"MS:1002470\").attributes['value'].to_f*0.01\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FDR qvalue: False discovery rate; that is, the estimated probability that the normalized enrichment score (NES) represents a false positive finding. For example, an FDR of 25% indicates that the result is likely to be valid 3 out of 4 times. | def fdr_q_value
@fdr_q_value ||= @fields[6].to_f
end | [
"def dfe\n n = battle_effect.dfe\n return (n * dfe_modifier).to_i if n\n return (dfe_basis * dfe_modifier).floor\n end",
"def calculate_e_factor\n return @ef if @q == 4\n @ef = @ef + (0.1 - (5 - @q) * (0.08 + (5 - @q) * 0.02))\n # If EF is less than 1.3 then let EF be 1.3.\n @ef = 2.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FWER pvalue: Familywiseerror rate; that is, a more conservatively estimated probability that the normalized enrichment score represents a false positive finding. Because the goal of GSEA is to generate hypotheses, the GSEA team recommends focusing on the FDR statistic. | def fwer_p_value
@fwer_p_value ||= @fields[7].to_f
end | [
"def dfe\n n = battle_effect.dfe\n return (n * dfe_modifier).to_i if n\n return (dfe_basis * dfe_modifier).floor\n end",
"def dfe\n return (dfe_basis * dfe_modifier).floor\n end",
"def value\n (\n 0.7 * (annual_income / average_income) +\n 0.3 * (base_manpower / avearge_ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /practitioner_roles POST /practitioner_roles.json | def create
@practitioner_role = PractitionerRole.new(practitioner_role_params)
respond_to do |format|
if @practitioner_role.save
format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully created.' }
format.json { render :show, status: :created, location: @practitioner_role }
else
format.html { render :new }
format.json { render json: @practitioner_role.errors, status: :unprocessable_entity }
end
end
end | [
"def create(options = {})\n request(:post, '/roles.json', default_params(options))\n end",
"def create_roles\n Role.create_roles(self)\n end",
"def create_roles\n Role.where(name: 'organizer', resource: self).first_or_create(description: 'For the organizers of the conference (who shall have full ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /practitioner_roles/1 PATCH/PUT /practitioner_roles/1.json | def update
respond_to do |format|
if @practitioner_role.update(practitioner_role_params)
format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully updated.' }
format.json { render :show, status: :ok, location: @practitioner_role }
else
format.html { render :edit }
format.json { render json: @practitioner_role.errors, status: :unprocessable_entity }
end
end
end | [
"def update\n respond_to do |format|\n if @team_role.update(team_role_params)\n format.html { redirect_to lab_team_roles_path(@lab), notice: 'Team role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.jso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /practitioner_roles/1 DELETE /practitioner_roles/1.json | def destroy
@practitioner_role.destroy
respond_to do |format|
format.html { redirect_to practitioner_roles_url, notice: 'Practitioner role was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @lab_role = LabRole.find(params[:id])\n @lab_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_roles_url }\n format.json { head :no_content }\n end\n end",
"def delete_roles\n delete(roles_path)\n end",
"def delete(id)\n request(:d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Following method will delete actual credentials and update default signing credentials in signing.properties file (inside SigningConfigs folder) | def restore_default_signing_credentials()
system($cmd_to_remove_signing_directory)
system($cmd_to_create_new_signing_file)
IO.copy_stream($path_to_default_signing_file, $path_to_actual_signing_file)
end | [
"def reset_credentials\n Aws.config.delete(:credentials)\n end",
"def delete_credentials\n if is_windows?\n @win_username = \"\"\n @win_password = \"\"\n else\n @keyring.delete_password(\"ubcbooker\", \"username\")\n @keyring.delete_password(\"ubcbooker\", \"password\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /fake_answers GET /fake_answers.json | def index
@fake_answers = FakeAnswer.all
end | [
"def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n render json: @answer\n end",
"def get_answers_for\n user = current_user\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /fake_answers POST /fake_answers.json | def create
@fake_answer = FakeAnswer.new(fake_answer_params)
@fake_answer.question_id = params[:question_id]
respond_to do |format|
if @fake_answer.save
format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' }
format.json { render :show, status: :created, location: @fake_answer }
else
format.html { render :new }
format.json { render json: @fake_answer.errors, status: :unprocessable_entity }
end
end
end | [
"def create\n @test_answer = TestAnswer.new(test_answer_params)\n\n respond_to do |format|\n if @test_answer.save\n params[:questions].each do |question|\n answer = Answer.new\n answer.test_answer_id = @test_answer.id\n answer.question_id = question.first\n answ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /fake_answers/1 PATCH/PUT /fake_answers/1.json | def update
respond_to do |format|
if @fake_answer.update(fake_answer_params)
format.html { redirect_to @fake_answer, notice: 'Fake answer was successfully updated.' }
format.json { render :show, status: :ok, location: @fake_answer }
else
format.html { render :edit }
format.json { render json: @fake_answer.errors, status: :unprocessable_entity }
end
end
end | [
"def update\n @answer = current_user.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.json { head :no_content }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /fake_answers/1 DELETE /fake_answers/1.json | def destroy
@fake_answer.destroy
respond_to do |format|
format.html { redirect_to fake_answers_url, notice: 'Fake answer was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @test_answer = TestAnswer.find(params[:id])\n @test_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to test_answers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n rend... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is invoked whenever Burp Scanner discovers a new, unique issue. | def newScanIssue(issue)
event = {
'details' => issue.getIssueDetail,
'vulnerability' => issue.issueName,
'severity' => issue.severity,
'url' => issue.url.to_s,
'port' => issue.port,
'host' => issue.host
}
send_event(event)
end | [
"def new_scan_issue(issue)\n pp [:got_newScanIssue, issue] if $DEBUG\n ScanIssueHelper.implant issue\n end",
"def addScanIssue(issue)\n _check_and_callback(:addScanIssue, issue)\n end",
"def after_create(issue)\n user_agent_detail_service.create\n handle_add_related_issue(issue)\n reso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
turn a gray entry to white | def turn_to_white(entry)
raise "Only a gray entry can be turned to white" unless entry.mode == Entry::MODE_GRAY
entry.be_white!
end | [
"def turn_to_black(entry)\n\t\traise \"Only a gray entry can be turned to black\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_black!\n\t\tdecrement!(:entries_num)\n\tend",
"def cancel_black(entry)\n\t\traise \"Ony a black entry can be canceled to gray\" unless entry.mode == Entry::MODE_BLACK\n\t\tentry.be... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
turn a gray entry to black | def turn_to_black(entry)
raise "Only a gray entry can be turned to black" unless entry.mode == Entry::MODE_GRAY
entry.be_black!
decrement!(:entries_num)
end | [
"def turn_to_white(entry)\n\t\traise \"Only a gray entry can be turned to white\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_white!\n\tend",
"def cancel_black(entry)\n\t\traise \"Ony a black entry can be canceled to gray\" unless entry.mode == Entry::MODE_BLACK\n\t\tentry.be_gray!\n\t\tincrement!(:entrie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cancel a black entry to gray | def cancel_black(entry)
raise "Ony a black entry can be canceled to gray" unless entry.mode == Entry::MODE_BLACK
entry.be_gray!
increment!(:entries_num)
end | [
"def turn_to_black(entry)\n\t\traise \"Only a gray entry can be turned to black\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_black!\n\t\tdecrement!(:entries_num)\n\tend",
"def turn_to_white(entry)\n\t\traise \"Only a gray entry can be turned to white\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get typographic and morphosyntactic normalization of an input text using an analyzer of ElasticSearch. (string) text Input text. | def normalize2(text, analyzer = nil)
Entry.normalize(text, normalizer2, analyzer)
end | [
"def pre_normalize(text); end",
"def normalize(text)\n normalized = text\n word_counts = measurements.keys.sort.reverse\n word_counts.each do |word_count|\n measurements[word_count].each do |variation, correct_form|\n\n normalized.gsub!(/\\b#{variation}\\b/i, correct_form.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate Krippendorff's alpha (interrater reliability) Assumed input (Matrix) [ [ nil, nil, nil, nil, nil, 3, 4, 1, 2, 1, 1, 3, 3, nil, 3 ], coder 1 [ 1, nil, 2, 1, 3, 3, 4, 3, nil, nil, nil, nil, nil, nil, nil], coder 2 [ nil, nil, 2, 1, 3, 4, 4, nil, 2, 1, 1, 3, 3, nil, 4 ] coder 3 ] | def krippendorff_alpha
in_array = self.to_a
in_array_flattened = in_array.transpose.flatten
unique_values = in_array.flatten.compact.uniq
# We need to keep track of the skip indexes separately since we can't send nils via C array of double
skip_indexes = []
in_array_flattened.each_with_index do |element, i|
skip_indexes << i if element.nil?
end
# Reformat the in_array to not have nil
skip_indexes.each {|i| in_array_flattened[i] = 0 }
FFI::MemoryPointer.new(:double, in_array_flattened.size) do |in_array_ptr|
FFI::MemoryPointer.new(:double, unique_values.size) do |unique_values_ptr|
FFI::MemoryPointer.new(:int, skip_indexes.size) do |skip_indexes_ptr|
in_array_ptr.write_array_of_double(in_array_flattened)
unique_values_ptr.write_array_of_double(unique_values)
skip_indexes_ptr.write_array_of_int(skip_indexes)
return _krippendorff_alpha(in_array_ptr, row_count, column_count, skip_indexes_ptr, skip_indexes.size, unique_values_ptr, unique_values.size)
end
end
end
end | [
"def fleiss(matrix)\n debug = true\n\n # n Number of rating per subjects (number of human raters)\n n = checkEachLineCount(matrix) # PRE : every line count must be equal to n\n i_N = matrix.size\n k = matrix[0].size\n\n if debug\n puts \"#{n} raters.\"\n puts \"#{i_N} subjects.\"\n puts \"#{k} cat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /wishlist_items GET /wishlist_items.xml | def index
@wishlist_items = WishlistItem.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @wishlist_items }
end
end | [
"def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end",
"def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /wishlist_items/1 GET /wishlist_items/1.xml | def show
@wishlist_item = WishlistItem.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @wishlist_item }
end
end | [
"def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end",
"def index\n @wishlist_items = WishlistItem.all\n\n respond_to do |format|\n format.html # index.html.e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /wishlist_items/new GET /wishlist_items/new.xml | def new
@wishlist_item = WishlistItem.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @wishlist_item }
end
end | [
"def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /wishlist_items/1 PUT /wishlist_items/1.xml | def update
@wishlist_item = WishlistItem.find(params[:id])
respond_to do |format|
if @wishlist_item.update_attributes(params[:wishlist_item])
format.html { redirect_to(@wishlist_item, :notice => 'Wishlist item was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }
end
end
end | [
"def update\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n if @wishlist_item.update_attributes(params[:wishlist_item])\n flash[:notice] = 'WishlistItem was successfully updated.'\n format.html { redirect_to(@wishlist_item) }\n format.xml { head :ok }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /wishlist_items/1 DELETE /wishlist_items/1.xml | def destroy
@wishlist_item = WishlistItem.find(params[:id])
@wishlist_item.destroy
respond_to do |format|
format.html { redirect_to(store_path, :notice => 'Item has been removed from your wishlist.') }
format.xml { head :ok }
end
end | [
"def destroy\n @wishlist_item = WishlistItem.find(params[:id])\n @wishlist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(wishlist_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_it... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether or not this event is a search event. | def search?
type == :search
end | [
"def search?\n @cmd.respond_to?( :\"search_status\" )\n end",
"def search?\n @cmd.respond_to?(:search_status)\n end",
"def searchable?\n !search_clause.nil?\n end",
"def searchable?\n false\n end",
"def event?\n entry_type == :event\n end",
"def searchable?\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks the given runtime options for required options. If no required options exist, returns true. Otherwise, checks the keys of the runtime options to see if they contain all of the required options. | def check_options_requirements(runtime_options)
required_options = options[:requires] || options[:require]
return true unless required_options
([required_options].flatten - runtime_options.keys).size == 0
end | [
"def valid?(options)\n (@required_options - options.keys).size == 0\n end",
"def required_keys_not_present?(options)\n required_options_not_present = requirements.reject do |required_key|\n options[required_key].present?\n end\n if required_options_not_pre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
kill all processes including servers, clients and trema PIDs for server and clients are in PID files | def kill_all_processes
puts "KILL : all processes"
pid_servers = PID_DIR_PATH + "/" + PID_FILE_PREFIX_SERVER + "*"
pid_clients = PID_DIR_PATH + "/" + PID_FILE_PREFIX_CLIENT + "*"
# for servers
Dir::glob(pid_servers).each do |f|
if File::ftype(f) == "file"
pid_server = f.split( "." )[1]
$pids_s.delete(pid_server)
begin
File.delete(f)
Process.kill('KILL', pid_server.to_i)
# puts "KILL : server [" + pid_server + "] was killed"
rescue Errno::ESRCH
STDERR.puts "KILL : server [" + pid_server + "]: No such process"
rescue
STDERR.puts "ERROR : Can't kill server process [" + pid_server + "]"
end
end
end
# for clients
Dir::glob(pid_clients).each do |f|
if File::ftype(f) == "file"
pid_client = f.split( "." )[1]
$pids_c.delete(pid_client)
begin
File.delete(f)
Process.kill('KILL', pid_client.to_i)
# puts "KILL : client [" + pid_client + "] was killed"
rescue Errno::ESRCH
STDERR.puts "KILL : client [" + pid_client + "]: No such process"
rescue
STDERR.puts "ERROR : Can't kill client process [" + pid_client + "]"
end
end
end
# for trema
cmd = TREMA + " killall"
system(cmd)
$pids_c.each{|pid|
if process_working?(pid.to_i) then Process.kill('KILL', pid.to_i) end
}
$pids_s.each{|pid|
if process_working?(pid.to_i) then Process.kill('KILL', pid.to_i) end
}
end | [
"def kill_processes\n pid_files = Dir[\"#{$out}/*.pid\"]\n pid_files.each do |file|\n f = File.open(file)\n pid = f.read\n file_prefix = File.basename(file, '.pid')\n puts \"killing process: #{file_prefix}\"\n `kill -9 #{pid}`\n #TODO: verify kill result\n File... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List all the groups. | def list
@groups = Group.find(:all, :order => 'name')
end | [
"def list\n response = @client.get('groups')\n verify response,\n forbidden: 'You do not have permission to view the groups list'\n end",
"def groups\n @cluster.list_groups\n end",
"def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Give the given group either ALL or NO permissions to all the folders | def give_permissions_to_folders(group, permission_to_everything)
Folder.find(:all).each do |folder|
add_to_group_permissions(group, folder, permission_to_everything)
end
end | [
"def set_permissions(folderid, group, permissions)\n args = local_variables.reduce({}) { |c, i| c[i] = binding.local_variable_get(i); c }\n response = request(:post, \"folders/#{folderid}/groups/#{group}\", args)\n h = doc_to_hash(response, \"//data\").try(:[], \"data\")\n return h == \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the given group and folder to GroupPermissions and (dis)allow everything | def add_to_group_permissions(group, folder, permission_to_everything)
group_permission = GroupPermission.new
group_permission.folder = folder
group_permission.group = group
group_permission.can_create = permission_to_everything
group_permission.can_read = permission_to_everything
group_permission.can_update = permission_to_everything
group_permission.can_delete = permission_to_everything
group_permission.save
end | [
"def set_permissions(folderid, group, permissions)\n args = local_variables.reduce({}) { |c, i| c[i] = binding.local_variable_get(i); c }\n response = request(:post, \"folders/#{folderid}/groups/#{group}\", args)\n h = doc_to_hash(response, \"//data\").try(:[], \"data\")\n return h == \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The group called 'admins' can not be edited or deleted. By calling this method via a before_filter, you makes sure this doesn't happen. | def do_not_rename_or_destroy_admins_group
if @group and @group.is_the_administrators_group?
redirect_to :action => 'list' and return false
end
end | [
"def prevent_zero_group_admins\n @membership = Membership.find(params[:id])\n @group = @membership.group\n if @group.has_one_admin? && (@membership.user == current_user)\n flash[:danger] = \"You cannot quit unless there are other group admins.\"\n redirect_to @group\n end\n end"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if a group exists before executing an action. If it doesn't exist: redirect to 'list' and show an error message | def does_group_exist
@group = Group.find(params[:id])
rescue
flash.now[:group_error] = 'Someone else deleted the group. Your action was cancelled.'
redirect_to :action => 'list' and return false
end | [
"def check_group_exists\n if (Group.where(group_params).count != 0)\n redirect_to Group.where(group_params).first\n end\n end",
"def require_member_of_group\n if !member_of(current_group)\n # TODO: Add flash alert\n redirect_back fallback_location: home_path\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a "square" array of subarrays, find the sum of values from the first value of the first array, the second value of the second array, the third value of the third array, and so on... Example 1: exampleArray = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] diagonalSum(exampleArray) => 4 Example 2: exampleArray = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]] diagonalSum(exampleArray) => 5 | def diagonalSum(matrix)
total = 0
(0...matrix.length).each {|sub| total += matrix[sub][sub]}
return total
end | [
"def two_d_sum(arr)\n\tsum = 0\n arr.each do |subArray|\n subArray.each do |i|\n sum += i\n end\n end\n return sum\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def sum_of_sums(array)\n \n total_sum = 0\n subsequence_sum = 0\n array.each do |num|\n subsequence_sum ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /test_bookings/1 DELETE /test_bookings/1.xml | def destroy
@test_booking = TestBooking.find(params[:id])
@test_booking.destroy
respond_to do |format|
format.html { redirect_to(test_bookings_url) }
format.xml { head :ok }
end
end | [
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end",
"def delete_bookings()\n sql = \"DELETE FROM bookings\n WHERE bookings.member_id = $1\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /company_types GET /company_types.json | def index
@company_types = CompanyType.all
render json: @company_types
end | [
"def index\n @company_types = CompanyType.all\n end",
"def show\n render json: @company_type\n end",
"def index\n @business_company_types = Business::CompanyType.all\n end",
"def types\n types = JSON.parse(connection.get(\"/Contact/Types\").body )\n end",
"def index\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /company_types/byState/1 GET /company_types/byState/1.json | def byState
@company_types = CompanyType.where("state_id = ?", company_type_params[:state_id])
render json: @company_types
end | [
"def byState\n @companies = Company.where(\"state_id = ?\", company_params[:state_id])\n\n render json: @companies\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def byState\n @domicile_types = DomicileType.where(\"state_id = ?\", domicile_type_pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /company_types/1 GET /company_types/1.json | def show
render json: @company_type
end | [
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def show\n @company_type = CompanyType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company_type }\n end\n end",
"def index\n @company_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /company_types POST /company_types.json | def create
@company_type = CompanyType.new(company_type_params)
if @company_type.save
render json: @company_type, status: :created, location: @company_type
else
render json: @company_type.errors, status: :unprocessable_entity
end
end | [
"def create\n @company_type = CompanyType.new(company_type_params)\n\n respond_to do |format|\n if @company_type.save\n format.html { redirect_to company_types_path, notice: 'Company type was successfully created.' }\n format.json { render :show, status: :created, location: @company_type }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /company_types/1 PATCH/PUT /company_types/1.json | def update
@company_type = CompanyType.find(params[:id])
if @company_type.update(company_type_params)
head :no_content
else
render json: @company_type.errors, status: :unprocessable_entity
end
end | [
"def update\n respond_to do |format|\n if @company_type.update(company_type_params)\n format.html { redirect_to company_types_path, notice: 'Company type was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_type }\n else\n format.html { render ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /company_types/1 DELETE /company_types/1.json | def destroy
@company_type.destroy
head :no_content
end | [
"def destroy\n @company_type = CompanyType.find(params[:id])\n @company_type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company_type.destroy\n respond_to do |format|\n format.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /gltf_models GET /gltf_models.json | def index
@gltf_models = GltfModel.all
end | [
"def list_gadget_models\n get('gadgets/models')\n end",
"def models(make, year, category)\n make_id = get_object_id make\n category_id = get_object_id category\n response = get_url \"Models/#{make_id}/#{year}/#{category_id}\"\n response_obj = JSON.parse response\n response_obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /gltf_models POST /gltf_models.json | def create
@gltf_model = GltfModel.new(gltf_model_params)
respond_to do |format|
if @gltf_model.save
format.html { redirect_to @gltf_model, notice: 'Gltf model was successfully created.' }
format.json { render :show, status: :created, location: @gltf_model }
else
format.html { render :new }
format.json { render json: @gltf_model.errors, status: :unprocessable_entity }
end
end
end | [
"def train\n training = @prediction.trainedmodels.insert.request_schema.new\n training.id = 'preconceito-nordeste'\n training.storage_data_location = DATA_OBJECT\n result = @client.execute(\n :api_method => @prediction.trainedmodels.insert,\n :parameters => {'project' => PROJECT_ID},\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /gltf_models/1 DELETE /gltf_models/1.json | def destroy
@gltf_model.destroy
respond_to do |format|
format.html { redirect_to gltf_models_url, notice: 'Gltf model was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @orf_model = OrfModel.find(params[:id])\n @orf_model.destroy\n\n respond_to do |format|\n format.html { redirect_to orf_models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mg_model.destroy\n respond_to do |format|\n format.html { redirect_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format kyc Always receives [Hash] :NOTE Reading data to format from key:'user_kyc' Author: Tejas Date: 24/09/2018 Reviewed By: Sets result_type, user_kyc | def show(data_to_format)
formatted_data = {
result_type: 'user_kyc',
user_kyc: user_kyc_base(data_to_format[:user_kyc_detail], data_to_format[:admin])
}
formatted_data
end | [
"def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n end",
"def fetch_user_kyc_details\n ar_relation = UserKycDetail.using_client_shard(client: @client).\n where(client_id: @client_id, status: GlobalConstant::... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format pre signed url for put Always receives [Hash] :NOTE Reading data to format from key:'file_upload_put' Author: Aniket Date: 20/09/2018 Reviewed By: | def get_pre_singed_url_for_put(data_to_format)
formatted_data = {
result_type: 'file_upload_put',
file_upload_put: data_to_format
}
formatted_data
end | [
"def get_presigned_url_put(custom_params = nil)\n\n default_val = {\n files: {\n selfie: 'image/jpeg'\n }\n }\n endpoint = \"/api/#{@version}/users-kyc/pre-signed-urls/for-put\"\n\n custom_params = custom_params || default_val\n params = request_parameters(end... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Admin Name Author: Tejas Date: 24/09/2018 Reviewed By: | def admin_name(last_acted_by, admin)
last_acted_by = last_acted_by.to_i
if (last_acted_by > 0)
admin[:name]
elsif (last_acted_by == Admin::AUTO_APPROVE_ADMIN_ID)
GlobalConstant::Admin.auto_approved_admin_name
else
''
end
end | [
"def display_name\n [nomenclator_name, author_year].compact.join(\" \")\n end",
"def author\n @info[:Author]\n end",
"def aname\n\t\t\"[name(#{@author})]\"\n\tend",
"def admin_name\n self.user.name\n end",
"def author_name\n if is_news?\n if authors_is_created_by?\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get response for sending KYC approve email Author: Mayur Date: 03/12/2018 Reviewed By: | def email_kyc_approve(data_to_format)
{}
end | [
"def email_kyc_approve\n @service_response = UserManagement::SendEmail::Approve.new(params).perform\n format_service_response\n end",
"def key_approved_msg(user, user_key)\n @recipient = user\n @user_key = user_key\n mail(:to => @recipient.email, \n :subject => \"The Bridge API Notice: You... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get response for sending KYC report issue email Author: Mayur Date: 14/12/2018 Reviewed By: | def email_kyc_report_issue(data_to_format)
{}
end | [
"def email_kyc_issue\n service_response = AdminManagement::Kyc::AdminAction::ReportIssue.new(params).perform\n render_api_response(service_response)\n end",
"def email_kyc_report_issue\n @service_response = UserManagement::SendEmail::ReportIssue.new(params).perform\n format_service_response\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /brite_td_aswaxman_rt_waxmen GET /brite_td_aswaxman_rt_waxmen.json | def index
@brite_td_aswaxman_rt_waxmen = BriteTdAswaxmanRtWaxman.all
end | [
"def index\n @brite_rt_waxmen = BriteRtWaxman.all\n end",
"def index\n @brite_td_asbarabasi_rt_waxmen = BriteTdAsbarabasiRtWaxman.all\n end",
"def index\n @brite_as_waxmen = BriteAsWaxman.all\n end",
"def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /brite_td_aswaxman_rt_waxmen POST /brite_td_aswaxman_rt_waxmen.json | def create
@brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.new(brite_td_aswaxman_rt_waxman_params)
respond_to do |format|
if @brite_td_aswaxman_rt_waxman.save
format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully created.' }
format.json { render :show, status: :created, location: @brite_td_aswaxman_rt_waxman }
else
format.html { render :new }
format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity }
end
end
end | [
"def create\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.new(brite_td_asbarabasi_rt_waxman_params)\n\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.save\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /brite_td_aswaxman_rt_waxmen/1 PATCH/PUT /brite_td_aswaxman_rt_waxmen/1.json | def update
respond_to do |format|
if @brite_td_aswaxman_rt_waxman.update(brite_td_aswaxman_rt_waxman_params)
format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully updated.' }
format.json { render :show, status: :ok, location: @brite_td_aswaxman_rt_waxman }
else
format.html { render :edit }
format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity }
end
end
end | [
"def update\n respond_to do |format|\n if @brite_rt_waxman.update(brite_rt_waxman_params)\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_rt_waxman }\n else\n format.html... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /brite_td_aswaxman_rt_waxmen/1 DELETE /brite_td_aswaxman_rt_waxmen/1.json | def destroy
@brite_td_aswaxman_rt_waxman.destroy
respond_to do |format|
format.html { redirect_to brite_td_aswaxman_rt_waxmen_url, notice: 'Brite td aswaxman rt waxman was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @brite_td_asbarabasi_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_td_asbarabasi_rt_waxmen_url, notice: 'Brite td asbarabasi rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brite_rt_waxma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
with this Object method we can obtain a hash named "hashinfo" with the gene information (from de Gene Classe) corresponding to the idmutant_gene we have in the StockData Class. | def gene_information(i)
if $gene[i].geneid == $stockdata[i].idmutant_gene
$hashinfo["#{$stockdata[i].stock}"] = $gene[i]
end
return $hashinfo
end | [
"def hash\n\t\t[@id].hash\n\tend",
"def get_seed_stock(seed_stock_file)\n lines = IO.readlines(seed_stock_file) #array that contains the lines of the file\n hash_seeds = Hash.new() #hash that will contain the SeedStock objects\n lines[1..-1].each {|line| seed_stock,mutant_gene_ID,last_planted,storage,grams_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Do we have all the information necessary to subscribe to the list? | def wants_to_subscribe?
source_is_ffcrm? && has_list?
end | [
"def subscribed?\n subscribed == true\n end",
"def subscribe?\n self.type == :subscribe\n end",
"def can_subscribe?\n @ask == 'subscribe' && %w[none from].include?(@subscription)\n end",
"def has_subscriptions?\n subscriptions.any?\n end",
"def subscribed?(list_id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves the cell information based on the parameters specified inside the `cell` object | def get_cell(cell)
query_cell_info '/cell/get', cell
end | [
"def get_cell(row_index, column_index); end",
"def cell(column, row)\n rows[row][column]\n end",
"def build_cell(cell)\n # implement in row class\n nil\n end",
"def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves the cell information and the measures used to calculate its position based on the parameters specified in the cell object | def get_cell_measures(cell)
query_cell_info '/cell/getMeasures', cell
end | [
"def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col]\n end",
"def get_cell(cell)\n query_cell_info '/cell/get', cell\n end",
"def position_of(cell)\n position_class.new(@minefield.index(cell))\n end",
"def get_cell(row_inde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves all the cells located inside the bounding box and whose parameters match the ones specified in the options | def get_cells_in_area(bbox, options = {})
raise ArgumentError, 'options must be a Hash' unless options.is_a? Hash
raise ArgumentError, 'bbox must be of type BBox' unless bbox.is_a? BBox
params = {bbox: bbox.to_s, fmt: 'xml'}
params.merge!(options.reject { |key| !GET_IN_AREA_ALLOWED_PARAMS.include? key})
exec_req_and_parse_response '/cell/getInArea', params
end | [
"def data(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all\n end",
"def get_cells_in_box(box)\n box_cells = []\n center_row, center_column = get_center_of_box(box)\n ((center_row-1)..(center_row+1)).each do |row|\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a measure (specified by the measure object) to a given cell (specified by the cell object). In case of success the response object will also contain the cell_id and the measure_id of the newly created measure. Although the library does not check this, a valid APIkey must have been specified while initializing the this object | def add_measure(cell, measure)
raise ArgumentError, "cell must be of type Cell" unless cell.is_a? Cell
raise ArgumentError, "measure must be of type Measure" unless measure.is_a? Measure
params = cell.to_query_hash
params[:lat] = measure.lat
params[:lon] = measure.lon
params[:signal] = measure.signal if measure.signal
params[:measured_at] = measure.taken_on if measure.taken_on
exec_req_and_parse_response "/measure/add", params
end | [
"def add_measure(measure)\n @measures << measure\n end",
"def add_measure_from_excel(measure)\n hash = {}\n hash[:classname] = measure['measure_file_name']\n hash[:name] = measure['name']\n hash[:display_name] = measure['display_name']\n hash[:measure_type] = measure['me... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List the measures added with a given API key. | def list_measures
exec_req_and_parse_response "/measure/list"
end | [
"def index\n @kr_measures = KrMeasure.all\n end",
"def index\n @api_v1_metrics_dashboards = Api::V1::MetricsDashboard.all\n end",
"def get_metrics_list\n\t\tjson_metrics_list \"#{@base_url}/source_list\"\n end",
"def stats(api_key = nil)\n if api_key && (!api_key.is_a? String)\n err... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes a measure previously added with the same API key. | def delete_measure(measure_id)
raise ArgumentError,"measure_id cannot be nil" unless measure_id
exec_req_and_parse_response "/measure/delete", {id: measure_id}
end | [
"def destroy\n @measure = Measure.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to measures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @measure = current_user.account.measures.find(params[:id])\n @measure.destroy\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /admin/kpi_templates/1 GET /admin/kpi_templates/1.json | def show
@admin_kpi_template = Admin::KpiTemplate.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @admin_kpi_template }
end
end | [
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def list\n @client.make_request :get, templates_path\n end",
"d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /admin/kpi_templates/new GET /admin/kpi_templates/new.json | def new
@admin_kpi_template = Admin::KpiTemplate.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @admin_kpi_template }
end
end | [
"def new\n @admin_template_type = TemplateType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template_type }\n end\n end",
"def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /admin/kpi_templates POST /admin/kpi_templates.json | def create
@admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])
respond_to do |format|
if @admin_kpi_template.save
format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }
format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }
else
format.html { render action: "new" }
format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }
end
end
end | [
"def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /admin/kpi_templates/1 PUT /admin/kpi_templates/1.json | def update
@admin_kpi_template = Admin::KpiTemplate.find(params[:id])
respond_to do |format|
if @admin_kpi_template.update_attributes(params[:admin_kpi_template])
format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }
end
end
end | [
"def update\n @template = current_site.templates.find(params[:id])\n params[:template].delete(:name) unless @template.is_deletable?\n respond_to do |format|\n if @template.update_attributes(params[:template])\n format.html { redirect_to(edit_admin_template_url(@template), :notice => t('template... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.