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 |
|---|---|---|---|---|---|---|
as having a peak point and descends from both sides from there. It should have a minimum length of 3 and the function should return 0 if there is no mountain present. Followup: Solve in one pass (completed). Followup: Solve in O(1) space (tbd). | def longest_mountain(arr)
# Return if the input array's length is less than the minimum mountain length
return 0 if arr.length < 3
mountain_cache = Array.new(arr.length, 0)
idx = 0
# Break if the remaining array is less than 3 in length.
until arr[idx + 2].nil?
#
mountain_cache[idx] = identify_mountain(arr, idx)
mountain_cache[idx] == 0 ? idx += 1 : idx = idx + mountain_cache[idx] - 1
end
# Lastly, we return the maximum mountain length
mountain_cache.max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longest_mountain(arr)\n return 0 if arr.length < 3\n max = 0\n idx = 0\n\n until arr[idx + 2].nil?\n max_from_idx = identify_mountain(arr, idx)\n if max_from_idx > max\n max = max_from_idx\n idx = idx + max_from_idx - 1\n else\n idx += 1\n end\n end\n max\nend",
"def solution... | [
"0.6604183",
"0.65417653",
"0.63645715",
"0.6357561",
"0.6166832",
"0.6139463",
"0.6018375",
"0.5982945",
"0.59738326",
"0.5967852",
"0.59504884",
"0.5868428",
"0.5861927",
"0.5837281",
"0.5792335",
"0.572293",
"0.5704559",
"0.5695027",
"0.56689143",
"0.56676984",
"0.5657078"... | 0.63414305 | 4 |
Without the cache, keeping track of current maximum. Don't really need dynamic programming for this solution, as we only ever need to keep track of a current maximum mountain range length and the max from the current idx, updating the max as necessary. Can use the exact same helper method. | def longest_mountain(arr)
return 0 if arr.length < 3
max = 0
idx = 0
until arr[idx + 2].nil?
max_from_idx = identify_mountain(arr, idx)
if max_from_idx > max
max = max_from_idx
idx = idx + max_from_idx - 1
else
idx += 1
end
end
max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max\n max = @storage[0]\n @size.times do |i|\n if @storage[i] > max\n max = @storage[i]\n end\n\n end\n return max\n end",
"def max\n [self.begin, self.end].max\n end",
"def find_max\n loc = find_max_locator and loc.value\n end",
"def max\n @max ||= begin\... | [
"0.66884893",
"0.6595908",
"0.65781796",
"0.6570968",
"0.65510285",
"0.6533966",
"0.6489789",
"0.6483517",
"0.64481944",
"0.64272845",
"0.6427069",
"0.6385805",
"0.6380694",
"0.6368538",
"0.63498133",
"0.62863415",
"0.627513",
"0.6264481",
"0.6264189",
"0.62532216",
"0.623960... | 0.6686947 | 1 |
GET /livros GET /livros.xml | def assunto
if (params[:search].nil? || params[:search].empty?)
render 'consultaA'
else
@assuntos = Assunto.find(:all, :conditions => ["assunto like ?", "%" + params[:search].to_s + "%"])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @livros }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @livro }\n end\n end",
"def index\n @lancamentos = Lancamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { rende... | [
"0.7265506",
"0.671781",
"0.6517422",
"0.6473924",
"0.6399853",
"0.63453794",
"0.62925833",
"0.62295985",
"0.62295985",
"0.6222106",
"0.603855",
"0.60281813",
"0.60072595",
"0.5999497",
"0.59902054",
"0.5982896",
"0.59805274",
"0.59801745",
"0.5975266",
"0.5971201",
"0.596895... | 0.0 | -1 |
GET /livros/1 GET /livros/1.xml | def show
@livro = Livro.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @livro }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @lancamentos = Lancamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lancamentos }\n end\n end",
"def index\n @lieus = Lieu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml ... | [
"0.65443945",
"0.647275",
"0.6457209",
"0.6416288",
"0.6314982",
"0.62769926",
"0.627444",
"0.62285376",
"0.61587787",
"0.61574066",
"0.61574066",
"0.6132867",
"0.6127354",
"0.61115414",
"0.6096647",
"0.6089113",
"0.60765374",
"0.6064262",
"0.6061438",
"0.60603696",
"0.605913... | 0.72345966 | 0 |
GET /livros/new GET /livros/new.xml | def new
@livro = Livro.new
1.times do
@livro.localizacaos.build
end
1.times do
@livro.assuntos.build
end
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @livro }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @lanc... | [
"0.7616922",
"0.74139345",
"0.7335126",
"0.73227555",
"0.7316215",
"0.7241846",
"0.72235596",
"0.72212315",
"0.71945214",
"0.71557415",
"0.7107746",
"0.7099635",
"0.7098008",
"0.7092173",
"0.70654047",
"0.7058442",
"0.70583326",
"0.70522535",
"0.70456845",
"0.70450395",
"0.70... | 0.0 | -1 |
POST /livros POST /livros.xml | def create
@livro = Livro.new(params[:livro])
respond_to do |format|
if @livro.save
flash[:notice] = 'Livro was successfully created.'
format.html { redirect_to(@livro) }
format.xml { render :xml => @livro, :status => :created, :location => @livro }
else
format.html { render :action => "new" }
format.xml { render :xml => @livro.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @livro = Livro.new(params[:livro])\n\n respond_to do |format|\n if @livro.save\n format.html { redirect_to @livro, :notice => 'Livro was successfully created.' }\n format.json { render :json => @livro, :status => :created, :location => @livro }\n else\n format.html... | [
"0.6648307",
"0.65039116",
"0.6365186",
"0.6206307",
"0.61245465",
"0.6083992",
"0.602142",
"0.600146",
"0.59161985",
"0.58827996",
"0.58263826",
"0.58119506",
"0.57995164",
"0.5768871",
"0.57643384",
"0.5730363",
"0.5714252",
"0.5697052",
"0.56857795",
"0.56661326",
"0.56577... | 0.7075445 | 0 |
PUT /livros/1 PUT /livros/1.xml | def update
@livro = Livro.find(params[:id])
respond_to do |format|
if @livro.update_attributes(params[:livro])
flash[:notice] = 'Livro was successfully updated.'
format.html { redirect_to(@livro) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @livro.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n if @livro.update_attributes(params[:livro])\n format.html { redirect_to @livro, :notice => 'Livro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => ... | [
"0.65185964",
"0.63878775",
"0.6223697",
"0.6177033",
"0.6175626",
"0.6041946",
"0.60080916",
"0.59267837",
"0.58828115",
"0.58793753",
"0.5839059",
"0.583709",
"0.58217573",
"0.58197963",
"0.58020663",
"0.5790065",
"0.578884",
"0.5742029",
"0.5737617",
"0.5723838",
"0.569445... | 0.6925895 | 0 |
DELETE /livros/1 DELETE /livros/1.xml | def destroy
@livro = Livro.find(params[:id])
@livro.destroy
respond_to do |format|
format.html { redirect_to(livros_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lien... | [
"0.7121067",
"0.6911868",
"0.6911868",
"0.6835006",
"0.67588854",
"0.67423064",
"0.674039",
"0.67071474",
"0.67027545",
"0.66890335",
"0.6667057",
"0.6639399",
"0.6632335",
"0.6629187",
"0.66288936",
"0.6625382",
"0.66157067",
"0.66115063",
"0.66040903",
"0.65804577",
"0.6569... | 0.72948813 | 0 |
get '/projects/:id' => "projectsshow" | def show
my_id = params[:id]
@proj = Project.find_by(id: my_id)
if @proj == nil
redirect_to("/404")
else
render 'show', layout: 'personal_layout'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html\n end\n end",
"def show\n\n @project = Project.find_by_slug(params[:id])\n\n ... | [
"0.7390522",
"0.7238051",
"0.71972454",
"0.71923274",
"0.71878433",
"0.7140213",
"0.7140213",
"0.7140213",
"0.7140213",
"0.7140213",
"0.7140213",
"0.7140213",
"0.7140213",
"0.7140213",
"0.70975584",
"0.7045667",
"0.7010371",
"0.69719535",
"0.697084",
"0.697084",
"0.697084",
... | 0.6891324 | 39 |
ensures that each new record has a UUID assigned to the 'uuid' field. | def set_uuid
self.uuid = SecureRandom.uuid unless uuid =~ REGEX
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_unique_uuid\n while (uuid.blank?)\n fresh = fresh_uuid\n if ActiveAggregate::EventBase.where(uuid: fresh).present?\n puts \"Event with uuid = #{fresh} found!\"\n else\n self.uuid = fresh\n end\n end\n end",
"def create_uuid\n if self.uuid.nil?... | [
"0.7390205",
"0.7092048",
"0.6868559",
"0.6823519",
"0.6816609",
"0.67440957",
"0.6712073",
"0.6337467",
"0.6337467",
"0.6326568",
"0.6299766",
"0.6291922",
"0.62554747",
"0.6254588",
"0.6200447",
"0.61876833",
"0.616439",
"0.6142855",
"0.6136188",
"0.6107552",
"0.607706",
... | 0.6564753 | 7 |
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength | def parsed_args
args = Options.new('binnacle - Simple Test and Infra automation Framework')
args.verbose = 0
args.runner = false
args.result_json = ''
opt_parser = OptionParser.new do |opts|
opts.banner = 'Usage: binnacle [options] <testfile>'
opts.on('-w', '--wide', 'Do not crop the task line') { args.wide = true }
opts.on('-v', '--verbose', 'Verbose output') { args.verbose += 1 }
opts.on('-r', '--runner', 'Run the tasks from a file (Internal use only)') { args.runner = true }
opts.on('--results-json=FILE', 'Results JSON file') do |json_file|
args.result_json = json_file
end
opts.on('-h', '--help', 'Prints this help') do
puts opts
exit
end
opts.on('--version', 'Show Version information') do
puts "Binnacle #{Binnacle::VERSION}"
exit
end
end
opt_parser.parse!(ARGV)
if ARGV.empty?
warn 'Task file is not specified'
exit EXIT_INVALID_ARGS
end
args.task_files = ARGV
args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def strategy; end",
"def used?; end",
"def offences_by; end",
"def custo... | [
"0.7688849",
"0.6349087",
"0.63157845",
"0.63157845",
"0.62754756",
"0.6209303",
"0.6209303",
"0.6209303",
"0.6209303",
"0.6173313",
"0.60307705",
"0.5963802",
"0.591194",
"0.588153",
"0.588153",
"0.58606446",
"0.5852829",
"0.5852829",
"0.5839763",
"0.5790378",
"0.5770753",
... | 0.0 | -1 |
initialize nodemap and properties hash from nokogiri document | def init_nodemap
# map of key1 => node, key2 => node, ...
@keynum = 1
text_nodes = @doc.search(text_nodes_xpath, tm: TM_NS)
text_nodes.each { |node| add_node(node) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_nodes(html_nodes, properties); end",
"def initialize(xmldoc)\n @xmldoc = xmldoc\n @output = {}\n end",
"def initialize\n @nodes_hash = Hash.new\n end",
"def parse (node, oeCount)\n\t\thash = {}\n\t\tpid = node['id'].split('_').last\n\t\thash[:pid] = pid\n\t\thash[:quantity] = node.css(... | [
"0.64674866",
"0.61472034",
"0.60545385",
"0.5998695",
"0.5996835",
"0.5987961",
"0.59099257",
"0.5909824",
"0.5907461",
"0.58935606",
"0.58825934",
"0.587948",
"0.5846973",
"0.58452034",
"0.5823228",
"0.5817314",
"0.5811653",
"0.58102036",
"0.5764883",
"0.57572865",
"0.57330... | 0.7522291 | 0 |
Problem: input: array of strings output: array of strings method that deletes the vowels from the strings capitalization doesnt matter Questions? Empty array? not an array? validation? Data structure / algorithm call map on array call reject on denominator check if char matches vowel | def remove_vowels(words)
words.map { |word| word.delete "aeiouAEIOU" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_vowels(array)\n array.map do |word|\n word.chars.reject { |letter| %w[a e i o u].include?(letter.downcase) }.join\n end\nend",
"def remove_vowels(array) #Works, but is very long, wordy and non-intuitive.\r\n vowels = [\"a\", \"A\", \"e\", \"E\", \"i\", \"I\", \"o\", \"O\", \"u\", \"U\"]\r\n new... | [
"0.7961029",
"0.7878241",
"0.7798679",
"0.7793034",
"0.77822953",
"0.7730406",
"0.77302086",
"0.77302086",
"0.77234566",
"0.7710844",
"0.7705647",
"0.770323",
"0.7685783",
"0.7679455",
"0.7667902",
"0.76625234",
"0.7662155",
"0.7661131",
"0.7658567",
"0.76519793",
"0.7640414"... | 0.7246829 | 41 |
A 1interesting polygon is just a square with a side of length 1. An ninteresting polygon is obtained by taking the n 1interesting polygon and appending 1interesting polygons to its rim, side by side. You can see the 1, 2, 3 and 4interesting polygons in the picture below. Example For n = 2, the output should be shapeArea(n) = 5; For n = 3, the output should be shapeArea(n) = 13. 1 1 1 2 5 4+1 3 13 9+22 4 25 16+33 | def shapeArea(n)
return (n*n) + ((n-1)*(n-1))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_general_area_span_for_numbered size\n area_span = []\n row_zero = [[0,0]]\n n = size + (size - 1)\n m = ::Matrix.build(n,n){|x,y| [x,y]} #.to_a.flatten(1).to_set\n (1...size).each do |i|\n row_zero << [0,i]\n row_zero << [0,-i]\n end\n\n row_zero.sort.each do |y,x|\n ... | [
"0.62373924",
"0.60878557",
"0.6075579",
"0.5972921",
"0.5897912",
"0.58602786",
"0.5744676",
"0.567832",
"0.563787",
"0.56345564",
"0.5614343",
"0.55894536",
"0.5582845",
"0.55041647",
"0.5462194",
"0.54200315",
"0.54180765",
"0.5416345",
"0.54094285",
"0.5396421",
"0.538976... | 0.7472626 | 0 |
This has the same behavior as parallel_map but returns the enumerator instead of the return values. | def parallel_each(pool: nil, &block)
return self unless block_given?
parallel_map(pool: pool, &block)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map &block\n result = size.times.map {nil}\n each_with_index {|value, i|\n result[i] = block.call(value)\n }\n result.par\n end",
"def my_map2(proc = nil)\n\n result = []\n\n if !proc.nil? && block_given?\n for i in self\n result << proc.... | [
"0.6865897",
"0.6858671",
"0.68086344",
"0.66886574",
"0.65635717",
"0.65260017",
"0.6478208",
"0.64239514",
"0.63891166",
"0.6364626",
"0.63098454",
"0.6212849",
"0.61981237",
"0.61942273",
"0.6192812",
"0.6188426",
"0.6137633",
"0.6090928",
"0.608123",
"0.6081127",
"0.60747... | 0.0 | -1 |
The flat_each method is tightly coupled to the usage of parallel_map within the ChefFS implementation. It is not itself a parallel method, but it is used to iterate through the 2nd level of nested structure, which is tied to the nested structures that ChefFS returns. This is different from Enumerableflat_map because that behaves like map.flatten(1) while this behaves more like flatten(1).each. We need this on an Enumerable, so we have no Enumerableflatten method to call. [ [ 1, 2 ], [ 3, 4 ] ].flat_each(&block) calls block four times with 1, 2, 3, 4 [ [ 1, 2 ], [ 3, 4 ] ].flat_map(&block) calls block twice with [1, 2] and [3,4] | def flat_each(&block)
map do |value|
if value.is_a?(Enumerable)
value.each(&block)
else
yield value
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flat_map(include_self = false, &block)\n case block && block.arity\n when nil then each_expression(include_self).to_a\n when 2 then each_expression(include_self).map(&block)\n else each_expression(include_self).map { |exp| block.call(exp) }\n end\n end",
"def my_flatten... | [
"0.66657376",
"0.61924076",
"0.6155753",
"0.61506164",
"0.61123836",
"0.6063535",
"0.60528505",
"0.5922181",
"0.5878943",
"0.57983524",
"0.57932717",
"0.5784652",
"0.5745836",
"0.5625136",
"0.5615854",
"0.55968523",
"0.55851763",
"0.5572185",
"0.5556582",
"0.5552416",
"0.5549... | 0.7678886 | 0 |
Memoizing accessor for the thread pool | def pool
@pool ||= Concurrent::ThreadPoolExecutor.new(
min_threads: threads || DEFAULT_THREAD_SIZE,
max_threads: threads || DEFAULT_THREAD_SIZE,
max_queue: 0,
# "synchronous" redefines the 0 in max_queue to mean 'no queue' instead of 'infinite queue'
# it does not mean synchronous execution (no threads) but synchronous offload to the threads.
synchronous: true,
# this prevents deadlocks on recursive parallel usage
fallback_policy: :caller_runs
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memoize\n cache = {} # An empty cache. The lambda captures this in its closure.\n lambda {|*args|\n # notice that the hash key is the entire array of arguments!\n unless cache.has_key?(args) # If no cached result for these args\n cache[args] = self[*args] # Compute and cache the resul... | [
"0.61401165",
"0.6065407",
"0.6058513",
"0.586623",
"0.58660454",
"0.5818108",
"0.58031386",
"0.57964104",
"0.5757518",
"0.5726386",
"0.5722587",
"0.56939876",
"0.56939876",
"0.5677332",
"0.5650477",
"0.56469023",
"0.5632474",
"0.5625634",
"0.5625634",
"0.5615153",
"0.560754"... | 0.52459013 | 61 |
Your Kerneleval, but only compiles and returns the compiled method object. return [MethodMirror] | def compile(source)
raise CapabilitiesExceeded
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compiled_method(locals_keys, scope_class = T.unsafe(nil)); end",
"def create_method_from_source(compiler)\n sol_method = @receiver.ct_type.object_class.resolve_method!(@name)\n return nil unless sol_method\n #puts \"#{sol_method.name} , adding to #{@receiver.ct_type.object_class.name}\"\n ... | [
"0.69221485",
"0.6424932",
"0.63057935",
"0.62660885",
"0.62660885",
"0.6213584",
"0.6183722",
"0.6178675",
"0.61651164",
"0.61429024",
"0.61332333",
"0.61304474",
"0.61125624",
"0.6010637",
"0.5930922",
"0.59253377",
"0.5865433",
"0.58544487",
"0.58544487",
"0.58440727",
"0.... | 0.0 | -1 |
For a specific compiler state, this holds the current module definition stack. This should be a list of modules in which the Thread, that belongs to this compiler state, is currently nested. The first element is the module that would be target for the next method definition. return [Array] | def module_scope
raise CapabilitiesExceeded
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stack\n return (@stack&.stack || [])\n end",
"def __stack\n @stack\n end",
"def __stack\n @stack ||= []\n end",
"def callstack\n @callstack.dup\n end",
"def stack\n @stack\n end",
"def return_stack\n return @state[:fiber][:return_stack]\n end"... | [
"0.62866914",
"0.6234546",
"0.61474466",
"0.6128842",
"0.59414804",
"0.5884378",
"0.5722139",
"0.57175124",
"0.57152843",
"0.57152843",
"0.5686671",
"0.55387175",
"0.5450151",
"0.5441518",
"0.5422639",
"0.5406382",
"0.5406382",
"0.5406382",
"0.5368365",
"0.5334344",
"0.532925... | 0.0 | -1 |
Parses changes, given by 'hashdiff' gem into IPC::Data::Package array | def parse_pkg_diff(diffs)
packages = []
diffs.each do |diff|
package = case diff[0]
when '-' then removed_package(diff)
when '+' then installed_package(diff)
when '~' then updated_package(diff)
end
packages.push(package)
end
packages
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_changes\n scanner = StringScanner.new(@status)\n requested_groups.each_with_object({}) do |(type, identifier), h|\n if scanner.scan_until(/#{identifier}/)\n scan_until_next_empty_line(scanner)\n file_block = scan_until_next_empty_line(scanner)\n h[type] = extract_changes(f... | [
"0.59928477",
"0.5869715",
"0.57312787",
"0.57289124",
"0.5724955",
"0.5716602",
"0.57045805",
"0.5656625",
"0.5569726",
"0.556544",
"0.55315405",
"0.5514433",
"0.5497455",
"0.54319996",
"0.542206",
"0.54023355",
"0.5386258",
"0.5308882",
"0.5305247",
"0.5299433",
"0.5287868"... | 0.7169202 | 0 |
FIXME: research about restrictions and make sure this work | def pkg_version_less(a, b)
a < b
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def suivre; end",
"def formation; end",
"def anchored; end",
"def intensifier; end",
"def implementation; end",
"def implementation; end",
"def identify... | [
"0.72753334",
"0.6218713",
"0.6218025",
"0.61208916",
"0.61208916",
"0.61208916",
"0.61208916",
"0.5941642",
"0.58516127",
"0.5835672",
"0.57631844",
"0.5763116",
"0.5763116",
"0.5673007",
"0.56630397",
"0.56630397",
"0.56375206",
"0.56375206",
"0.5587309",
"0.55740947",
"0.5... | 0.0 | -1 |
GET /trip_plans GET /trip_plans.json | def index
@trip_plans = TripPlan.where(user_id: current_user.try(:id)).order('created_at DESC')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def show\n @plans = Stripe::Plan.all\n end",
"def index\n @plans = Plan.all\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.7451303",
"0.73861176",
"0.7032488",
"0.70070285",
"0.6982541",
"0.6982541",
"0.6947987",
"0.68420523",
"0.6804414",
"0.6789867",
"0.6784926",
"0.6777551",
"0.6743173",
"0.67354447",
"0.671098",
"0.6649444",
"0.6599041",
"0.6581636",
"0.655539",
"0.65450376",
"0.6543801",
... | 0.6835862 | 8 |
GET /trip_plans/1 GET /trip_plans/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @plans = Plan.all\n\n render json: @plans\n end",
"def plans(params = {})\n scope 'default'\n get('plans/', params)\n end",
"def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end",
"def index\n @plans = Plan.all\n\n respond_to do |format|\n f... | [
"0.72951204",
"0.7139221",
"0.7053011",
"0.6984612",
"0.68618965",
"0.68618965",
"0.68603635",
"0.6814796",
"0.67500454",
"0.67421794",
"0.6694391",
"0.66865486",
"0.66758645",
"0.66758645",
"0.6675296",
"0.6663865",
"0.6663865",
"0.6623864",
"0.65979034",
"0.65849686",
"0.65... | 0.0 | -1 |
POST /trip_plans POST /trip_plans.json | def create
@trip_plan = TripPlan.new(trip_plan_params.merge(user_id: current_user.try(:id)))
respond_to do |format|
if @trip_plan.save
format.html { redirect_to @trip_plan, notice: 'Trip plan was successfully created.' }
format.json { render :show, status: :created, location: @trip_plan }
format.js {}
else
format.html { render :new }
format.json { render json: @trip_plan.errors, status: :unprocessable_entity }
format.js {}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @plan = Plan.new(params[:plan])\n\n if @plan.save\n render json: @plan, status: :created, location: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end",
"def create\n @plan = Plan.new(plan_params)\n\n if @plan.save\n render json: @pl... | [
"0.71381664",
"0.7084142",
"0.6837011",
"0.6763854",
"0.6763854",
"0.6620278",
"0.6538596",
"0.6527033",
"0.6519243",
"0.65035987",
"0.64933866",
"0.64883554",
"0.6479739",
"0.64703476",
"0.6455573",
"0.63977134",
"0.6357058",
"0.63535",
"0.6339868",
"0.6332066",
"0.6331305",... | 0.7059177 | 2 |
PATCH/PUT /trip_plans/1 PATCH/PUT /trip_plans/1.json | def update
respond_to do |format|
if @trip_plan.update(trip_plan_params)
format.html { redirect_to @trip_plan, notice: 'Trip plan was successfully updated.' }
format.json { render :show, status: :ok, location: @trip_plan }
else
format.html { render :edit }
format.json { render json: @trip_plan.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @tasks = @plan.tasks\n\n @goals = @plan.goals\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to back_index_case_url, notice: 'Plan was successfully updated.' }\n # format.json { render :show, status: :ok, location: @plan }\n else\n ... | [
"0.6872409",
"0.67844903",
"0.67288256",
"0.66701317",
"0.66588545",
"0.66545",
"0.66545",
"0.6545476",
"0.6545476",
"0.6545476",
"0.6545476",
"0.6545476",
"0.6530603",
"0.6526192",
"0.652494",
"0.64939356",
"0.6422879",
"0.6323977",
"0.631166",
"0.6311556",
"0.6301798",
"0... | 0.7021877 | 0 |
DELETE /trip_plans/1 DELETE /trip_plans/1.json | def destroy
@trip_plan.destroy
respond_to do |format|
format.html { redirect_to trip_plans_url, notice: 'Trip plan was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to test_plans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to p... | [
"0.73738545",
"0.727948",
"0.727948",
"0.7240511",
"0.7240511",
"0.7240511",
"0.72214943",
"0.7119448",
"0.7083073",
"0.70628655",
"0.7044855",
"0.7044855",
"0.7044855",
"0.7044855",
"0.7044855",
"0.7044855",
"0.7044855",
"0.7044855",
"0.70268047",
"0.7017745",
"0.701703",
... | 0.7555055 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_trip_plan
@trip_plan = TripPlan.where(user_id: current_user.try(:id)).find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165422",
"0.60457647",
"0.5946384",
"0.5916027",
"0.58905005",
"0.583495",
"0.5777223",
"0.56995213",
"0.56995213",
"0.56532377",
"0.5621348",
"0.5422839",
"0.54118705",
"0.54118705",
"0.54118705",
"0.53935355",
"0.5379617",
"0.53577393",
"0.53407264",
"0.53398263",
"0.53... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def trip_plan_params
params.require(:trip_plan).permit(:name, :image)
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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.629... | 0.0 | -1 |
POST request /contacts Whenever you want to save to db, use create | def create
# Contact object is re-assigning to the fields
# Mass assigment of form fields into Contact object
@contact = Contact.new(contact_params)
# Save the Contact object to the database
if @contact.save
# If the save is successful
# Grab the name, email, and comments from the parameters
# and store them in these variables
name = params[:contact][:name]
email = params[:contact][:email]
body = params[:contact][:comments]
# Plug variables into Contact Mailer email method and send email
ContactMailer.contact_email(name, email, body).deliver
# Store success message in flash hash and redirect to new action
flash[:success] = "Message sent."
redirect_to new_contact_path
else
# If Contact object doesnt save, store errors in flash hash
# and redirect to new action
# Errors will be in an array format
flash[:danger] = @contact.errors.full_messages.join(", ")
redirect_to new_contact_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_contact\n\t\tcontact = Contact.new\n\t\tcontact.first_name = params[:first_name]\n\t\tcontact.last_name = params[:last_name]\n\t\tcontact.phone_number = params[:phone_number]\n\t\tcontact.email = params[:email]\n\t\tcontact.save\n\t\tcurrent_agendify_user.contacts.push(contact)\n\t\tcurrent_agendify_user.... | [
"0.77823114",
"0.76573366",
"0.7644778",
"0.7535969",
"0.75228864",
"0.7420989",
"0.7387985",
"0.7363209",
"0.73556656",
"0.7349714",
"0.7333074",
"0.7331096",
"0.73105204",
"0.7294884",
"0.7275554",
"0.7252227",
"0.7241656",
"0.72240204",
"0.7213224",
"0.7213224",
"0.7213224... | 0.6673824 | 93 |
To not rewrite logic of promotion from guest (user with guest role anyway created on visit) this composer will simply mock params from omnihash and after that composer is done will continue and do logic related to omniauth only (handle oauth credential) | def set_params_from_omniauth_hash_to_pass_it_to_transfer_to_guest_cmpsr
@params_from_omniauth_for_transfer_to_guest_cmpsr = pick_fields_from_omniauth_hash_that_will_be_passed_to_transfer_guest_cmpsr_as_params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_defective_auth_hash\n nil\n end",
"def guest_params(user)\n if user.stub?\n { token: user.guest_token }\n else\n {}\n end\n end",
"def create_user\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({\n ... | [
"0.648713",
"0.6144646",
"0.60123765",
"0.5997562",
"0.5980947",
"0.5946785",
"0.591466",
"0.5791981",
"0.5774048",
"0.5747805",
"0.5706046",
"0.5706046",
"0.55651987",
"0.55475664",
"0.55176747",
"0.54986703",
"0.54766816",
"0.54566205",
"0.54543674",
"0.54275817",
"0.541733... | 0.6041515 | 2 |
Method to adjust heap in downward manner | def adjusted_down(adjusted_array, parent, limit)
top = adjusted_array[parent]
while (child = 2 * parent) <= limit
child += 1 if (child < limit) && (adjusted_array[child] < adjusted_array[child + 1])
break if top >= adjusted_array[child]
adjusted_array[parent] = adjusted_array[child]
parent = child
end
adjusted_array[parent] = top
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heapify\n for i in (0..(@ary.size-1)).to_a.reverse\n upheap(i)\n downheap(i)\n end\n end",
"def up_heap(ary, k)\n p = (k - 1)/2\n down = ary[k]\n while (k-1)/2 >= 0 and ary[(k-1)/2] < down\n ary[k] = ary[(k-1)/2]\n k = (k-1).abs/2\n break if k == 0 \n end\n ary[k] = down\nend",... | [
"0.74122",
"0.71622974",
"0.71052444",
"0.7074458",
"0.7050505",
"0.7029065",
"0.698966",
"0.6988606",
"0.69091684",
"0.6904579",
"0.6902537",
"0.68916947",
"0.68790907",
"0.6856294",
"0.68493617",
"0.6844139",
"0.68430614",
"0.6841282",
"0.68406665",
"0.68362594",
"0.682636"... | 0.58366734 | 87 |
=== displaying headers === | def gen_header(fp)
fp.puts("/*")
fp.puts(" * Copyright (c) 2015, Masayuki Kimura")
fp.puts(" * All rights reserved.")
fp.puts(" *")
fp.puts(" * Redistribution and use in source and binary forms, with or without")
fp.puts(" * modification, are permitted provided that the following conditions are met:")
fp.puts(" * * Redistributions of source code must retain the above copyright")
fp.puts(" * notice, this list of conditions and the following disclaimer.")
fp.puts(" * * Redistributions in binary form must reproduce the above copyright")
fp.puts(" * notice, this list of conditions and the following disclaimer in the")
fp.puts(" * documentation and/or other materials provided with the distribution.")
fp.puts(" * * Neither the name of the Masayuki Kimura nor the")
fp.puts(" * names of its contributors may be used to endorse or promote products")
fp.puts(" * derived from this software without specific prior written permission.")
fp.puts(" *")
fp.puts(" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND")
fp.puts(" * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED")
fp.puts(" * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE")
fp.puts(" * DISCLAIMED. IN NO EVENT SHALL MASAYUKI KIMURA BE LIABLE FOR ANY")
fp.puts(" * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES")
fp.puts(" * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;")
fp.puts(" * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND")
fp.puts(" * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT")
fp.puts(" * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS")
fp.puts(" * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.")
fp.puts(" */")
fp.puts("")
fp.puts("/* CAUTION! THIS SOURCE CODE IS GENERATED AUTOMATICALLY. DON'T MODIFY BY HAND. */")
fp.puts("")
fp.puts("")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header\n end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def headers; end",
"def header; end",
"def header; end",
"def header; end",
"def hea... | [
"0.7776754",
"0.76590383",
"0.76590383",
"0.76590383",
"0.76590383",
"0.76590383",
"0.76590383",
"0.76590383",
"0.76590383",
"0.76590383",
"0.76590383",
"0.76421046",
"0.76421046",
"0.76421046",
"0.7629143",
"0.7577252",
"0.7511261",
"0.7454782",
"0.73709273",
"0.72875",
"0.7... | 0.0 | -1 |
The resource is always scoped by the site defined by the membership. | def initialize(membership, resource)
@membership = membership
@resource = resource
raise Pundit::NotAuthorizedError, 'must be logged in' unless account
raise Pundit::NotAuthorizedError, 'should have a resource' unless resource
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_resource\n current_site\n end",
"def authenticate_scope!\r\n send(:\"authenticate_#{resource_name}!\")\r\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\r\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = r... | [
"0.6303575",
"0.6079911",
"0.59591424",
"0.59591424",
"0.5930164",
"0.592438",
"0.5842448",
"0.58216786",
"0.57978284",
"0.57940143",
"0.57903713",
"0.57854134",
"0.5783261",
"0.5766357",
"0.56948715",
"0.567617",
"0.5625178",
"0.5607962",
"0.56023353",
"0.5583423",
"0.557427... | 0.0 | -1 |
Return a prepared query object | def query
::User.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare( sql )\n Statement.new( self, sql )\n end",
"def prepare record = nil, command\n record ? Statement.new(record, command) : db.prepare(command)\n end",
"def prepared_sql\n case prepared_type\n when :select, :all, :each\n # Most common scenario, so listed first.... | [
"0.7188056",
"0.6654354",
"0.65714645",
"0.65591675",
"0.6510609",
"0.64399195",
"0.6348788",
"0.6324276",
"0.62753624",
"0.62239844",
"0.6207612",
"0.61750895",
"0.6162522",
"0.6136799",
"0.61137766",
"0.6106673",
"0.61043394",
"0.6090427",
"0.6072116",
"0.60698",
"0.6056421... | 0.0 | -1 |
Called when meta[count] is true, i.e. the client has requested the total count of objects | def count
query.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n call_client(:count)\n end",
"def count\n collection.count\n end",
"def count\n # implement in subc... | [
"0.72222704",
"0.72222704",
"0.72222704",
"0.7200492",
"0.71165764",
"0.70400155",
"0.6923576",
"0.6889039",
"0.6877976",
"0.68690026",
"0.68690026",
"0.68690026",
"0.686204",
"0.68426216",
"0.68267965",
"0.67656595",
"0.67656595",
"0.67498845",
"0.6748971",
"0.67190504",
"0.... | 0.65310717 | 46 |
SamlConfiguration is a dependent object that does not have a link until created. So, we create the link for it to allow HyperResource to successfully create the object. Afterwords, we can directly manage the SamlConfiguration | def create_saml_configuration!(params)
HyperResource::Link.new(
self,
'href' => "#{href}/saml_configurations"
).post(self.class.normalize_params(params))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saml\n RubyAem::Resources::Saml.new(@client)\n end",
"def link_auto_configuration_state\n super\n end",
"def saml_metadata_url=(value)\n @saml_metadata_url = value\n end",
"def configure\n @config ||= OpenWebslides::Configuration.new\n yield @config\n ... | [
"0.6530908",
"0.5804142",
"0.5433595",
"0.5325754",
"0.53185225",
"0.5267621",
"0.5219019",
"0.517565",
"0.51170087",
"0.5092379",
"0.5006375",
"0.49923792",
"0.49845383",
"0.49845383",
"0.49604562",
"0.49436352",
"0.49146628",
"0.48820594",
"0.48704013",
"0.48627755",
"0.484... | 0.63420105 | 1 |
Returns, depending on direction, the relation key | def key(direction = nil)
case direction.try :to_s
when nil then "#{start_node_id}:#{label}:#{end_node_id}"
when 'out' then "#{start_node_id}:#{label}:out"
when 'in' then "#{end_node_id}:#{label}:in"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relation_key\n self[:relation_key] || name.to_s\n end",
"def relation_foreign_key(relation)\n relation_reflect(relation).foreign_key\n end",
"def associated_key_column\n self[:left_key]\n end",
"def first_level_relation_foreign_key(relation)\n relation = rel... | [
"0.8320469",
"0.7097198",
"0.7013781",
"0.6874073",
"0.6804715",
"0.67401767",
"0.6541404",
"0.6486882",
"0.6473458",
"0.645201",
"0.6404218",
"0.64032865",
"0.6356772",
"0.6293733",
"0.6220454",
"0.6193291",
"0.61790496",
"0.6129424",
"0.61151206",
"0.6113579",
"0.6107759",
... | 0.63885444 | 12 |
Access the contact name without forcing a download of an incomplete, summary invoice. | def contact_name
attributes[:contact] && attributes[:contact][:name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primaryContactName\n if primary_contact\n primary_contact.full_name\n else\n \"Unassigned\"\n end\n end",
"def contact_name\n contact['name']\n end",
"def get_contact_name(page)\n page.css(WebScraper::JOB_DETAILS_SELECTOR)[WebScraper::JOB_CONTACT_NAME_POS].content.strip\n en... | [
"0.74075073",
"0.73002005",
"0.72354335",
"0.6973334",
"0.66371804",
"0.6608596",
"0.64882874",
"0.64655536",
"0.64295405",
"0.6396871",
"0.63733876",
"0.63733876",
"0.63653994",
"0.635612",
"0.63530415",
"0.6353005",
"0.63047177",
"0.63032436",
"0.6288777",
"0.62884426",
"0.... | 0.73703694 | 1 |
Access the contact ID without forcing a download of an incomplete, summary invoice. | def contact_id
attributes[:contact] && attributes[:contact][:contact_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact_id\n if self.person_id.present?\n contact_type = CIVICRM::ContactType.where(name: 'Individual').take\n prev_id = CIVICRM::VineContactPrevId.where(f1_id: self.person_id, contact_type_id: contact_type.id).take\n else\n contact_type = CIVICRM::ContactType.where(name: 'Household').take... | [
"0.72082067",
"0.7003595",
"0.6975045",
"0.6851793",
"0.6792053",
"0.6792053",
"0.6792053",
"0.6792053",
"0.6792053",
"0.6598385",
"0.6549435",
"0.64570564",
"0.64570564",
"0.64545166",
"0.64208907",
"0.6355709",
"0.63366884",
"0.6322561",
"0.62325966",
"0.6176656",
"0.616650... | 0.69834393 | 2 |
Helper method to check if the invoice has been approved. | def approved?
[ 'AUTHORISED' ].include? status
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def approved?\n if order_status == 'approved'\n return true\n else\n return false\n end\n end",
"def approved?\n !self.pending\n end",
"def approved?\n status == STATUS_APPROVED\n end",
"def approved?\n (status == APPROVED)\n end",
"def approved?\n !approved_on.ni... | [
"0.75522286",
"0.7473865",
"0.73532933",
"0.7292855",
"0.7157331",
"0.7123667",
"0.71203417",
"0.7021209",
"0.7018187",
"0.6941404",
"0.69359",
"0.6911396",
"0.6897378",
"0.68335694",
"0.6830245",
"0.6813374",
"0.6779804",
"0.6718488",
"0.67013836",
"0.6675351",
"0.66668",
... | 0.6797709 | 16 |
Helper method to check if the invoice is accounts payable. | def accounts_payable?
type == 'ACCPAY'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accounts_payable?\n type == 'ACCPAYCREDIT'\n end",
"def accounts_receivable?\n type == 'ACCRECCREDIT'\n end",
"def accounts_receivable?\n type == 'ACCREC'\n end",
"def payment_on_account?\n status == Enums::PaymentStatus::PAYMENT_ON_ACCOUNT\n end",
"def invoice?\n ... | [
"0.8056469",
"0.7294571",
"0.7150738",
"0.713237",
"0.7130977",
"0.6729921",
"0.6613813",
"0.6554428",
"0.6540301",
"0.6533699",
"0.6531109",
"0.6513893",
"0.65013754",
"0.6485914",
"0.642992",
"0.64237577",
"0.6419866",
"0.63469875",
"0.6308775",
"0.6289144",
"0.6288771",
... | 0.80858713 | 0 |
Helper method to check if the invoice is accounts receivable. | def accounts_receivable?
type == 'ACCREC'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accounts_receivable?\n type == 'ACCRECCREDIT'\n end",
"def invoice?\n (payment_on_account? || payment_received?) && fully_shipped?\n end",
"def accounts_payable?\n type == 'ACCPAYCREDIT'\n end",
"def receivers?(other_user)\n\t\treceivers.include?(other_user)\n\tend",
"def accounts_p... | [
"0.80052996",
"0.6819932",
"0.6741412",
"0.64513975",
"0.64356655",
"0.6357082",
"0.6320902",
"0.6244995",
"0.62015384",
"0.61534965",
"0.61400044",
"0.6048981",
"0.60442954",
"0.603577",
"0.592533",
"0.5916439",
"0.5871558",
"0.5827383",
"0.58114105",
"0.5788178",
"0.5769519... | 0.76756364 | 1 |
GET /dishes/new Create a dish on Dish/New | def new
# Initialize a new model.
@dish = Dish.new
#Retreive all dish types.
@dishtypes = Dishtype.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @dish = Dish.new(params[:dish])\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @dish, notice: 'Dish was successfully created.' }\n format.json { render json: @dish, status: :created, location: @dish }\n else\n format.html { render action: \"... | [
"0.7984107",
"0.7984107",
"0.7974698",
"0.7974698",
"0.7937782",
"0.7847599",
"0.78189754",
"0.77276343",
"0.76361305",
"0.7618285",
"0.75318706",
"0.7491643",
"0.7442553",
"0.7424385",
"0.74122626",
"0.73606217",
"0.7346116",
"0.7342351",
"0.7339541",
"0.72665477",
"0.721894... | 0.7775347 | 7 |
GET /dishes/new Display a dish on Dish/Show given a dish id. | def show
#Set a dish by given dish id.
@dish = Dish.dish_by_id(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @dish = Dish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dish }\n end\n end",
"def new\n @dish = Dish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dish }\n end\n end",
"d... | [
"0.80994314",
"0.80994314",
"0.8043844",
"0.76066816",
"0.75414366",
"0.7512237",
"0.7495784",
"0.74728656",
"0.7462242",
"0.7374809",
"0.7374809",
"0.73570275",
"0.7291968",
"0.72766185",
"0.72720623",
"0.71927446",
"0.7182731",
"0.712452",
"0.70926595",
"0.7069708",
"0.7060... | 0.7859979 | 3 |
POST /postdish Create a new dish, using a dish model inicialised in /dish/New. | def create
#Create a new dish matching properties ( not all properties.)
@dish = Dish.new(params[:dish])
#Set the dish type querying the database.
@dish.dishtype = Dishtype.find_by_id(params[:dishtype][:id])
#Create a nested user attached to the dish
@dish.nesteduser = @current_user.to_nested
#Store the image in a safely way.
@dish.store_image(params[:picture])
#If the user is save correctly, redirect it the the account page on /Account.
respond_to do |format|
if @dish.save
format.html { redirect_to account_page_path, notice: 'Dish was successfully created.' }
else
format.html { render action: "new" }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @dish = Dish.new(params[:dish])\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @dish, notice: 'Dish was successfully created.' }\n format.json { render json: @dish, status: :created, location: @dish }\n else\n format.html { render action: \"... | [
"0.80218315",
"0.80218315",
"0.7961143",
"0.7918185",
"0.7887158",
"0.77047116",
"0.76682246",
"0.759046",
"0.75359267",
"0.7477807",
"0.7470125",
"0.7464177",
"0.73992014",
"0.73849833",
"0.7376214",
"0.73190576",
"0.7267172",
"0.72056955",
"0.71873593",
"0.7130189",
"0.7110... | 0.7036144 | 24 |
DELETE /dishes/1 DELETE /dishes/1.json | def destroy
@dish = Dish.find(params[:id])
@dish.destroy
respond_to do |format|
format.html { redirect_to my_page_path }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n ... | [
"0.7440273",
"0.7440273",
"0.73323315",
"0.73185074",
"0.73185074",
"0.72294873",
"0.7137638",
"0.7016546",
"0.69750285",
"0.69523454",
"0.6889441",
"0.68826485",
"0.6871693",
"0.68359524",
"0.6816588",
"0.68026924",
"0.67950034",
"0.6791443",
"0.67818314",
"0.6746856",
"0.67... | 0.70040405 | 8 |
Loads consul data into the given server | def load_data url, config_file
server = @service_discovery.build_address(url)
@consul_loader.load_config config_file, server
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_reload(server)\n result = request(\n :path => \"containers/#{server.id}\",\n :expects => [200, 404]\n )\n if(result[:response].code == 200)\n result = result.get(:body, :metadata)\n server.load_data(\n :id => result[:nam... | [
"0.6588886",
"0.6430613",
"0.58921087",
"0.57966727",
"0.5758399",
"0.56713706",
"0.56152576",
"0.5586529",
"0.5574031",
"0.55550796",
"0.55363655",
"0.5505343",
"0.54946196",
"0.54787326",
"0.5473459",
"0.5473459",
"0.543467",
"0.5434642",
"0.5428787",
"0.54066616",
"0.53952... | 0.71017426 | 0 |
default 2 hours ago | def check_expiration
return unless @user.password_reset_expired?
render json: {
success: false,
message: "Reset password token has expired."
}, status: :bad_request
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ago(t = Time.now); t - self; end",
"def ago(t = Time.now); t - self; end",
"def ago\n Time.now - self\n end",
"def time_ago\n \"#{time_ago_in_words(self.created_at)} ago\"\n end",
"def ago(time = ::Time.now)\n time - self\n end",
"def ago(seconds)\n\t\t a = seconds\n\t\t case a\n\t\... | [
"0.7349246",
"0.7349246",
"0.71575713",
"0.68833447",
"0.68754077",
"0.67819875",
"0.6727833",
"0.6578771",
"0.6578771",
"0.6542741",
"0.6542741",
"0.6538792",
"0.64885396",
"0.64750266",
"0.6455147",
"0.64416134",
"0.64052546",
"0.64036596",
"0.6304035",
"0.63006264",
"0.627... | 0.0 | -1 |
method to create new student by user input takes string | def new_student (db, name)
db.execute("INSERT INTO student (name) VALUES (?)", [name])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def student_add\n\t\tname_array = name.split(\" \")\n\t\tname = Student.new(name_array[0], name_array[1])\n\t\tputs \"Enter course you would like to add.\"\n\t\tchoice = gets.chomp.downcase\n\t\tname.enroll(choice) if choice.is_a?(Course)\n\tend",
"def create_new_student(student_name)\n object = controller_cr... | [
"0.7568086",
"0.74644446",
"0.7448381",
"0.6875942",
"0.6779313",
"0.6693501",
"0.66904634",
"0.6661804",
"0.6577029",
"0.6547725",
"0.6545073",
"0.6545073",
"0.6525294",
"0.65101063",
"0.64895207",
"0.64700913",
"0.64527464",
"0.64273304",
"0.642404",
"0.6416118",
"0.6403349... | 0.6615759 | 8 |
method to populate problems table so that user can specify they will practice multiplying 1s10s takes in integers populates all problems => starts at starting integer for first number, prints integers by increment of 1 in each row of column until it reaches the second integer's value => starts second integer at starting integer, until it reaches second integer's value => saves numbers into array of strings with the appropriate operator in the middle. => scrambles array so they show up in random order in game output: array of strings | def lists_problems(num1, num2)
i1 = num1.to_i
i2 = num2.to_i
if i1 < i2
range = (i1..i2)
else
range = (i2..i1)
end
orig1 = i1
orig2 = i2
prob_array = []
range.each do |i|
i2 = orig2
until i2 <= orig1
second_integer = (i2 -= 1) + 1
prob_array << "#{i} * #{second_integer}"
end
i += 1
end
prob_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_times_table\n\treturn_array = []\n\tgame_array = []\n\n\t#2 * 2-9\n\t#3 * 3-9\n\t#4 * 4-9\n\t# etc ...\n\n\t(2..9).each do |i|\n\t\t(i..9).each do |j|\n\t\t\tgame_array << i * j\n\t\t\tgame_array << i \n\t\t\tgame_array << j\n\t\t\t2.times do \n\t\t\t\tgame_array << add_wrong(9, game_array)\n\t\t\tend\n... | [
"0.6529262",
"0.6254461",
"0.6251052",
"0.62314266",
"0.6194566",
"0.61862755",
"0.61703277",
"0.6163497",
"0.61569667",
"0.6052671",
"0.5966701",
"0.59519005",
"0.5936237",
"0.5920027",
"0.59096366",
"0.5906641",
"0.5873862",
"0.58679074",
"0.58575594",
"0.58284146",
"0.5825... | 0.6277324 | 1 |
method to calculate answers of problems => takes in an array of string of mathematical problems => breaks each position down into array of 3 items, no spaces => if index(2) is , use the in problem => index 0 of string is first integer => index 1 is second integer => output is integer that solves problem => save answer into problem table | def calculates(problems)
problems.each do |each_prob|
calculate_problem(each_prob)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend",
"def calculate(program)\n operator = ''\n a = 0\n b = 0\n thearray = program.split(\",\").map { |s| s.to_i }\n thearray.each_with_index do | val, key |\n case key.divmod(4)[1]\n when 0\n case va... | [
"0.6209563",
"0.6094695",
"0.6001603",
"0.5993703",
"0.5908953",
"0.58691394",
"0.5857171",
"0.5787865",
"0.5779775",
"0.5773549",
"0.57619977",
"0.5750793",
"0.57213396",
"0.57192343",
"0.5708585",
"0.56877035",
"0.5661589",
"0.5654139",
"0.5650353",
"0.5627436",
"0.5625645"... | 0.566306 | 16 |
method to populate students_problems table | def populate_students_prob(db, true_o_false, students_id, probs_id)
db.execute("INSERT INTO students_problems (answered_correct, id_student, id_problem) VALUES (?, ?, ?);", [true_o_false, students_id, probs_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installProblems\n if ! @cud.instructor? then\n redirect_to :action=>\"index\" and return\n end\n\n if Problem.where(:assessment_id=>@assessment.id).count == 0 then\n for problem in @problems do\n p = Problem.new(:name=>problem['name'],\n :description=>problem['description... | [
"0.6474109",
"0.6399346",
"0.59360754",
"0.57676756",
"0.55766535",
"0.5567923",
"0.5542429",
"0.5524734",
"0.55111235",
"0.54598534",
"0.5273837",
"0.5231825",
"0.5230994",
"0.5221572",
"0.5182954",
"0.516785",
"0.5162307",
"0.5162307",
"0.5162307",
"0.51425743",
"0.514154",... | 0.7218151 | 0 |
method to help populate problem table Input: array of strings containing problems save the return of each array position into a variable output is the variable (a string containing the problem) | def populate_problem_table(db)
problems_array = lists_problems(input1, input2)
problems_array.each do |this_prob|
db.execute("INSERT INTO problem (individ_problem, answer) VALUES (?, ?);", [this_prob, calculate_problem(this_prob)])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_problem(p)\n return p[0].to_s+\"-\"+p[1]\nend",
"def parseOutFromLP_solve(inputArray, dim)\n if (inputArray.length==1)\n puts \"LP solve output: \" + inputArray.to_s.gsub(/[\\[\\]\\,\\\"]/, '')\n Kernel.exit\n end\n\n objFuncVal = inputArray[1][4]\n outString = String.new\n dim = dim.to_... | [
"0.6081941",
"0.59784126",
"0.56323713",
"0.5560785",
"0.5541709",
"0.55220956",
"0.55170405",
"0.5489001",
"0.54457104",
"0.5438407",
"0.5312927",
"0.53023934",
"0.5264002",
"0.52363515",
"0.5213535",
"0.52115595",
"0.5210699",
"0.5210446",
"0.51812714",
"0.5170467",
"0.5145... | 0.5962418 | 2 |
GET /drafts GET /drafts.xml | def index
@drafts = @compare.drafts.reorder('id')
#order("id DESC")
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @drafts }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @drafts = SmsOnRails::Draft.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @drafts }\n end\n end",
"def index\n @drafts = Draft.all\n end",
"def index\n @drafts = current_user.drafts\n\n respond_to do |format|\n format... | [
"0.76118845",
"0.7079566",
"0.70420957",
"0.70291334",
"0.6955246",
"0.69325864",
"0.6911983",
"0.6877003",
"0.6617158",
"0.65511596",
"0.63534474",
"0.6339738",
"0.632642",
"0.63242006",
"0.6288786",
"0.6218216",
"0.62174195",
"0.6198417",
"0.61353457",
"0.6134539",
"0.60407... | 0.62853634 | 15 |
GET /drafts/1 GET /drafts/1.xml | def show
@draft = Draft.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @draft }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @drafts = SmsOnRails::Draft.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @drafts }\n end\n end",
"def show_drafts; end",
"def show\n @draft = SmsOnRails::Draft.find(params[:id])\n\n respond_to do |format|\n format.html #... | [
"0.72935843",
"0.69008255",
"0.6806465",
"0.67906386",
"0.6710457",
"0.6676709",
"0.6574095",
"0.65477",
"0.6405756",
"0.6374382",
"0.61915016",
"0.6183123",
"0.6179933",
"0.6160188",
"0.61240655",
"0.6078289",
"0.6058579",
"0.60363394",
"0.6031351",
"0.60267466",
"0.59451544... | 0.69265497 | 1 |
GET /drafts/new GET /drafts/new.xml | def new
@draft = @compare.drafts.build
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @draft }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @draft = SmsOnRails::Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def new\n @draft_list = DraftList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => ... | [
"0.73676187",
"0.7224005",
"0.7059207",
"0.68800557",
"0.6873294",
"0.68641365",
"0.68289214",
"0.6632357",
"0.6563956",
"0.64911073",
"0.6462716",
"0.64595723",
"0.64296657",
"0.6427903",
"0.64274955",
"0.64194876",
"0.64094347",
"0.6402897",
"0.63831913",
"0.6365833",
"0.63... | 0.7502817 | 0 |
POST /drafts POST /drafts.xml | def create
@draft = Draft.new(params[:draft])
respond_to do |format|
if @draft.save
format.html { redirect_to(compare_path(:id => @draft.compare_id), :flash => { :success => 'draft created.'}) }
format.xml { render :xml => @draft, :status => :created, :location => @draft }
else
format.html { render :action => "new" }
format.xml { render :xml => @draft.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @draft = current_user.drafts.build(params[:draft])\n\n respond_to do |format|\n if @draft.save\n format.html { redirect_to @draft, flash: { success: 'Черновик был успешно создан' } }\n format.json { render json: @draft, status: :created, location: @draft }\n else\n ... | [
"0.66456777",
"0.65495694",
"0.63771933",
"0.63712794",
"0.6318703",
"0.6317409",
"0.618331",
"0.61442506",
"0.61021554",
"0.5923322",
"0.59109235",
"0.5901281",
"0.5890612",
"0.58793324",
"0.58534867",
"0.5820133",
"0.5817504",
"0.5802731",
"0.57973826",
"0.57741034",
"0.573... | 0.6181691 | 7 |
PUT /drafts/1 PUT /drafts/1.xml | def update
@draft = Draft.find(params[:id])
respond_to do |format|
if @draft.update_attributes(params[:draft])
format.html { redirect_to(@draft, :notice => 'Draft was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @draft.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n format.html { redirect_to @draft, :notice => 'Draft was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => ... | [
"0.6353839",
"0.6322492",
"0.6219366",
"0.6211566",
"0.62061954",
"0.6134169",
"0.6009424",
"0.5946256",
"0.59351337",
"0.58047765",
"0.5762963",
"0.5743588",
"0.57094467",
"0.5672926",
"0.5650528",
"0.56334263",
"0.561718",
"0.55974627",
"0.55922854",
"0.55922854",
"0.559228... | 0.65781283 | 0 |
DELETE /drafts/1 DELETE /drafts/1.xml | def destroy1
@draft = Draft.find(params[:id])
@draft.destroy
respond_to do |format|
format.html { redirect_to(
# @draft.compare_id ,
compare_path(:id => @draft.compare_id ),
:notice => 'Draft was successfully deleted.'
)
}
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @draft = SmsOnRails::Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_drafts_url) }\n format.xml { head :ok }\n end\n end",
"de... | [
"0.7264597",
"0.71469766",
"0.68640393",
"0.6860251",
"0.68048173",
"0.66591233",
"0.66584116",
"0.6572306",
"0.6533932",
"0.65315974",
"0.65125483",
"0.64944416",
"0.64899826",
"0.64899826",
"0.64724857",
"0.64707094",
"0.6463761",
"0.6462746",
"0.6460057",
"0.6430424",
"0.6... | 0.6700019 | 5 |
0 :VX, 2000, DQ | def evaluate_damage_power(user, obj, patk, matk, pdef, mdef)
p_damage = (patk - pdef/2) * obj.atk_f / 100
m_damage = (matk - mdef/2) * obj.spi_f / 200
damage = (p_damage + m_damage)
damage = (damage * XRXSV44::DamageValueRate).to_i
damage += obj.base_damage.abs
return damage
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dv; end",
"def band_a\n 1000\n end",
"def qv\n end",
"def band; end",
"def band; end",
"def dy() 0 end",
"def adc_a_d\n end",
"def quarter_wind; end",
"def cp_d8\n end",
"def qcks_max_slow_down\n Quicksands[terrain_tag][:max_slow_down] \n end",
"def dopri\n ... | [
"0.6260957",
"0.59274006",
"0.58366746",
"0.55298454",
"0.55298454",
"0.5503657",
"0.5429083",
"0.54162675",
"0.5380218",
"0.53750914",
"0.53595185",
"0.5340565",
"0.5340565",
"0.52951235",
"0.52779895",
"0.52673405",
"0.5249303",
"0.5205111",
"0.51920193",
"0.51920193",
"0.5... | 0.0 | -1 |
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. Submission Details 166 / 166 test cases passed. Status: Accepted Runtime: 83 ms Submitted: 0 minutes ago You are here! Your runtime beats 100.00% of rubysubmissions. | def partition(head, x)
less = ListNode.new(:less)
less_last = less
more = ListNode.new(:more)
more_last = more
while head
next_head = head.next
head.next = nil
if head.val < x
less_last.next = head
less_last = head
else
more_last.next = head
more_last = head
end
head = next_head
end
less_last.next = more.next
return less.next
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partitionList list, x\n prev = list.head\n node = prev.next\n\n while node\n if (node.val < x)\n prev.next = node.next\n node.next = list.head\n list.head = node\n node = prev.next\n else\n prev = prev.next\n node = prev ? prev.next : nil\n end\n end\nend",
"def par... | [
"0.83340585",
"0.80996627",
"0.80778515",
"0.79761386",
"0.7773354",
"0.756376",
"0.7321485",
"0.7109138",
"0.6985263",
"0.62152445",
"0.61778784",
"0.614569",
"0.61039233",
"0.61028236",
"0.5955293",
"0.5953475",
"0.5906963",
"0.5888155",
"0.58138",
"0.5734911",
"0.5733673",... | 0.81047994 | 1 |
name of ospfare node in ospfarea layer | def area_node_name(asn, area)
"as#{asn}-area#{area}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n node.name\n end",
"def name\n node.name\n end",
"def pacemaker_node_name(n)\n if n[:pacemaker][:is_remote]\n \"remote-#{n[:hostname]}\"\n else\n n[:hostname]\n end\nend",
"def node_name\n path = self.class.to_s\n if i = path.rindex('::')\n path = path[(i+2... | [
"0.67223614",
"0.67223614",
"0.6583227",
"0.65089923",
"0.6496861",
"0.63505685",
"0.6336516",
"0.6322703",
"0.62610644",
"0.62338346",
"0.6220231",
"0.61852723",
"0.61852723",
"0.61481345",
"0.6142554",
"0.61357033",
"0.6122718",
"0.60935813",
"0.60935813",
"0.60935813",
"0.... | 0.72919935 | 0 |
Never trust parameters from the scary internet, only allow the white list through. | def record_params
params.require(:record).permit(:email)
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
next_scene takes a scene_name parameter, and returns an instance of the next scene | def next_scene(scene_name)
return @@scenes[scene_name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_scene(scene_name)\n scene = @@scenes[scene_name]\n return scene\n end",
"def next_scene(scene_name)\n\t\tval = @@scenes[scene_name]\n\t\treturn val\n\tend",
"def next_scene(scene)\n end_current_scene\n add_scene(scene)\n end",
"def opening_scene()\n return next_scene(@st... | [
"0.91985774",
"0.8503376",
"0.80771327",
"0.7218646",
"0.67483675",
"0.6502512",
"0.6409503",
"0.6386385",
"0.6303925",
"0.62338084",
"0.62338084",
"0.62069833",
"0.61450344",
"0.61040276",
"0.60989815",
"0.6070487",
"0.5982418",
"0.59253424",
"0.5836877",
"0.57972234",
"0.57... | 0.89246005 | 1 |
oprning_scene calls the next_scene function | def opening_scene()
return next_scene(@start_scene)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_scene(scene)\n end_current_scene\n add_scene(scene)\n end",
"def start_scene; end",
"def opening_scene()\n\t\tval = next_scene(@start_scene)\n\t\treturn val\n\tend",
"def next_scene(scene_name)\n scene = @@scenes[scene_name]\n return scene\n end",
"def next_scene(scene_na... | [
"0.7815515",
"0.7499943",
"0.7027992",
"0.6923522",
"0.68468046",
"0.6835522",
"0.6828475",
"0.6677052",
"0.66038644",
"0.6553768",
"0.6545816",
"0.65063256",
"0.6469102",
"0.64157516",
"0.63757837",
"0.6339543",
"0.62770164",
"0.6260441",
"0.6244869",
"0.62315995",
"0.622694... | 0.7591558 | 1 |
Initializes a new instance with given +server+ and +parts+. | def initialize(server, parts)
@parts = parts
@server = server
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(parts)\n @parts = parts\n end",
"def initialize(*parts)\n @parts = parts.to_a.flatten\n end",
"def initialize(value, parts)\n @value, @parts = value, parts\n end",
"def initialize *parts\n @parts = []\n @parts.concat parts\n end",
"def initialize(server)\n ... | [
"0.75189215",
"0.67588156",
"0.64356613",
"0.63976216",
"0.62963545",
"0.6267625",
"0.6187332",
"0.6122104",
"0.6076063",
"0.6075855",
"0.5865357",
"0.5861183",
"0.58428544",
"0.583351",
"0.5799981",
"0.5766852",
"0.57539177",
"0.573801",
"0.5724555",
"0.56855816",
"0.5679496... | 0.9255988 | 0 |
Returns a String representation of this answer. | def to_s
content.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_str( )\n @question\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n toString()\n end",
"def to_s\n self.inspect\n end",
"def to_s\n ... | [
"0.80012214",
"0.7395312",
"0.7395312",
"0.7395312",
"0.7395312",
"0.73125756",
"0.7302142",
"0.72956496",
"0.72888887",
"0.7276474",
"0.7260848",
"0.7260848",
"0.7260848",
"0.7260848",
"0.7138511",
"0.70922446",
"0.70661336",
"0.70512545",
"0.703345",
"0.70293915",
"0.702939... | 0.0 | -1 |
Returns true if the object is the same object, or is a string and has the same content. | def ==(other)
if equal?(other)
return true
end
if other.is_a?(self.class)
return to_s == other.to_s
end
if other.is_a?(String)
Whois.deprecate "Comparing an answer with a String is deprecated and will be removed in Whois 2.1."
return to_s == other.to_s
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equal?(other)\n return false unless other.is_a?(self.class)\n are_identical = false\n if self.title == other.title\n begin\n obj_id = self.object_id.to_s\n self.title += obj_id\n are_identical = (self.title == other.title)\n ensure\n self.title.s... | [
"0.7024318",
"0.69607115",
"0.6931908",
"0.6887456",
"0.68862426",
"0.68862426",
"0.68795615",
"0.6878946",
"0.6876817",
"0.6874429",
"0.6864299",
"0.6838386",
"0.68280554",
"0.6802542",
"0.67790335",
"0.6770665",
"0.67590564",
"0.6695825",
"0.66903716",
"0.6686981",
"0.66644... | 0.0 | -1 |
Joins and returns all answer parts into a single string and separates each response with a newline character. | def content
@content ||= parts.map(&:body).join("\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def txt_from_answer\n search_result = QueryForKeywords.new(skills_in_request).call\n answer = search_result.to_array # Here we can decide what output we need\n\n \"\".tap do |str|\n if answer[0].present?\n people = answer[0].map(&:full_name).join(\", \")\n skills = answer[1].map(&:titl... | [
"0.6906389",
"0.6415692",
"0.6387994",
"0.6269337",
"0.6178184",
"0.61505",
"0.6150259",
"0.61493826",
"0.61143947",
"0.609211",
"0.5922301",
"0.58660567",
"0.5737266",
"0.57273334",
"0.57252955",
"0.5713173",
"0.57049423",
"0.5703416",
"0.5685824",
"0.5662308",
"0.56499976",... | 0.0 | -1 |
Lazyloads and returns the parser proxy for current answer. | def parser
@parser ||= Parser.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parser\n @parser ||= Parser.new(self)\n end",
"def parser\n if !defined?(@parser) || !@parser\n DEFAULT_PARSER\n else\n @parser || DEFAULT_PARSER\n end\n end",
"def parser\n attributes.fetch(:parser)\n end",
"def pluggable_parser; end",
"def p... | [
"0.6257252",
"0.5985845",
"0.5980241",
"0.5729434",
"0.56859434",
"0.56617266",
"0.55779743",
"0.55552846",
"0.54931587",
"0.54931587",
"0.5419787",
"0.54099435",
"0.53976274",
"0.53710985",
"0.52997625",
"0.52875835",
"0.52775663",
"0.5269674",
"0.5231555",
"0.5187929",
"0.5... | 0.63432384 | 1 |
Returns true if the property passed as symbol is supported by any available parser for this answer. | def property_supported?(property)
parser.property_supported?(property)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def must_respond?(symbol_doc)\n !symbol_doc.nil?\n end",
"def respond_to?(symbol, include_private=false) end",
"def respond_to?( sym )\n\t\treturn true if @struct.member?( sym.to_s.sub(/(=|\\?)$/, '') )\n\t\tsuper\n\tend",
"def respond_to?(symbol, include_private = false)\n (@pjson[s = symbol.to... | [
"0.6696094",
"0.64690244",
"0.643342",
"0.6426984",
"0.637113",
"0.63631904",
"0.63517123",
"0.63412625",
"0.6279251",
"0.62735134",
"0.6238924",
"0.61960495",
"0.61885345",
"0.61709964",
"0.61605513",
"0.6148025",
"0.6049468",
"0.60404724",
"0.6035258",
"0.5955056",
"0.59527... | 0.709922 | 1 |
Collects and returns all the contacts. | def contacts
parser.contacts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contacts\n collection = CapsuleCRM::ContactCollection.new(self,CapsuleCRM::Contact, [])\n collection.concat emails\n collection.concat phone_numbers\n collection.concat websites\n collection.concat addresses\n collection\n end",
"def all_contacts\n ret = []\n chunk_size = 200\n ... | [
"0.81392527",
"0.8001419",
"0.783834",
"0.77504814",
"0.76766187",
"0.7674057",
"0.7629516",
"0.7538972",
"0.75252044",
"0.74871904",
"0.7486112",
"0.7474047",
"0.7450066",
"0.740053",
"0.737354",
"0.7308318",
"0.72951066",
"0.7281515",
"0.7253479",
"0.7251191",
"0.7228282",
... | 0.71455634 | 27 |
Checks whether this is a throttle response. | def throttle?
parser.throttle?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_throttled?\n !!node(\"response-throttled\")\n end",
"def throttled?\n @throttle >= params[:throttle].value\n end",
"def throttle?\n false\n end",
"def throttled?\n Throttled.throttled? job\n end",
"def throttled?\n publisher.throttled?\n... | [
"0.7810957",
"0.7486189",
"0.74564767",
"0.72287357",
"0.71968967",
"0.7084289",
"0.69429046",
"0.67536736",
"0.67508495",
"0.67368776",
"0.65553105",
"0.64631504",
"0.6332289",
"0.6329495",
"0.62462026",
"0.6205735",
"0.61694205",
"0.61621904",
"0.6141324",
"0.6141324",
"0.6... | 0.7389818 | 3 |
Delegates all method calls to the internal parser. | def method_missing(method, *args, &block)
if Parser::PROPERTIES.include?(method)
self.class.define_property_method(method)
send(method, *args, &block)
elsif Parser::METHODS.include?(method)
self.class.define_method_method(method)
send(method, *args, &block)
elsif method.to_s =~ /([a-z_]+)\?/ and (Parser::PROPERTIES + Parser::METHODS).include?($1.to_sym)
self.class.define_question_method($1)
send(method)
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end",
"def pluggable_parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def method_missing(name,*args,&block)\n self.class.send :define_me... | [
"0.7150066",
"0.7029466",
"0.7020353",
"0.7020353",
"0.7020353",
"0.7020353",
"0.68718046",
"0.6782711",
"0.67367816",
"0.6714518",
"0.66051906",
"0.6557059",
"0.6539821",
"0.64988434",
"0.64313614",
"0.6423557",
"0.6410116",
"0.6410116",
"0.6410116",
"0.6403537",
"0.6403537"... | 0.57793576 | 52 |
GET /events GET /events.json | def index
user = current_user
# note 这里实现的是获取用户有权访问的项目
# 也可以实现成按Team查看
@projects = Hash[user.projects.select(:id, :key, :title).map { |pj| [pj.id, pj] }]
respond_to do |format|
format.html do
@team_members = user.team_brothers.select(:key,:name,:team_id)
end
format.json do
now = Time.zone.now
today_range = now.beginning_of_day..now.end_of_day
yesterday_range = (now - 1.day).beginning_of_day..(now - 1.day).end_of_day
member = User.where(key: params[:member]).first if params[:member]
#todo 检查是否有权查看另外用户的动态
#进行两次查找,首先找是否有今天和昨天的,如果没有,则显示更早的
chain = Event.select('events.*','todos.project_id')
.joins(:todo)
.where(todos: { project_id: @projects.keys})
.order(created_at: :desc)
#按成员筛选
chain = chain.where(source_id: member.id) if member
events = chain.where(created_at: yesterday_range.first..today_range.last)
events = chain if events.empty?
#对事件进行分组
events_with_group = {}
events.includes(:source)
.paginate(page: params[:page], per_page: 50).collect do |event|
day , time = event.created_at.strftime('%Y-%m-%d|%H:%M').split('|')
events_with_group[day] ||= {}
events_with_group[day][time] ||= []
events_with_group[day][time] << {
id: event.id,
kind: event.kind,
user: {
name: event.source.try(:name),
key: event.source.try(:key)
},
title: event.title,
content: event.content,
created_at: event.created_at,
project_id: event.project_id
}
end
render json: events_with_group
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}... | [
"0.83367944",
"0.82404274",
"0.79437834",
"0.7928559",
"0.7768565",
"0.77415425",
"0.7670922",
"0.7666102",
"0.7659591",
"0.76432544",
"0.7621922",
"0.76163495",
"0.76163495",
"0.76136506",
"0.75696373",
"0.7523349",
"0.7489483",
"0.7481514",
"0.747057",
"0.7442786",
"0.74411... | 0.0 | -1 |
GET /events/1 GET /events/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use... | [
"0.7503071",
"0.7400693",
"0.736082",
"0.7348986",
"0.7346848",
"0.73377246",
"0.73175955",
"0.7287442",
"0.7281302",
"0.7246309",
"0.72304124",
"0.7219399",
"0.7219399",
"0.72191817",
"0.72191817",
"0.72139806",
"0.72049224",
"0.7199011",
"0.7197146",
"0.7192692",
"0.7192348... | 0.0 | -1 |
POST /events POST /events.json | def create
@event = Event.new(event_params)
respond_to do |format|
if @event.save
format.html { redirect_to @event, notice: 'Event was successfully created.' }
format.json { render :show, status: :created, location: @event }
else
format.html { render :new }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def crea... | [
"0.77128094",
"0.76106113",
"0.760296",
"0.75403166",
"0.7444139",
"0.73198915",
"0.73130167",
"0.7280886",
"0.7250538",
"0.7234768",
"0.7234768",
"0.72142935",
"0.7167504",
"0.71493334",
"0.71257424",
"0.711791",
"0.71167594",
"0.7115284",
"0.7096495",
"0.7089964",
"0.708183... | 0.69470763 | 68 |
PATCH/PUT /events/1 PATCH/PUT /events/1.json | def update
respond_to do |format|
if @event.update(event_params)
format.html { redirect_to @event, notice: 'Event was successfully updated.' }
format.json { render :show, status: :ok, location: @event }
else
format.html { render :edit }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.75299805",
"0.7372486",
"0.71766764",
"0.7172103",
"0.7170955",
"0.71424884",
"0.70959055",
"0.7082709",
"0.7082709",
"0.7057662",
"0.70209146",
"0.6989379",
"0.69825095",
"0.69775003",
"0.69601995",
"0.6954494",
"0.6954494",
"0.6951992",
"0.692109",
"0.692109",
"0.692109"... | 0.0 | -1 |
DELETE /events/1 DELETE /events/1.json | def destroy
@event.destroy
respond_to do |format|
format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_... | [
"0.7693098",
"0.76887214",
"0.76887214",
"0.76887214",
"0.7681338",
"0.75863475",
"0.75692576",
"0.7561527",
"0.7541655",
"0.7541335",
"0.7541335",
"0.7541335",
"0.7541335",
"0.7541335",
"0.7541335",
"0.7541335",
"0.7541335",
"0.7541335",
"0.7541335",
"0.7541335",
"0.7540784"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_event
@event = Event.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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def event_params
params.require(:event).permit(:kind, :source_id, :target, :target_id, :data)
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
Create a new client Permissions Needed: CLIENTS_ADMIN | def create_client(opts = {})
data, _status_code, _headers = create_client_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_client\n if current_admin.present?\n @client = Client.new(params[:client])\n respond_to do |format|\n if @client.save\n flash[:notice] = \"Client has been successfully added!\"\n format.html { redirect_to root_url }\n format.json { render json: @client, sta... | [
"0.6756088",
"0.6755407",
"0.6677395",
"0.65934587",
"0.653709",
"0.6326032",
"0.6255968",
"0.61949843",
"0.61949843",
"0.61949843",
"0.61888593",
"0.6142318",
"0.6091746",
"0.60890454",
"0.6060747",
"0.6039872",
"0.6039872",
"0.6012213",
"0.59676063",
"0.5962644",
"0.5923563... | 0.0 | -1 |
Create a new client Permissions Needed: CLIENTS_ADMIN | def create_client_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: AuthClientsApi.create_client ..."
end
# resource path
local_var_path = "/auth/clients"
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'client_resource'])
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'ClientResource')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AuthClientsApi#create_client\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_client\n if current_admin.present?\n @client = Client.new(params[:client])\n respond_to do |format|\n if @client.save\n flash[:notice] = \"Client has been successfully added!\"\n format.html { redirect_to root_url }\n format.json { render json: @client, sta... | [
"0.6755048",
"0.6754512",
"0.66780716",
"0.6593098",
"0.6536805",
"0.6325192",
"0.6254486",
"0.61948067",
"0.61948067",
"0.61948067",
"0.61873",
"0.614117",
"0.6090556",
"0.60893184",
"0.6059671",
"0.6039587",
"0.6039587",
"0.60124254",
"0.5966313",
"0.596117",
"0.592423",
... | 0.0 | -1 |
Delete a client Permissions Needed: CLIENTS_ADMIN | def delete_client(client_key, opts = {})
delete_client_with_http_info(client_key, opts)
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n if current_admin.present?\n @client = Client.friendly.find(params[:id])\n @client.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n else\n redirect_to new_admin_session_path and return\n ... | [
"0.70938194",
"0.70607996",
"0.69763136",
"0.6761677",
"0.67564",
"0.6725539",
"0.66437656",
"0.6617015",
"0.6572416",
"0.6554367",
"0.6472325",
"0.6450071",
"0.6432797",
"0.64276",
"0.64209247",
"0.6399763",
"0.635977",
"0.63577837",
"0.63132614",
"0.6309929",
"0.626462",
... | 0.0 | -1 |
Delete a client Permissions Needed: CLIENTS_ADMIN | def delete_client_with_http_info(client_key, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: AuthClientsApi.delete_client ..."
end
# verify the required parameter 'client_key' is set
if @api_client.config.client_side_validation && client_key.nil?
fail ArgumentError, "Missing the required parameter 'client_key' when calling AuthClientsApi.delete_client"
end
# resource path
local_var_path = "/auth/clients/{client_key}".sub('{' + 'client_key' + '}', client_key.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AuthClientsApi#delete_client\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n if current_admin.present?\n @client = Client.friendly.find(params[:id])\n @client.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n else\n redirect_to new_admin_session_path and return\n ... | [
"0.70948076",
"0.70623535",
"0.6977734",
"0.6764438",
"0.675906",
"0.6727153",
"0.66460675",
"0.661989",
"0.65741473",
"0.6555396",
"0.64737004",
"0.64518595",
"0.6435102",
"0.6429086",
"0.64187413",
"0.64019334",
"0.6363013",
"0.63600385",
"0.6316184",
"0.6308883",
"0.626651... | 0.0 | -1 |
Get a single client Permissions Needed: CLIENTS_ADMIN | def get_client(client_key, opts = {})
data, _status_code, _headers = get_client_with_http_info(client_key, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clients\n if self.is_admin?\n User.where(client_id: self.id)\n else\n raise Unauthorized.new(self)\n end\n end",
"def admin_only\n current_client == current_user\n unless current_user.admin? || @client == current_user\n redirect_to clients_path, :alert => \"Access denied.\"\... | [
"0.65013844",
"0.6407802",
"0.6240887",
"0.6240846",
"0.62308383",
"0.6061652",
"0.6015361",
"0.6005349",
"0.600177",
"0.5937722",
"0.5936335",
"0.5936335",
"0.592541",
"0.5923635",
"0.5912228",
"0.5861108",
"0.58349955",
"0.5824035",
"0.57966584",
"0.5794813",
"0.5787114",
... | 0.0 | -1 |
Get a single client Permissions Needed: CLIENTS_ADMIN | def get_client_with_http_info(client_key, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: AuthClientsApi.get_client ..."
end
# verify the required parameter 'client_key' is set
if @api_client.config.client_side_validation && client_key.nil?
fail ArgumentError, "Missing the required parameter 'client_key' when calling AuthClientsApi.get_client"
end
# resource path
local_var_path = "/auth/clients/{client_key}".sub('{' + 'client_key' + '}', client_key.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'ClientResource')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AuthClientsApi#get_client\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clients\n if self.is_admin?\n User.where(client_id: self.id)\n else\n raise Unauthorized.new(self)\n end\n end",
"def admin_only\n current_client == current_user\n unless current_user.admin? || @client == current_user\n redirect_to clients_path, :alert => \"Access denied.\"\... | [
"0.6498664",
"0.64076114",
"0.6241257",
"0.6241042",
"0.62317336",
"0.60626817",
"0.6013111",
"0.60067415",
"0.60010797",
"0.59387505",
"0.59366024",
"0.59366024",
"0.5925734",
"0.5922243",
"0.59131044",
"0.5860945",
"0.5836367",
"0.58243454",
"0.579824",
"0.5795112",
"0.5787... | 0.0 | -1 |
List available client grant types Permissions Needed: CLIENTS_ADMIN | def get_client_grant_types(opts = {})
data, _status_code, _headers = get_client_grant_types_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectable_access_types\n [['Unrestricted Access', 'open'], ['Controlled Access', 'restricted'], ['Other', 'closed']]\n end",
"def permission_grants\n return @permission_grants\n end",
"def get_client_grant_types_with_http_info(opts = {})\n if @api_client.config.debugging... | [
"0.65638596",
"0.6342415",
"0.6166175",
"0.6128732",
"0.6124347",
"0.6105904",
"0.606991",
"0.6004055",
"0.5972181",
"0.5972181",
"0.59376705",
"0.59184635",
"0.59138775",
"0.59081113",
"0.5902747",
"0.5900028",
"0.5882678",
"0.5863363",
"0.5851762",
"0.5798788",
"0.5765154",... | 0.5748296 | 22 |
List available client grant types Permissions Needed: CLIENTS_ADMIN | def get_client_grant_types_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: AuthClientsApi.get_client_grant_types ..."
end
# resource path
local_var_path = "/auth/clients/grant-types"
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Array<GrantTypeResource>')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AuthClientsApi#get_client_grant_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectable_access_types\n [['Unrestricted Access', 'open'], ['Controlled Access', 'restricted'], ['Other', 'closed']]\n end",
"def permission_grants\n return @permission_grants\n end",
"def index\n authorize TokenPermissionType\n @user = current_user\n @token_types = ... | [
"0.6562073",
"0.6342697",
"0.6129001",
"0.6124704",
"0.61060095",
"0.6069288",
"0.60035634",
"0.5972428",
"0.5972428",
"0.5937674",
"0.5920276",
"0.5914438",
"0.59081674",
"0.5902472",
"0.5898934",
"0.58825964",
"0.5861749",
"0.58508664",
"0.5799277",
"0.57662207",
"0.5760996... | 0.6165363 | 2 |
List and search clients Permissions Needed: CLIENTS_ADMIN | def get_clients(opts = {})
data, _status_code, _headers = get_clients_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clients = current_user.is_admin ? Client.all : current_user.clients\n end",
"def index\n @can_see_all = [\"Super Admin\", \"Recruitment Company Manager\", \"Recruirment Company Administrator\"]\n if @can_see_all.include?(current_user.role)\n @clients = Client.all\n elsif curr... | [
"0.7128356",
"0.6961914",
"0.6891247",
"0.6646638",
"0.63338757",
"0.6293607",
"0.6293607",
"0.6190661",
"0.6152607",
"0.6140282",
"0.6132658",
"0.6113622",
"0.6106175",
"0.6102758",
"0.6093877",
"0.60434055",
"0.6025993",
"0.60111105",
"0.6008119",
"0.59889483",
"0.5967523",... | 0.0 | -1 |
List and search clients Permissions Needed: CLIENTS_ADMIN | def get_clients_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: AuthClientsApi.get_clients ..."
end
# resource path
local_var_path = "/auth/clients"
# query parameters
query_params = {}
query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'PageResourceClientResource')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AuthClientsApi#get_clients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clients = current_user.is_admin ? Client.all : current_user.clients\n end",
"def index\n @can_see_all = [\"Super Admin\", \"Recruitment Company Manager\", \"Recruirment Company Administrator\"]\n if @can_see_all.include?(current_user.role)\n @clients = Client.all\n elsif curr... | [
"0.7128356",
"0.6961914",
"0.6891247",
"0.6646638",
"0.63338757",
"0.6293607",
"0.6293607",
"0.6190661",
"0.6152607",
"0.6140282",
"0.6132658",
"0.6113622",
"0.6106175",
"0.6102758",
"0.6093877",
"0.60434055",
"0.6025993",
"0.60111105",
"0.6008119",
"0.59889483",
"0.5967523",... | 0.0 | -1 |
Set grant types for a client Permissions Needed: CLIENTS_ADMIN | def set_client_grant_types(client_key, opts = {})
set_client_grant_types_with_http_info(client_key, opts)
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAsAdmin\n self.clientType = CLIENT_TYPES[:administrator]\n end",
"def set_client_grant_types_with_http_info(client_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthClientsApi.set_client_grant_types ...\"\n end\n # verify the r... | [
"0.6749127",
"0.6235527",
"0.5951453",
"0.59220773",
"0.58158356",
"0.57421935",
"0.5741886",
"0.5654136",
"0.56527174",
"0.56420726",
"0.55836827",
"0.55836827",
"0.55749786",
"0.5564271",
"0.5549851",
"0.5547697",
"0.55368173",
"0.55150187",
"0.5508274",
"0.5476101",
"0.545... | 0.632022 | 1 |
Set grant types for a client Permissions Needed: CLIENTS_ADMIN | def set_client_grant_types_with_http_info(client_key, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: AuthClientsApi.set_client_grant_types ..."
end
# verify the required parameter 'client_key' is set
if @api_client.config.client_side_validation && client_key.nil?
fail ArgumentError, "Missing the required parameter 'client_key' when calling AuthClientsApi.set_client_grant_types"
end
# resource path
local_var_path = "/auth/clients/{client_key}/grant-types".sub('{' + 'client_key' + '}', client_key.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'grant_list'])
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AuthClientsApi#set_client_grant_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAsAdmin\n self.clientType = CLIENT_TYPES[:administrator]\n end",
"def set_client_grant_types(client_key, opts = {})\n set_client_grant_types_with_http_info(client_key, opts)\n return nil\n end",
"def permission_grants=(value)\n @permission_grants = value\n end"... | [
"0.67471355",
"0.6318787",
"0.5953652",
"0.59211653",
"0.5817435",
"0.574166",
"0.5741496",
"0.5653271",
"0.565278",
"0.5641202",
"0.55820715",
"0.55820715",
"0.55748105",
"0.5565464",
"0.5549495",
"0.5547859",
"0.5533938",
"0.5513728",
"0.5507648",
"0.5477211",
"0.54574317",... | 0.6234344 | 2 |
Set redirect uris for a client Permissions Needed: CLIENTS_ADMIN | def set_client_redirect_uris(client_key, opts = {})
set_client_redirect_uris_with_http_info(client_key, opts)
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_uri\n\t\t@client.authorization.authorization_uri.to_s\n\tend",
"def redirectUris=(uris)\n self.redirect_url = uris.first\n end",
"def redirect_uris=(value)\n @redirect_uris = value\n end",
"def set_client_redirect_uris_with_http_info(client_key, opts = {})\n ... | [
"0.65145737",
"0.6443263",
"0.6387227",
"0.6206579",
"0.6041785",
"0.59709054",
"0.5942265",
"0.5920471",
"0.5872605",
"0.5872605",
"0.5872605",
"0.5868436",
"0.5862209",
"0.58477515",
"0.583429",
"0.5807522",
"0.58016306",
"0.58016306",
"0.5796743",
"0.5780076",
"0.572303",
... | 0.6181837 | 4 |
Set redirect uris for a client Permissions Needed: CLIENTS_ADMIN | def set_client_redirect_uris_with_http_info(client_key, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: AuthClientsApi.set_client_redirect_uris ..."
end
# verify the required parameter 'client_key' is set
if @api_client.config.client_side_validation && client_key.nil?
fail ArgumentError, "Missing the required parameter 'client_key' when calling AuthClientsApi.set_client_redirect_uris"
end
# resource path
local_var_path = "/auth/clients/{client_key}/redirect-uris".sub('{' + 'client_key' + '}', client_key.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'redirect_list'])
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AuthClientsApi#set_client_redirect_uris\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_uri\n\t\t@client.authorization.authorization_uri.to_s\n\tend",
"def redirectUris=(uris)\n self.redirect_url = uris.first\n end",
"def redirect_uris=(value)\n @redirect_uris = value\n end",
"def set_client_redirect_uris(client_key, opts = {})\n set_client_re... | [
"0.6516425",
"0.6448733",
"0.6392426",
"0.6186415",
"0.6046208",
"0.59661514",
"0.59398836",
"0.5925291",
"0.5876381",
"0.5876381",
"0.5876381",
"0.5868704",
"0.5863573",
"0.58434033",
"0.5836791",
"0.58096844",
"0.5807419",
"0.5807419",
"0.5794649",
"0.5781212",
"0.5724673",... | 0.62096614 | 3 |
Update a client Permissions Needed: CLIENTS_ADMIN | def update_client(client_key, opts = {})
data, _status_code, _headers = update_client_with_http_info(client_key, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAsAdmin\n self.clientType = CLIENT_TYPES[:administrator]\n end",
"def update_access_controls!\n update!(edit_users: permission_template.agent_ids_for(access: 'manage', agent_type: 'user'),\n edit_groups: permission_template.agent_ids_for(access: 'manage', agent_type: 'group'))\n e... | [
"0.707893",
"0.66039276",
"0.65194345",
"0.6424768",
"0.6393222",
"0.6345672",
"0.62554944",
"0.6234296",
"0.6155328",
"0.6113677",
"0.60930145",
"0.6082807",
"0.6082263",
"0.6073434",
"0.6042732",
"0.6015323",
"0.6011491",
"0.59914756",
"0.59791446",
"0.5966778",
"0.5961278"... | 0.0 | -1 |
Update a client Permissions Needed: CLIENTS_ADMIN | def update_client_with_http_info(client_key, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: AuthClientsApi.update_client ..."
end
# verify the required parameter 'client_key' is set
if @api_client.config.client_side_validation && client_key.nil?
fail ArgumentError, "Missing the required parameter 'client_key' when calling AuthClientsApi.update_client"
end
# resource path
local_var_path = "/auth/clients/{client_key}".sub('{' + 'client_key' + '}', client_key.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(opts[:'client_resource'])
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'ClientResource')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: AuthClientsApi#update_client\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAsAdmin\n self.clientType = CLIENT_TYPES[:administrator]\n end",
"def update_access_controls!\n update!(edit_users: permission_template.agent_ids_for(access: 'manage', agent_type: 'user'),\n edit_groups: permission_template.agent_ids_for(access: 'manage', agent_type: 'group'))\n e... | [
"0.7078628",
"0.6603347",
"0.65213174",
"0.6425867",
"0.6394051",
"0.63459015",
"0.6256345",
"0.62342703",
"0.6156948",
"0.61159724",
"0.6092262",
"0.6082958",
"0.6080985",
"0.60726327",
"0.6042272",
"0.60157335",
"0.60112375",
"0.5992724",
"0.5978067",
"0.5966109",
"0.596200... | 0.0 | -1 |
set params for ocr field searching | def ocr_search_params(solr_parameters = {})
solr_parameters[:facet] = false
solr_parameters[:hl] = true
solr_parameters[:'hl.fl'] = blacklight_config.iiif_search[:full_text_field]
solr_parameters[:'hl.fragsize'] = 100
solr_parameters[:'hl.snippets'] = 10
solr_parameters[:qf] = blacklight_config.iiif_search[:full_text_field]
# catalog controller puts params here when you call search_results
solr_parameters[:fq] = solr_parameters[:fq] || []
solr_parameters[:fq] += blacklight_params[:fq]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ocr_search_params(solr_parameters = {})\n solr_parameters[:facet] = false\n solr_parameters[:hl] = true\n solr_parameters[:'hl.fl'] = blacklight_config.ocr_search_field\n solr_parameters[:'hl.fragsize'] = 135\n solr_parameters[:'hl.snippets'] = 10\n end",
"def search_params search... | [
"0.760696",
"0.6676922",
"0.65110457",
"0.64984554",
"0.6414773",
"0.6306247",
"0.62911904",
"0.62451345",
"0.6193345",
"0.6171417",
"0.61288744",
"0.6111483",
"0.6070151",
"0.60491574",
"0.6036613",
"0.6005338",
"0.60021895",
"0.59857905",
"0.5978341",
"0.5956901",
"0.594140... | 0.73753035 | 1 |
GET /places GET /places.json | def index
# if !session[:access_token]
# redirect_to Instagram.authorize_url(:redirect => 'http://localhost:3000')
# elsif response.access_token.present?
@places = Place.all
puts @places
@hash = Gmaps4rails.build_markers(@places) do |place, marker|
marker.lat place.latitude
marker.lng place.longitude
marker.infowindow render_to_string(:partial => "places/infowindow", :locals => { :place => place})
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render json: @places\n end",
"def index\n @places = Place.all\n\n respond_to do |format|\n format.html\n format.json { render json: @places }\n end\n end",
"def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.78389436",
"0.7674796",
"0.7626472",
"0.74537194",
"0.74348694",
"0.7306086",
"0.72399825",
"0.72012126",
"0.7180925",
"0.7168759",
"0.7166474",
"0.71347314",
"0.7120634",
"0.7120634",
"0.7120634",
"0.70995235",
"0.7078512",
"0.70782316",
"0.70677066",
"0.7065581",
"0.7065... | 0.0 | -1 |
def instagram_callback return if session[:access_token] response = Instagram.get_access_token(params[:code], :redirect_uri => CALLBACK_URL) session[:access_token] = response.access_token redirect_to places_path end GET /places/1 GET /places/1.json | def show
@places = Place.all
@hash = Gmaps4rails.build_markers(@places) do |place, marker|
marker.lat place.latitude
marker.lng place.longitude
marker.infowindow render_to_string(:partial => "places/infowindow", :locals => { :place => place})
end
client = Instagram.client(:access_token => session[:access_token])
@results = client.media_search(@place.latitude, @place.longitude, :distance => 11)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_callback\n # puts \"INTAGRAM CLIENT response ACCESS TOKEN ???? #{params.inspect}\"\n if params[:access_token]\n session[:instagram_access_token] = params[:access_token]\n # puts \"INTAGRAM SESSION TOKEN #{params[:access_token].inspect}\"\n\n end\n respond_to do |format|\n forma... | [
"0.8218258",
"0.7499104",
"0.74749863",
"0.74221736",
"0.7229825",
"0.71996164",
"0.7139828",
"0.7107361",
"0.7099143",
"0.70876646",
"0.7074591",
"0.69892776",
"0.6972152",
"0.6970138",
"0.6965504",
"0.6854065",
"0.6806354",
"0.67969114",
"0.67210394",
"0.6617261",
"0.661496... | 0.6042103 | 49 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.