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 |
|---|---|---|---|---|---|---|
Look in `SEARCH_PATHS` for a nonempty favicon file with extension in `EXTENSIONS` | def locate
return if @app.dead?
file_names = EXTENSIONS.map { |ext| "favicon.#{ext}" }
paths = SEARCH_PATHS.product(file_names).map { |path| File.join(@app.path, path) }
paths.each do |path|
next if File.size?(path).to_i == 0
@path = path
break
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_file(req, res, basename)\n # /file.* > /file/index.html > /file.html\n super || super(req, res, \"#{basename}.html\")\n end",
"def search_file(req, res, basename)\n # /file.* > /file/index.html > /file.html\n super ||\n super(req, res, \"#{basename... | [
"0.5681829",
"0.55800134",
"0.5492179",
"0.54712933",
"0.5439361",
"0.5406097",
"0.5401655",
"0.53098756",
"0.53029567",
"0.52860826",
"0.5260841",
"0.5257047",
"0.52325255",
"0.522512",
"0.52089244",
"0.5180328",
"0.51735324",
"0.515278",
"0.5129168",
"0.51257455",
"0.512225... | 0.7136318 | 0 |
Data URI for favicon | def data_uri
data = Base64.encode64(File.open(@path, 'r').read).gsub(/\n/, '')
"data:#{mime_type};base64,#{data}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def favicon #google has an api that fetches favicons. :-)\n \"https://plus.google.com/_/favicon?domain=#{self.feed.html_url}\"\n end",
"def favicon\n @favicon ||= begin\n url = @doc.match(FAVICON_MATCHES).first\n if url and @url and !url.start_with? \"http\"\n url = URI.join(@url ... | [
"0.73991805",
"0.7177213",
"0.71003205",
"0.70540714",
"0.677746",
"0.6744592",
"0.66210556",
"0.6596541",
"0.6596541",
"0.6582179",
"0.6371138",
"0.6345337",
"0.6340656",
"0.63220304",
"0.6304545",
"0.62569857",
"0.62442786",
"0.6203918",
"0.6116816",
"0.60969293",
"0.609394... | 0.57679856 | 35 |
Mime type of favicon | def mime_type
# image/vnd.microsoft.icon won't render in IE8
Rack::Mime::MIME_TYPES.merge!('.ico' => 'image/x-icon')
Rack::Mime.mime_type(File.extname(@path))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mimetype\n return attributes['mimetype'] if attributes['mimetype']\n return \"image/png\" if content =~ /^.PNG/\n return \"application/octet-stream\"\n end",
"def mimetype\n return @mimetype if defined? @mimetype\n\n content_type = metadata['Content-Type'].is_a?(Array) ? metadata['Content-Typ... | [
"0.70172656",
"0.6962836",
"0.69306016",
"0.69306016",
"0.69306016",
"0.69306016",
"0.6904119",
"0.685911",
"0.68308794",
"0.6809766",
"0.6790159",
"0.67888474",
"0.67602015",
"0.6735184",
"0.67214566",
"0.67214566",
"0.67195755",
"0.6717798",
"0.671256",
"0.67056847",
"0.670... | 0.79746634 | 0 |
Method for simplifying attaching nonSQL data statements to a transaction. For instance, Mongo or CQL queries, Memcached or Redis keys would all be appropriate data to attach as statements. Data passed to this method is NOT obfuscated by New Relic, so please ensure that user information is obfuscated if the agent settin... | def notice_nosql_statement(nosql_statement)
return unless record_sql?
@nosql_statement = Database.truncate_query(nosql_statement)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compound_dataset_sql_append(sql, ds)\n sql << '('\n super\n sql << ')'\n end",
"def sql(event)\n payload = crypt_keeper_payload_parse(event.payload[:sql])\n event.payload[:sql] = crypt_keeper_filter_postgres_log(payload)\n super(event)\n end",
"def notice... | [
"0.5714744",
"0.5588189",
"0.54608303",
"0.53948504",
"0.5374112",
"0.5357876",
"0.53146183",
"0.53146183",
"0.5311164",
"0.52868587",
"0.5221761",
"0.5157314",
"0.5153559",
"0.51396084",
"0.5066241",
"0.50632995",
"0.50073683",
"0.49885002",
"0.49489164",
"0.49044564",
"0.48... | 0.45202035 | 62 |
uhm, should this change to 0? | def track_line_number(line_number)
@min_line_number = line_number if line_number < min_line_number
@max_line_number = line_number if line_number > max_line_number
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero?; end",
"def zero?; end",
"def seuil()\n\t\treturn 0\n\tend",
"def zero?() end",
"def zero?() end",
"def positive; end",
"def positive; end",
"def nonzero?; end",
"def unbleed\n @unbleed || 0\n end",
"def zero?()\n #This is a stub, used for indexing\n end",
"def zero?... | [
"0.7203823",
"0.7203823",
"0.66604894",
"0.6526648",
"0.6526648",
"0.6414195",
"0.6414195",
"0.63160676",
"0.6254486",
"0.62491876",
"0.61699",
"0.615164",
"0.60735047",
"0.59909177",
"0.5959973",
"0.59401006",
"0.5921098",
"0.59193575",
"0.5919207",
"0.59024787",
"0.589255",... | 0.0 | -1 |
GET /tick_tracks/1 GET /tick_tracks/1.json | def show
@tick_track = TickTrack.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tick_track }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tracks = Track.all\n render json: {tracks: @tracks}\n end",
"def index\n @tracks = Track.all\n render json: serialize(@tracks)\n end",
"def index\n @tracks = @disc.tracks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: ... | [
"0.7040544",
"0.69557524",
"0.6913302",
"0.68707055",
"0.68013346",
"0.6772637",
"0.6676898",
"0.6652035",
"0.6642702",
"0.6642702",
"0.6642702",
"0.66140646",
"0.66139406",
"0.659479",
"0.65631807",
"0.65631807",
"0.65631807",
"0.65511453",
"0.65470254",
"0.65295666",
"0.645... | 0.73618966 | 0 |
GET /tick_tracks/new GET /tick_tracks/new.json | def new
@tick_track = TickTrack.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @tick_track }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @track = Track.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @track }\n end\n end",
"def new\n @track = Track.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @track }\n end\n end"... | [
"0.7528708",
"0.7528708",
"0.7528708",
"0.74763393",
"0.7333825",
"0.7238342",
"0.686808",
"0.68652177",
"0.6778383",
"0.6778383",
"0.6766834",
"0.6764053",
"0.6762166",
"0.6740074",
"0.6699219",
"0.6693734",
"0.6693734",
"0.6656743",
"0.6568184",
"0.65409166",
"0.65126926",
... | 0.78883094 | 0 |
POST /tick_tracks POST /tick_tracks.json | def create
@tick_track = TickTrack.new(params[:tick_track])
if @tick_track.bulkCount != nil
if @tick_track.bulkCount > 1
labelAdd = 1
@tick_track.name = @tick_track.name + " " + labelAdd.to_s
saveSuccess = @tick_track.save
until (labelAdd - 1) == @tick_track.bulkCount
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @track = Track.new(track_params)\n if @track.save\n render json: @track, status: :created, location: @track\n else\n render json: @track.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tick = Tick.new(tick_params)\n\n respond_to do |format|\n if @... | [
"0.6677735",
"0.64708436",
"0.6409926",
"0.63767886",
"0.63730365",
"0.63196355",
"0.63196355",
"0.628828",
"0.6215785",
"0.6212097",
"0.6190636",
"0.6156834",
"0.61356723",
"0.61305803",
"0.6045736",
"0.6029984",
"0.5979614",
"0.594164",
"0.593817",
"0.59285",
"0.59097695",
... | 0.69846696 | 0 |
PUT /tick_tracks/1 PUT /tick_tracks/1.json | def update
@tick_track = TickTrack.find(params[:id])
respond_to do |format|
if @tick_track.update_attributes(params[:tick_track])
format.html { redirect_to tick_tracks_url }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @track.update(track_params)\n render json: @track\n else\n render json: { error: @track.errors }, status: :unprocessable_entity\n end\n end",
"def update\n if @track.update(edit_track_params)\n render json: @track\n else\n render json: @track.errors... | [
"0.6862266",
"0.6494964",
"0.64897656",
"0.6340057",
"0.6340057",
"0.62570494",
"0.6248863",
"0.6229133",
"0.6229133",
"0.6229133",
"0.6229133",
"0.6229133",
"0.6229133",
"0.6229133",
"0.6229133",
"0.6229133",
"0.6229133",
"0.62279886",
"0.6227477",
"0.6226821",
"0.6226821",
... | 0.7273226 | 0 |
DELETE /tick_tracks/1 DELETE /tick_tracks/1.json | def destroy
@tick_track = TickTrack.find(params[:id])
@tick_track.destroy
respond_to do |format|
format.html { redirect_to tick_tracks_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.html { redirect_to tracks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @track = Track.find(params[:id])\n @track.destroy\n\n respond_to do |format|\n format.ht... | [
"0.73046166",
"0.7258119",
"0.7252932",
"0.71921474",
"0.7155484",
"0.71503615",
"0.7070473",
"0.70460176",
"0.7025437",
"0.6961546",
"0.6961546",
"0.6958062",
"0.69523257",
"0.69354296",
"0.69261163",
"0.69033825",
"0.6901476",
"0.68368816",
"0.681443",
"0.67697453",
"0.6755... | 0.7866051 | 0 |
The CARMA Staging and Prod enviornments will not exist until ~May 2020 So we will not be hitting SALESFORCE_INSTANCE_URL in runtime, to avoid 500 errors. Instead we'll use stub req/res in order to do user testing on the rest of our submission code. | def create_submission_stub(_payload)
{
'message' => 'Application Received',
'data' => {
'carmacase' => {
'id' => 'aB935000000F3VnCAK',
'createdAt' => DateTime.now.iso8601
}
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n super\n\n uri = _get_entity_name\n opt_target_env = _get_option(\"target_environment\")\n\n payloads = [\n {\n :environment => \"local\",\n :name => \"Localhost\",\n :host => \"127.0.0.1\",\n :path => \"/\",\n :success_regex => /^.*$/\n },\n #... | [
"0.6068237",
"0.59129834",
"0.5639249",
"0.5600515",
"0.55399394",
"0.5521706",
"0.5329302",
"0.5263606",
"0.52515733",
"0.5227286",
"0.52189445",
"0.5215121",
"0.5171706",
"0.5167816",
"0.51450515",
"0.51426566",
"0.5134445",
"0.51204324",
"0.5119091",
"0.5116342",
"0.508691... | 0.0 | -1 |
Get all opinion polls from the current user. | def index
ok_request current_user, %w(user, opinion_polls, opinion_polls.time_slots)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @userpolls = eager_userpoll.where(user_id: current_user.id)\n end",
"def index\n @pending_polls = Poll.where(id: current_user.user_poll.where(answered: nil).pluck(:poll_id))\n @done_polls = Poll.where(id: current_user.user_poll.where(answered: true).pluck(:poll_id))\n end",
"def index\n ... | [
"0.74269384",
"0.6583244",
"0.6466918",
"0.6430649",
"0.5974597",
"0.58148676",
"0.5733732",
"0.5727429",
"0.5685777",
"0.5677326",
"0.55989397",
"0.55798584",
"0.55798584",
"0.55798584",
"0.55798584",
"0.55798584",
"0.557891",
"0.5550726",
"0.55436903",
"0.5540813",
"0.55381... | 0.6259252 | 4 |
Get a specific opinion poll with an link or id given. If the link is given, we decode it. | def show
id = params[:id]
unless is_number? id
token = id
decode_t = decode_link token
id = decode_t[0]['id']
end
@opinion_poll = OpinionPoll.find(id)
return ok_request @opinion_poll, %w(user time_slots answers.time_slots)
rescue ActiveRecord::RecordNotFound
r = {opinion_po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @poll = Poll.find_by_mgr_link!(params[:id])\n end",
"def get_single_poll(id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge... | [
"0.5631612",
"0.559067",
"0.55768245",
"0.54572815",
"0.54106325",
"0.5373081",
"0.5322666",
"0.52973515",
"0.51605576",
"0.50850934",
"0.5077814",
"0.50620973",
"0.50274235",
"0.5026436",
"0.50155926",
"0.49705264",
"0.49605882",
"0.49358884",
"0.49158692",
"0.48297203",
"0.... | 0.61607945 | 0 |
Update a specific opinion poll with a link or id given. If the link is given, we decode it. | def update
id = params[:id]
unless is_number? id
token = id
decode_t = decode_link token
id = decode_t[0]['id']
end
@opinion_poll = OpinionPoll.find(id)
if @opinion_poll.update(opinion_params)
return ok_request @opinion_poll
else
return bad_request @opinion_poll.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @poll = Poll.find_by_mgr_link!(params[:id])\n if @poll.update_attributes(params[:poll])\n redirect_to @poll\n else\n render action: :edit\n end\n end",
"def update\n update_and_respond(@link, link_params)\n end",
"def update\n @poll_answer = Poll.find(params[:id])\n ... | [
"0.66786194",
"0.66061544",
"0.6565347",
"0.6337967",
"0.6304742",
"0.62696475",
"0.62558126",
"0.61852247",
"0.60858625",
"0.60238856",
"0.6004914",
"0.6004914",
"0.59640545",
"0.593527",
"0.593178",
"0.5887565",
"0.58784854",
"0.58784854",
"0.5846564",
"0.5845218",
"0.58448... | 0.7491265 | 0 |
Destroy a specific opinion poll with an link or id given. If the link is given, we decode it. | def destroy
id = params[:id]
unless is_number? id
token = id
decode_t = decode_link token
id = decode_t[0]['id']
end
@opinion_poll = OpinionPoll.find(id)
@opinion_poll.destroy
return deleted_request
rescue ActiveRecord::RecordNotFound
r = {opinion_poll: 'Record Not Foun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @poll_answer = PollAnswer.find(params[:id])\n @poll = @poll_answer.poll\n @poll_answer.destroy\n end",
"def destroy\n destroy_and_respond(@link)\n end",
"def destroy\n @link.destroy\n flash[:success] = \"Link gelöscht!\"\n respond_to do |format|\n format.html {... | [
"0.674325",
"0.6454442",
"0.62952685",
"0.62897635",
"0.62678576",
"0.6267316",
"0.6245357",
"0.6154846",
"0.61200386",
"0.6111874",
"0.61002356",
"0.6090982",
"0.6090982",
"0.6086639",
"0.6077926",
"0.5996988",
"0.598371",
"0.5975666",
"0.5966603",
"0.59642166",
"0.5957049",... | 0.74211997 | 0 |
Check if the parameter is a Float/Integer. Return true if string is a Float/Integer, otherwise false. | def is_number? string
true if Float(string) rescue false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def float?(str)\n true if Float(str) rescue false\n end",
"def value_is_float?(string)\n return false if string.scan(/\\./).length != 1\n sides = string.split('.')\n return sides[0].numeric? && sides[1].numeric? && sides[1].to_i >= 0\n end",
"def is_number? string\n \t\ttrue if Float(str... | [
"0.819987",
"0.80219036",
"0.79984295",
"0.79978144",
"0.7970946",
"0.79465634",
"0.7883073",
"0.7861111",
"0.78224087",
"0.7802389",
"0.7793973",
"0.77775216",
"0.77470297",
"0.7722195",
"0.772108",
"0.77126026",
"0.7704189",
"0.7700964",
"0.7691357",
"0.7636934",
"0.7635159... | 0.7881857 | 8 |
Check if all email for the invitations are valid. emails: array of email | def validate_emails emails
invitation_models = []
emails.each do |email|
invit = Invitation.new(email: email, opinion_poll: @opinion_poll)
bad_request invit.errors.messages and return unless invit.valid? #opinion_poll_id: @opinion_poll)
invitation_models.append invit
end
invitation_mod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_emails(emails)\n return if emails.nil?\n\n if emails.respond_to? :each\n emails.each { |e| @ses.verify_email_identity email_address: e }\n else\n @ses.verify_email_identity email_address: emails\n end\n end",
"def validate_emails\n # can have zero or more email... | [
"0.7994571",
"0.7641191",
"0.6819384",
"0.6773968",
"0.6734462",
"0.6646655",
"0.6617043",
"0.6602181",
"0.65749276",
"0.6507539",
"0.6503614",
"0.6502153",
"0.6446022",
"0.6421505",
"0.64152604",
"0.638408",
"0.6348454",
"0.63471276",
"0.6339611",
"0.6335004",
"0.6256945",
... | 0.7765515 | 1 |
Check if all datetime for the time_slot are valid. times: array of timeSlot object | def validate_time_slots times
time_models = []
times.each do |time|
t = TimeSlot.new(from: time[:from], to: time[:to], opinion_poll: @opinion_poll)
bad_request t.errors.messages and return unless t.valid?
time_models.append t
end
time_models
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_time_slot_ids times\n\n empty_times if times.size == 0\n\n times.each do |id|\n time_slot = TimeSlot.find(id)\n end\n true\n\n rescue ActiveRecord::RecordNotFound\n r = {times: 'Record Not Found'}\n return not_found r\n end",
"def validate\n\t\tif not isEmpty(self.time)\n\t\... | [
"0.74307626",
"0.7231083",
"0.7216731",
"0.70782375",
"0.7064598",
"0.67520165",
"0.67138594",
"0.667697",
"0.66711265",
"0.6556665",
"0.64362895",
"0.6421706",
"0.64177173",
"0.62983394",
"0.6297088",
"0.62579376",
"0.62399673",
"0.6202186",
"0.61988854",
"0.6196015",
"0.614... | 0.8114175 | 0 |
Encode some data to create unique link with JWT id: opinion_poll's id title: opinion_poll's title | def encode_link id, title
payload = {
:id => id,
:title => title
}
link = JWT.encode payload, nil, 'none'
link.sub('.', '_').chop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_short_url\n # encode base 10 id as base 62 string as seen here https://gist.github.com/zumbojo/1073996\n i = id\n return Constants::ALPHABET[0] if i.zero?\n s = ''\n base = Constants::ALPHABET.length\n while i > 0\n s << Constants::ALPHABET[i.modulo(base)]\n ... | [
"0.6138062",
"0.6108356",
"0.61056376",
"0.5916774",
"0.5895421",
"0.5752373",
"0.5751686",
"0.57026225",
"0.56920755",
"0.5676025",
"0.5675327",
"0.56201386",
"0.56201386",
"0.56201386",
"0.5573795",
"0.55585",
"0.5545487",
"0.55051625",
"0.5476974",
"0.54466695",
"0.5430361... | 0.7929047 | 0 |
Decode the link generated by encode_link | def decode_link data
link = data.sub('_', '.')
JWT.decode link, nil, false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unescape_link\n self.link = CGI.unescape(link) if self.link.present?\n end",
"def urldecode\n _rfc2396_parser.unescape(self)\n end",
"def parse_link; end",
"def url_decode\n Rack::Utils.unescape self\n end",
"def decode\n transform :decode\n end",
"def decode; end",
"def decode; end... | [
"0.7186964",
"0.6778721",
"0.66369534",
"0.63971317",
"0.637161",
"0.62787867",
"0.62787867",
"0.62239677",
"0.6133534",
"0.6125122",
"0.61145025",
"0.5905528",
"0.58921516",
"0.5860475",
"0.5859842",
"0.58084166",
"0.57465047",
"0.5732515",
"0.5689367",
"0.56890404",
"0.5675... | 0.71097636 | 1 |
Modified to use method instead in order to evaluate more expression | def true_false(data)
if data
"Evaluates: TRUE"
else
"Evaluates: FALSE"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expression; end",
"def expressions; end",
"def expr()\n #This is a stub, used for indexing\n end",
"def create_method_from_expressions; end",
"def expression(method)\n\n\n\n # 245:5: ( variable_or_method_use[method] | any_expression[method] )\n alt34 = 2\n # 244:1... | [
"0.7470174",
"0.705238",
"0.6886792",
"0.6845253",
"0.67833304",
"0.67024994",
"0.6607268",
"0.6580696",
"0.6484303",
"0.6243066",
"0.6234799",
"0.62189996",
"0.6209264",
"0.6133774",
"0.6115231",
"0.6102987",
"0.60494804",
"0.60277146",
"0.60130656",
"0.6001937",
"0.59977704... | 0.0 | -1 |
fetch persona from openid.sreg parameters returned by openid server if supported | def map_openid_registration_with_persona_fields(registration)
self.nickname ||= registration["nickname"] if respond_to?(:nickname) && !registration["nickname"].blank?
self.login ||= registration["nickname"] if respond_to?(:login) && !registration["nickname"].blank?
self.email ||= registration["e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openid_identifier\n auth_params[:openid_identifier] if auth_params?\n end",
"def oidsrv(op, nr=nil, s=nil)\r\n\t\tif not params[\"openid.identity\"].nil?\r\n\t\t\tnr = case params[\"openid.identity\"]\r\n\t\t\twhen /openid.piratenpartei-niedersachsen.de/ \t: 0\r\n\t\t\twhen /www.piratenpartei-hamburg.de/... | [
"0.6134792",
"0.6111671",
"0.5687502",
"0.55959946",
"0.55814856",
"0.55341226",
"0.5528788",
"0.5482964",
"0.5376596",
"0.5365683",
"0.53331363",
"0.5274028",
"0.52525777",
"0.52398765",
"0.5236376",
"0.52029824",
"0.51816803",
"0.5159918",
"0.51548284",
"0.5136081",
"0.5128... | 0.5274274 | 11 |
Since we use attr_accessible or attr_protected, we should overwrite this method defined in authlogic_openid. | def map_saved_attributes(attrs)
attrs.each do |key, value|
send("#{key}=", value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def attributes_protected_by_default\n ['id']\n end",
"def create_accessible_attributes\n read_inheritable_attribute(:attr_create_accessible)\n end",
"def attributes(_record)\n raise 'Abstract method attribut... | [
"0.63985753",
"0.63985753",
"0.6315942",
"0.6282257",
"0.62217444",
"0.6004186",
"0.6001977",
"0.59652853",
"0.5959027",
"0.59551096",
"0.5948236",
"0.59475404",
"0.5925306",
"0.58764213",
"0.5872285",
"0.5809258",
"0.5808231",
"0.5806253",
"0.57880193",
"0.57804763",
"0.5761... | 0.0 | -1 |
impedir transmissao de parametros maliciosos strong params | def project_params
params.require(:project).permit(:name, :desc, :id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def unsolved_params\n \n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def analise_privacidade_params\n #params.require(:analise_privacidade).permit(:rede_social, :url_rede_social, :descricao_analise... | [
"0.6995465",
"0.6637292",
"0.66118217",
"0.6610508",
"0.65528476",
"0.6536238",
"0.6386637",
"0.6380093",
"0.63624185",
"0.6362033",
"0.6342501",
"0.6328451",
"0.6309772",
"0.6288057",
"0.6283333",
"0.6268222",
"0.62649477",
"0.6231901",
"0.6231729",
"0.62164867",
"0.6211274"... | 0.0 | -1 |
Not supporting any of these just yet | def index; redirect_to '/'; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def fallbacks; end",
"def fallbacks; end",
"def missing; end",
"def support\n raise \"Not implemented\"\n end",
"def probers; end",
"def missing?; end",
"def custom; end",
"def custom; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
... | [
"0.68294084",
"0.6456297",
"0.6456297",
"0.63661426",
"0.6224687",
"0.6184912",
"0.61059177",
"0.5965158",
"0.5965158",
"0.5946403",
"0.5946403",
"0.5946403",
"0.5946403",
"0.5943423",
"0.5941117",
"0.5941117",
"0.5907982",
"0.58901614",
"0.580212",
"0.5794661",
"0.5794661",
... | 0.0 | -1 |
filter out listed taxa that do not belong to a particular list Note that "other_list" is a hash, not an active record query in progress | def filter_by_list(list, other_list)
other_list.select{|lt|
lt['list_id'].to_s == list.id.to_s
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supplies_excluding_tax\n self.supplies.select{|p| not p[:including_tax]}\n end",
"def filtered_list(list_attribute)\n if list_attribute == :link_transactions\n [:returns_lbtt_link_transactions, Lbtt::LinkTransactions.attribute_list]\n else\n [:returns_lbtt_yearly_rent, Lbtt::Y... | [
"0.6154076",
"0.6003541",
"0.5955985",
"0.5933336",
"0.5704037",
"0.5298126",
"0.52933574",
"0.5288993",
"0.5272589",
"0.52602255",
"0.52170086",
"0.52021116",
"0.5155946",
"0.5138118",
"0.5132509",
"0.5127479",
"0.50895345",
"0.50632155",
"0.5044336",
"0.5006125",
"0.4987796... | 0.6546629 | 0 |
def full_name self.first_name + " " + self.last_name end | def sign_up_date
self.created_at.to_date.to_s(:long)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name\n self.first_name + \" \" + self.last_name\n end",
"def full_name\n self.first_name + \" \" + self.last_name \n end",
"def full_name \n self.first_name + ' ' + self.last_name\n end",
"def full_name\n self.first_name + \" \" + self.last_name\n end",
"def full_name\... | [
"0.9758428",
"0.9753539",
"0.9737148",
"0.97342676",
"0.97342676",
"0.9730955",
"0.9730955",
"0.9730955",
"0.97222424",
"0.96878344",
"0.9679736",
"0.9679424",
"0.9679424",
"0.96437347",
"0.96322143",
"0.9625388",
"0.9618435",
"0.9618435",
"0.9618435",
"0.96148497",
"0.961012... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def section_params
params.require(:section).permit(:fee, :registration_fee, :enrollment_limit,
:term_id, :room_id, :user_id, :course_id,
meeting_day_time_attributes: [:day, :start_time, :end_time])
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 |
pretty print the DFS traversal | def pp_dfs(tree)
arr = []
pp_dfs_helper(tree, arr)
return arr.inspect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printout\n\t\t\n\t\tindex = 0\n\t\t\n\t\tdef small_loop (node, index)\n\t\t\t\n\t\t\tfor i in 0...index\n\t\t\t\tprint \" \"\n\t\t\tend\n\t\t\t\n\t\t\tputs node.name\n\t\t\tindex += 1\n\t\t\t\n\t\t\tif node.children.length > 0\n\t\t\t\tindex += 1\n\t\t\t\tnode.children.cycle(1) { |child| small_loop(child, inde... | [
"0.67512923",
"0.67056185",
"0.668754",
"0.6647291",
"0.6641492",
"0.65802044",
"0.65685403",
"0.6565172",
"0.65591294",
"0.65466493",
"0.6529406",
"0.65074974",
"0.6505433",
"0.64803827",
"0.6454488",
"0.6438338",
"0.6401225",
"0.6342364",
"0.6336167",
"0.6318443",
"0.630479... | 0.6757015 | 0 |
format the combination array to add the '' | def format_comb(arr)
ret = []
arr.each do |sub_arr|
if sub_arr.size > 1
# use dash to connect the multiple strings
ret << sub_arr.inject('') {|acc, e| acc + e + '-' }[0..-2]
elsif sub_arr.size == 1
ret << sub_arr[0]
else
# do nothing..... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combination(chars_array)\n array_of_letters = chars_array.map { |digit| @letters[digit] }\n combination = array_of_letters.shift.product(*array_of_letters).map(&:join)\n end",
"def formatAnswersToSimple( answerArr )\n resultString = \"\"\n # answerArr.each{ |ansArr|\n# resultString = resultS... | [
"0.60276735",
"0.6015009",
"0.6003799",
"0.5930467",
"0.5911248",
"0.5903281",
"0.5896798",
"0.5859347",
"0.58568096",
"0.58362174",
"0.5823158",
"0.5815131",
"0.5776225",
"0.5764727",
"0.57601917",
"0.5752997",
"0.5693666",
"0.5674821",
"0.5663656",
"0.5662821",
"0.56433225"... | 0.747239 | 0 |
this is the general DFS that can pass in a block | def dfs(&block)
yield @data
@nodes.each do |node|
node.dfs(&block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dfs(start_vertex, &block)\n start_vertex.gray!\n @time += 1\n start_vertex.discovery = @time\n start_vertex.get_connections.each do |next_vertex|\n if next_vertex.white?\n next_vertex.predecessor = start_vertex\n dfs(next_vertex, &block)\n end\n end\n start_vertex.blac... | [
"0.7002693",
"0.6821668",
"0.663707",
"0.6550791",
"0.6486326",
"0.647421",
"0.6454304",
"0.6400519",
"0.63940454",
"0.6369812",
"0.6300074",
"0.62882274",
"0.61887825",
"0.6159723",
"0.61563283",
"0.61078817",
"0.60894746",
"0.60894746",
"0.60754734",
"0.60616535",
"0.605290... | 0.7084068 | 0 |
this part we need to 'lift' the recursion one level up so we can collect all the siblings. because of the natural feature of the combination tree, we can always choose any one child to perform DFS safely. | def tree2path_helper(tree, current, path)
path << '/' << current
if !tree.children.empty?
set = []
# use reverse to be consistent with the sample in the problem
tree.children.reverse_each do |child|
set << child.data unless child.data.include?('-')
end
acc =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then ch... | [
"0.67687476",
"0.644497",
"0.63330585",
"0.61791533",
"0.6119006",
"0.6038987",
"0.59627587",
"0.59516364",
"0.5936295",
"0.5917192",
"0.58747476",
"0.58617747",
"0.5854595",
"0.58222663",
"0.58105487",
"0.5806761",
"0.58036935",
"0.5795212",
"0.5793471",
"0.57928723",
"0.578... | 0.0 | -1 |
GET /picks GET /picks.json | def index
@picks = Pick.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @picks = PickName.order(:id).all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @picks }\n end\n end",
"def show\n @picks = @hashtag.picks.page(params[:page]).per(10)\n render json: @picks, include: [params[:include]]\n e... | [
"0.727397",
"0.7158272",
"0.70214623",
"0.67694813",
"0.65924346",
"0.6553762",
"0.64068943",
"0.6256001",
"0.6145401",
"0.60961026",
"0.60851896",
"0.59575874",
"0.59150606",
"0.58451116",
"0.5808071",
"0.5770038",
"0.57676536",
"0.5762799",
"0.57614464",
"0.57285696",
"0.57... | 0.64882565 | 6 |
GET /picks/1 GET /picks/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @pick = @game.picks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pick }\n end\n end",
"def index\n @picks = PickName.order(:id).all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json {... | [
"0.7176806",
"0.7148532",
"0.69865984",
"0.66311955",
"0.64078707",
"0.6285178",
"0.6228906",
"0.6195264",
"0.61600393",
"0.6113025",
"0.6074102",
"0.59620166",
"0.59512067",
"0.59492576",
"0.5949167",
"0.5875059",
"0.58541334",
"0.58340544",
"0.58008814",
"0.57880664",
"0.57... | 0.0 | -1 |
POST /picks POST /picks.json | def create
@pick = Pick.new(pick_params)
@pick.result = 0
@pick.user_id = current_user.id
@pick.game_id = Game.find(params[:game_id]).id
@pick.week = Game.find(params[:game_id]).week
respond_to do |format|
if @pick.save
make_updates(@pick.week)
format.html { redirect_to cu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @game = Game.find params[:game_id]\n if @game.picks.find_by(user_id: current_user.id)\n else\n @pick = @game.picks.build(picks_params)\n @pick.user = current_user\n @pick.save\n end\n\n respond_to do |format|\n if @pick.save\n format.html { redirect_to games_p... | [
"0.6253204",
"0.599505",
"0.5838768",
"0.5701518",
"0.55707693",
"0.55518746",
"0.5501453",
"0.5415585",
"0.5383841",
"0.5346346",
"0.5317396",
"0.5315591",
"0.5310798",
"0.53048176",
"0.52642024",
"0.52409697",
"0.52369726",
"0.52241653",
"0.5204926",
"0.5182078",
"0.51778",... | 0.5146222 | 21 |
PATCH/PUT /picks/1 PATCH/PUT /picks/1.json | def update
respond_to do |format|
if @pick.update(pick_params)
make_updates(@pick.week)
format.html { redirect_to current_user, notice: 'Pick was successfully updated.' }
format.json { render :show, status: :ok, location: @pick }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @pick.update_attributes(picks_params)\n format.html { redirect_to games_path, notice: 'Pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"... | [
"0.66604394",
"0.6640845",
"0.65464497",
"0.64332443",
"0.63735074",
"0.6239517",
"0.6229029",
"0.6191199",
"0.6190061",
"0.6172243",
"0.6157495",
"0.61430174",
"0.6139615",
"0.61136806",
"0.61078596",
"0.6074105",
"0.6074105",
"0.6062766",
"0.6062238",
"0.6016444",
"0.600422... | 0.5658588 | 49 |
DELETE /picks/1 DELETE /picks/1.json | def destroy
@pick.destroy
respond_to do |format|
format.html { redirect_to picks_url, notice: 'Pick was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def cmd_delete argv\n set... | [
"0.71811396",
"0.69348586",
"0.68810207",
"0.68422014",
"0.68403316",
"0.6756321",
"0.6703069",
"0.66086304",
"0.6600601",
"0.65965223",
"0.65954363",
"0.65954363",
"0.6568451",
"0.6560983",
"0.6550654",
"0.6537647",
"0.65364575",
"0.6529778",
"0.6516595",
"0.6512285",
"0.651... | 0.6396598 | 41 |
Use callbacks to share common setup or constraints between actions. | def set_pick
@pick = Pick.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 pick_params
params.require(:pick).permit(:game_id, :user_id, :pick, :result, :week)
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 |
POST /comments POST /comments.json | def create
@comment = Comment.new(comment_params)
respond_to do |format|
if @comment.save
format.html { redirect_to @comment.week.lecture_module, notice: 'Comment was successfully created.' }
format.js
else
format.html { render :new }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @comment = @post.comments.new(comment_params)\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n\n end",
"def comment options={}\n client.post(\"/#{id}/comments\", options)\n end",
... | [
"0.75120175",
"0.74212646",
"0.7374645",
"0.72364116",
"0.7205224",
"0.7086658",
"0.7069151",
"0.70549524",
"0.7049054",
"0.6989455",
"0.69825",
"0.69657713",
"0.69578165",
"0.6910411",
"0.6909373",
"0.68731725",
"0.6871654",
"0.6822542",
"0.6810818",
"0.6787486",
"0.6785412"... | 0.0 | -1 |
PATCH/PUT /comments/1 PATCH/PUT /comments/1.json | def update
@comment = Comment.find(params[:id])
@original_body = @comment.body
if params[:body] != @comment.body
respond_to do |format|
if @comment.update(body: params[:body])
format.js
else
format.js { render :template => 'comments/update_empty.js.erb' }
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end",
"def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end",
"def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.com... | [
"0.72266555",
"0.7066674",
"0.706502",
"0.7026744",
"0.6884827",
"0.677817",
"0.67368984",
"0.6731739",
"0.67238224",
"0.67238224",
"0.6694732",
"0.66679853",
"0.6661322",
"0.6639529",
"0.6634859",
"0.6628473",
"0.6605412",
"0.65988064",
"0.6597005",
"0.6597005",
"0.65964127"... | 0.0 | -1 |
DELETE /comments/1 DELETE /comments/1.json | def destroy
@comment.destroy
respond_to do |format|
format.html { redirect_back fallback_location: root_path, notice: 'Comment was successfully destroyed.' }
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @comment.destroy\n render json: @comment, status: :ok\n\n end",
"def destroy\n @comment1 = Comment1.find(params[:id])\n @comment1.destroy\n\n respond_to do |f... | [
"0.7563111",
"0.74376714",
"0.7375191",
"0.7369342",
"0.7360642",
"0.7356597",
"0.7295853",
"0.7295853",
"0.72800404",
"0.726927",
"0.72620535",
"0.72620535",
"0.72620535",
"0.7257083",
"0.7257083",
"0.7257083",
"0.72429276",
"0.72420895",
"0.7241516",
"0.7241516",
"0.7241516... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_comment
@comment = Comment.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 comment_params
params.require(:comment).permit(:week_id, :user_id, :body)
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 |
Create a new line item object on the requisition. | def set_lines
set_line(:line_item, OLE_QA::Framework::OLEFS::Line_Item)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_line_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\texisting_line_item = Item.where('product_id = ? AND sale_id = ?', params[:product_id], @sale.id).first\n\n\t\tif existing_line_item.blank?\n\t\t\tline_item = Item.new(product_id: params[:product_id], sale_id: params[:sale_id], quantity: params[:quant... | [
"0.7398036",
"0.7306355",
"0.72719",
"0.7240863",
"0.7127501",
"0.71087474",
"0.70981884",
"0.7073335",
"0.70607376",
"0.701314",
"0.7007038",
"0.6972272",
"0.6943818",
"0.6905788",
"0.6902219",
"0.6901371",
"0.6890732",
"0.6857535",
"0.6826762",
"0.6826762",
"0.6826762",
"... | 0.0 | -1 |
Set Requisition screen elements. | def set_elements
super
# Requisition Detail Area
element(:license_request_checkbox) {b.checkbox(:id => "document.licensingRequirementIndicator")}
element(:receiving_required_checkbox) {b.checkbox(:id => "document.receivingDocumentRequiredIndicator")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_screen screen\n\n screen.set_editable false\n screen.set_xalign 1\n screen.set_can_focus false\n\n end",
"def set_requisition\n @resquisition = Requisition.find(params[:id])\n end",
"def set_screen\n @screen = Screen.find(params[:id])\n end",
"def set_screen\n @scr... | [
"0.6159585",
"0.6066822",
"0.5639038",
"0.56383824",
"0.5581375",
"0.5581375",
"0.5581375",
"0.5577046",
"0.5576906",
"0.5566733",
"0.55237967",
"0.5516484",
"0.5409269",
"0.5396287",
"0.5381933",
"0.5318889",
"0.5260715",
"0.5228426",
"0.52214324",
"0.5194487",
"0.51835644",... | 0.54779255 | 12 |
=============Manera de filtrar ========= ventas.map do |k,v| puts v if v < 70000 end ======================================= ============= CON METODO ================ | def filtrando(ventas)
ventas.group_by {|x| x.to_i > 70000}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greater_than_500_appearances(values) \n values.each do |appearances|\n if appearances[0].to_i > 500\n puts appearances[0]\n end\n end\nend",
"def filtered_entries; end",
"def greater_than_500(list)\n gtf = list.select do |c|\n c[:mentions] > 500\n end\n return gtf\nend",
"def getShortF... | [
"0.5747606",
"0.5706178",
"0.5634588",
"0.5620268",
"0.547156",
"0.54199165",
"0.5411479",
"0.5365514",
"0.535649",
"0.5336199",
"0.53196037",
"0.53097236",
"0.52867246",
"0.52693367",
"0.52526295",
"0.5214758",
"0.5214063",
"0.5209268",
"0.51927114",
"0.5179827",
"0.51773554... | 0.7235006 | 0 |
GET /question_attributes/1 GET /question_attributes/1.xml | def show
@question_attribute = QuestionAttribute.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @question_attribute }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @question_attribute = QuestionAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_attribute }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html\n format... | [
"0.63757676",
"0.62089926",
"0.62089926",
"0.6146186",
"0.6055273",
"0.592097",
"0.592097",
"0.5915549",
"0.58840066",
"0.5879735",
"0.58790636",
"0.58790636",
"0.58790636",
"0.58790636",
"0.58790636",
"0.58790636",
"0.58790636",
"0.5858807",
"0.5858807",
"0.5858807",
"0.5818... | 0.7183832 | 0 |
GET /question_attributes/new GET /question_attributes/new.xml | def new
@question_attribute = QuestionAttribute.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @question_attribute }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question... | [
"0.7242149",
"0.7146488",
"0.7146488",
"0.7146488",
"0.7146488",
"0.7146488",
"0.71362776",
"0.70240474",
"0.7003645",
"0.6989997",
"0.697901",
"0.695746",
"0.6949822",
"0.6852935",
"0.682533",
"0.682533",
"0.6818119",
"0.6816747",
"0.6807583",
"0.6795968",
"0.6792785",
"0.... | 0.78703284 | 0 |
POST /question_attributes POST /question_attributes.xml | def create
@question_attribute = QuestionAttribute.new(params[:question_attribute])
respond_to do |format|
if @question_attribute.save
flash[:notice] = 'QuestionAttribute was successfully created.'
format.html { redirect_to(@question_attribute) }
format.xml { render :xml => @ques... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def question_params\n params.require(:question).permit(:content, :response_type_id, :parent_id, :category_id, :groups,\n :version_independent_id, :description, :other_allowed, :subcategory_id,\n concepts_attributes: [:id, :value, :display_n... | [
"0.63307583",
"0.6267332",
"0.5940268",
"0.5909981",
"0.58806115",
"0.58567744",
"0.585457",
"0.5850891",
"0.58507913",
"0.58479047",
"0.5840933",
"0.58386904",
"0.5834973",
"0.58100295",
"0.58040607",
"0.5773031",
"0.57579434",
"0.5740889",
"0.57367307",
"0.5722532",
"0.5714... | 0.6702121 | 0 |
PUT /question_attributes/1 PUT /question_attributes/1.xml | def update
@question_attribute = QuestionAttribute.find(params[:id])
respond_to do |format|
if @question_attribute.update_attributes(params[:question_attribute])
flash[:notice] = 'QuestionAttribute was successfully updated.'
format.html { redirect_to(@question_attribute) }
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.json { render :json => 'Question updated OK' }\n format.xml { head :ok }\n else\n format.json { render :json => @question.errors }\n ... | [
"0.6682341",
"0.64900154",
"0.6487342",
"0.6464095",
"0.64198315",
"0.64198315",
"0.64198315",
"0.64198315",
"0.64198315",
"0.6412825",
"0.6329267",
"0.6310907",
"0.63057774",
"0.6255532",
"0.6253144",
"0.6248218",
"0.6219023",
"0.6219023",
"0.6219023",
"0.6219023",
"0.621902... | 0.7115038 | 0 |
DELETE /question_attributes/1 DELETE /question_attributes/1.xml | def destroy
@question_attribute = QuestionAttribute.find(params[:id])
@question_attribute.destroy
respond_to do |format|
format.html { redirect_to(question_attributes_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @etx_file = EtxFile.find(params[:id])\n \n arr = @etx_file.ques_no.split(\",\")\n Question.destroy(arr)\n @etx_file.update_attributes(status: true)\n #@etx_file.destroy\n\n respond_to do |format|\n format.html { redirect_to etx_files_url }\n format.json { head :ok }\n ... | [
"0.6531071",
"0.64431924",
"0.64252925",
"0.6402974",
"0.6391546",
"0.6391546",
"0.63837266",
"0.6372122",
"0.6372122",
"0.6372122",
"0.6372122",
"0.6372122",
"0.6372122",
"0.6372122",
"0.6367164",
"0.6351775",
"0.6348708",
"0.63342184",
"0.63277847",
"0.63080984",
"0.6298386... | 0.7494262 | 0 |
Public: Create a new Connection uri the connection uri for the Redis Client name the String name of the Connection Returns a new Connection. | def initialize( uri, name )
@uri = uri
@client = Redis.new :host => @uri.host, :port => @uri.port
@name = name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redis_connection(name)\n name = name.to_s\n config = redis_config_by_name(name)\n ConnectionWrapper.new(self, name, config)\n end",
"def create\n conn = EM::Hiredis::Client.new(@host, @port, @password, @database)\n conn.connect\n conn\n end",
"def redis\n... | [
"0.7128372",
"0.6450537",
"0.637258",
"0.6241709",
"0.6232986",
"0.6135051",
"0.6078268",
"0.603212",
"0.60102814",
"0.60073143",
"0.589503",
"0.5870839",
"0.5860504",
"0.58337814",
"0.58247066",
"0.5761339",
"0.5754265",
"0.57349694",
"0.57344294",
"0.56847274",
"0.5657322",... | 0.67827696 | 1 |
Public: destroy the connection Closes the redis client connection. Returns nothing. | def destroy
@client.client.disconnect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n connection.close\n end",
"def close\n redis.disconnect!\n end",
"def destroy_connection\n begin\n @ssock.close if @ssock\n @rsock.close if @rsock\n ensure\n @connected=false\n end\n end",
"def close\n\n @redis.quit\n end",... | [
"0.76501465",
"0.7335599",
"0.73133135",
"0.72698057",
"0.7012806",
"0.69023085",
"0.6725241",
"0.6556225",
"0.65448105",
"0.651955",
"0.649202",
"0.6478424",
"0.6374226",
"0.6347031",
"0.63404775",
"0.6339864",
"0.62696403",
"0.62632936",
"0.62575966",
"0.62462175",
"0.62395... | 0.67493993 | 6 |
expects priority and a block, or an event as a hash with a `priority` key. | def append(priority: nil, event: nil, &blk)
increment_seen
return if @capacity == 0
if full?
priority ||= priority_for(event)
if priority_for(@items[0]) < priority
heapify_items_array
incoming = event || yield
@items[0] = incoming
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acquire_priority\n case @event['status']\n when '0', '1'\n 'low'\n when '2', '3'\n 'normal'\n end\n end",
"def register_one(owner, event, priority, &block); end",
"def register(owners, event, priority: T.unsafe(nil), &block); end",
"def push(priority, key, &block)\n MagLev::Gu... | [
"0.61355",
"0.6026746",
"0.60170954",
"0.5792042",
"0.5640767",
"0.557006",
"0.5426252",
"0.5421016",
"0.5421016",
"0.5378983",
"0.5339391",
"0.53190523",
"0.5317394",
"0.5305182",
"0.5301111",
"0.5284544",
"0.52332",
"0.52332",
"0.5212328",
"0.5132957",
"0.5128938",
"0.507... | 0.5461188 | 6 |
get the recently downloaded repository | def git
# log "Thread.current[:repo] nil? " + Thread.current[:repo].nil?.to_s
Thread.current[:repo] ||= clone(ARGV[0], ARGV[1])
Thread.current[:repo]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_updated\n repo = Grit::Repo.init_bare_or_open(File.join(path , '.git'))\n repo.commits.first.commited_date\n end",
"def last(repo)\n find(repo)\n end",
"def get_repositories\n get(\"#{url_base}/repositories?#{dc}\")[\"data\"]\n end",
"def retrieve\n raise RetrieverErr... | [
"0.6697473",
"0.66926444",
"0.66878605",
"0.6665921",
"0.6428795",
"0.63554513",
"0.63509554",
"0.6295078",
"0.6258899",
"0.6233061",
"0.61731416",
"0.61364174",
"0.6126957",
"0.61176884",
"0.60931355",
"0.60692286",
"0.6062764",
"0.60305613",
"0.6026122",
"0.6024977",
"0.599... | 0.0 | -1 |
r.to_s(16).rjust(2, '0') + g.to_s(16).rjust(2, '0') + b.to_s(16).rjust(2, '0') end | def to_ints(hex)
r,g,b = hex.scan(/\w\w/)
[r,g,b].map do |s|
s.hex
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hex(r, g, b)\n [r, g, b].inject(\"#\") do |hex, n|\n hex + n.to_s(16).rjust(2,'0')\n end\nend",
"def rgb(r, g, b) \n [r, g, b].map do |i|\n i = 0 if i.negative?\n i = 255 if i > 255\n i.to_s(16).rjust(2, \"0\")\n end.join.upcase\nend",
"def to_hex(r, g, b)\n # 1)\n #'#' +\n # r.to_s... | [
"0.75363415",
"0.690918",
"0.682031",
"0.65847504",
"0.64971083",
"0.6462601",
"0.6440414",
"0.640786",
"0.6400827",
"0.6395479",
"0.6321532",
"0.6240684",
"0.6123336",
"0.60965085",
"0.6053701",
"0.60490686",
"0.6046208",
"0.60353273",
"0.60291076",
"0.60266596",
"0.60167193... | 0.0 | -1 |
Returns the type of a member If the passed in parameter is one of Basic types return the corresponding BasicType, else the parameter is returned unmodified | def find_basic_type(key)
only_basic_type(key) || key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_of(member)\n self.class.type_of(member)\n end",
"def type_of(member)\n self::MEMBERS_HASH[member].type\n end",
"def get_member_type_string(attr_details)\n attr_details[:primitive].to_s.downcase == 'array' ? member_type_is_basic?(attr_details) : attr_details[:primitive]\n end",
"def membe... | [
"0.78307444",
"0.7450411",
"0.701051",
"0.6803881",
"0.6723147",
"0.6561091",
"0.6517488",
"0.626694",
"0.6096845",
"0.5810947",
"0.57658017",
"0.57175314",
"0.561611",
"0.5493145",
"0.5486899",
"0.5478843",
"0.5477948",
"0.54236865",
"0.5421536",
"0.5417214",
"0.5400415",
... | 0.5615049 | 13 |
Returns the corresponding basic data type in Java | def only_basic_type(key)
BasicTypes[key.camelcase(:lower)]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_type\n JavaType.new(@package, @name)\n end",
"def java_type\n Jrodb::Type.java_type_for(type)\n end",
"def data_type\n if @data_type\n @data_type\n else\n (@is_string ? String : nil)\n end\n end",
"def data_type\n\t\tend",
"def data_type\n ... | [
"0.71378785",
"0.6980195",
"0.6923733",
"0.68536055",
"0.6751583",
"0.6749689",
"0.6743367",
"0.67220277",
"0.6715912",
"0.6681623",
"0.66656",
"0.66153985",
"0.6588963",
"0.6582654",
"0.65238976",
"0.64948916",
"0.6419297",
"0.6387437",
"0.6385041",
"0.6375318",
"0.6362114",... | 0.0 | -1 |
Returns the imports for the Class | def imports(data_type, schema, package, classname, schema_format, operation_input = false)
list = []
# custom package provided during generation
pkg = options[:namespace]
pkg += "." if pkg.present?
# mandatory imports
list += ["com.paypal.core.rest.JSONFormatter"] if (s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def importer_names\n importers.map{|e| e.const_name }\n end",
"def imported\n @imported ||= []\n end",
"def imported\n @imported ||= []\n end",
"def import(cls)\n if cls.respond_to? :java_class\n @imports << cls.java_class.name\n else\n @imports << cls.to_s\n ... | [
"0.7148298",
"0.6980634",
"0.6980634",
"0.67558604",
"0.6504778",
"0.635343",
"0.6339568",
"0.6335061",
"0.6253971",
"0.6191317",
"0.616673",
"0.61481345",
"0.60860187",
"0.6049942",
"0.6044294",
"0.60345554",
"0.599496",
"0.5990899",
"0.5976",
"0.59592927",
"0.5949799",
"0... | 0.0 | -1 |
Generate imports for WSDL Service class | def service_imports(schema, service, package)
list = []
# custom package provided during generation
pkg = options[:namespace]
pkg += "." if pkg.present?
# import request and response of operations
service.operations.each do |name, definition|
if (definition.re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_imports(schema, service, package)\n list = []\n \n # custom package provided during generation\n pkg = options[:namespace]\n pkg += \".\" if pkg.present?\n \n # import request and response of operations\n service.operations.each do |name, defini... | [
"0.7540551",
"0.6295386",
"0.6279971",
"0.62786883",
"0.61475635",
"0.60943466",
"0.58838236",
"0.58220464",
"0.5755185",
"0.5732571",
"0.5633199",
"0.56114537",
"0.55690145",
"0.5566691",
"0.5566691",
"0.5566691",
"0.5566691",
"0.55600494",
"0.553903",
"0.5504919",
"0.548600... | 0.7379626 | 1 |
Returns the property type name to be used as the type name in enclosing Class | def get_property_class(property, classname = nil)
type = find_basic_type(property.type)
# If type is Self (as per Spec) treat is as HostType
# classname is always in camelcase
type = classname if type == "self"
type = "List<#{type}>" if property.array
type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def property_name_from_classname\n CLASSNAME_TO_PROPERTY[classname]\n end",
"def name\n Properties[self.class] ||= {}\n return Properties[self.class][:name] || \"\"\n end",
"def get_type_name(type)\n type_name = TypeName.new get_class_name(type), get_class_module_path(type), get_class_file_na... | [
"0.72117877",
"0.7041396",
"0.7016509",
"0.68329585",
"0.68255615",
"0.678822",
"0.67835444",
"0.6772878",
"0.6564154",
"0.6558875",
"0.6549502",
"0.6535483",
"0.6476872",
"0.64592385",
"0.6435422",
"0.64098626",
"0.63821435",
"0.63799244",
"0.6358193",
"0.6340803",
"0.632258... | 0.7162193 | 1 |
Replaces any "" present in the path URI to valid "_" used while replacing placeholders with exact values | def validate_path(path)
path.gsub(/\{([^}]*)\}/){|match| "\{#{validate_property_name($1)}\}" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_path\n gsub(/[\\/: ]/,'_')\n end",
"def replace_path_parameter(path, name, value)\n if value == nil\n value = \"\"\n end\n if value.to_s != \"\"\n value = \"/\" + CGI.escape(value.to_s).gsub('+', '%20')\n end\n path.sub('/{' + name + '}', value)\n end",
... | [
"0.71601385",
"0.68519527",
"0.6532923",
"0.6379035",
"0.6356338",
"0.6340841",
"0.63053256",
"0.6302241",
"0.6269756",
"0.6265832",
"0.62599695",
"0.62293726",
"0.61938125",
"0.618467",
"0.6154706",
"0.61085683",
"0.6097919",
"0.60954416",
"0.60867316",
"0.6080463",
"0.60663... | 0.0 | -1 |
Replaces '' with '_' and CamelCase(s) them [Java] | def validate_class_name(name)
only_basic_type(name) || name.gsub(/-/, "_").camelcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def underscore!\n gsub!('::', '_')\n gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n downcase!\n end",
"def CamelCasetoUnderscore(str)\n str.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n ... | [
"0.7895247",
"0.7875073",
"0.77673614",
"0.76673883",
"0.762736",
"0.76166576",
"0.7605167",
"0.7592399",
"0.7584403",
"0.75823",
"0.7552222",
"0.74954057",
"0.74674463",
"0.7466049",
"0.7443282",
"0.74295837",
"0.73751915",
"0.73455954",
"0.73278725",
"0.73193586",
"0.731596... | 0.0 | -1 |
Replaces '' with '_' and camelCase(s) them used for valid property names [Java] replaces keywords with substitutes form KeywordsSubstitute | def validate_property_name(name)
valid_name = name.gsub(/-/, "_").camelcase(:lower)
if KeyWords.include? valid_name
valid_name = KeywordsSubstitute[valid_name]
end
valid_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def underscore_vars\r\n self.gsub(/\\b[a-z][a-z]*(?:[A-Z][a-z]*)(?:[A-Z][a-z]*)*\\b/) {|word|\r\n word.underscore\r\n }\r\n end",
"def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"def sanitize_property_name( name )\n name.to_s.camelize \n ... | [
"0.7007142",
"0.6788593",
"0.6744361",
"0.66978776",
"0.66114855",
"0.65325403",
"0.6499864",
"0.64596736",
"0.6409755",
"0.6404403",
"0.63607115",
"0.63534844",
"0.63478655",
"0.62909496",
"0.6288228",
"0.626717",
"0.6257136",
"0.6242542",
"0.6191764",
"0.6171136",
"0.616667... | 0.6639289 | 4 |
Replaces '' and spaces with '_' used for valid enum names [Java] | def validate_enum_name(name)
name.gsub(/[-\s]/, "_").sub(/^\d/, '_\0')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end",
"def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\... | [
"0.6768467",
"0.6767107",
"0.65491927",
"0.650152",
"0.6470126",
"0.6445241",
"0.6399424",
"0.63783354",
"0.6366409",
"0.6347694",
"0.63220537",
"0.6312539",
"0.6308943",
"0.6301226",
"0.6301226",
"0.62934923",
"0.62657464",
"0.6257972",
"0.6231917",
"0.62298506",
"0.6223944"... | 0.7213645 | 0 |
Prepends do to method names that are keywords | def validate_method_name(name)
KeyWords.include?(name) ? "do#{name.gsub(/-/, "_").camelcase}" : validate_property_name(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_process\n @method_suffix = \"\"\n @arity = @words.length\n @bareword_slots = []\n @words.each_with_index do |word|\n case word\n when '*'\n @arity = MULTIPLE_ARGS \n @method_suffix += \"_star\"\n @bareword_slo... | [
"0.60598",
"0.5611301",
"0.55684865",
"0.55387545",
"0.545546",
"0.5450107",
"0.54236144",
"0.5403514",
"0.53336143",
"0.5316974",
"0.5300673",
"0.52822316",
"0.52297926",
"0.5223308",
"0.5196321",
"0.51647276",
"0.51565474",
"0.51531816",
"0.51059926",
"0.51059926",
"0.50978... | 0.56173223 | 1 |
Generate method formal parameters for REST API calls | def form_rest_api_args(classname, property, name)
arguments = {}
property.path.scan(/{([^}]*)}/).each do |name, etc|
if is_static_method(property) or validate_class_name(name) !~ /^#{classname}/i
arguments[validate_property_name(name)] = "String"
end
end
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_parameters; end",
"def get_parameters; end",
"def get_parameters; end",
"def generate_parameters(method)\n # If it's not a method, try to make it one\n unless method.respond_to? :parameters \n method = @class.instance_method method\n end\n\n req = method.parameters... | [
"0.6912238",
"0.67996824",
"0.67996824",
"0.655902",
"0.65455955",
"0.64485717",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
"0.64226377",
... | 0.64419997 | 6 |
Generate method formal parameters for CXF interface The argument type is appended with annotations | def form_cxf_args(classname, property, name)
arguments = {}
arguments["context"] = "@Context final MessageContext"
property.parameters.each do |name, parameter|
arguments[validate_property_name(name)] = "@#{parameter.location.capitalize}Param(\"#{name}\") String"
end if propert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_param_calls_from( atts )\n atts.map do |att|\n case att\n when String, Symbol then \"param :#{att}, '#{att}', nullable: true\"\n when Hash\n att.map do |key,references|\n ( single = (references.last == Parametrization::Config::SINGLETON_FLAG) ) &&... | [
"0.5805585",
"0.57892394",
"0.5744641",
"0.56960434",
"0.55708086",
"0.55708086",
"0.55708086",
"0.55708086",
"0.55708086",
"0.5558043",
"0.54788435",
"0.5385579",
"0.53527945",
"0.53527945",
"0.53250796",
"0.5253373",
"0.51792353",
"0.51792353",
"0.5127256",
"0.5121908",
"0.... | 0.5098172 | 21 |
Generates a map of parameters for placeholders used to process path URI | def generate_format_hash(classname, property, resourcePath)
map = {}
resourcePath.scan(/\{([^}]*)\}/) { |name, etc|
if (name.match(/^#{classname}.*/i) and !is_static_method(property))
map[name] = 'this.getId()'
else
map[name] = validate_property_name(name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_placeholders\n {\n :path => @dir,\n :basename => basename,\n :output_ext => output_ext,\n }\n end",
"def routing_params_with_patterns\n @routing_params_with_patterns ||= begin\n Gapic::UriTemplate.parse_arguments(path).map do |name, patter... | [
"0.6957828",
"0.6762115",
"0.6760498",
"0.6471538",
"0.63870704",
"0.622684",
"0.6207749",
"0.6183892",
"0.61691",
"0.6085849",
"0.6034924",
"0.6024542",
"0.5999145",
"0.59853584",
"0.5970152",
"0.58938736",
"0.58884126",
"0.5853609",
"0.5852705",
"0.58460045",
"0.58182544",
... | 0.0 | -1 |
Returns the expression to set for payLoad in the API call | def get_payload(classname, property)
payLoad = '""';
if !is_static_method(property)
if property.request == classname
payLoad = "this.toJSON()"
elsif property.request
payLoad = validate_property_name(property.request) + ".toJSON()"
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exp_rate; CPanel::EXPRATE; end",
"def expression_value\n return @expression_value if defined?(@expression_value)\n\n subexpr_value =\n (1 + periodic_interest_rate) ** total_number_of_payments\n @expression_value =\n (periodic_interest_rate * subexpr_value) / (subexpr_value - 1)\n... | [
"0.5753901",
"0.5530806",
"0.5489813",
"0.54354864",
"0.5420907",
"0.5289219",
"0.52535975",
"0.5248849",
"0.52341783",
"0.51580524",
"0.5153788",
"0.5149339",
"0.51492155",
"0.5042085",
"0.5014797",
"0.50146794",
"0.49996835",
"0.49622786",
"0.49433523",
"0.4937633",
"0.4927... | 0.0 | -1 |
Returns true if data_type is in services operations request or header, else returns false | def is_operation_input(data_type, schema)
schema.services.each do |service_name, servicedef|
servicedef.operations.each do |operation_name, oper_definition|
if (data_type.name == oper_definition.request || data_type.name == oper_definition.header)
return true
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type_header?\n request.headers['Content-Type']&.include?('application/fhir+json')\n end",
"def request?\n @type == :request\n end",
"def request?\n self.operation == OP_REQUEST\n end",
"def type?\n @data[:type].empty? ? false : true\n end",
"def api... | [
"0.64769244",
"0.6408442",
"0.6385362",
"0.6370429",
"0.6244427",
"0.6233994",
"0.6198959",
"0.61863494",
"0.61320657",
"0.61199063",
"0.611415",
"0.60985696",
"0.6068215",
"0.6047905",
"0.60325",
"0.600551",
"0.5972027",
"0.5956508",
"0.5917946",
"0.5917412",
"0.59133446",
... | 0.8005957 | 0 |
Returns the name used during serialization for types that extend Serializer interface | def get_rootname_serialization(data_type, schema)
schema.services.each do |service_name, servicedef|
servicedef.operations.each do |operation_name, oper_definition|
if (data_type.name == oper_definition.request)
return (oper_definition.request_property.package + ":" + oper_de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialized_name\n @serialized_name ||= to_s.demodulize.underscore\n end",
"def type_name\n @type_name ||= name.underscore\n end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"... | [
"0.6809344",
"0.6553941",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6551529",
"0.6543538",
"0.6527784",
"0.6458091",
"0.6445174",
"... | 0.0 | -1 |
Returns a hash of arguments for wsdl operations including the request type and name hash is in the format of [name] = [type] | def get_wsdl_operation_arguments(operation_definition)
argument_hash = {}
argument_hash[validate_property_name(operation_definition.request_property.name)] = operation_definition.request
argument_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_wsdl_operation_arguments(operation_definition)\n argument_array = []\n argument_array.push('$' + operation_definition.request.camelcase(:lower))\n #argument_array.push('$' + operation_definition.header.camelcase(:lower))\n argument_array\n end",
"def form_cxf_args(cla... | [
"0.68441445",
"0.66209537",
"0.646918",
"0.62713385",
"0.6255575",
"0.6112479",
"0.6108762",
"0.6095091",
"0.60510576",
"0.6012878",
"0.59430355",
"0.5931008",
"0.58570445",
"0.58519644",
"0.5842228",
"0.58234423",
"0.58054286",
"0.5786141",
"0.57556546",
"0.573176",
"0.57231... | 0.7564174 | 0 |
Stub SECRETS.eventbrite_data with invalid data. | def stub_invalid_eventbrite_secrets
SECRETS.stub!(:eventbrite_data => {
'app_key' => 'test',
'user_key' => 'test',
'event_id' => 'test',
'tickets' => 'test',
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataVazia(data)\n\t\tif data.blank?\n\t\t\tthrow Exception.message = \"sem_eventos\"\n\t\tend\n\tend",
"def get_data\n raise \"overwrite it\"\n end",
"def ignore_bad_data(val = nil)\n \t(config :ignore_bad_data => val) unless val.nil?\n \tstate[:ignore_bad_data]\n end",
"def service_response... | [
"0.5758806",
"0.55938935",
"0.5562407",
"0.5461943",
"0.5413449",
"0.5413449",
"0.5328766",
"0.5250468",
"0.52403486",
"0.523155",
"0.5210083",
"0.5206279",
"0.51776093",
"0.5151014",
"0.51032585",
"0.507504",
"0.5037413",
"0.5005123",
"0.49792993",
"0.4972095",
"0.49541122",... | 0.6577635 | 0 |
GET /mail_items/1 GET /mail_items/1.xml | def show
@mail_item = MailItem.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @mail_item }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @receiving_items = ReceivingItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receiving_items }\n end\n end",
"def new\n @mail_item = MailItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml ... | [
"0.6676601",
"0.6625023",
"0.66160065",
"0.6453716",
"0.64466816",
"0.6439234",
"0.6328178",
"0.62497795",
"0.62327325",
"0.6232146",
"0.6174563",
"0.6098675",
"0.60737187",
"0.60704255",
"0.6053223",
"0.5998775",
"0.5998749",
"0.5986285",
"0.59126073",
"0.5905719",
"0.590435... | 0.7197728 | 0 |
GET /mail_items/new GET /mail_items/new.xml | def new
@mail_item = MailItem.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @mail_item }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @mailfetch = Mailfetch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mailfetch }\n end\n end",
"def new\n @mail_item = MailItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mai... | [
"0.73554647",
"0.7346316",
"0.73179907",
"0.7312288",
"0.71680975",
"0.71680975",
"0.71680975",
"0.71680975",
"0.71680975",
"0.71680975",
"0.71680975",
"0.71680975",
"0.7161752",
"0.7088468",
"0.7053908",
"0.70521295",
"0.70307744",
"0.7013196",
"0.69795835",
"0.69686997",
"0... | 0.8042679 | 0 |
POST /mail_items POST /mail_items.xml | def create
@mail_item = MailItem.new(params[:mail_item])
respond_to do |format|
if @mail_item.save
flash[:notice] = 'MailItem was successfully created.'
format.html { redirect_to(@mail_item) }
format.xml { render :xml => @mail_item, :status => :created, :location => @mail_item }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @mail_item = MailItem.new(mail_item_params)\n\n respond_to do |format|\n if @mail_item.save\n format.html { redirect_to @mail_item, notice: 'Mail item was successfully created.' }\n format.json { render :show, status: :created, location: @mail_item }\n else\n forma... | [
"0.65152466",
"0.6048163",
"0.6001549",
"0.59741366",
"0.58863753",
"0.5845351",
"0.58437544",
"0.5732078",
"0.572919",
"0.5717697",
"0.56982076",
"0.5647305",
"0.5591048",
"0.5561697",
"0.5524937",
"0.54956496",
"0.5485123",
"0.5485123",
"0.5469335",
"0.5469335",
"0.545975",... | 0.67221737 | 0 |
PUT /mail_items/1 PUT /mail_items/1.xml | def update
@mail_item = MailItem.find(params[:id])
respond_to do |format|
if @mail_item.update_attributes(params[:mail_item])
flash[:notice] = 'MailItem was successfully updated.'
format.html { redirect_to(@mail_item) }
format.xml { head :ok }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @mail_item.update(mail_item_params)\n format.html { redirect_to @mail_item, notice: 'Mail item was successfully updated.' }\n format.json { render :show, status: :ok, location: @mail_item }\n else\n format.html { render :edit }\n for... | [
"0.64803195",
"0.6350475",
"0.63025635",
"0.61387324",
"0.6089067",
"0.6082797",
"0.60469794",
"0.60227984",
"0.6000047",
"0.6000047",
"0.6000047",
"0.5993456",
"0.5988733",
"0.59554666",
"0.59538454",
"0.59538454",
"0.59312123",
"0.5929643",
"0.58991313",
"0.58540726",
"0.58... | 0.6983654 | 0 |
DELETE /mail_items/1 DELETE /mail_items/1.xml | def destroy
@mail_item = MailItem.find(params[:id])
@mail_item.destroy
respond_to do |format|
format.html { redirect_to(mail_items_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mail_item = MailItem.find(params[:id])\n @mail_item.destroy\n\n respond_to do |format|\n format.html { redirect_to mail_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mail_item.destroy\n respond_to do |format|\n format.html { redirect... | [
"0.6866829",
"0.6841202",
"0.66254157",
"0.6579374",
"0.6579374",
"0.6578038",
"0.65208614",
"0.64687014",
"0.64299744",
"0.64240414",
"0.63476545",
"0.6271296",
"0.6237571",
"0.6223289",
"0.62190264",
"0.6203705",
"0.619663",
"0.61909807",
"0.6189878",
"0.6171919",
"0.615480... | 0.7393751 | 0 |
This utility method converts the time and date fields from the event form into the start and end times. | def parse_params
# Find the offset so we store times in UTC
offset = Time.zone.now.time_zone.utc_offset
# Make sure and check if our timezone currently has daylight savings time
if Time.zone.now.dst?
offset = offset + 60*60
end
begin
if @event.all_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_start_end_dates\n if new_record?\n self.start_time ||= '12:00 PM'\n self.end_time ||= '01:00 PM'\n parse_start_end\n elsif has_attribute?(:start_at) # this if is to allow custom selects on the Event module\n self.start_date = start_at.to_s(:slashes) unless start_at.blank?\n ... | [
"0.64119774",
"0.6385843",
"0.6240768",
"0.6006883",
"0.58978945",
"0.58527493",
"0.5847322",
"0.58188593",
"0.5813425",
"0.5805046",
"0.5740929",
"0.5714649",
"0.5698454",
"0.5693918",
"0.56349343",
"0.5628769",
"0.5606291",
"0.55766916",
"0.553665",
"0.5526127",
"0.55251807... | 0.6713651 | 0 |
Create a new event | def create
calendar = Calendar.where(default: true, user_id: current_user.id)[0]
@event = calendar.events.build(params[:event])
parse_params
if @event.save
redirect_to request.referer
else
flash[:error] = "Event creation failed!"
redirect_to r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create_event(&blk)\n setup_event(Event.new, &blk)\n end",
"def create_event(&blk)\n setup_event(Event.new, &blk)\n end",
"def create_events\n end",
"def new\n @new_event = Event.... | [
"0.8064176",
"0.7957774",
"0.7957774",
"0.78302616",
"0.7750949",
"0.7728808",
"0.77077186",
"0.7690393",
"0.76463884",
"0.76463884",
"0.76463884",
"0.76463884",
"0.76463884",
"0.76463884",
"0.76463884",
"0.7638487",
"0.7638487",
"0.7577983",
"0.75584066",
"0.7489254",
"0.745... | 0.0 | -1 |
Start editing an event. Send the javascript response which will fill in the event edit form with the current event fields. | def edit
@event = Event.find_by_id(params[:id])
respond_to do |format|
format.html
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n # Mostra la form per modificare un evento\n render \"edit\"\n end",
"def edit\n @current_event = Event.find(params[:id])\n # render html: 'edit!'\n end",
"def create\n @event = Event.new(params[:event])\n @event.start_date = Date.strptime(params[:event][:start_date], '%... | [
"0.70025086",
"0.68608135",
"0.6537552",
"0.64190036",
"0.64076173",
"0.6394963",
"0.6350987",
"0.63410574",
"0.6333548",
"0.63245213",
"0.6316069",
"0.62860435",
"0.6277893",
"0.62620467",
"0.62620467",
"0.6222915",
"0.61956453",
"0.61795187",
"0.6165316",
"0.6165316",
"0.61... | 0.71362424 | 0 |
Update an event which was edit. | def update
@event = Event.find_by_id(params[:id])
@event.title = params[:event][:title]
@event.location = params[:event][:location]
@event.calendar_id = params[:event][:calendar_id]
@event.all_day = params[:event][:all_day]
@event.notes = params[:event][:notes]
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n setup_variables\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(admin_event_path(@event)) }\n format.xml { head :ok }\n ... | [
"0.7426014",
"0.7317736",
"0.72694576",
"0.72561157",
"0.72157586",
"0.720414",
"0.716142",
"0.71545064",
"0.71523714",
"0.71339464",
"0.7129836",
"0.7128857",
"0.71147466",
"0.71127605",
"0.71085244",
"0.7107094",
"0.7103291",
"0.7099561",
"0.70929295",
"0.7090578",
"0.70851... | 0.0 | -1 |
Valaidte the user, making sure they have read/write access to the calendar which owns the event being accessed | def correct_user
@event = Event.find_by_id(params[:id])
if @event.nil?
redirect_to root_url
else
@calendar = current_user.calendars.find_by_id(@event.calendar_id)
if @calendar.nil?
@calendar =
current_user.subscriptions.fin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized_user\n @event = Event.friendly.find(params[:id])\n if @event.creator_id != current_user.id\n if current_user.email == 'pubudu@eventhub.lk' || current_user.email == 'pavithra@eventhub.lk'\n return true\n end\n redirect_to root_path, alert: \"Oops! You don't hav... | [
"0.7008859",
"0.6778674",
"0.6690286",
"0.66204387",
"0.66194516",
"0.6565841",
"0.6525165",
"0.64944303",
"0.6457878",
"0.6452721",
"0.6452721",
"0.6452721",
"0.6424638",
"0.6411831",
"0.63620526",
"0.635246",
"0.6344587",
"0.6340088",
"0.6306117",
"0.6283495",
"0.627733",
... | 0.66797763 | 3 |
rubocop:enable Metrics/CyclomaticComplexity rubocop:enable Metrics/MethodLength | def error(message)
STDERR.puts <<-EOS
\u001b[1;91mERROR\u001b[0m \u001b[1m#{message}\u001b[0m
#{self.banner}
EOS
exit 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refutal()\n end",
"def strategy; end",
"def used?; end",
"def suivre; end",
"def custom; en... | [
"0.7687838",
"0.6431265",
"0.6386552",
"0.6386552",
"0.6248278",
"0.6222326",
"0.6222326",
"0.6222326",
"0.6222326",
"0.61982304",
"0.6055562",
"0.60191256",
"0.5962572",
"0.59179723",
"0.59179723",
"0.59057176",
"0.588056",
"0.588056",
"0.58571464",
"0.58466923",
"0.5835058"... | 0.0 | -1 |
get the number of divisors | def divisors(num)
count = []
factors = Prime.prime_division(num)
#prime_division returns nested array of [[prime, #of times],[prime, #oftimes]]
#just want the second value of each subarray
factors.flatten.each_with_index do |value, i|
if i%2 != 0
count << value
end
end
#a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_divisors\n return 1 if self == 1\n self.prime_division.map{|num, power| power + 1 }.inject(&:*)\n end",
"def number_of_divisors\n (1..Math.sqrt(self)).inject(0) {|sum, i| modulo(i) == 0 ? sum + 2 : sum}\n end",
"def num_divisors\n\t\tndf = self.num_distinct_factors\n\t\tif ndf <= 0\n\t... | [
"0.8736949",
"0.8723386",
"0.8273416",
"0.82146275",
"0.8139639",
"0.81073",
"0.8056692",
"0.80136216",
"0.79680866",
"0.78950787",
"0.78500974",
"0.7717741",
"0.7534358",
"0.74688536",
"0.73781633",
"0.7348038",
"0.7274715",
"0.71055454",
"0.7085038",
"0.707885",
"0.70560366... | 0.77799684 | 11 |
this function will write the fully compiled jack file using Parser2 | def writeCompiledFile(tokens, classNames, outFile)
resultList = compileClass2(tokens, classNames)
str = resultList[0]
classTable = resultList[1]
methodsTableList = resultList[2]
vmFile = File.new(outFile, "w")
vmFile.syswrite(str)
#will print the symbol tables commented out in the vm file
str = "\n\n/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile(filename)\n # First pass - define labels\n elements.each do |codeline|\n codeline.register_labels\n @@position += codeline.size\n end\n\n # Second pass - write to binary file\n File.open(filename, 'wb') do |f|\n elements.each do |codeline|\n f.writ... | [
"0.61188954",
"0.58853483",
"0.57786334",
"0.57627916",
"0.57618636",
"0.5688254",
"0.56047225",
"0.55864894",
"0.5573748",
"0.55142486",
"0.55003786",
"0.54754364",
"0.54732406",
"0.54623073",
"0.5453817",
"0.543492",
"0.54052806",
"0.53884816",
"0.53884816",
"0.5384955",
"0... | 0.546443 | 13 |
this function will write the xml file of the parse tree from parser | def writeCompiledXMLFile(tokens, classNames, outFile)
str = compileClass(tokens, classNames)
str = tabXMLTags(str)
xmlFile = File.new(outFile, "w")
xmlFile.syswrite(str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_tree outfile\n writer = Bio::PhyloXML::Writer.new(outfile)\n writer.write(@tree)\n end",
"def save args={}\n raise ArgumentError, \"No file name provided\" if args[:filename].nil?\n @savable_sgf = \"(\"\n @root.children.each { |child| write_node child }\n @savable_sgf << \")\... | [
"0.7074382",
"0.65786415",
"0.6523396",
"0.6488109",
"0.6488109",
"0.647959",
"0.6426315",
"0.63974583",
"0.6325777",
"0.6297798",
"0.6295409",
"0.6258507",
"0.6247382",
"0.6241933",
"0.6235346",
"0.6233969",
"0.6232846",
"0.62060446",
"0.62051564",
"0.6174825",
"0.6167448",
... | 0.5989065 | 29 |
this function will write the tokens in an xml file | def writeTokensXMLFile(tokens, outFile)
str = "<tokens>\n"
for i in 0..tokens.size-1
str += getXMLString(tokens, i)
end
str += "</tokens>\n"
str = tabXMLTags(str)
xmlFile = File.new(outFile, "w")
xmlFile.syswrite(str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeCompiledXMLFile(tokens, classNames, outFile)\n str = compileClass(tokens, classNames)\n str = tabXMLTags(str)\n xmlFile = File.new(outFile, \"w\")\n\n\n xmlFile.syswrite(str)\nend",
"def write_file(directory)\n xml = \"\"\n xml << taxon_xml\n xml << enzyme_xml\n xml << n_terminal_xml if ... | [
"0.66637045",
"0.6351761",
"0.62393636",
"0.60058993",
"0.5983602",
"0.5950042",
"0.59047216",
"0.5900432",
"0.58976835",
"0.58870476",
"0.5850764",
"0.5823289",
"0.5823001",
"0.5802133",
"0.57599485",
"0.57438546",
"0.57383597",
"0.5735763",
"0.56512856",
"0.56448925",
"0.55... | 0.7897827 | 0 |
the main function of the compiler IO to get all the files in a directory and compile it | def compile(path)
files = getFilesInDirCompiler(path)
filesWithLines = getFilesWithLinesCompiler(files)
classNames = getClassNames(filesWithLines)
functionInfo = getFunctionNameTypesFiles(filesWithLines)
compilerInfo = [classNames, functionInfo]
for i in 0..filesWithLines.size-1
fSize = filesWithLines[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile(dir)\r\n\tsavedir = Dir.pwd\r\n\tDir.chdir(dir)\r\n\r\n\t# 中間ファイル削除\r\n\tclean\r\n\r\n\t# 個別ファイルコンパイル\r\n\tDir::glob(\"*.pdf\").each do |file|\r\n\t\tnext if \"nzmath_doc\" == file[0...-4]\r\n\t\ttex_compile(file[0...-4])\r\n\tend\r\n\r\n\theader_footer = [\"header_overview.tex\", \"header_basic_util.t... | [
"0.72728425",
"0.725979",
"0.7234156",
"0.7228649",
"0.7031059",
"0.6997806",
"0.69588405",
"0.6891482",
"0.6691613",
"0.6664023",
"0.66133463",
"0.661255",
"0.65995014",
"0.65772337",
"0.6447394",
"0.64241576",
"0.64200276",
"0.6408477",
"0.6382401",
"0.6253869",
"0.6232808"... | 0.6969339 | 6 |
this function will get all of the files in a specified path and return them in an array | def getFilesInDirCompiler(path)
files = []
#search for all of the files in the directory
Dir.foreach(path) do |filename|
#dont include parent files
next if filename == '.' || filename == '..'
#dont include files that are not jack files
next unless filename.to_s.include?("jack")
#push the fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_data_files(path)\n each_data_file(path).to_a\n end",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def read_files(file_path)\n\tlist=Dir.entries(file_path)\n\treturn list\nend",
"def list_files(path)\n base_directory_content = Dir.glob(File.join(path, \"*\"))\n ... | [
"0.80742425",
"0.804442",
"0.79320437",
"0.77028334",
"0.76885754",
"0.7668555",
"0.7558186",
"0.7510267",
"0.74465895",
"0.74352574",
"0.741408",
"0.7402879",
"0.73939997",
"0.73700726",
"0.7369996",
"0.73567176",
"0.7346412",
"0.7315387",
"0.72958463",
"0.7259472",
"0.72306... | 0.6989953 | 54 |
min example of the same | def min(num1, num2, num3)
if num1 <= num2 and num1 <= num3
return num1
elsif num2 <= num1 and num2 <= num3
return num2
else
return num3
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min() end",
"def min; end",
"def min; end",
"def min\n end",
"def min\n end",
"def get_min()\n end",
"def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end",
"def eqp_r_min(item)\n end",
"def better_my_min\n min = s... | [
"0.75052863",
"0.70214283",
"0.70214283",
"0.67429155",
"0.67429155",
"0.66159487",
"0.6441401",
"0.63636917",
"0.6355567",
"0.6269305",
"0.6185832",
"0.61819804",
"0.61731863",
"0.61620194",
"0.61601186",
"0.6114009",
"0.6100356",
"0.6070924",
"0.60410696",
"0.6040958",
"0.6... | 0.0 | -1 |
GET /primaries GET /primaries.json | def index
@primaries = Primary.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @primaries = Primary.page(params[:page]).per(3)\n q_param = params[:q]\n @q = Primary.ransack q_param\n @primaries = @q.result.page\n end",
"def index\n @precincts = Precinct.all(:order => \"number\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json ... | [
"0.63221747",
"0.61911535",
"0.61569107",
"0.6119818",
"0.611411",
"0.5908044",
"0.58103335",
"0.5807886",
"0.579545",
"0.5790494",
"0.5785403",
"0.5781482",
"0.57752144",
"0.57557774",
"0.57531226",
"0.57265437",
"0.57263786",
"0.57002276",
"0.5686566",
"0.5681739",
"0.56750... | 0.70138705 | 0 |
GET /primaries/1 GET /primaries/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @primaries = Primary.all\n end",
"def index\n @precincts = Precinct.all(:order => \"number\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @precincts }\n end\n end",
"def index\n @primaries = Primary.page(params[:page]).per(3)\n ... | [
"0.6866451",
"0.62459236",
"0.61555284",
"0.6022644",
"0.5979835",
"0.59333825",
"0.5852906",
"0.5806693",
"0.5794344",
"0.574485",
"0.5739166",
"0.5726596",
"0.5697998",
"0.5691503",
"0.5671037",
"0.56542593",
"0.5649898",
"0.56437296",
"0.56348056",
"0.5630003",
"0.5609652"... | 0.0 | -1 |
POST /primaries POST /primaries.json | def create
@primary = Primary.new(primary_params)
respond_to do |format|
if @primary.save
format.html { redirect_to @primary, notice: 'Primary was successfully created.' }
format.json { render :show, status: :created, location: @primary }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end",
"def ind... | [
"0.60168254",
"0.5952056",
"0.5469195",
"0.5336936",
"0.5318398",
"0.5298511",
"0.5295793",
"0.52534133",
"0.52501184",
"0.5210148",
"0.52086353",
"0.52045906",
"0.51989156",
"0.51874596",
"0.5183737",
"0.517251",
"0.5167027",
"0.516124",
"0.516108",
"0.51609534",
"0.51541126... | 0.0 | -1 |
PATCH/PUT /primaries/1 PATCH/PUT /primaries/1.json | def update
respond_to do |format|
if @primary.update(primary_params)
format.html { redirect_to @primary, notice: 'Primary was successfully updated.' }
format.json { render :show, status: :ok, location: @primary }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @summary = Summary.find(params[:id])\n\n respond_to do... | [
"0.6051075",
"0.60488623",
"0.6035688",
"0.5871087",
"0.57901484",
"0.57798576",
"0.57795435",
"0.5771498",
"0.5771498",
"0.5771498",
"0.5759969",
"0.57371104",
"0.57323533",
"0.572026",
"0.5696261",
"0.56771207",
"0.5638519",
"0.5628653",
"0.5624222",
"0.56200784",
"0.561772... | 0.0 | -1 |
DELETE /primaries/1 DELETE /primaries/1.json | def destroy
@primary.destroy
respond_to do |format|
format.html { redirect_to primaries_url, notice: 'Primary was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @summary.destroy\n respond_to do |format|\n format.html { redirect_to summaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @summary = Summary.find(params[:id])\n @summary.destroy\n\n respond_to do |format|\n format.html { redirect_to summ... | [
"0.67609274",
"0.67111295",
"0.65053076",
"0.64469355",
"0.64469355",
"0.6334706",
"0.633244",
"0.6325709",
"0.6323519",
"0.62940526",
"0.6277707",
"0.6253875",
"0.624523",
"0.6150548",
"0.61351943",
"0.6133146",
"0.61078006",
"0.61002207",
"0.6095205",
"0.6092052",
"0.609181... | 0.6745701 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_primary
@primary = Primary.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 primary_params
params.require(:primary).permit(:workorganization, :cmt1, :followupsystem, :cmt2, :measuringprogram, :cmt3, :quailtyculture, :cmt4, :messegesystem, :cmt5, :studentshonoring, :cmt6, :teachershonoring, :cmt7, :schoolboard, :cmt8, :selfevaluation, :cmt9, :schoolapplying, :cmt10, :oneteamspirit, :c... | {
"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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.