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 |
|---|---|---|---|---|---|---|
Returns the account for this business linked to a "money" program with is_money == true | def cashbox
return @cashbox if @cashbox.present?
return nil unless has_money_program?
@cashbox = self.accounts.where(:program_id => money_program.id, :is_money => true).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_account\n accounts.currency_code_is(\"flc\").first\n end",
"def payment_entry\n business_account.entries.find { |e|\n e.code == number.to_s and not e.accounts.include? commodity_account\n }\n end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self... | [
"0.6982914",
"0.68794227",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.6677856",
"0.6670226",
"0.6612918",
"0.6459652",
"0.644602",
"0.64443004",
"0.6411041",
"0.6390428",
"0.63... | 0.69634044 | 1 |
This method checks for any place is set to true or not | def is_any_primary?
self.places.each do |place|
return place.is_primary? == true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coarticulated?\n place.size > 1\n end",
"def placed?\n # check if we currently have everything we need for our current_position\n return !@current_position[:x].nil? && !@current_position[:y].nil? && !@current_position[:direction].nil?\n end",
"def placed?\n !current_placement.... | [
"0.7195538",
"0.67494684",
"0.66716576",
"0.6662474",
"0.65965015",
"0.6582582",
"0.65427417",
"0.65343237",
"0.65119374",
"0.6451466",
"0.64111793",
"0.6404873",
"0.6397836",
"0.6350714",
"0.6319925",
"0.63129866",
"0.6292121",
"0.62672865",
"0.623975",
"0.61843365",
"0.6161... | 0.6228267 | 19 |
def encrypt_password if password.present? self.password_salt = BCrypt::Engine.generate_salt self.password_hash = BCrypt::Engine.hash_secret(password, password_salt) end end | def get_user(uid)
@inv = User.find_by_id(uid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n\n if password.present?\n\n self.password_salt = BCrypt::Engine.generate_sa... | [
"0.97585744",
"0.9730521",
"0.96352077",
"0.96352077",
"0.96352077",
"0.96352077",
"0.96352077",
"0.9615684",
"0.96124494",
"0.9602712",
"0.9582362",
"0.95505273",
"0.9546148",
"0.9529659",
"0.9490923",
"0.9485892",
"0.94757485",
"0.94549435",
"0.94021964",
"0.93527305",
"0.9... | 0.0 | -1 |
each is blocking while the connection persists call close in the given block to make each return | def each
return enum_for(:each) unless block_given?
while event = next_event
yield event
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n @pool.with do |conn|\n conn.send_query @sql\n conn.set_single_row_mode\n loop do\n res = conn.get_result\n break unless res\n res.check\n res.stream_each { |row| yield row }\n end\n end\n end",
"def each\n\t\t\t\t\twhile chun... | [
"0.70007807",
"0.68851066",
"0.6740391",
"0.6699022",
"0.65327257",
"0.65327257",
"0.65183467",
"0.65015453",
"0.64238983",
"0.6330063",
"0.6310066",
"0.62871075",
"0.62767124",
"0.62587565",
"0.62560415",
"0.6248892",
"0.62270975",
"0.61665344",
"0.61577666",
"0.6139217",
"0... | 0.0 | -1 |
Tries to detect the current processor based if any of the processors exist. Mogrify have precedence over gm by default. === Returns [String] The detected procesor | def choose_processor
self.processor = if MiniMagick::Utilities.which('mogrify')
:mogrify
elsif MiniMagick::Utilities.which('gm')
:gm
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gm?\n choose_processor if processor.nil?\n\n return processor.to_s.downcase.to_sym == :gm unless processor.nil?\n false\n end",
"def mogrify?\n choose_processor if processor.nil?\n\n return processor.to_s.downcase.to_sym == :mogrify unless processor.nil?\n false\n end",
... | [
"0.74321014",
"0.7190223",
"0.6387016",
"0.6373831",
"0.60417885",
"0.5790201",
"0.5749444",
"0.5714313",
"0.57106245",
"0.56824136",
"0.55886793",
"0.5558089",
"0.5539528",
"0.55147165",
"0.54887444",
"0.5444319",
"0.5433147",
"0.5340609",
"0.5298695",
"0.5288989",
"0.527379... | 0.74514323 | 0 |
Discovers the imagemagick version based on mogrify's output. === Returns The imagemagick version | def image_magick_version
@@version ||= Gem::Version.create(`mogrify --version`.split(' ')[2].split('-').first)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imagemagick7?; end",
"def valid_version_installed?\n image_magick_version >= minimum_image_magick_version\n end",
"def version\n Gem.loaded_specs['image_optim'].version.to_s\n rescue\n 'DEV'\n end",
"def minimum_image_magick_version\n @@minimum_version ||= Gem::Version.create... | [
"0.6637482",
"0.65219146",
"0.6472974",
"0.64288706",
"0.63321644",
"0.62835586",
"0.61837244",
"0.590618",
"0.58283144",
"0.5734902",
"0.5685154",
"0.56706923",
"0.561554",
"0.5570928",
"0.55627096",
"0.5544048",
"0.55422163",
"0.550007",
"0.5496064",
"0.5496064",
"0.5496064... | 0.8131971 | 0 |
The minimum allowed imagemagick version === Returns The minimum imagemagick version | def minimum_image_magick_version
@@minimum_version ||= Gem::Version.create('6.6.3')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_version_installed?\n image_magick_version >= minimum_image_magick_version\n end",
"def image_magick_version\n @@version ||= Gem::Version.create(`mogrify --version`.split(' ')[2].split('-').first)\n end",
"def os_minimum_version\n return @os_minimum_version\n ... | [
"0.7833048",
"0.766381",
"0.67313546",
"0.67313546",
"0.6671334",
"0.6591078",
"0.6586556",
"0.6427364",
"0.6194594",
"0.6013946",
"0.59711105",
"0.59376246",
"0.59376246",
"0.5827781",
"0.5827781",
"0.5811156",
"0.5773059",
"0.5773059",
"0.5773059",
"0.5725629",
"0.5670229",... | 0.8851184 | 0 |
Checks whether the imagemagick's version is valid === Returns [Boolean] | def valid_version_installed?
image_magick_version >= minimum_image_magick_version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n validate!\n true\n rescue MiniMagick::Invalid\n false\n end",
"def valid?\n image_resource? && supported_format?\n end",
"def invalid?\n %w(undefined 0).include?(version.to_s)\n end",
"def valid_version?\n !statement[\"ver\"].empty?\n end",
"def val... | [
"0.7430224",
"0.70996916",
"0.7020582",
"0.6940662",
"0.69345105",
"0.6854174",
"0.6702889",
"0.6696321",
"0.6671831",
"0.6659723",
"0.6572059",
"0.6560966",
"0.65524983",
"0.65450585",
"0.64926857",
"0.6492017",
"0.6451872",
"0.64208996",
"0.6383397",
"0.63796216",
"0.637726... | 0.8595329 | 0 |
Picks the right processor if it isn't set and returns whether it's mogrify or not. === Returns [Boolean] | def mogrify?
choose_processor if processor.nil?
return processor.to_s.downcase.to_sym == :mogrify unless processor.nil?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gm?\n choose_processor if processor.nil?\n\n return processor.to_s.downcase.to_sym == :gm unless processor.nil?\n false\n end",
"def choose_processor\n self.processor = if MiniMagick::Utilities.which('mogrify')\n :mogrify\n elsif MiniMagick... | [
"0.7781849",
"0.74955004",
"0.63985616",
"0.62639934",
"0.61793256",
"0.59958065",
"0.5983024",
"0.58769286",
"0.58340687",
"0.5832451",
"0.5798496",
"0.57964385",
"0.5730911",
"0.56767637",
"0.56473035",
"0.56198865",
"0.5616269",
"0.5589491",
"0.5588428",
"0.55843437",
"0.5... | 0.8571836 | 0 |
Picks the right processor if it isn't set and returns whether it's graphicsmagick or not. === Returns [Boolean] | def gm?
choose_processor if processor.nil?
return processor.to_s.downcase.to_sym == :gm unless processor.nil?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_processor\n self.processor = if MiniMagick::Utilities.which('mogrify')\n :mogrify\n elsif MiniMagick::Utilities.which('gm')\n :gm\n else\n nil\n end\n end",
... | [
"0.7287053",
"0.725614",
"0.67848223",
"0.66996956",
"0.62745863",
"0.61968267",
"0.5919397",
"0.5857916",
"0.58336717",
"0.5826745",
"0.5820798",
"0.5733881",
"0.5703429",
"0.5697703",
"0.56916964",
"0.5678483",
"0.5641339",
"0.5613499",
"0.56020576",
"0.5601356",
"0.5584178... | 0.7643658 | 0 |
entry point for application | def start args = ARGV
load_user_config
load_builtin_tasks
load_hemfiles
load_project_config
define_global_opts @slop
begin
# Parse out global args first
@slop.parse! args
opts = @slop.to_hash
@help_opts[:all] = opts[:all]
# Necessary to make command level help work
args.push "--help" if @slop.help? || args.empty?
include_pre_tasks
remaining = @slop.parse! args.dup
remaining.push "--help" if @slop.help?
if remaining == args
include_post_tasks opts
remaining = @slop.parse! remaining
end
raise Hem::InvalidCommandOrOpt.new remaining.join(" ") if remaining.size > 0
show_help if @slop.help?
rescue Halt
# NOP
end
return 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def main\n @app.main\n end",
"def run_main\n end",
"def app; @app; end",
"def main\n\n end",
"def main\n end",
"... | [
"0.8055486",
"0.8055486",
"0.8055486",
"0.8055486",
"0.8055486",
"0.8055486",
"0.8055486",
"0.8055486",
"0.8055486",
"0.8055486",
"0.79338986",
"0.74301225",
"0.7415379",
"0.74061334",
"0.7346861",
"0.72432274",
"0.722784",
"0.7167663",
"0.7167663",
"0.7167663",
"0.7149598",
... | 0.0 | -1 |
Display help and exit | def show_help(opts = {})
Hem.ui.info @help_formatter.help(@help_opts.merge(opts))
halt
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help\n\t\tself.usage(false)\n\t\texit EX_OK\n\tend",
"def dump_help_and_exit!\n dump_help\n exit(1)\n end",
"def help\n puts @option_parser\n exit\n end",
"def help\n end",
"def help\r\n end",
"def help\r\n end",
"def show_help(opts)\n puts opts\n exit 0\nend"... | [
"0.863563",
"0.8302719",
"0.8250372",
"0.824401",
"0.82272625",
"0.82272625",
"0.82191765",
"0.82191765",
"0.8172111",
"0.8119405",
"0.8103821",
"0.8103821",
"0.8103821",
"0.8103821",
"0.8103821",
"0.8103821",
"0.8103821",
"0.80702925",
"0.80702925",
"0.8059565",
"0.8040766",... | 0.73904884 | 57 |
Takes a nested hash of commands and creates nested Slop instances populated with metadata. | def define_tasks structured_list, scope, stack = [], map = {}
structured_list.each do |k, v|
name = (stack + [k]).join(':')
new_stack = stack + [k]
logger.debug("cli: Defined #{name}")
map[name] = if v.size == 0
define_command(name, scope, new_stack)
else
define_namespace(name, scope, new_stack, v, map)
end
end
return map
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_command_structure\n @command_structure = []\n @command_structure.push(@command[0])\n for i in 1...@command.length-1\n if i.odd?\n @command_structure.push(Command.new(@command[i],@command[i + 1]))\n end\n end\n end",
"def initialize(*commands)\n @options = (commands... | [
"0.54536486",
"0.5378789",
"0.53779125",
"0.5369003",
"0.53205115",
"0.5272554",
"0.51796025",
"0.5154473",
"0.51357627",
"0.5066331",
"0.50406563",
"0.50337934",
"0.49974543",
"0.4968119",
"0.49615702",
"0.49440807",
"0.49425286",
"0.49408606",
"0.49390024",
"0.4923642",
"0.... | 0.44670445 | 63 |
Map rake namespace to a Slop command | def define_namespace name, scope, stack, subtasks, map
metadata = Hem::Metadata.metadata[name]
hem = self
new_scope = nil
scope.instance_eval do
new_scope = command stack.last do
description metadata[:desc]
long_description metadata[:long_desc]
hidden metadata[:hidden]
project_only metadata[:project_only]
# NOP; run runs help anyway
on '-h', '--help', 'Display help' do end
run do |opts, args|
hem.show_help(target: name)
end
end
end
define_tasks subtasks, new_scope, stack, map
return new_scope
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command(name=nil)\n Runner.instance.namespace = name\n end",
"def rake(app_name, cmd)\n # deprecated by virtue of start deprecation 08/02/2012\n start(app_name, \"rake #{cmd}\", :attached).to_s\n end",
"def rake(*args) run_command('rake', args) end",
"def rake *args\n ruby \"-S\", \"rake\... | [
"0.65130705",
"0.6493772",
"0.6254906",
"0.61710477",
"0.6003229",
"0.5868888",
"0.5751845",
"0.5700486",
"0.5699123",
"0.56835294",
"0.56710213",
"0.5655488",
"0.5573082",
"0.5555707",
"0.5555707",
"0.5498449",
"0.5498361",
"0.5498361",
"0.5498361",
"0.5498361",
"0.5493917",... | 0.0 | -1 |
Map rake task to a Slop command | def define_command name, scope, stack
metadata = Hem::Metadata.metadata[name]
hem = self
new_scope = nil
scope.instance_eval do
new_scope = command stack.last do
task = Rake::Task[name]
description metadata[:desc]
long_description metadata[:long_desc]
arg_list metadata[:arg_list]
hidden metadata[:hidden]
project_only metadata[:project_only]
metadata[:opts].each do |opt|
on *opt
end if metadata[:opts]
on '-h', '--help', 'Display help' do
hem.show_help(target: name)
end
run do |opts, args|
Dir.chdir Hem.project_path if Hem.in_project?
raise ::Hem::ProjectOnlyError.new if opts.project_only && !Hem.in_project?
task.opts = opts.to_hash.merge({:_unparsed => hem.slop.unparsed})
task.invoke *Helper::convert_args(name, args, metadata[:arg_list])
task.opts = nil
end
end
end
return new_scope
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rake(*args) run_command('rake', args) end",
"def rake *args\n ruby \"-S\", \"rake\", *args\nend",
"def ruby_rake_task(task)\n Rake::Task[task].invoke\nend",
"def rake(app_name, cmd)\n # deprecated by virtue of start deprecation 08/02/2012\n start(app_name, \"rake #{cmd}\", :attached).to_s\n end"... | [
"0.6893453",
"0.67485726",
"0.6715381",
"0.67011565",
"0.64711857",
"0.64568585",
"0.64447886",
"0.64447886",
"0.64447886",
"0.64447886",
"0.6381223",
"0.637836",
"0.63599783",
"0.63541675",
"0.63445973",
"0.63445973",
"0.6327916",
"0.6319041",
"0.6317196",
"0.62988335",
"0.6... | 0.0 | -1 |
Expand flat task list in to hierarchy (nonrecursive) | def structure_tasks list
out = {}
list.each do |name|
ref = out
name = name.split(":")
name.each do |n|
ref[n] ||= {}
ref = ref[n]
end
end
out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten_task_tree\n tasks = [self]\n start_index = 0\n loop do\n end_index = tasks.length\n while start_index < end_index\n tasks.concat(tasks[start_index].next_tasks) unless tasks[start_index].next_tasks.nil?\n start_index += 1\n end\n break if end_... | [
"0.76510215",
"0.64929456",
"0.6402783",
"0.60095584",
"0.56561804",
"0.56138754",
"0.55426",
"0.5541791",
"0.55141824",
"0.55011356",
"0.5488265",
"0.5457188",
"0.540413",
"0.5402968",
"0.53750813",
"0.53746974",
"0.53572255",
"0.5333996",
"0.5331951",
"0.53180724",
"0.53154... | 0.5570728 | 6 |
if we have an object named tag we can ask for tag.articles. | def tag_list
self.tags.collect do |tag|
tag.name
end.join(", ") #When we joined the array Ruby called the default #to_s method on every one of these Tag instances
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def articles_by_tag\n # find tag\n @tag = Tag.find(params[:tag_id])\n # if tag is found, load articles which are accessible by current uer\n unless @tag.blank?\n @articles = @tag.articles.accessibles(current_user).paginate(page: params[:page], per_page: Article::PER_PAGE)\n end\n @more_link_... | [
"0.7420001",
"0.68833774",
"0.6719245",
"0.64155084",
"0.6382213",
"0.6359274",
"0.6282347",
"0.6183272",
"0.61719817",
"0.61466116",
"0.61183923",
"0.60992974",
"0.60889775",
"0.6005126",
"0.5905949",
"0.58935446",
"0.58617043",
"0.57964003",
"0.5776397",
"0.5750052",
"0.573... | 0.0 | -1 |
Returns a Project object identified by given string The following identifiers are accepted /gdc/md/ /gdc/projects/ | def [](id, options = {})
return id if id.respond_to?(:project?) && id.project?
if id == :all
Project.all
else
if id.to_s !~ %r{^(\/gdc\/(projects|md)\/)?[a-zA-Z\d]+$}
fail(ArgumentError, 'wrong type of argument. Should be either project ID or path')
end
id = id.match(/[a-zA-Z\d]+$/)[0] if id =~ /\//
response = GoodData.get PROJECT_PATH % id
Project.new response
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](id)\n return id if id.respond_to?(:is_project?) && id.is_project?\n if id == :all\n Project.all\n else\n if id.to_s !~ /^(\\/gdc\\/(projects|md)\\/)?[a-zA-Z\\d]+$/\n raise ArgumentError.new('wrong type of argument. Should be either project ID or path')\n ... | [
"0.714441",
"0.63858455",
"0.63714254",
"0.63254607",
"0.625838",
"0.6231655",
"0.62274665",
"0.61855274",
"0.6158891",
"0.61544067",
"0.61487347",
"0.6116764",
"0.6111021",
"0.60941035",
"0.5968301",
"0.5968301",
"0.5963218",
"0.5962752",
"0.5957147",
"0.5939222",
"0.5939222... | 0.6904942 | 1 |
Create a project from a given attributes Expected keys: :title (mandatory) :summary :template (default /projects/blank) | def create(attributes, &block)
GoodData.logger.info "Creating project #{attributes[:title]}"
auth_token = attributes[:auth_token] || GoodData.connection.auth_token
fail 'You have to provide your token for creating projects as :auth_token parameter' if auth_token.nil? || auth_token.empty?
json = {
'project' =>
{
'meta' => {
'title' => attributes[:title],
'summary' => attributes[:summary] || 'No summary'
},
'content' => {
'guidedNavigation' => attributes[:guided_navigation] || 1,
'authorizationToken' => auth_token,
'driver' => attributes[:driver] || 'Pg'
}
}
}
json['project']['meta']['projectTemplate'] = attributes[:template] if attributes[:template] && !attributes[:template].empty?
project = Project.new json
project.save
# until it is enabled or deleted, recur. This should still end if there is a exception thrown out from RESTClient. This sometimes happens from WebApp when request is too long
while project.state.to_s != 'enabled'
if project.state.to_s == 'deleted'
# if project is switched to deleted state, fail. This is usually problem of creating a template which is invalid.
fail 'Project was marked as deleted during creation. This usually means you were trying to create from template and it failed.'
end
sleep(3)
project.reload!
end
if block
GoodData.with_project(project) do |p|
block.call(p)
end
end
sleep 3
project
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(attributes, &block)\n GoodData.logger.info \"Creating project #{attributes[:title]}\"\n\n auth_token = attributes[:auth_token] || GoodData.connection.auth_token\n\n json = {:project =>\n {\n 'meta' => {\n 'title' => attributes... | [
"0.8320349",
"0.79774123",
"0.7497254",
"0.72329956",
"0.7230693",
"0.7163867",
"0.7096181",
"0.7064429",
"0.68343747",
"0.68101704",
"0.6772369",
"0.6758192",
"0.675522",
"0.6746101",
"0.6702313",
"0.6695158",
"0.6692445",
"0.6653899",
"0.66389066",
"0.66231376",
"0.6611315"... | 0.79261535 | 2 |
Takes one CSV line and creates hash from data extracted | def user_csv_import(row)
{
'user' => {
'content' => {
'email' => row[0],
'login' => row[1],
'firstname' => row[2],
'lastname' => row[3]
},
'meta' => {}
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_csv(file)\n data = CSV.read(file, {encoding: \"UTF-8\", headers: true, header_converters: :symbol, converters: :all})\n hashed_data = data.map { |d| d.to_hash } \n \n puts \"CSV Loaded...\"\n\n return hashed_data\n end",
"def prod_to_hash(csv_name)\n\tprod_array = CSV.read(csv_name)\n\... | [
"0.6965014",
"0.68393385",
"0.67873573",
"0.6761959",
"0.6737752",
"0.6650777",
"0.66477764",
"0.6640152",
"0.6618277",
"0.6585459",
"0.6563964",
"0.6487206",
"0.6465769",
"0.6424091",
"0.6342367",
"0.63341224",
"0.63157356",
"0.6311186",
"0.6287384",
"0.6273959",
"0.6267461"... | 0.57436514 | 62 |
Gets author of project | def author
# TODO: Return object instead
@json['project']['meta']['author']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_author()\n return @author\n end",
"def extract_author_name\n `git config user.name`.strip\n end",
"def get_author()\n @author\n end",
"def\n get_author()\n @author\n end",
"def author\n @author ||= begin\n UnfuddleAPI::People.find(self[:author_id]).username\... | [
"0.75654566",
"0.75434136",
"0.7531482",
"0.7456287",
"0.73964405",
"0.73358434",
"0.7323249",
"0.7306709",
"0.730264",
"0.72318107",
"0.7229581",
"0.72145975",
"0.71947294",
"0.71786714",
"0.71773136",
"0.71660554",
"0.715834",
"0.7139117",
"0.7107673",
"0.71068704",
"0.7090... | 0.81335694 | 0 |
Returns web interface URI of project | def browser_uri(options = {})
grey = options[:grey]
if grey
GoodData.connection.url + uri
else
GoodData.connection.url + '#s=' + uri
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_for_project_directory( project, options = nil )\n # setup_project_urls( project )\n # return the base url for this project\n project.domain + project.directory_url\n end",
"def project_url\n project_hash['html_url']\n end",
"def source_url(project)\n \"github.com/#{project.name}\"\... | [
"0.7483607",
"0.704913",
"0.68406487",
"0.6810691",
"0.67603",
"0.6752918",
"0.6749367",
"0.66254455",
"0.6622132",
"0.66112304",
"0.65966666",
"0.65966666",
"0.659164",
"0.65810573",
"0.6569338",
"0.6568283",
"0.6565655",
"0.653751",
"0.65227103",
"0.65227103",
"0.65227103",... | 0.0 | -1 |
Gets the date when created | def created
DateTime.parse(@json['project']['meta']['created'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_t... | [
"0.8560904",
"0.85166",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
"0.85162914",
... | 0.0 | -1 |
Gets ruby wrapped raw project JSON data | def data
raw_data['project']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json\n if project.source_exists?\n JSON.parse(File.read(project.project_path))\n else\n []\n end\n end",
"def getProject(projectName)\n data = CLIENT.repository(projectName)\n return data\nend",
"def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, ... | [
"0.70782727",
"0.6797672",
"0.6551246",
"0.6530466",
"0.6362855",
"0.6343553",
"0.6287911",
"0.6110015",
"0.60831463",
"0.6057243",
"0.60512817",
"0.6028828",
"0.60168654",
"0.5995319",
"0.5976462",
"0.59062135",
"0.58701104",
"0.5859514",
"0.5852959",
"0.58440536",
"0.581069... | 0.78173083 | 0 |
Gets processes for the project | def processes
GoodData::Process.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processes\n request('getAllProcessInfo')\n end",
"def processes\n\t\tif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos = `uname -s`.chomp\n\t\t\tif os == \"Linux\"\n\t\t\t\tresolve_unix_uids(linux_processes)\n\t\t\telsif os == \"Darwin\" or os == \"FreeBSD\"\n\t\t\t\tos... | [
"0.80347586",
"0.74158776",
"0.72340024",
"0.713875",
"0.7050003",
"0.7050003",
"0.7041058",
"0.69955397",
"0.6994636",
"0.691956",
"0.6894043",
"0.6835446",
"0.6757749",
"0.67367315",
"0.6736554",
"0.6707742",
"0.66298705",
"0.6589174",
"0.65719426",
"0.6502011",
"0.6502011"... | 0.6117287 | 31 |
Deletes dashboards for project | def delete_dashboards
Dashboard.all.map { |data| Dashboard[data['link']] }.each { |d| d.delete }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n conf.delete 'dashboard'\n end",
"def destroy\n @dashboard_project.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_dashboard(das... | [
"0.69312346",
"0.6843769",
"0.6836013",
"0.67823917",
"0.673084",
"0.6690916",
"0.6652889",
"0.66266125",
"0.661454",
"0.6568845",
"0.65664697",
"0.65664697",
"0.65664697",
"0.65664697",
"0.65664697",
"0.6409158",
"0.6402482",
"0.63316554",
"0.6320223",
"0.61900336",
"0.61697... | 0.80604047 | 0 |
Gets project role by its identifier | def get_role_by_identifier(role_name, role_list = roles)
role_name = role_name.downcase.gsub(/role$/, '')
role_list.each do |role|
tmp_role_name = role.identifier.downcase.gsub(/role$/, '')
return role if tmp_role_name == role_name
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_role user\n project_role_user = ProjectRoleUser.where(:project_id => self, :user_id => user).first\n if project_role_user\n project_role_user.role.name\n else\n nil\n end\n end",
"def GetRole id\n\n APICall(path: \"custom_roles/#{id}.json\")\n\n end",
"def role(id)\n ... | [
"0.71927595",
"0.7185642",
"0.70451254",
"0.69949067",
"0.69549805",
"0.69331217",
"0.67824197",
"0.6763306",
"0.66385937",
"0.6515117",
"0.6489144",
"0.64808166",
"0.6477828",
"0.6477828",
"0.64731944",
"0.64712024",
"0.64600474",
"0.6452943",
"0.6446945",
"0.6445987",
"0.63... | 0.642811 | 20 |
Gets project role byt its summary | def get_role_by_summary(role_summary, role_list = roles)
role_list.each do |role|
return role if role.summary.downcase == role_summary.downcase
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_role user\n project_role_user = ProjectRoleUser.where(:project_id => self, :user_id => user).first\n if project_role_user\n project_role_user.role.name\n else\n nil\n end\n end",
"def display_role\n ROLE_LIST[self.role]\n end",
"def getProjectActorByRole\n if @role.nil? an... | [
"0.69252276",
"0.65983015",
"0.65933084",
"0.6576181",
"0.64411587",
"0.64147127",
"0.6348822",
"0.6348822",
"0.6281939",
"0.62592596",
"0.6209841",
"0.62093836",
"0.6200686",
"0.6200608",
"0.61546564",
"0.61338323",
"0.61338323",
"0.61308676",
"0.61137",
"0.61130714",
"0.610... | 0.6995733 | 0 |
Gets project role by its name | def get_role_by_title(role_title, role_list = roles)
role_list.each do |role|
return role if role.title.downcase == role_title.downcase
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_role(role_name)\n self.class.get_role(role_name)\n end",
"def find_role(name)\n self.roles.find {|a| a.name == name}\n end",
"def get_role user\n project_role_user = ProjectRoleUser.where(:project_id => self, :user_id => user).first\n if project_role_user\n project_role_user.role... | [
"0.7902128",
"0.7890013",
"0.7770981",
"0.7427956",
"0.73989105",
"0.73483276",
"0.7089635",
"0.700193",
"0.68303025",
"0.67435557",
"0.66361576",
"0.6587511",
"0.656318",
"0.65623057",
"0.65403694",
"0.653453",
"0.6516624",
"0.64940065",
"0.6435678",
"0.64017296",
"0.6385283... | 0.5862698 | 80 |
Gets user by its email, full_name, login or uri | def get_user(name, user_list = users)
return name if name.instance_of?(GoodData::Membership)
name.downcase!
user_list.each do |user|
return user if user.uri.downcase == name ||
user.login.downcase == name ||
user.email.downcase == name
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_by_email(email)\n get(\"get_user_by_email&email=#{email}\")\n end",
"def get_user(name, user_list = users)\n return member(name) if name.instance_of?(GoodData::Membership)\n return member(name) if name.instance_of?(GoodData::Profile)\n name = name.is_a?(Hash) ? name[:login] ||... | [
"0.7440288",
"0.73696816",
"0.7223716",
"0.70032763",
"0.6917902",
"0.6887149",
"0.6869737",
"0.68231744",
"0.6805159",
"0.68003166",
"0.67992693",
"0.67870873",
"0.6757296",
"0.67553675",
"0.6752607",
"0.67427224",
"0.6657986",
"0.665711",
"0.6654087",
"0.6640529",
"0.660904... | 0.7276652 | 2 |
Initializes object instance from raw wire JSON | def initialize(json)
@json = json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(json:)\n @raw_json = json\n end",
"def initialize(resource_json)\n @json = JSON.parse(resource_json)\n parse_base\n end",
"def initialize(json)\n @info = json if json.is_a? Hash\n @info ||= JSON.parse(json)\n end",
"def initialize(data = nil)\n ActiveSuppor... | [
"0.7994019",
"0.74328977",
"0.7280297",
"0.7265734",
"0.7196214",
"0.71650875",
"0.7119276",
"0.7104409",
"0.7064393",
"0.69869477",
"0.696403",
"0.69311124",
"0.69311124",
"0.69258475",
"0.6907904",
"0.68978137",
"0.68978137",
"0.68933576",
"0.68718237",
"0.6864444",
"0.6788... | 0.72602654 | 4 |
Invites new user to project | def invite(email, role, msg = DEFAULT_INVITE_MESSAGE)
puts "Inviting #{email}, role: #{role}"
role_url = nil
if role.index('/gdc/') != 0
tmp = get_role(role)
role_url = tmp.uri if tmp
else
role_url = role if role_url.nil?
end
data = {
:invitations => [
{
:invitation => {
:content => {
:email => email,
:role => role_url,
:action => {
:setMessage => msg
}
}
}
}
]
}
url = "/gdc/projects/#{pid}/invitations"
GoodData.post(url, data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n _user_not_anonymous\n @user = CwaIpaUser.new\n @project = Project.find(Redmine::Cwa.project_id)\n\n if !params[:saa] \n flash[:error] = \"Please indicate that you accept the system access agreement\"\n redirect_to :action => :index\n return\n end\n\n if !params[:tos]\n... | [
"0.68705904",
"0.66224855",
"0.66157156",
"0.6613724",
"0.6594698",
"0.6557995",
"0.65118605",
"0.6511343",
"0.65101016",
"0.6478275",
"0.6448584",
"0.6443658",
"0.643859",
"0.6434301",
"0.6426461",
"0.64135",
"0.6394249",
"0.6362326",
"0.6359099",
"0.63445574",
"0.6334464",
... | 0.0 | -1 |
Returns invitations to project | def invitations
res = []
tmp = GoodData.get @json['project']['links']['invitations']
tmp['invitations'].each do |invitation|
res << GoodData::Invitation.new(invitation)
end
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end",
"def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend",
"def invitations()\n return MicrosoftGraph::Invitations::Invitat... | [
"0.76814204",
"0.7535096",
"0.73966706",
"0.7234537",
"0.71821076",
"0.70033073",
"0.70033073",
"0.70033073",
"0.6896788",
"0.68899786",
"0.68819606",
"0.6843941",
"0.68025196",
"0.6798536",
"0.67652124",
"0.67607087",
"0.67198896",
"0.66972095",
"0.66972095",
"0.66972095",
"... | 0.8202656 | 0 |
Returns project related links | def links
data['links']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to_related_project(object)\n url = \"/projects/\"\n rp = related_project(object)\n url << rp.id.to_s unless rp.nil?\n end",
"def get_projects()\n a = []\n self.projects.each_index do |i|\n img = \"<img src='#{self.projects[i].thumbnail.url}' alt='#{self.projects[i].title}'/>\"\n ... | [
"0.7545514",
"0.68863064",
"0.6634111",
"0.6587875",
"0.63772446",
"0.63772446",
"0.6373625",
"0.63087136",
"0.61918557",
"0.6190613",
"0.6190613",
"0.6190613",
"0.6185904",
"0.6158239",
"0.6151662",
"0.6112966",
"0.6110879",
"0.609558",
"0.6092711",
"0.60834825",
"0.60717875... | 0.56350595 | 77 |
Gets membership for profile specified | def member(profile, list = members)
if profile.is_a? String
return list.find do |m|
m.uri == profile || m.login == profile
end
end
list.find { |m| m.login == profile.login }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile\n self.class.get '/members/private', @options\n end",
"def profile; Profile.get(self.profile_id); end",
"def profile\n unless @profile\n if associated_profile\n @profile = Profile.new(associated_profile)\n else\n options = {:fields => 'user_id', :inc... | [
"0.7401145",
"0.6793878",
"0.6787787",
"0.6647348",
"0.6573575",
"0.6536089",
"0.64900494",
"0.6470624",
"0.6458553",
"0.643542",
"0.64262563",
"0.6397904",
"0.63640064",
"0.63342124",
"0.6293887",
"0.627082",
"0.6248981",
"0.6230586",
"0.6188416",
"0.6147746",
"0.6128925",
... | 0.6850957 | 2 |
Checks if the profile is member of project | def member?(profile, list = members)
!member(profile, list).nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def member_of?(project)\n role_for_project(project).member?\n end",
"def user_is_member\n project = Project.find(params[:project_id])\n unless (current_user.id == project.created_by.id) || (project.users.any? { |u| u.id == current_user.id })\n flash[:error] = \"You are not a member of this ... | [
"0.7741602",
"0.77354455",
"0.77354455",
"0.76170164",
"0.7298606",
"0.7183383",
"0.7167663",
"0.71299493",
"0.6944099",
"0.6908831",
"0.6792698",
"0.679249",
"0.6714446",
"0.67074114",
"0.66148067",
"0.65884525",
"0.6588382",
"0.6555031",
"0.65537286",
"0.65331954",
"0.65191... | 0.6994175 | 9 |
Gets raw resource ID | def obj_id
uri.split('/').last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_id\n return \"%s:%s\" % [self.resource_type, self.id]\n end",
"def resource_id\n return @resource_id\n end",
"def resource_id\n return @resource_id\n end",
"def resource_id\n return @resource_id\n end",... | [
"0.8005086",
"0.7806621",
"0.7806621",
"0.7806621",
"0.77972275",
"0.75682867",
"0.7556008",
"0.720286",
"0.7168298",
"0.6949293",
"0.69488525",
"0.6913514",
"0.6887989",
"0.6869654",
"0.6863135",
"0.6780684",
"0.6777319",
"0.67698807",
"0.66928",
"0.66604483",
"0.6644265",
... | 0.6233833 | 73 |
Checks if this object instance is project | def project?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_for_project?\n not self.project.nil?\n end",
"def project?\n ! @project.nil?\n end",
"def project?; @is_project || false; end",
"def has_project?\n !project_id.nil? && project.visible\n end",
"def project?(p)\r\n projects.include?(p)\r\n end",
"def belongs_to_project?(proje... | [
"0.85757875",
"0.81913626",
"0.7927502",
"0.7593589",
"0.7592387",
"0.75436443",
"0.72515917",
"0.7238059",
"0.70117134",
"0.68325853",
"0.6826295",
"0.680668",
"0.6783032",
"0.6719298",
"0.6627733",
"0.66117585",
"0.65926325",
"0.6570935",
"0.65682834",
"0.648983",
"0.647895... | 0.8303266 | 1 |
Forces project to reload | def reload!
if saved?
response = GoodData.get(uri)
@json = response
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n true\n end",
"def reload\n true\n end",
"def reload\n re... | [
"0.75344175",
"0.75344175",
"0.75344175",
"0.75344175",
"0.75344175",
"0.75344175",
"0.75344175",
"0.7419122",
"0.7419122",
"0.7399516",
"0.7399516",
"0.7364154",
"0.7358428",
"0.7309596",
"0.7277626",
"0.72770864",
"0.72770864",
"0.72770864",
"0.72770864",
"0.7262883",
"0.72... | 0.0 | -1 |
Gets the list or project roles | def roles
url = "/gdc/projects/#{pid}/roles"
tmp = GoodData.get(url)
tmp['projectRoles']['roles'].map do |role_url|
json = GoodData.get role_url
GoodData::ProjectRole.new(json)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roles\n roles_from_users\n end",
"def roles\r\n @roles ||= user_roles.map(&:name)\r\n end",
"def the_roles\n roles.each.map{|_r| User::ROLES[_r.to_sym] }\n end",
"def roles\n client.user_roles(id)\n end",
"def roles\n client.user_roles(id)\n end",
"def roles\n self.dig_... | [
"0.8275544",
"0.8129134",
"0.7981738",
"0.795179",
"0.795179",
"0.794485",
"0.79406863",
"0.78327465",
"0.78126746",
"0.77202016",
"0.77178854",
"0.75295633",
"0.75295633",
"0.7529526",
"0.7508435",
"0.75042945",
"0.7466383",
"0.7451267",
"0.7439454",
"0.74319017",
"0.7417180... | 0.8051969 | 2 |
Checks if is project saved | def saved?
res = uri.nil?
!res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_saved?\n begin \n @project.transaction do\n # validations\n ensure_unique_project_name!\n ensure_unique_tasks_names! \n # save\n save_project!\n save_tasks!\n end\n return true \n rescue Exception => e\n return false\n end \n en... | [
"0.78906953",
"0.7183366",
"0.71447355",
"0.6949027",
"0.6869737",
"0.6852707",
"0.6713404",
"0.6672425",
"0.66444767",
"0.66187966",
"0.6599406",
"0.65113854",
"0.65032554",
"0.6492416",
"0.6464664",
"0.6458803",
"0.64401937",
"0.6410376",
"0.6350726",
"0.63333523",
"0.62819... | 0.5770622 | 49 |
Gets project update date | def updated
DateTime.parse(@json['project']['meta']['updated'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_updated\n updated_at.strftime(\"%b %d, %Y\")\n end",
"def updated_for_repo(repo)\n repo.updated_at.iso8601\n end",
"def last_edited\n self.latest_update.to_date\n end",
"def last_edited\n\t\tself.latest_update.to_date\n\tend",
"def last_updated\n repo = Grit::Repo.init_bare_... | [
"0.7243601",
"0.7116965",
"0.7002887",
"0.688242",
"0.6768324",
"0.6752917",
"0.6735119",
"0.6735119",
"0.6735119",
"0.6735119",
"0.67088586",
"0.67088586",
"0.66656107",
"0.6634576",
"0.66023195",
"0.65239465",
"0.650722",
"0.650722",
"0.64935714",
"0.6489516",
"0.6485808",
... | 0.73746365 | 0 |
Uploads file to project | def upload(file, schema, mode = 'FULL')
schema.upload file, self, mode
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_file\n #TODO\n end",
"def upload\r\n \r\n end",
"def upload\n end",
"def upload\n end",
"def upload(file, someone)\n end",
"def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n ... | [
"0.8405073",
"0.7947121",
"0.78446376",
"0.78446376",
"0.7639189",
"0.74630183",
"0.73803073",
"0.72719944",
"0.7190853",
"0.7176918",
"0.7158903",
"0.71565",
"0.7148172",
"0.71469045",
"0.71436507",
"0.7113689",
"0.70911807",
"0.7060643",
"0.7037039",
"0.7004088",
"0.6975869... | 0.0 | -1 |
List of users in project | def users
res = []
tmp = GoodData.get @json['project']['links']['users']
tmp['users'].map do |user|
res << GoodData::Membership.new(user)
end
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_users\n request :user\n end",
"def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end",
"def list\n get('users')['users']\n end",
"def getUsers(projectId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(pr... | [
"0.79261184",
"0.79221153",
"0.77875215",
"0.7780208",
"0.76629",
"0.76501006",
"0.76489794",
"0.7639909",
"0.7597535",
"0.7571336",
"0.7571336",
"0.75698465",
"0.74340844",
"0.7409283",
"0.73992705",
"0.7378906",
"0.7373646",
"0.73710155",
"0.7349721",
"0.7349721",
"0.732540... | 0.7466837 | 12 |
Imports users from CSV Features Create new users Delete old users Update existing users CSV Format TODO: Describe CSV Format here | def users_import(new_users, domain = nil)
# Diff users
diff = GoodData::Membership.diff_list(users, new_users)
# Create domain users
GoodData::Domain.users_create(diff[:added], domain)
# Create new users
role_list = roles
users_create(diff[:added], role_list)
# Get changed users objects from hash
list = diff[:changed].map do |user|
user[:user]
end
# Join list of changed users with 'same' users
list = list.zip(diff[:same]).flatten.compact
new_users_map = Hash[new_users.map { |u| [u.email, u] }]
# Create list with user, desired_roles hashes
list = list.map do |user|
{
:user => user,
:roles => new_users_map[user.email].json['user']['content']['role'].split(' ').map { |r| r.downcase }.sort
}
end
# Update existing users
set_users_roles(list, role_list)
# Remove old users
users_remove(diff[:removed])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_user_status_csv_import\n if params[:import].nil?\n flash[:message] = 'Please upload a csv file'\n redirect_to admin_user_status_csv_import_path\n return\n end\n file = CSV.parse(params[:import][:csv].read)\n @failures = []\n file.each do |row|\n user_id = row[0]\n # I... | [
"0.7584262",
"0.73641866",
"0.7277701",
"0.72634166",
"0.72488374",
"0.71577287",
"0.7157373",
"0.7057852",
"0.7027753",
"0.6989543",
"0.68581074",
"0.6792965",
"0.6694382",
"0.6568569",
"0.65595895",
"0.65281105",
"0.64624804",
"0.6461363",
"0.6433527",
"0.6429175",
"0.63310... | 0.6434338 | 18 |
Update list of users | def set_users_roles(list, role_list = roles)
list.map do |user_hash|
user = user_hash[:user]
roles = user_hash[:role] || user_hash[:roles]
{
:user => user,
:result => set_user_roles(user, roles, role_list)
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_many\n if @users.update_all(user_params)\n render json: @users, status: :ok, location: users_url\n else\n render json: @users.errors, status: :unprocessable_entity\n end\n end",
"def bulk_update(users = [])\n Iterable.request(conf, '/users/bulkUpdate').post(users: users)\n ... | [
"0.77579224",
"0.76979804",
"0.7690526",
"0.7435408",
"0.72665745",
"0.69867986",
"0.68912953",
"0.6875648",
"0.6828584",
"0.6826797",
"0.6785792",
"0.6751285",
"0.6706678",
"0.67003804",
"0.6642177",
"0.66331154",
"0.6629827",
"0.66050535",
"0.6604278",
"0.65862286",
"0.6577... | 0.0 | -1 |
Run validation on project Valid settins for validation are (default all): ldm Checks the consistency of LDM objects. pdm Checks LDM to PDM mapping consistency, also checks PDM reference integrity. metric_filter Checks metadata for inconsistent metric filters. invalid_objects Checks metadata for invalid/corrupted objects. asyncTask response | def validate(filters = %w(ldm, pdm, metric_filter, invalid_objects))
response = GoodData.post "#{GoodData.project.md['validate-project']}", 'validateProject' => filters
polling_link = response['asyncTask']['link']['poll']
polling_result = GoodData.get(polling_link)
while polling_result['wTaskStatus'] && polling_result['wTaskStatus']['status'] == 'RUNNING'
sleep(3)
polling_result = GoodData.get(polling_link)
end
polling_result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n needs :project unless skip_project_check?\n end",
"def validate_project\n\n # project name should be 10 to 30 length, and 5 words or fewer\n validate_length_words 'Project Name', self.project_name, 10, 30, 0, 5\n\n # vision should be 1 sentence\n validate_sentences_leng... | [
"0.60966474",
"0.5920944",
"0.5883326",
"0.5790503",
"0.56967425",
"0.564787",
"0.56322885",
"0.56300765",
"0.55392665",
"0.55196273",
"0.54341996",
"0.5409193",
"0.54084873",
"0.5390367",
"0.5372635",
"0.5371687",
"0.5356898",
"0.5320983",
"0.5318901",
"0.52747625",
"0.52654... | 0.7684566 | 0 |
retrieve market id get market id from Vendor classfile match up market id and vendor id provide a collection of all vendor instances associated with market by id | def vendors ##DON'T NEED TO PASS IN AN ARGUMENT JUST THE VALUE FROM THE ARGUMENT!!!!
# lookup every vendor that matches this market id
FarMar::Vendor.by_market(@id)
##OMG YAY, REMEMBER THIS TO BRING IN CLASSES FOR DIFFERENT METHODS,
##bring in class object and method and pass in the id from market
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendors\n FarMar::Vendor.by_market(id)\n end",
"def market #returns the FarMar::Market instance that is associated with this vendor using the FarMar::Vendor market_id field ##WORKS\n\t\tmarkets = []\n\t\tlist = FarMar::Market.all\n\t\tlist.each do |market|\n\t\t\tif market.id == @market_id\n\t\t\t\tputs ... | [
"0.8072416",
"0.79924387",
"0.7924431",
"0.76777023",
"0.7669088",
"0.76245666",
"0.7323986",
"0.6869937",
"0.68620455",
"0.6855523",
"0.6814425",
"0.67456746",
"0.67456746",
"0.6721337",
"0.6629167",
"0.6595687",
"0.6595687",
"0.6540909",
"0.65010834",
"0.6476018",
"0.647119... | 0.8236412 | 0 |
GET /collections GET /collections.json | def index
@collections = current_user.collections
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collection(slug, options)\n _get(\"v1/collections/\" + slug, options)\n end",
"def index\n @collections = current_user.collections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end",
"def list\n @collection... | [
"0.7903878",
"0.7902042",
"0.7901478",
"0.7798958",
"0.76547277",
"0.74742806",
"0.73411196",
"0.73396087",
"0.7331687",
"0.7301158",
"0.7301158",
"0.7140841",
"0.70761335",
"0.7036882",
"0.70322394",
"0.70099014",
"0.6999159",
"0.6996238",
"0.6944972",
"0.69432664",
"0.69201... | 0.7404062 | 6 |
GET /collections/1 GET /collections/1.json | def show
@collection ||= Collection.shareds.find(params[:id])
fail ActiveRecord::RecordNotFound if @collection.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collection(slug, options)\n _get(\"v1/collections/\" + slug, options)\n end",
"def index\n @collections = current_user.collections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end",
"def show\n\n @collecti... | [
"0.7678446",
"0.76061696",
"0.75371283",
"0.7443003",
"0.72130686",
"0.7119864",
"0.7102526",
"0.7100734",
"0.7100734",
"0.709121",
"0.7061903",
"0.704557",
"0.70365316",
"0.7006357",
"0.6956208",
"0.6920214",
"0.6828716",
"0.6815708",
"0.68125314",
"0.6763249",
"0.6738598",
... | 0.6140593 | 80 |
POST /collections POST /collections.json | def create
@collection = current_user.collections.new(collection_params)
respond_to do |format|
if @collection.save
format.html { redirect_to @collection, notice: 'Collection was successfully created.' }
format.json { render :show, status: :created, location: @collection }
else
format.html { render :new }
format.json { render json: @collection.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n collection = Collection.create(collection_params)\n\n render json: collection\n end",
"def create\n @collection = Admin::Collection.new(collection_params)\n\n if @collection.save\n render json: @collection, status: :created#, location: @collection\n else\n render json: @col... | [
"0.7404623",
"0.7381908",
"0.72971326",
"0.7065041",
"0.6995211",
"0.6995211",
"0.69571704",
"0.6955287",
"0.6951492",
"0.6944973",
"0.69421273",
"0.6927642",
"0.6895561",
"0.68512917",
"0.6742824",
"0.67056274",
"0.6700699",
"0.6657101",
"0.6657101",
"0.65612787",
"0.653609"... | 0.7038641 | 4 |
PATCH/PUT /collections/1 PATCH/PUT /collections/1.json | def update
respond_to do |format|
if @collection.update(collection_params)
format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }
format.json { render :show, status: :ok, location: @collection }
else
format.html { render :edit }
format.json { render json: @collection.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render_json :status => :forbidden and return unless @collection.write?(@user, @client)\n if !params[:collection]\n render_json :status => :bad_request, :messages => \"Tried to update collection with no data.\" and return\n end\n @collection.update_attributes(params[:collection].slice(... | [
"0.7259187",
"0.70242816",
"0.6988402",
"0.6988402",
"0.6988402",
"0.69667065",
"0.6930278",
"0.6921567",
"0.6830044",
"0.6799727",
"0.6756897",
"0.6718455",
"0.66887903",
"0.6638254",
"0.658537",
"0.6582955",
"0.657624",
"0.65664434",
"0.65103716",
"0.64496946",
"0.6392205",... | 0.6771525 | 12 |
DELETE /collections/1 DELETE /collections/1.json | def destroy
@collection.destroy
respond_to do |format|
format.html { redirect_to collections_url, notice: 'Collection was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n response = connection.delete(\"/collections/#{id}\")\n (200..299).include?(response.status)\n end",
"def destroy\n @collection = Collection.find(params[:id])\n @collection.destroy\n\n respond_to do |format|\n format.html { redirect_to collections_url }\n format.json ... | [
"0.7953756",
"0.76781094",
"0.7663579",
"0.7663579",
"0.7663579",
"0.7663579",
"0.75701225",
"0.7556668",
"0.75391763",
"0.75385195",
"0.7530683",
"0.74889785",
"0.74639094",
"0.74485254",
"0.7430147",
"0.7295264",
"0.72811234",
"0.7268873",
"0.7263628",
"0.72565955",
"0.7251... | 0.7448116 | 15 |
Use callbacks to share common setup or constraints between actions. | def set_collection
@collection = current_user.collections.find_by(id: params[:id]) if current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def collection_params
params.require(:collection).permit(:name, :public)
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.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.6290564... | 0.0 | -1 |
Notes about matching: Matches are case insensitive, matching with last name and email address only does not work Instructions can be MatchOnly: Only look for a match; don't update the database in any way. MatchAndStore: If no match is found, directly create a new person record in the database. If a match is found, update the existing record with any new information provided in the candidate. MatchAndProcess: If no match is found, add the record to the Process Volunteers queue. If a match is found, update the existing record with any new information provided in the candidate. ProcessOnly: Do not perform any matching at this time; just add the record to the Process Volunteers queue. | def match_person(instruction, match_xml)
message = create_message do |xml|
xml.MatchPerson 'xmlns' => "https://api.securevan.com/Services/V3/" do |xml|
xml << match_xml
xml.instruction(instruction)
xml.options
end
end
MatchPersonResponse.new(make_request('MatchPerson', message).body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def candidatesmatch\n if current_user_candidate\n @candidate = current_user_candidate.candidate\n populate_matches_for_candidate (current_user_candidate)\n @candidate = current_user_candidate.candidate\n @match = Match.where(\n candidate: @candidate,\n job_like: nil,\n )\n... | [
"0.6204757",
"0.6104355",
"0.60992587",
"0.6014425",
"0.59429955",
"0.5928825",
"0.5901453",
"0.58481324",
"0.5800626",
"0.57979697",
"0.57680666",
"0.5760369",
"0.5738814",
"0.5726758",
"0.5684222",
"0.56179285",
"0.56116766",
"0.56114316",
"0.56060183",
"0.5563945",
"0.5562... | 0.5511076 | 25 |
Replace this with your real tests. | def test_truth
assert_kind_of SchoolSession, @school_session
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testing\n # ...\n end",
"def __dummy_test__\n end",
"def tests; end",
"def tests; end",
"def spec; end",
"def spec; end",
"def self_test; end",
"def self_test; end",
"def test \n end",
"def test_0_dummy\n\t\tend",
"def test\n\n end",
"def test\n end",
"def test\n end"... | [
"0.7446459",
"0.6956364",
"0.69155836",
"0.69155836",
"0.6864151",
"0.6864151",
"0.66406286",
"0.66406286",
"0.66253287",
"0.6547665",
"0.6524571",
"0.6484549",
"0.6484549",
"0.6484549",
"0.6403847",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188"... | 0.0 | -1 |
Get the display name. | def display_name
NAME
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def dis... | [
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"0.8648397",
"... | 0.78731966 | 63 |
Elect a primary server within this topology. | def elect_primary(description, servers); self; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elect_primary(description, servers)\n if description.replica_set_name == replica_set_name\n unless detect_stale_primary!(description)\n servers.each do |server|\n if server.primary? && server.address != description.address\n server.description.un... | [
"0.6445153",
"0.54944026",
"0.5484852",
"0.5451359",
"0.5447465",
"0.54417884",
"0.5406501",
"0.53859746",
"0.5379763",
"0.5375298",
"0.5346694",
"0.5250826",
"0.52389693",
"0.52299094",
"0.5220387",
"0.5218819",
"0.5205547",
"0.5151638",
"0.5149905",
"0.5144666",
"0.5117638"... | 0.7482492 | 0 |
Initialize the topology with the options. | def initialize(options, seeds = [])
@options = options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(options = { })\n @options = DEFAULT_OPTIONS.merge(options)\n \n load_config\n end",
"def initialize(options); end",
"def initialize(options = {})\n @options = DEFAULT_OPTIONS.merge options\n @protocol_options = (options.delete(:protocol) || {}).dup\n @run =... | [
"0.6626425",
"0.6595223",
"0.65364945",
"0.6530968",
"0.6485037",
"0.64363813",
"0.6422725",
"0.6413999",
"0.63641346",
"0.63612306",
"0.6357994",
"0.6335453",
"0.632957",
"0.632957",
"0.632957",
"0.632957",
"0.632957",
"0.632957",
"0.6325736",
"0.6311034",
"0.6310234",
"0.... | 0.0 | -1 |
A sharded topology is not a replica set. | def replica_set?; false; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconfiguring_replica_set?\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"] || \"\"\n NOT_MASTER.include?(details[\"code\"]) || err.include?(\"not master\")\n end",
"def replica_set?\n type == Mongo::Cluster::Topology::ReplicaSetNoPrimary ||\n type == ... | [
"0.7143609",
"0.7060166",
"0.6762376",
"0.6663953",
"0.6663953",
"0.6418832",
"0.6398116",
"0.6336039",
"0.615511",
"0.615511",
"0.60004354",
"0.5953003",
"0.57551754",
"0.57269275",
"0.56973815",
"0.5678911",
"0.5630599",
"0.559276",
"0.5581108",
"0.5580852",
"0.55638844",
... | 0.69258046 | 2 |
Sharded topologies have no replica set name. | def replica_set_name; nil; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replica_set?; false; end",
"def replica_set?; true; end",
"def replica_set?\n type == Mongo::Cluster::Topology::ReplicaSetNoPrimary ||\n type == Mongo::Cluster::Topology::ReplicaSetWithPrimary\n end",
"def reconfiguring_replica_set?\n err = details[\"err\"] || details[\"er... | [
"0.6891267",
"0.67285687",
"0.645339",
"0.643664",
"0.6387346",
"0.6276711",
"0.6276711",
"0.6241491",
"0.6241491",
"0.6145875",
"0.6053696",
"0.6028507",
"0.6027574",
"0.5945153",
"0.5669629",
"0.5662772",
"0.5561229",
"0.5559615",
"0.5517034",
"0.5479895",
"0.54232806",
"... | 0.70127517 | 0 |
Select appropriate servers for this topology. | def servers(servers)
servers.select{ |server| server.mongos? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_server\n compute.servers.map { |s| [s.name, s.id] }\n end",
"def servers_selected\n @_servers_selected ||=[]\n end",
"def candidate_servers\n @candidate_servers.select { |s| !['Unknown', 'PossiblePrimary'].include?(s['type']) }\n end",
"def set_servers(servers)\n ... | [
"0.7110933",
"0.6805508",
"0.6548057",
"0.6381372",
"0.6363743",
"0.6319522",
"0.62874997",
"0.62847114",
"0.6215813",
"0.6195722",
"0.61236924",
"0.61236924",
"0.6055331",
"0.5992089",
"0.59698653",
"0.59573436",
"0.5955589",
"0.59487915",
"0.59422916",
"0.59303814",
"0.5928... | 0.6119497 | 12 |
A sharded topology is sharded. | def sharded?; true; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sharded?\n @sharded\n end",
"def shard; end",
"def sharded?; false; end",
"def sharded?\n $mongo_client ||= initialize_scanned_client!\n $sharded ||= ($mongo_client.cluster.sharded? || single_mongos?)\nend",
"def sharded?\n $mongo_client ||= initialize_scanned_client!\n $sharded ||= ($mongo... | [
"0.64567375",
"0.6401802",
"0.628635",
"0.6077936",
"0.6077936",
"0.601789",
"0.5766073",
"0.5748678",
"0.56937706",
"0.56869894",
"0.56317043",
"0.5486915",
"0.5449605",
"0.5342455",
"0.5271522",
"0.50610167",
"0.4985788",
"0.49834564",
"0.49709225",
"0.49651423",
"0.4964324... | 0.6496563 | 0 |
A sharded topology is not single. | def single?; false; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shard; end",
"def sharded?; true; end",
"def sharded?; false; end",
"def star_cluster; end",
"def sharded?\n $mongo_client ||= initialize_scanned_client!\n $sharded ||= ($mongo_client.cluster.sharded? || single_mongos?)\nend",
"def sharded?\n $mongo_client ||= initialize_scanned_client!\n $sharde... | [
"0.6202378",
"0.6136092",
"0.6015226",
"0.59429127",
"0.58819497",
"0.58819497",
"0.5775546",
"0.5755554",
"0.5734257",
"0.5707881",
"0.56181484",
"0.5348295",
"0.533122",
"0.5308106",
"0.52898794",
"0.524865",
"0.51927525",
"0.51777595",
"0.51514333",
"0.5147458",
"0.5089654... | 0.0 | -1 |
A sharded topology is not unknown. | def unknown?; false; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def missing_network_topology?\n !missing_network_topology.empty?\n end",
"def sharded?; false; end",
"def sharded?; true; end",
"def has_ships_still_floating?\n end",
"def EnforceTopology\n #enforce topology on all the (potential) wired and wireless interfaces\n #onEvent(:ALL_INTERFA... | [
"0.61889195",
"0.57041186",
"0.56262505",
"0.5493531",
"0.5457307",
"0.5443937",
"0.54140675",
"0.5376828",
"0.53641796",
"0.53105646",
"0.53105646",
"0.52566993",
"0.5235098",
"0.5227494",
"0.5226561",
"0.52252644",
"0.5223768",
"0.5223768",
"0.5187607",
"0.51419353",
"0.512... | 0.48833662 | 67 |
Creates a new version of the app in HockeyApp. | def create_version
Milkrun.say "Creating new version of app in HockeyApp"
body = {}.tap do |json|
json[:bundle_version] = version_code
json[:bundle_short_version] = version_name
json[:status] = 1
end
headers = {}.tap do |h|
h["X-HockeyAppToken"] = token
h["Accept"] = "application/json"
h["Content-Type"] = "application/json"
end
url = "#{base_url}/#{app_id}/app_versions/new"
response = Excon.post(url, body: body.to_json, connect_timeout: 10, headers: headers)
if response.status != 201
Milkrun.error response.data.to_s
raise "Failed to post new version to HockeyApp!"
end
Milkrun.say "New version created in HockeyApp"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil)\n puts(\"The `version` parameter is deprecated. Use `ensure_version!` method instead\") if version\n client.cre... | [
"0.69854003",
"0.6732899",
"0.668877",
"0.65476656",
"0.6515963",
"0.64948446",
"0.6347779",
"0.634168",
"0.6288814",
"0.6277851",
"0.6277574",
"0.62440366",
"0.62321925",
"0.62309766",
"0.62111074",
"0.6194539",
"0.6173755",
"0.61472636",
"0.60987973",
"0.6071858",
"0.604536... | 0.87121814 | 0 |
returns digits 79 of epoch time for use in CSS_ID sequencing | def shortened_time
Time.now.to_i.to_s.split("")[6..8].join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def epoch_time\n return time + epoch\n end",
"def epoch_now()\n Time.now.to_i\n end",
"def last_epoch_time; end",
"def revolutionnumberepoch\n (@line2[63...68]).to_i\n end",
"def get_next_id\n id = java.lang.System.nanoTime.to_s\n $log.info(\"*** get_next_id:... | [
"0.72156304",
"0.6791591",
"0.66989285",
"0.6534214",
"0.6490572",
"0.6480636",
"0.6464102",
"0.6457643",
"0.64098984",
"0.62948465",
"0.6213917",
"0.6213917",
"0.6189102",
"0.6168584",
"0.6166635",
"0.61446124",
"0.6132979",
"0.6121307",
"0.61091655",
"0.6073659",
"0.6073230... | 0.0 | -1 |
search query starts here | def search(search,compare,year,rain_fall_type)
# if block starts here
if search == "All"
# if block starts here
if rain_fall_type == "All"
where(Year: year).order('id ')
else
where(Year: year).order("#{rain_fall_type} ")
end
# if block end here
elsif compare == "Bihar vs District"
where("Districts = ? OR Districts = ?", search, "Bihar").where("year = ?", year).order(:id)
else
# if block starts here
if rain_fall_type == "All"
where("Districts = ? ", search).where("year = ?", year).order(:id)
else
where("Districts = ? ", search).where("year = ?", year).order(rain_fall_type)
end
# if block end here
end
# if block end here
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(query); end",
"def search; end",
"def search\n\n end",
"def search\n end",
"def search \n\n end",
"def parse_search(q)\n # TODO continue\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"... | [
"0.86091244",
"0.8167887",
"0.81198937",
"0.80836415",
"0.804525",
"0.80368185",
"0.80162084",
"0.80162084",
"0.80162084",
"0.80162084",
"0.80162084",
"0.80162084",
"0.80162084",
"0.80162084",
"0.80162084",
"0.80162084",
"0.79841757",
"0.77973676",
"0.77239686",
"0.7638385",
... | 0.0 | -1 |
search query end here Logic to generate table starts | def table (b,rain_fall_type,year,ji,compare)
if rain_fall_type == "All"
hash_data = ji.map do |el|
{title:el, field:el, sorter:"string", editor:true}
end
else
if compare == "None"
hash_data = [
{title:"Year", field:"Year", sorter:"string", editor:true},
{title:rain_fall_type, field:rain_fall_type, sorter:"string", editor:true},
{title:"Districts", field:"Districts", sorter:"string", editor:true}
]
else
hash_data = [
# {title:compare, field:compare, sorter:"string", editor:true},
{title:"Year", field:"Year", sorter:"string", editor:true},
{title:rain_fall_type, field:rain_fall_type, sorter:"string", editor:true},
{title:"Districts", field:"Districts", sorter:"string", editor:true}
]
end
end
data = {column: hash_data,data: b}
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_builder table, search\n \n # Throw on some wildcards to make search more forgiving\n search_string = \"%#{search}%\"\n\n # Check to see if the search_string is a number, if it is, also search on numerical columns\n search_number = (is_number? search) ? Float(search) : nil\n\n search_dat... | [
"0.63722837",
"0.6345869",
"0.6333752",
"0.63309693",
"0.628934",
"0.62668735",
"0.6239813",
"0.62322396",
"0.61540264",
"0.61214495",
"0.6110631",
"0.608796",
"0.6083567",
"0.60322464",
"0.60136455",
"0.59905154",
"0.5983947",
"0.5978103",
"0.59713566",
"0.5961534",
"0.59475... | 0.0 | -1 |
Logic to generate table end | def map_search(search,compare,year,rain_fall_type)
if search == "All"
if rain_fall_type == "All"
where(Year: year).order(:id)
else
where(Year: year).order(rain_fall_type)
end
else
# where(Districts: search)
where(Year: year).order(rain_fall_type)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_table_body\n data.each_with_index do |row, i|\n output << \",\\n\" if i > 0 \n build_row(row)\n end\n output << \"\\n\"\n end",
"def build_table_body\n body =\n if data.column_names && !data.column_names.empty?\n data\n else\n ... | [
"0.7204978",
"0.6912701",
"0.6662215",
"0.6598779",
"0.6598779",
"0.6598779",
"0.6598779",
"0.6561837",
"0.63415927",
"0.63228935",
"0.63181823",
"0.6277754",
"0.62142396",
"0.62141746",
"0.6193849",
"0.6174467",
"0.61456454",
"0.6138774",
"0.6117442",
"0.609266",
"0.6088106"... | 0.0 | -1 |
Static configuration which doesn't vary by environment. e.g. hostname / port. | def static
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def static_env; end",
"def static_env; end",
"def static_env; end",
"def public_host_config\n config = {:host => SERVER_DOMAIN[RAILS_ENV.to_sym], :subdomain => subdomain, :l => locale(:en)}\n if default_host\n config = {:host => default_host, :subdomain => 'www', :l => locale(:en)}\n end\n\n ... | [
"0.7176546",
"0.7176546",
"0.7176546",
"0.70208764",
"0.70045054",
"0.66799045",
"0.66654843",
"0.66654843",
"0.66654843",
"0.66654843",
"0.6638767",
"0.6560268",
"0.6541577",
"0.64589566",
"0.6456256",
"0.6446363",
"0.64042133",
"0.637229",
"0.63542",
"0.6327531",
"0.6312349... | 0.0 | -1 |
Whether the environment is valid for this provider. | def valid?
env_keys.all? { |k| env.key?(k) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environment_valid?\n %w(test production development).include?(@environment)\n end",
"def valid?(request_env)\n\t\t\treturn false unless valid_fields?(request_env)\n\t\t\ttrue\n\t\tend",
"def valid_environment?\n env['USER'] == config.user && env['HOME'] == config.home_path\n end",
"def va... | [
"0.85026413",
"0.76318866",
"0.7421536",
"0.73386705",
"0.71294063",
"0.71245724",
"0.71205235",
"0.7063185",
"0.7055769",
"0.70506364",
"0.7012718",
"0.70002174",
"0.6954537",
"0.6952816",
"0.69519633",
"0.69255656",
"0.6903113",
"0.690139",
"0.68640417",
"0.6843815",
"0.683... | 0.8144832 | 1 |
Which ENV keys are used by this provider. | def env_keys
mapping.values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_variable_names\n [\n CONSUMER_KEY_NAME,\n CONSUMER_SECRET_NAME,\n ACCESS_TOKEN_KEY_NAME,\n ACCESS_TOKEN_SECRET_NAME\n ]\n end",
"def env_key; end",
"def environments\n environment_config.keys\n end",
"def env_types\n DataCach... | [
"0.7349117",
"0.6966224",
"0.67559063",
"0.669164",
"0.66486645",
"0.65551156",
"0.6551152",
"0.6537317",
"0.64472985",
"0.64296883",
"0.6428147",
"0.64051884",
"0.6392358",
"0.6262647",
"0.6251861",
"0.6251024",
"0.6251024",
"0.6251024",
"0.6251024",
"0.6240439",
"0.62042075... | 0.69529015 | 2 |
The configuration derived from the environment for this provider. | def config
filter_config(static.merge(dynamic))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configuration\n provider.configuration\n end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def config\n @_config ||= self.class.config.inheritable_copy\n end",
"def env_config\n @env_config ||= {}\n end",
"def config\n ... | [
"0.7818201",
"0.7535298",
"0.7535298",
"0.7535298",
"0.7535298",
"0.75107795",
"0.7503293",
"0.7484445",
"0.74232906",
"0.73608136",
"0.7319906",
"0.7318101",
"0.72821903",
"0.7185757",
"0.7185757",
"0.7183277",
"0.7148264",
"0.71298",
"0.7113183",
"0.71023315",
"0.71015275",... | 0.0 | -1 |
A hook for arbitrary changes to the config hash. | def filter_config(config)
config
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change(hash); end",
"def after_config_update(*_)\n config[:parameters] ||= Smash.new\n config[:compile_parameters] ||= Smash.new\n config[:apply_stack] ||= []\n config[:apply_mapping] ||= Smash.new\n stack_name = arguments.first\n content = load_file_for(stack_name)\... | [
"0.6687242",
"0.6344338",
"0.6254987",
"0.6252013",
"0.61530894",
"0.61187595",
"0.6001172",
"0.59776664",
"0.59768194",
"0.5893282",
"0.5872892",
"0.5837987",
"0.58077943",
"0.5783342",
"0.57129943",
"0.5703411",
"0.5703245",
"0.56657",
"0.56459403",
"0.5623749",
"0.56118613... | 0.0 | -1 |
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: split string into an array of individual items set default quantity to 1 put each item from the array into the hash print the list to the console [can you use one of your other methods here?] > print_list output: hash Method to add an item to a list input: list, item name, and optional quantity steps: add item to the hash if quantity is not provided, default to 1 output: updated hash Method to remove an item from the list input: list, item name steps: find keyvalue pair with a value that matches item name, delete pair output: updated hash Method to update the quantity of an item input: list, item name, quantity steps: check hash for key that matches item name, reassign value output: updated hash Method to print a list and make it look pretty input: list steps: loop through entire hash print key and value with some formatting output: string | def create_list(items)
groceries = items.split(' ')
grocery_list = Hash.new
groceries.each do |grocery|
grocery_list[grocery] = 1
end
print_list(grocery_list)
return grocery_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createlist(str)\r\n# steps:\r\n# break the string into an array\r\n items = str.split\r\n item_list = {}\r\n\r\n\t# iterate through array and build hash\r\n items.each do |item|\r\n\r\n\t\t# iterate through array and build hash\r\n\t\t# set default quantity to 1\r\n \titem_list[item] = 1\r\n e... | [
"0.8223276",
"0.7990618",
"0.78546983",
"0.77299744",
"0.7674989",
"0.7614531",
"0.7595771",
"0.7533703",
"0.7508786",
"0.7430988",
"0.74304175",
"0.7423202",
"0.72865415",
"0.72628886",
"0.7256374",
"0.7251072",
"0.7245896",
"0.72133285",
"0.72126967",
"0.7191112",
"0.718483... | 0.0 | -1 |
GET /people_tasks GET /people_tasks.json | def index
@people_tasks = TasksPerson.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @people_tasks }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasks_person }\n end\n end",
"def get_user_tasks\n render json: get_current_user.tasks\n end",
"def tasks\n @todos = Todo.all\n render js... | [
"0.73588705",
"0.71109337",
"0.7009187",
"0.6887127",
"0.6873431",
"0.68418485",
"0.6736645",
"0.673531",
"0.67280954",
"0.66958576",
"0.6682668",
"0.6649931",
"0.66353023",
"0.6624169",
"0.6604962",
"0.65877634",
"0.6570386",
"0.6555804",
"0.65556246",
"0.6552364",
"0.655126... | 0.7704657 | 0 |
GET /people_tasks/1 GET /people_tasks/1.json | def show
@tasks_person = TasksPerson.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tasks_person }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @people_tasks = TasksPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people_tasks }\n end\n end",
"def show\n render :json => Project.find(params[:project_id]).tasks.find(params[:id])\n end",
"def show\n @task = Task.... | [
"0.75819623",
"0.6937273",
"0.69366366",
"0.6923732",
"0.6905428",
"0.68815845",
"0.6829282",
"0.6826633",
"0.6778851",
"0.6767741",
"0.67472607",
"0.66577345",
"0.66504943",
"0.6614728",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599... | 0.75678724 | 1 |
GET /people_tasks/new GET /people_tasks/new.json | def new
@tasks_person = TasksPerson.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @tasks_person }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n # raise params.inspect\n @task = Task.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n\n\n\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render j... | [
"0.7775306",
"0.77416384",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7529903",
"0.74275225",
"0.7372045",
"0.73702204",
"0.73412675",
"0.7319687",
"0.7273926",... | 0.8022029 | 0 |
POST /people_tasks POST /people_tasks.json | def create
@tasks_person = TasksPerson.new(params[:tasks_person])
respond_to do |format|
if @tasks_person.save
format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully created.' }
format.json { render json: @tasks_person, status: :created, location: @tasks_person }
else
format.html { render action: "new" }
format.json { render json: @tasks_person.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end",
"def create\n @task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n @users = User.all\n @users.each do |user|\n user.tasks << @task... | [
"0.70283276",
"0.6979206",
"0.69347423",
"0.68283695",
"0.67829514",
"0.67596644",
"0.6630701",
"0.6628671",
"0.6620221",
"0.6580558",
"0.6576762",
"0.6564267",
"0.6546276",
"0.65427387",
"0.65413153",
"0.6502328",
"0.64934987",
"0.6488791",
"0.6481077",
"0.6477163",
"0.64599... | 0.7100527 | 0 |
PUT /people_tasks/1 PUT /people_tasks/1.json | def update
@tasks_person = TasksPerson.find(params[:id])
respond_to do |format|
if @tasks_person.update_attributes(params[:tasks_person])
format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @tasks_person.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end",
"def edit_user_task\n task = Task.find(params[:id])\n \n if... | [
"0.7054414",
"0.701209",
"0.701209",
"0.68201935",
"0.67519337",
"0.66676843",
"0.6646136",
"0.66448426",
"0.6598996",
"0.6573599",
"0.65337265",
"0.6518665",
"0.6455328",
"0.64218044",
"0.6417866",
"0.6416317",
"0.63909566",
"0.63806975",
"0.63777274",
"0.63777274",
"0.63777... | 0.71400964 | 0 |
DELETE /people_tasks/1 DELETE /people_tasks/1.json | def destroy
@tasks_person = TasksPerson.find(params[:id])
@tasks_person.destroy
respond_to do |format|
format.html { redirect_to people_tasks_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_task\n @task = Task.find_by(id: params[:id])\n @task.destroy\n render :json => @task.as_json(:only => [:id])\n end",
"def destroy\n name = @task.name\n @task.destroy\n\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end",
"def destroy\n @user_task... | [
"0.7278031",
"0.7105234",
"0.71013814",
"0.7084282",
"0.7056598",
"0.7056598",
"0.70548373",
"0.7045825",
"0.7032664",
"0.7031984",
"0.70243746",
"0.70174325",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700... | 0.7748938 | 0 |
Shortcut to jira web.xml file | def web_xml()
"#{self.build_dir()}/src/webapp/WEB-INF/web.xml"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_web_xml()\n web_xml = File.readlines(self.web_xml()).map do |line|\n if line =~ /#{web_xml_token}/\n template = File.open(\"#{DEPLOYER_HOME}/resources/jira_cas_web.xml\") { |f| f.read() }\n line + ERB.new(template).result(self.send(:binding))\n else\n line\n... | [
"0.59749234",
"0.59558946",
"0.5377453",
"0.51630783",
"0.5086364",
"0.50474346",
"0.5011779",
"0.50064504",
"0.49403116",
"0.49383205",
"0.49317926",
"0.49060914",
"0.48885345",
"0.48746756",
"0.48457748",
"0.48367837",
"0.48148423",
"0.47830132",
"0.47724497",
"0.47724497",
... | 0.5803094 | 2 |
Updates the jira web.xml file with the soulwing (CAS library) authentication configuration | def config_web_xml()
web_xml = File.readlines(self.web_xml()).map do |line|
if line =~ /#{web_xml_token}/
template = File.open("#{DEPLOYER_HOME}/resources/jira_cas_web.xml") { |f| f.read() }
line + ERB.new(template).result(self.send(:binding))
else
line
end
end
File.open(self.web_xml(), "w") do |io|
web_xml.each { |line| io.puts(line) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_auth\r\n send_request_cgi({\r\n 'uri' => normalize_uri(target_uri.path.to_s, 'login.jsp'),\r\n 'method' => 'POST',\r\n 'cookie' => \"atlassian.xsrf.token=#{@xsrf_token}; #{@session_id}\",\r\n 'vars_post' => {\r\n 'os_username' => datas... | [
"0.58678955",
"0.5813508",
"0.5813508",
"0.54553145",
"0.52606964",
"0.5175465",
"0.51485616",
"0.51173985",
"0.510662",
"0.504985",
"0.5040798",
"0.50070447",
"0.49489963",
"0.49272862",
"0.49161395",
"0.4902212",
"0.48999223",
"0.48954642",
"0.4858142",
"0.48515493",
"0.480... | 0.5831531 | 1 |
Shortcut to jira entityengine.xml file | def entityengine_xml()
"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/entityengine.xml"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_entityengine_xml()\n ee_xml = File.readlines(self.entityengine_xml()).map do |line|\n if m = /(#{Regexp.quote(self.entityengine_xml_db_token())})/.match(line)\n self.debug(m[0])\n new_str = \"#{m.pre_match}#{entityengine_db}#{m.post_match}\"\n self.debug(new_str)\n... | [
"0.6398696",
"0.5248405",
"0.48659834",
"0.48535803",
"0.48516288",
"0.4803681",
"0.47713846",
"0.47287074",
"0.4721212",
"0.4706146",
"0.4703447",
"0.46532586",
"0.46518803",
"0.46467614",
"0.46467504",
"0.46376362",
"0.46367082",
"0.46184602",
"0.45869818",
"0.45743212",
"0... | 0.7211464 | 0 |
Updates the jira entityengine.xml file with the correct database configs | def config_entityengine_xml()
ee_xml = File.readlines(self.entityengine_xml()).map do |line|
if m = /(#{Regexp.quote(self.entityengine_xml_db_token())})/.match(line)
self.debug(m[0])
new_str = "#{m.pre_match}#{entityengine_db}#{m.post_match}"
self.debug(new_str)
new_str
elsif m = /(#{Regexp.quote(self.entityengine_xml_schema_token())})/.match(line)
self.debug(m[0])
new_str = "#{m.pre_match}#{self.entityengine_schema()}#{m.post_match}"
self.debug(new_str)
new_str
else
line
end
end
File.open(self.entityengine_xml(), "w") do |io|
ee_xml.each { |line| io.puts(line) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_db\n require \"#{File.dirname(__FILE__)}/../conf/db_schema.rb\"\n Knj::Db::Revision.new.init_db(\"debug\" => false, \"db\" => @db, \"schema\" => Openall_time_applet::DB_SCHEMA)\n end",
"def entityengine_xml()\n \"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/entityengine.xml\"\n e... | [
"0.57058316",
"0.56865704",
"0.51462287",
"0.5125705",
"0.5029244",
"0.50115347",
"0.48502994",
"0.4849333",
"0.4825936",
"0.480926",
"0.4796927",
"0.47873434",
"0.4776646",
"0.47746593",
"0.47675866",
"0.47366372",
"0.47258762",
"0.47244507",
"0.47176516",
"0.47176516",
"0.4... | 0.6346941 | 0 |
Shortcut to jira seraphconfig.xml file | def seraph_config_xml()
"#{self.build_dir()}/src/webapp/WEB-INF/classes/seraph-config.xml"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_seraph_config_xml()\n seraph_xml = File.readlines(self.seraph_config_xml()).map do |line|\n if m = /(#{Regexp.quote(self.seraph_config_xml_auth_class_token())})/.match(line)\n self.debug(m[0])\n new_str = \"#{m.pre_match}#{self.cas_authenticator_class()}#{m.post_match}\"\n ... | [
"0.5723253",
"0.56698084",
"0.56275",
"0.56238925",
"0.5587852",
"0.55189437",
"0.5508963",
"0.5494081",
"0.54921",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.543... | 0.6575264 | 0 |
Updates the jira seraph_config.xml file with the soulwing authenticator. | def config_seraph_config_xml()
seraph_xml = File.readlines(self.seraph_config_xml()).map do |line|
if m = /(#{Regexp.quote(self.seraph_config_xml_auth_class_token())})/.match(line)
self.debug(m[0])
new_str = "#{m.pre_match}#{self.cas_authenticator_class()}#{m.post_match}"
self.debug(new_str)
new_str
elsif m = /(#{Regexp.quote(self.seraph_config_xml_logout_url_token())})/.match(line)
self.debug(m[0])
new_str = "#{m.pre_match}#{self.cas_server_url()}/logout#{m.post_match}"
self.debug(new_str)
new_str
else
line
end
end
File.open(self.seraph_config_xml(), "w") do |io|
seraph_xml.each { |line| io.puts(line) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\r\n SystemConfig.set :auth, to_h, true\r\n end",
"def add_authentication(xml)\n xml.tag! :Authentication do\n xml.tag! :client, @options[:login]\n xml.tag! :password, @options[:password]\n end\n end",
"def add_authentication(xml)\n xml.tag! :Authenti... | [
"0.5323589",
"0.50956655",
"0.50956655",
"0.501868",
"0.49512613",
"0.4914384",
"0.49026796",
"0.48615596",
"0.48091918",
"0.47805527",
"0.4772286",
"0.47704378",
"0.47487733",
"0.47434014",
"0.47265384",
"0.46971887",
"0.46937457",
"0.46818027",
"0.4681231",
"0.46799538",
"0... | 0.62757486 | 0 |
Shortcut to jiraapplication.properties file | def jira_application_properties()
"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/jira-application.properties"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_jira_application_properties()\n jira_props = File.readlines(self.jira_application_properties()).map do |line|\n if m = /(#{Regexp.quote(jira_home_token)})/.match(line)\n self.debug(m[0])\n new_str = \"#{self.jira_home_token()} #{self.data_dir()}\"\n self.debug(new_... | [
"0.7073052",
"0.56550014",
"0.5536825",
"0.54226947",
"0.53882706",
"0.5310216",
"0.52702767",
"0.5259988",
"0.51730555",
"0.51256853",
"0.5119314",
"0.5119314",
"0.5099526",
"0.5093299",
"0.5065135",
"0.50203323",
"0.49945876",
"0.49896342",
"0.49575347",
"0.49569803",
"0.49... | 0.76433784 | 0 |
Sets the jira.home property in the file: jiraapplication.properties. | def config_jira_application_properties()
jira_props = File.readlines(self.jira_application_properties()).map do |line|
if m = /(#{Regexp.quote(jira_home_token)})/.match(line)
self.debug(m[0])
new_str = "#{self.jira_home_token()} #{self.data_dir()}"
self.debug(new_str)
new_str
else
line
end
end
File.open(self.jira_application_properties(), "w") do |io|
jira_props.each { |line| io.puts(line) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jira_application_properties()\n \"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/jira-application.properties\"\n end",
"def jruby_home\n ENV['JRUBY_HOME'] || RbConfig::CONFIG['prefix']\n end",
"def set_home\n end",
"def home\n @home ||= File.expand_path('~')\n end",
"def... | [
"0.6404565",
"0.5775393",
"0.56609976",
"0.5628493",
"0.55924094",
"0.54392564",
"0.5433737",
"0.5392451",
"0.53642577",
"0.53558356",
"0.5351502",
"0.5227393",
"0.52152365",
"0.5190894",
"0.5190352",
"0.5187228",
"0.51773024",
"0.5165123",
"0.51646346",
"0.514183",
"0.513415... | 0.6387023 | 1 |
Places IST banner jpg in imaages directory | def config_ist_banner()
FileUtils.cp("#{UcbDeployer::RESOURCES_DIR}/ist_banner.jpg",
"#{self.build_dir()}/src/webapp/images/")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def banner_path\n path = @path[0...@path.length - 4] + '_banner.png'\n path_remote = @path_remote[0...@path_remote.length - 4] + '_banner.png'\n File.exists?(path) ? path_remote : 'https://maps.avicus.net' + '/default_map_banner.png' # May need configured\n end",
"def images_path\n @imags_path |... | [
"0.6503407",
"0.63239735",
"0.6185664",
"0.6161505",
"0.6141384",
"0.6141076",
"0.6140199",
"0.60203546",
"0.59374505",
"0.5884834",
"0.58692557",
"0.5857529",
"0.58498365",
"0.5837028",
"0.5834459",
"0.583369",
"0.58140457",
"0.5797562",
"0.57962584",
"0.5750768",
"0.5750231... | 0.7484696 | 0 |
Remove jars from WEBINF/lib that have been installed at the container level to avoid conflicts. | def reshuffle_jars()
FileUtils.mkdir_p("#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/")
FileUtils.cp(Dir["#{UcbDeployer::RESOURCES_DIR}/soulwing-casclient-*"],
"#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/")
# These have been placed in $CATALINA_HOME/lib
["mail", "activation", "javamail", "commons-logging", "log4j"].each do |jar|
FileUtils.rm_rf(Dir["#{self.build_dir()}/src/webapp/WEB-INF/lib/#{jar}-*"])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_jcl_over_slf\n dir_glob = Dir.glob(File.join @app_dir, 'WEB-INF', 'lib', 'jcl-over-slf4*.jar')\n dir_glob.each do |f|\n File.delete f\n end\n end",
"def remove_library(lib)\n lib = lib.to_s\n\n @libraries[:start].delete lib\n @libraries[:sub_session].delete lib\... | [
"0.7207337",
"0.59160626",
"0.5915155",
"0.58779615",
"0.5759871",
"0.57521474",
"0.56346065",
"0.56267524",
"0.5559628",
"0.554475",
"0.5521686",
"0.5498694",
"0.5494546",
"0.54410636",
"0.5403568",
"0.53731227",
"0.5349069",
"0.53250724",
"0.532069",
"0.52869606",
"0.528390... | 0.74428827 | 0 |
Write a method, vowel_censor that takes in a string and replaces any vowels in it with an "X". Do not modify the original string. | def vowel_censor(string)
vowels=["a","e","i","o","u"]
new_string=""
string.each_char do |char|
if vowels.include? char
new_string << "X"
else
new_string << char
end
# while i<=string.length
# if char==string[i]
# new_string+="X"
# added = true
# else
# new_string+=char
# end
# i+=1
# end
end
puts new_string
return new_string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vowel_censor(string)\n\n string.tr('aeiou', 'X')\nend",
"def vowel_censor(string)\n\n string.gsub(/[aeiou]/, 'X') \n p string \n \nend",
"def censor_word(word)\n vowels = \"aeiou\"\n\n censored = word.split(\"\").map do |char|\n if vowels.include?(char.downcase)\n char = \"*\"\n else \... | [
"0.8710354",
"0.85540473",
"0.72102433",
"0.6714598",
"0.6626025",
"0.66237",
"0.6613211",
"0.6544972",
"0.6539751",
"0.6490821",
"0.6467531",
"0.6444061",
"0.6419502",
"0.6407751",
"0.63753605",
"0.63683414",
"0.6360635",
"0.6354349",
"0.6351878",
"0.6338696",
"0.63378054",
... | 0.753319 | 2 |
Switch Roles! Print 10 Write a method, array_print_10, that puts the numbers 0 9 using an array and the each method | def array_print_10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_case\n puts \" 1 2 3\" \n for n in 0..2 do #on commence à compter à 0\n print (65+n).chr + \" \" #affiche 65.chr correspond à A en ACSII donc ensuite en ajoutant n, on a B, C, \n @case_array[n][0].print_case\n print \" | \"\n @case_array[n][1].print_case\n ... | [
"0.6275246",
"0.61135775",
"0.6067515",
"0.605335",
"0.6027156",
"0.6023017",
"0.5947229",
"0.59239376",
"0.5899214",
"0.58658105",
"0.5843036",
"0.5827367",
"0.5819852",
"0.58156735",
"0.5802928",
"0.5691142",
"0.56848645",
"0.568277",
"0.56664586",
"0.56591815",
"0.5648665"... | 0.6585481 | 0 |
Write a method, range_print_10, that prints the numbers 0 9 using a range and the each method | def range_print_10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_print_10\n (0..9).step(1) do |n| \n puts n \n end \n \nend",
"def range_print_10\n array = (0..9).to_a\narray.each do |x|\n print x\nend\n\nend",
"def puts_1_to_10\n (1..10).each { |i| puts i }\nend",
"def puts_1_to_10\n (1..10).each { |i| puts i }\nend",
"def output\n @range.each { |... | [
"0.848194",
"0.84154624",
"0.72716564",
"0.72716564",
"0.72206295",
"0.72206295",
"0.72206295",
"0.6939404",
"0.6834125",
"0.66014296",
"0.6543455",
"0.653032",
"0.64792454",
"0.6423243",
"0.6173442",
"0.6123834",
"0.6095711",
"0.60792685",
"0.6077574",
"0.60465443",
"0.60432... | 0.858811 | 0 |
Write a method, integer_print_10, that prints the numbers 0 9 using an integer and the times method | def integer_print_10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integer_print_10\n 10.times do |x|\n print x\n end\nend",
"def integer_print_10\n 10.times do |x|\n puts x \n end \nend",
"def q1_print_times(str, num)\n num.times {|num_here|\n p str\n }\nend",
"def repeat(string, int)\n int.times { puts string }\nend",
"def repeat(str, int)\n int.tim... | [
"0.8370745",
"0.8019723",
"0.6917267",
"0.68825996",
"0.6880553",
"0.6847512",
"0.6815837",
"0.6771567",
"0.6735165",
"0.67280626",
"0.6712343",
"0.67103726",
"0.6621699",
"0.66179854",
"0.6608558",
"0.6608558",
"0.6605648",
"0.65978473",
"0.65978473",
"0.6597411",
"0.6565435... | 0.81304765 | 1 |
Disable notowner to manage reservations | def begin_of_association_chain
# raise self.action_name.inspect
case self.action_name
when 'index', 'show' : super
when 'owned_by' :
@user=User.find(params[:user_id])
else
current_user
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_ownership\n run_baby_run 'diskutil', ['disableOwnership', self.dev_node], :sudo => true\n end",
"def cannot_edit(_t)\n !session[:is_administrator] && !_t.approver_id.blank?\n end",
"def set_reservation_owner\n @reservation_owner = ReservationOwner.find(params[:id])\n end",
... | [
"0.66025513",
"0.59945977",
"0.593318",
"0.59066767",
"0.5902096",
"0.5896067",
"0.58845043",
"0.5774392",
"0.5715057",
"0.56770855",
"0.56518507",
"0.5640324",
"0.55974704",
"0.55907273",
"0.55883384",
"0.5583184",
"0.55581456",
"0.5534364",
"0.5510906",
"0.55087906",
"0.549... | 0.0 | -1 |
Parse file Clean balnk or empty lines form a file storing significat lines in given new file returns the number of significant lines | def parse( new_file_name = "#{@full_pathname}.clean.txt" )
lines_total = 0
lines_removed = 0
new_file = File.open( new_file_name, 'w' )
File.open( @full_pathname, 'r' ) do |f|
f.each_line do |curr_line| # Make sure each line has a valid UTF-8 sequence of characters:
curr_line = EncodingTools.force_valid_encoding( curr_line )
curr_line = ResultFileNormalizer.hints_remover( curr_line )
lines_total += 1
# Check if current line should be removed
if !ResultFileNormalizer.is_data_line?( curr_line )
# Remove the line
lines_removed += 1
else
new_file << curr_line
end
end
end
lines_total - lines_removed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_file\n line_count = 0\n @text.each_line do |line|\n if line == nil || line == '' || line.size == 0 || line[0] == '#' || line[0] == \"\\n\"\n next\n end\n elements = line.split(' ')\n if elements.size > 2\n puts 'Waring : '.red + 'in file \"' + @file_name.yellow + '... | [
"0.6748733",
"0.60515606",
"0.59816027",
"0.58807105",
"0.57976073",
"0.576504",
"0.57561237",
"0.5753687",
"0.5722975",
"0.5696997",
"0.56915474",
"0.5690263",
"0.56616646",
"0.5638411",
"0.56324923",
"0.56324923",
"0.5625236",
"0.5614476",
"0.5594559",
"0.55759364",
"0.5569... | 0.62429416 | 1 |
old, look at plate_layout_controllers method of the same name | def performance_xls
plate = Plate.find(params['id'])
path = plate.get_performance_xls
send_file(path, :type => "application/vnd.ms-excel")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layouts; end",
"def layouts; end",
"def layouts=(_arg0); end",
"def layouts=(_arg0); end",
"def layout; end",
"def controller_layout\n layout = self.send(:_layout)\n if layout.instance_of? String\n layout\n else\n File.basename(layout.identifier).split('.').first\n e... | [
"0.63532203",
"0.63532203",
"0.6243165",
"0.6243165",
"0.62191224",
"0.6070418",
"0.5942661",
"0.59300953",
"0.59155285",
"0.5842654",
"0.5803238",
"0.5801459",
"0.58004636",
"0.57797205",
"0.5756514",
"0.5741285",
"0.5739852",
"0.57391363",
"0.57391363",
"0.5724333",
"0.5723... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.