query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
outputs a JDBC result set to a formatted file formatter defaults to JSON output unless you provide your own proc
def rs_to_json_file(rs, file_object, formatter) # default formatter outputs json objects for each row formatter = json_formatter unless formatter # get basic metadata for the recordset meta = rs.getMetaData cols = meta.getColumnCount.to_i record_count = 0 # loop through the r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_output(result, format)\n case format\n when :json\n JSON.pretty_generate(result)\n when :yaml\n YAML.dump(result)\n when :text\n result = result.keys if result.respond_to?(:keys)\n result.join(\" \")\n else\n raise ArgumentError, \"Unknown outp...
[ "0.573599", "0.5730984", "0.5653076", "0.5626883", "0.5584541", "0.55663943", "0.5487415", "0.53582895", "0.5343643", "0.5322585", "0.52930725", "0.5291068", "0.52810764", "0.525809", "0.5253949", "0.524335", "0.52348226", "0.5223327", "0.52182007", "0.52170575", "0.5212134",...
0.59093994
0
The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Input: (2 > 4 > 3) + (5 > 6 > 4) Output: 7 > 0 > 8 Input: (2 > 4 > 3) + (1 > 1) Output: (...
def add_two_numbers(head1, head2) result_dummy = ListNode.new(nil) current, current1, current2 = result_dummy, head1, head2 tens = 0 while current1 && current2 sum = current1.val + current2.val + tens tens = sum > 9 ? 1 : 0 current.next = ListNode.new(sum % 10) current, current1, current2 = cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_two_number(l1, l2)\n m, n = l1, l2\n result = ListNode.new(0)\n curr = result\n carry = 0\n while(!m.nil? || !n.nil?)\n x = m.nil? ? 0 : m.val\n y = n.nil? ? 0 : n.val\n sum = x + y + carry\n curr.next = ListNode.new(sum % 10)\n carry = sum / 10\n curr = curr.next\n m = m.next if...
[ "0.80926156", "0.8011175", "0.7946918", "0.78408176", "0.7772548", "0.77425724", "0.766689", "0.76340985", "0.74667794", "0.7416486", "0.7333097", "0.72953606", "0.7196797", "0.7180074", "0.71260834", "0.7053395", "0.680556", "0.6800919", "0.67467386", "0.6723095", "0.6577235...
0.83210474
0
The Order Books channel allow you to keep track of the state of the Bitfinex order book. It is provided on a price aggregated basis, with customizable precision.
def books(symbol="btcusd", precision="P0", params = {}) check_params(params, %i{len}) get("book/#{symbol}/#{precision}", params: params).body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_books *markets, &b\n @update_book_state ||= {}\n \n markets.each do |m|\n @update_book_state[m] = b\n end\n \n subscribe *markets\n end", "def orderbook\n Fyb.public.orderbook.perform.parse\n end", "def order_book(params)\n Client.current.get(\"#{r...
[ "0.594006", "0.56894517", "0.557276", "0.5456961", "0.54207736", "0.53878194", "0.5345059", "0.52692515", "0.526555", "0.5232492", "0.5202735", "0.5194791", "0.5181118", "0.5162786", "0.51259065", "0.5104325", "0.5077379", "0.50472796", "0.5045644", "0.50438863", "0.501318", ...
0.6108757
0
Get active positions return [Array]
def active_positions authenticated_post("auth/positions").body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_available_positions\n @state.each.with_index(1).select { |mark, index| mark.nil? }.map { |mark, index| index }\n end", "def current_pos\n\t\treturn arr = [pos_x, pos_y]\n\tend", "def get_available_positions\n\t\tpositions = []\n\t\tfor i in (1..9) do\n\t\t\tx = ((i - 0.1) / 3).truncate\n\t\t\ty = (...
[ "0.701823", "0.67625785", "0.66894484", "0.6672783", "0.6540751", "0.646897", "0.645351", "0.6355815", "0.6198254", "0.6185264", "0.6078444", "0.60753644", "0.60666585", "0.6051508", "0.60495335", "0.6049066", "0.60448986", "0.60087186", "0.59601533", "0.5910466", "0.5875664"...
0.6932113
1
array = [] if array.size == 1 return array[0] elsif array.size == 2 return array.join(" and ") else return array[0..2].join(", ") + ", and " + array[1] end end
def oxford_comma(array) case array.length when 1 "#{array[0]}" when 2 array[0..1].join(" and ") else array[0...-1].join(", ") << ", and #{array[-1]}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_comma_and(array)\n return array.join if array.length <= 1\n array[0..-2].join(', ') + \" and #{array[-1]}\"\nend", "def oxford_comma(array)\n if array.length == 1\n array.join\n elsif array.length == 2\n array.join(\" and \")\n elsif array.length > 2\n element_storage = array.pop\n ne...
[ "0.8817381", "0.87850916", "0.8783364", "0.8672317", "0.86502385", "0.8619752", "0.85513765", "0.84947544", "0.84351546", "0.84203255", "0.83673567", "0.7994148", "0.7987542", "0.7894754", "0.7823151", "0.76368093", "0.76368093", "0.763606", "0.76291895", "0.7420303", "0.7345...
0.8794363
1
Returns all nodes which the FE will identify as a metrics embed placeholder element Removes any nodes beyond the first 100
def nodes strong_memoize(:nodes) do nodes = doc.xpath(XPATH) nodes.drop(EMBED_LIMIT).each(&:remove) nodes end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_nodes_used_by_barclamp(role)\n role.elements.values.flatten.compact.uniq\n end", "def unused_nodes\n s = []\n (0..7).each do |i|\n if position[i] && !position[i].used\n s << i\n end\n end\n s\n end", "def blank_nodes\n bindings.values.select {|v| v.is_a?(RDF::Node...
[ "0.5992009", "0.5867051", "0.55657506", "0.55183196", "0.5480147", "0.5459047", "0.54403377", "0.53421336", "0.53418565", "0.532333", "0.52880627", "0.52473325", "0.523446", "0.52164924", "0.5213894", "0.5209335", "0.5198474", "0.5192336", "0.5168889", "0.51537853", "0.515344...
0.69686943
0
Maps a node to key properties of an embed. Memoized so we only need to run the regex to get the project full path from the url once per node.
def embeds_by_node strong_memoize(:embeds_by_node) do nodes.each_with_object({}) do |node, embeds| embed = Embed.new url = node.attribute('data-dashboard-url').to_s permissions_by_route.each do |route| set_path_and_permission(embed, url, route.regex, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_key(node)\n node = node.name if node.is_a? Deployment::Node\n node.to_s.to_sym\n end", "def node_hash(node_id)\n \n end", "def key_for(node)\n \"#{id}-#{node.id}\"\n end", "def node_get(node)\n nodes.fetch prepare_key(node), nil\n end", "def get_node(key); end",...
[ "0.55087274", "0.54031813", "0.53443235", "0.53390694", "0.5290109", "0.5203178", "0.5202327", "0.5169662", "0.5152272", "0.50218284", "0.5009764", "0.49615878", "0.49175355", "0.4910432", "0.48833722", "0.4856148", "0.48459575", "0.4839225", "0.48351142", "0.48011926", "0.47...
0.6592307
0
Attempts to determine the path and permission attributes of a url based on expected dashboard url formats and sets the attributes on an Embed object
def set_path_and_permission(embed, url, regex, permission) return unless path = regex.match(url) do |m| "#{$~[:namespace]}/#{$~[:project]}" end embed.project_path = path embed.permission = permission end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_url\n set_url_type_and_command\n generate_field\n set_domain\n end", "def normalize_url\n return if self.url.blank?\n normalized = self.url.normalize\n if normalized.blank?\n self.errors.add(:url, \"is invalid\")\n return false\n elsif normalized.match(\"archiveof...
[ "0.5481789", "0.5149962", "0.5120458", "0.50904936", "0.50897175", "0.5065979", "0.505942", "0.5042535", "0.49857998", "0.49514598", "0.49513608", "0.49290696", "0.48927814", "0.4890938", "0.4875103", "0.48588884", "0.48439834", "0.4840636", "0.48381987", "0.48188874", "0.480...
0.6149344
0
Returns a mapping representing whether the current user has permission to view the embed for the project. Determined in a batch
def user_access_by_embed strong_memoize(:user_access_by_embed) do unique_embeds.each_with_object({}) do |embed, access| project = projects_by_path[embed.project_path] access[embed] = Ability.allowed?(user, embed.permission, project) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_authorized(current_user)\n return self.goal.public? || self.edit_authorized(current_user)\n end", "def can_edit?(project)\n current_user.id == project.created_by\n end", "def has_embed_permission?\n return get_bot_profile.permission?(:embed_links, command.event.channel)\n end", "...
[ "0.6519714", "0.64993", "0.64456755", "0.6415356", "0.64080507", "0.6336924", "0.6296164", "0.6266389", "0.6262047", "0.62307996", "0.62229747", "0.6189747", "0.61837846", "0.61821437", "0.6144973", "0.6138494", "0.61232483", "0.6101368", "0.60974395", "0.60775936", "0.607688...
0.75265586
0
Returns a unique list of embeds
def unique_embeds embeds_by_node.values.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedments\n model.embedments\n end", "def embeddables\n page_items.map(&:embeddable)\n end", "def embeddables\n self.page_items.collect{|qi| qi.embeddable}\n end", "def embeddings\n @embeddings ||= {}\n end", "def tracked_embeds_many\n @tracked_embeds_many ...
[ "0.6652065", "0.653032", "0.6295075", "0.6067385", "0.5988965", "0.58692795", "0.5819951", "0.55615884", "0.5556146", "0.54799247", "0.5437159", "0.5429653", "0.5420964", "0.5338043", "0.5325094", "0.5319032", "0.52821004", "0.5276762", "0.5276582", "0.5270719", "0.52617794",...
0.8026379
0
Maps a project's full path to a Project object. Contains all of the Projects referenced in the metrics placeholder elements of the current document
def projects_by_path strong_memoize(:projects_by_path) do Project.eager_load(:route, namespace: [:route]) .where_full_path_in(unique_project_paths) .index_by(&:full_path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_project\n @id ||= @project.at('id').inner_html\n @api_url ||= \"#{CONFIG[:api_location]}/projects/#{@id}\"\n @url ||= \"http://www.pivotaltracker.com/projects/#{@id}\"\n @name = @project.at('name').inner_html\n @iteration_length = @project.at...
[ "0.59914744", "0.5985843", "0.5985813", "0.5985813", "0.59412974", "0.5934773", "0.5837891", "0.5812077", "0.5778879", "0.5731566", "0.5714118", "0.56905466", "0.5689402", "0.56801474", "0.56801474", "0.56639034", "0.56637335", "0.5658622", "0.5652741", "0.564035", "0.5613948...
0.62221426
0
Returns a list of the full_paths of every project which has an embed in the doc
def unique_project_paths embeds_by_node.values.map(&:project_path).uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def referenced_files\r\n\t\t(\r\n\t\t\t[file] +\r\n\t\t\t%w[sourcepath importfile].flat_map do |att|\r\n\t\t\t\tfind(att=>/./).flat_map do |asset|\r\n\t\t\t\t\tasset[att].values.compact.map do |path|\r\n\t\t\t\t\t\tpath.sub!(/#.+/,'')\r\n\t\t\t\t\t\tabsolute_path(path) unless path.empty?\r\n\t\t\t\t\tend.compact\r...
[ "0.62346786", "0.5918912", "0.5874733", "0.584984", "0.5781054", "0.57483196", "0.56905484", "0.56779635", "0.56759006", "0.5595686", "0.5595335", "0.55889183", "0.5551173", "0.5548125", "0.5531814", "0.5517835", "0.5515088", "0.5497157", "0.5496448", "0.5496117", "0.54947495...
0.70257634
0
:nodoc: Creates a new Cartage instance. If provided a Cartage::Config object in +config+, sets the configuration and resolves it. If +config+ is not provided, the default configuration will be loaded.
def initialize(config = nil) self.config = config || Cartage::Config.load(:default) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cartage(config = nil)\n if defined?(@cartage) && @cartage && config\n fail \"Cannot provide another configuration after initialization.\"\n end\n @cartage ||= Cartage.new(config)\n end", "def initialize(config = {})\n init_config(config)\n end", "def initialize(config =...
[ "0.80554163", "0.6134293", "0.6134293", "0.6134293", "0.6127044", "0.6127044", "0.6104844", "0.6104844", "0.6104844", "0.605249", "0.6028437", "0.6014652", "0.6005664", "0.59873104", "0.5975472", "0.5953757", "0.5924136", "0.58803815", "0.5823752", "0.5809698", "0.5765067", ...
0.7609528
1
:attr_accessor: compression The compression to be applied to any tarballs created (either the final tarball or the dependency cache tarball).
def compression unless defined?(@compression) @compression = :bzip2 reset_computed_values end @compression end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compression\n configuration[:copy_compression] || :gzip\n end", "def compression\n type = configuration[:copy_compression] || :gzip\n case type\n when :gzip, :gz then Compression.new(\"tar.gz\", %w(tar czf), %w(tar xzf))\n when :bzip2, :bz2 t...
[ "0.70987284", "0.7081034", "0.7068281", "0.7027188", "0.6960356", "0.6873269", "0.6820189", "0.6676352", "0.6646644", "0.6611192", "0.655306", "0.6543042", "0.65274256", "0.6490417", "0.6485131", "0.64782757", "0.6372748", "0.6372748", "0.63488275", "0.63266504", "0.6288815",...
0.7153924
0
:attr_accessor: dependency_cache_path Reads or sets the vendored dependency cache path. This is where the tarball of vendored dependencies in the working path will reside. On a CI system, this should be written somewhere that the CI system uses for build caching. On Semaphore CI, this would be $SEMAPHORE_CACHE.
def dependency_cache_path self.dependency_cache_path = tmp_path unless defined?(@dependency_cache_path) @dependency_cache_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependency_cache\n self.dependency_cache_path = tmp_path unless defined?(@dependency_cache)\n @dependency_cache\n end", "def cache_path\n @cache_path ||= Pathname.new(Berkshelf.berkshelf_path).join('.cache', 'halite', dependency.name)\n end", "def dependency_cache\n @dependency_cache ||...
[ "0.76007575", "0.7082776", "0.6601134", "0.6575435", "0.6549439", "0.6465902", "0.643242", "0.639735", "0.63759977", "0.63399404", "0.62761533", "0.62516564", "0.61948854", "0.61614484", "0.61614484", "0.61582416", "0.61439896", "0.61391", "0.6113455", "0.60837907", "0.603766...
0.7770697
0
The cartage configuration object, implemented as a recursive OpenStruct. This can return just the subset of configuration for a command or plugin by providing the +for_plugin+ or +for_command+ parameters.
def config(for_plugin: nil, for_command: nil) if for_plugin && for_command fail ArgumentError, "Cannot get config for plug-in and command together" elsif for_plugin @config.dig(:plugins, for_plugin.to_sym) || OpenStruct.new elsif for_command @config.dig(:commands, for_command.to_sym) || Op...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configuration\n @configuration ||= RecursiveOpenStruct.new\n end", "def configuration\n config = {}\n tag_configuration_plugins.each do |p|\n # the first submodule listed is the one which accepts the configuration\n key = p.plugin.modules.first.submodule_name\n config[key] = p.pa...
[ "0.67473197", "0.6521486", "0.6501981", "0.6461292", "0.6258252", "0.6168597", "0.61253613", "0.608895", "0.60242337", "0.6011729", "0.6007466", "0.59719926", "0.5948451", "0.5947815", "0.59307784", "0.59228456", "0.59129924", "0.5882594", "0.5881301", "0.5881301", "0.5881301...
0.6817802
0
The release metadata that will be written for the package.
def release_metadata @release_metadata ||= { package: { name: name, repo: { type: "git", # Hardcoded until we have other support url: repo_url }, hashref: release_hashref, timestamp: timestamp } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_release_metadata_json\n @final_release_metadata_json ||= Pathname(\"#{final_name}-release-metadata.json\")\n end", "def metadata_for(package)\n {\n 'omnibus.project' => package.metadata[:name],\n 'omnibus.platform' => publish_platform(package),\n 'omnibus....
[ "0.7370195", "0.704034", "0.6974283", "0.6931723", "0.687603", "0.6865384", "0.68415904", "0.6788328", "0.6764603", "0.6728841", "0.6558144", "0.65011644", "0.64920175", "0.6459338", "0.6448915", "0.6416685", "0.6378653", "0.6378653", "0.6352862", "0.63475406", "0.6345276", ...
0.86120516
0
Return the release hashref.
def release_hashref @release_hashref ||= `git rev-parse HEAD`.chomp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_info\n @release_info ||= @connection.get(RELEASE_INFO_PATH)['release']\n end", "def release\n variables[:release]\n end", "def get_release(release_id)\n query_and_build \"releases/#{release_id}\"\n end", "def hash\n return @revision.hash if @revision\n return...
[ "0.6629636", "0.64458394", "0.621137", "0.6109361", "0.5998346", "0.5909543", "0.59017736", "0.5836455", "0.57948226", "0.5766315", "0.57381177", "0.5732085", "0.5723467", "0.5696285", "0.56712866", "0.5638505", "0.56241345", "0.5613825", "0.561206", "0.5600599", "0.5599641",...
0.80670696
0
The working path for the job, in tmp_path.
def work_path @work_path ||= tmp_path.join(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tmp_path\n return @tmp_path if @tmp_path\n\n raise NotImplementedError.new (\"implement this before running on the cluster!\")\n\n end", "def tmp_path\n File.join gem_root, 'tmp'\n end", "def tmp_path(path)\n return File.expand_path(File.join(@@config['tmpPath'], path))\n end",...
[ "0.7774178", "0.7678143", "0.74410623", "0.73712856", "0.72641516", "0.7232138", "0.72193927", "0.7189407", "0.7179259", "0.71389437", "0.71087044", "0.7107827", "0.7095835", "0.70888895", "0.703683", "0.7003822", "0.69759995", "0.69213796", "0.688066", "0.67916536", "0.67849...
0.83223426
0
The path to the resulting releasemetadata.json file.
def final_release_metadata_json @final_release_metadata_json ||= Pathname("#{final_name}-release-metadata.json") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_for(package)\n \"#{package.path}.metadata.json\"\n end", "def path_for(package)\n \"#{package.path}.metadata.json\"\n end", "def save_release_metadata(local: false)\n display \"Saving release metadata...\"\n json = JSON.generate(release_metadata)\n\n if local\n ...
[ "0.77460736", "0.7704511", "0.7180564", "0.70426124", "0.7034589", "0.68961227", "0.6814203", "0.6727422", "0.6727008", "0.67100906", "0.6627003", "0.6492116", "0.6325937", "0.63027555", "0.6253498", "0.62166125", "0.61987066", "0.61975974", "0.61975974", "0.6139154", "0.6114...
0.84361136
0
Create the release package(s). Requests: +:vendor_dependencies+ (vendor_dependencies, path) +:pre_build_package+ +:build_package+ +:post_build_package+
def build_package # Force timestamp to be initialized before anything else. This gives us a # stable timestamp for the process. timestamp # Prepare the work area: copy files from root_path to work_path based on # the resolved Manifest.txt. prepare_work_area # Anything that has been modified ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_package_tasks\n prerelease_version\n\n Gem::PackageTask.new spec do |pkg|\n pkg.need_tar = @need_tar\n pkg.need_zip = @need_zip\n end\n\n desc \"Install the package as a gem. (opt. NOSUDO=1)\"\n task :install_gem => [:clean, :package, :check_extra_deps] do\n install_gem Dir...
[ "0.7017179", "0.68987334", "0.68424535", "0.68273526", "0.6779996", "0.6650517", "0.64741325", "0.6452508", "0.6430756", "0.6377577", "0.6262525", "0.6233674", "0.61593926", "0.61492634", "0.61390024", "0.6132946", "0.6100692", "0.6081724", "0.602151", "0.60104483", "0.599980...
0.72996867
0
Just save the release metadata.
def save_release_metadata(local: false) display "Saving release metadata..." json = JSON.generate(release_metadata) if local Pathname(".").join("release-metadata.json").write(json) else work_path.join("release-metadata.json").write(json) final_release_metadata_json.write(json) end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release\n fail AlreadyRelease unless prerelease?\n @special = ''\n @metadata = ''\n end", "def release_metadata\n @release_metadata ||= {\n package: {\n name: name,\n repo: {\n type: \"git\", # Hardcoded until we have other support\n url: repo_url\n ...
[ "0.6915536", "0.67203814", "0.66205096", "0.6428404", "0.63915217", "0.6343135", "0.6320992", "0.6207279", "0.6163682", "0.6148982", "0.6146405", "0.61162776", "0.60762054", "0.6056135", "0.603418", "0.602915", "0.6024174", "0.6023661", "0.60146034", "0.5988743", "0.5916445",...
0.8056552
0
Returns the flag to use with +tar+ given the value of +compression+.
def tar_compression_flag case compression when :bzip2, "bzip2", nil "j" when :gzip, "gzip" "z" when :none, "none" "" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tar_compression_flag(path)\n case path\n when /\\.tar\\.bz2$/\n return \"-j\"\n when /\\.tar\\.gz$|\\.tgz$/\n return \"-z\"\n when /\\.tar\\.xz$/\n return \"-J\"\n else\n return nil\n end\n end", "def tar_compression_extension\n case compression\n ...
[ "0.81088746", "0.76863986", "0.7069913", "0.6714602", "0.62748426", "0.6239286", "0.61987615", "0.6151005", "0.61487615", "0.60653067", "0.60653067", "0.60440516", "0.6039443", "0.600582", "0.599921", "0.5957356", "0.589299", "0.58805084", "0.5847525", "0.58454776", "0.582538...
0.86584175
0
Returns the extension to use with +tar+ given the value of +compression+.
def tar_compression_extension case compression when :bzip2, "bzip2", nil ".bz2" when :gzip, "gzip" ".gz" when :none, "none" "" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compression_extension\n case compression\n when :gzip, :gz then \"tar.gz\"\n when :bzip2, :bz2 then \"tar.bz2\"\n when :zip then \"zip\"\n else raise ArgumentError, \"invalid compression type #{compression.inspect}\"\n end\n e...
[ "0.88780177", "0.7630842", "0.7230568", "0.65677327", "0.65666264", "0.6450668", "0.6192784", "0.6192784", "0.6192784", "0.5966159", "0.59362817", "0.59341556", "0.5931738", "0.5915673", "0.5915673", "0.583386", "0.58309007", "0.58104515", "0.580815", "0.57887346", "0.5722649...
0.88721985
1
Recursively copy a provided +path+ to the work_path, using a tar pipeline. The target location can be amended by the use of the +to+ parameter as a relative path to work_path. If a relative +path+ is provided, it will be treated as relative to root_path, and it will be used unmodified for writing to the target location...
def recursive_copy(path, to: nil) path = Pathname(path) to = Pathname(to) if to if path.to_s =~ %r{\.\./} || (to && to.to_s =~ %r{\.\./}) fail StandardError, "Recursive copy parameters cannot contain '/../'" end if path.relative? parent = root_path else parent, path = path.sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(source, destination_path)\n # TODO: Honor file mode\n\n source = Pathname.new(source) unless source.is_a?(Pathname)\n random = random_dir\n\n # Add Dockerfile instruction\n if source.directory?\n self << 'ADD ' + random + ' ' + destination_path\n ...
[ "0.5896885", "0.5759824", "0.5518162", "0.54922396", "0.5378837", "0.5352244", "0.52944356", "0.5287502", "0.5257331", "0.5234744", "0.5151499", "0.51333517", "0.5127549", "0.51213557", "0.5119133", "0.51166093", "0.50594896", "0.5042769", "0.5019281", "0.5015522", "0.4985219...
0.8040494
0
This started out as a straight line drawn to step barbs, but at a certain point it also started being used to draw straight lines with no arrow heads from step barbs to calm barbs.
def render_to_step_barb(calm=false) stroke ARROW_STROKE_COLOR stroke_weight ARROW_STROKE_WEIGHT # Initial trig calculations for the arrow head adj = @to_barb.pos.x - @from_barb.pos.x opp = @to_barb.pos.y - @from_barb.pos.y angle = Math.atan(opp/adj) if adj>0 and opp<0.001 and opp>-0.001 line_from...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def straight\n @line_type = '--'\n self\n end", "def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end", "def line(x0, y0, x1, y1)\n # clean params\n x0, y0, x1, y1 = x0.to_i, y0.to_i, x1.to_i, y1.to_i\n y0, y1, x0, x1 = y1, y0, x1, x0 if y0>y1\n sx = (dx = x1-x0...
[ "0.7066812", "0.67349887", "0.6514534", "0.64701605", "0.6394434", "0.63000363", "0.61088437", "0.60969186", "0.6061821", "0.60171723", "0.60125303", "0.5992418", "0.59683186", "0.59341025", "0.5927244", "0.59172577", "0.59150565", "0.5903107", "0.586656", "0.5856103", "0.583...
0.7237108
0
Hovers the widget defined by +name+ and optional +args+.
def hover(name, *args) widget(name, *args).hover end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hover\n base.image_for(\"#{name}_hover\")\n end", "def hover_click(*args)\n if args.size == 1\n driver.action.click(element).perform\n else\n sym,id = args\n driver.action.click(driver.find_element(sym.to_sym,id)).perform\n end\n\n end", "def mouse_over locator\r\n ...
[ "0.59003514", "0.5877121", "0.5668789", "0.5668789", "0.559635", "0.548851", "0.5447665", "0.54334414", "0.540149", "0.53910315", "0.5373412", "0.5340327", "0.5338084", "0.5295968", "0.52948105", "0.52810556", "0.5279943", "0.5199232", "0.51675224", "0.5116657", "0.50699365",...
0.90037346
0
Double clicks the widget defined by +name+ and optional +args+.
def double_click(name, *args) widget(name, *args).double_click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right_click(name, *args)\n widget(name, *args).right_click\n end", "def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend", "def double_click(*args)\n case args.length\n when 1 then click_image(args[0]...
[ "0.75034124", "0.7450685", "0.7434601", "0.7431053", "0.735549", "0.7069308", "0.68412656", "0.6669535", "0.6624832", "0.65474355", "0.6547266", "0.64397454", "0.63531953", "0.63485444", "0.63150084", "0.63038003", "0.61704737", "0.61327314", "0.6113735", "0.61123866", "0.611...
0.916154
0
Right clicks the widget defined by +name+ and optional +args+.
def right_click(name, *args) widget(name, *args).right_click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_click(name, *args)\n widget(name, *args).double_click\n end", "def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend", "def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = ni...
[ "0.81100863", "0.7150753", "0.7143982", "0.6974602", "0.67703515", "0.67618877", "0.67600584", "0.66718864", "0.64862144", "0.629425", "0.6235374", "0.6235374", "0.6235374", "0.6178716", "0.6176475", "0.6120835", "0.6095269", "0.6095269", "0.60702384", "0.60663825", "0.606638...
0.8895936
0
Returns a widget instance for the given name.
def widget(name, *args) eventually { document.widget(name, *args) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object(name)\n gtk_builder_get_object(@builder, name)\n end", "def jmaki_load_widget(name)\n # Return previously parsed content (if any)\n if !@jmaki_widgets\n @jmaki_widgets = { }\n end\n previous = @jmaki_widgets[name]\n if previous\n return previous\n end\n conte...
[ "0.6700946", "0.6534847", "0.6436914", "0.6254253", "0.60838956", "0.6064248", "0.5990443", "0.5872015", "0.5869043", "0.5864325", "0.5836126", "0.5826878", "0.58184946", "0.57983124", "0.5732239", "0.56951845", "0.5688887", "0.5665339", "0.56639415", "0.5634459", "0.56262785...
0.67785233
0
Returns a list of widget instances for the given name.
def widgets(name, *args) document.widgets(name, *args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def widgets(win_name)\n @driver.getQuickWidgetList(win_name).map do |java_widget|\n case java_widget.getType\n when QuickWidget::WIDGET_ENUM_MAP[:button]\n QuickButton.new(self,java_widget)\n when QuickWidget::WIDGET_ENUM_MAP[:checkbox]\n QuickCheckbox.new(self,j...
[ "0.7471749", "0.6291563", "0.6247767", "0.62255275", "0.60761404", "0.60491467", "0.60024506", "0.5961512", "0.5910529", "0.58980614", "0.5896949", "0.5856864", "0.58459985", "0.5744007", "0.5697456", "0.5674075", "0.56366825", "0.5594575", "0.55323553", "0.553062", "0.550094...
0.68105316
1
D: return the objects total face count.
def get_face_count count = 0 @groups.each_value do |grp| count += grp.faces.size end return count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_objects_count\n @game_objects.count\n end", "def count_objects\n ObjectSpace.count_objects\n end", "def count_objects\n count = 0\n @objects.keys.each do |key|\n count += @objects[key].length\n end\n\n return count\n end", "def objects_count\n @objects_count ||= ...
[ "0.7563178", "0.75399995", "0.73734385", "0.7326226", "0.700369", "0.69684803", "0.6877062", "0.6816855", "0.6805063", "0.6798709", "0.6780053", "0.6742576", "0.67302614", "0.672904", "0.6615932", "0.6594205", "0.6587683", "0.6582197", "0.65558004", "0.65522766", "0.6549445",...
0.8467805
0
D: Read a .obj file and turn the lines into data points to create the object.
def parse wo_lines = IO.readlines( @file_dir ) @current_group = get_group( "default" ) @current_material_name = "default" puts("+Loading .obj file:\n \"#{@file_dir.sub(ROOT, '')}\"") if @verbose # parse file context wo_lines.each do |line| tokens = line.split # make ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_objects(file, objects)\n objects.each do |data_type|\n num = DataNumber.new.read(file).data\n\n # use i to indentify the type of object.\n num.times do ||\n _obj = data_type.new.read(file)\n end\n end\n end", "def from_file line\n\t\tvals = line.split(\"-\")\n\t\t@type ...
[ "0.6930454", "0.62949574", "0.61179334", "0.60561913", "0.59808797", "0.59243625", "0.5873185", "0.56598336", "0.5589822", "0.55775833", "0.5478374", "0.54504454", "0.53911966", "0.53388566", "0.53007317", "0.5274141", "0.5268032", "0.5266095", "0.5262088", "0.5230244", "0.52...
0.6578253
1
Records when was the world seen into the world's coordinator record
def add_record(id, time = Time.now) record = find_world id @executor[id] ||= record.data[:class] == 'Dynflow::Coordinator::ExecutorWorld' record.data[:meta].update(:last_seen => self.class.format_time(time)) @world.coordinator.update_record(record) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_seen_at() ; info_time(:last_seen) ; end", "def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend", "def history_added; end", "def stamp\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end", "def stamp\n self.dateChanged = Time.now\n sel...
[ "0.5985351", "0.5702953", "0.5644542", "0.5639094", "0.5639094", "0.5639094", "0.56062806", "0.5555142", "0.5473823", "0.5473823", "0.5377818", "0.5344288", "0.53417057", "0.5312277", "0.5312277", "0.5312277", "0.5312277", "0.5312277", "0.5312277", "0.52680624", "0.5266372", ...
0.58622915
1
Looks into the cache whether the world has an executor
def executor?(id) @executor[id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def executing?(name)\n Threaded.executing?(name)\n end", "def executable?\n \n # Return false if picked up by another WQ instance\n if id\n old_lock_version = lock_version\n self.reload\n return false if old_lock_version != lock_version\n end\n \n # Retu...
[ "0.6265423", "0.61224943", "0.6103797", "0.60713375", "0.6040377", "0.6039144", "0.60386235", "0.60386235", "0.60386235", "0.60244215", "0.59997284", "0.5996314", "0.59745073", "0.5966175", "0.59192693", "0.58917797", "0.5882518", "0.58809906", "0.58665013", "0.58665013", "0....
0.7203416
0
Loads the coordinator record from the database and checks whether the world was last seen within the time limit
def fresh_record?(id) record = find_world(id) return false if record.nil? @executor[id] = record.data[:class] == 'Dynflow::Coordinator::ExecutorWorld' time = self.class.load_time(record.data[:meta][:last_seen]) time >= Time.now - @max_age end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_is_recent_enough?\n # It's possible for a replica to not replay WAL data for a while,\n # despite being up to date. This can happen when a primary does not\n # receive any writes for a while.\n #\n # To prevent this from happening we check if the lag size (in b...
[ "0.54737556", "0.5451", "0.53868717", "0.53526783", "0.5323105", "0.5323105", "0.5298916", "0.5298916", "0.5277637", "0.52180606", "0.5167324", "0.5094911", "0.50887007", "0.5088627", "0.5065216", "0.50643003", "0.50152117", "0.5013471", "0.49971685", "0.4965012", "0.49443424...
0.70421654
0
Records when was the world with provided id last seen using a PingCache
def add_ping_cache_record(id) log Logger::DEBUG, "adding ping cache record for #{id}" @ping_cache.add_record id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_seen_at() ; info_time(:last_seen) ; end", "def add_record(id, time = Time.now)\n record = find_world id\n @executor[id] ||= record.data[:class] == 'Dynflow::Coordinator::ExecutorWorld'\n record.data[:meta].update(:last_seen => self.class.format_time(time))\n ...
[ "0.61532664", "0.56334555", "0.5567016", "0.55406165", "0.5500623", "0.5338272", "0.5311125", "0.5244022", "0.5236393", "0.5226602", "0.52120185", "0.5211168", "0.5197269", "0.51751626", "0.5146236", "0.51421404", "0.5099745", "0.5097896", "0.5097896", "0.50839597", "0.507730...
0.6573504
0
Tries to reduce the number of sent Ping requests by first looking into a cache. If the destination world is an executor world, the result is resolved solely from the cache. For client worlds the Ping might be sent if the cache record is stale.
def with_ping_request_caching(request, future) return yield unless request.is_a?(Dynflow::Dispatcher::Ping) return yield unless request.use_cache if @ping_cache.fresh_record?(request.receiver_id) future.fulfill(true) else if @ping_cache.executor?(request.receiver_id)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def try_route_with_internal_cache(type, name)\n if host = self.cache[name]\n logger.debug \"Found '#{host}' for #{type} '#{name}' from Internal Cache.\"\n host\n else\n logger.warn \"No entry in Internal Cache...\"\n try_route_with_new_redis_connection(type, name)\n end\n...
[ "0.5506904", "0.5448852", "0.536698", "0.5194941", "0.5173094", "0.51420766", "0.5075313", "0.5038279", "0.49995124", "0.49597052", "0.49459925", "0.49328312", "0.48977798", "0.48755512", "0.48401", "0.4835775", "0.48188362", "0.48129246", "0.48111284", "0.47891805", "0.47847...
0.58573693
0
GET /dor_masters GET /dor_masters.json
def index @dor_masters = DorMaster.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @djrmasters = Djrmaster.all\n end", "def index\n @masters = Master.all\n end", "def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end", "def index\n @town_masters = TownMaster.all\n end", "def index\n @masterservices = Masterservice.all\n end",...
[ "0.6960988", "0.68790364", "0.64194214", "0.64019245", "0.63474435", "0.62803537", "0.6245516", "0.62290746", "0.6191616", "0.6131362", "0.61055446", "0.60811263", "0.60811263", "0.60555166", "0.6026892", "0.6005102", "0.6000466", "0.5991465", "0.5956027", "0.59559053", "0.59...
0.728603
0
POST /dor_masters POST /dor_masters.json
def create @dor_master = DorMaster.new(dor_master_params) respond_to do |format| if @dor_master.save format.html { redirect_to @dor_master, notice: 'Dor master was successfully created.' } format.json { render :show, status: :created, location: @dor_master } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @master = Master.new(master_params)\n\n respond_to do |format|\n if @master.save\n format.html { redirect_to @master, notice: 'Master was successfully created.' }\n format.json { render :show, status: :created, location: @master }\n else\n format.html { render :new...
[ "0.62448233", "0.61886626", "0.6172584", "0.6143834", "0.60216755", "0.59618944", "0.5952", "0.59434", "0.59066623", "0.5819302", "0.57763493", "0.57525057", "0.57051605", "0.568505", "0.5588518", "0.55665827", "0.55290824", "0.5518695", "0.551768", "0.55174637", "0.55152285"...
0.6797411
0
PATCH/PUT /dor_masters/1 PATCH/PUT /dor_masters/1.json
def update respond_to do |format| if @dor_master.update(dor_master_params) format.html { redirect_to @dor_master, notice: 'Dor master was successfully updated.' } format.json { render :show, status: :ok, location: @dor_master } else format.html { render :edit } format.jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @master.update(master_params)\n format.html { redirect_to @master, notice: 'Master was successfully updated.' }\n format.json { render :show, status: :ok, location: @master }\n else\n format.html { render :edit }\n format.json { rend...
[ "0.6608503", "0.6519024", "0.64278144", "0.64157003", "0.62379485", "0.62108123", "0.61983496", "0.61805767", "0.6169099", "0.61632514", "0.61289513", "0.61267215", "0.6074874", "0.60691965", "0.60635203", "0.6034237", "0.60055965", "0.6003266", "0.596919", "0.5958468", "0.59...
0.67960846
0
DELETE /dor_masters/1 DELETE /dor_masters/1.json
def destroy @dor_master.destroy respond_to do |format| format.html { redirect_to dor_masters_url, notice: 'Dor master was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @hot_master.destroy\n respond_to do |format|\n format.html { redirect_to hot_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destr...
[ "0.70097053", "0.7001957", "0.6980012", "0.69762015", "0.696791", "0.69638145", "0.692363", "0.6921887", "0.6910164", "0.6890854", "0.6880473", "0.68403643", "0.6836584", "0.6821473", "0.6800084", "0.67787975", "0.6775802", "0.67735064", "0.6769035", "0.6743476", "0.6716086",...
0.7358595
0
What is the longest height based on width of dp[i][j]
def expand(dp, i, j) height = 0 width = dp[i][j] # Up i.downto(0).each do |m| break if dp[m][j] < width height += 1 end # Down (i+1..dp.size-1).each do |m| break if dp[m][j] < width height += 1 end height*width end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_area(height)\n max_area = 0\n seen = {}\n\n (0...height.length).each do |idx|\n next if seen[idx]\n seen[idx] = true\n\n (idx + 1...height.length).each do |idx2|\n h = [height[idx], height[idx2]].min\n area = h * (idx2 - idx)\n max_area = area > max_area ? area : max_area\n en...
[ "0.64059925", "0.63923764", "0.63339835", "0.631743", "0.631596", "0.6270813", "0.6242039", "0.6204277", "0.6183002", "0.6183002", "0.6183002", "0.6183002", "0.6183002", "0.6183002", "0.61391354", "0.6133667", "0.61227804", "0.61004394", "0.61004394", "0.604049", "0.60266834"...
0.66691875
0
GET /announcements/new GET /announcements/new.xml
def new @announcement = Announcement.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @announcement } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @announcement }\n end\n end", "def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: ...
[ "0.7923954", "0.75682324", "0.7436319", "0.7276343", "0.71831554", "0.7018658", "0.70069426", "0.6921423", "0.6859628", "0.6828302", "0.6828028", "0.6810493", "0.6788889", "0.6767258", "0.67655563", "0.67655563", "0.6735334", "0.6735334", "0.6735334", "0.673487", "0.6732698",...
0.7999204
1
POST /announcements POST /announcements.xml
def create @announcement = Announcement.new(params[:announcement]) respond_to do |format| if @announcement.save flash[:notice] = 'Announcement was successfully created.' format.html { redirect_to announcements_path } format.xml { render :xml => @announcement, :status => :created,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @announcement = Announcement.new(announcement_params)\n\n respond_to do |format|\n if @announcement.save\n format.html { render html: '200' }\n format.json { render 'announcements/announcement', status: :created, announcement: @announcement }\n else\n format.html {...
[ "0.6889887", "0.6874412", "0.6874412", "0.68625504", "0.6846886", "0.6703081", "0.6667529", "0.66169566", "0.658104", "0.6554651", "0.6519784", "0.6501138", "0.64651704", "0.64454", "0.6397792", "0.63735604", "0.63589764", "0.63033664", "0.62843746", "0.6250486", "0.62473965"...
0.6905966
0
A utility method for escaping XML names of tags and names of attributes. xml_name_escape('1 "1___2___3" It follows the requirements of the specification:
def xml_name_escape(name) name = name.to_s return "" if name.blank? return name if name.match?(SAFE_XML_TAG_NAME_REGEXP) starting_char = name[0] starting_char.gsub!(INVALID_TAG_NAME_START_REGEXP, TAG_NAME_REPLACEMENT_CHAR) return starting_char if name.size == 1 following_cha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_escape(input); end", "def escape_name(name)\n escaped_name = \"\"\n name.each_char do |char|\n if (char =~ /[-A-Za-z0-9_]/) != nil\n escaped_name += char\n else\n converted_char = TAG_NAME_MAP[char]\n if not converted_char\n msg = \"Bad charac...
[ "0.6893634", "0.6816913", "0.667457", "0.6610737", "0.62776357", "0.6230387", "0.6137847", "0.6127742", "0.6103563", "0.59219015", "0.5745236", "0.57385474", "0.56709146", "0.5514325", "0.5474733", "0.5453317", "0.53750974", "0.5334463", "0.52972114", "0.51998824", "0.519555"...
0.8096469
0
ps:dynos [QTY] DEPRECATED: use `heroku ps:scale dynos=N` scale to QTY web processes if QTY is not specified, display the number of web processes currently running Example: $ heroku ps:dynos 3 Scaling dynos... done, now running 3
def dynos # deprecation notice added to v2.21.3 on 03/16/12 display("~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`") dynos = shift_argument validate_arguments! if dynos action("Scaling dynos") do new_dynos = api.put_dynos(app, dynos).body["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale\n app = extract_app\n current_process = nil\n changes = args.inject({}) do |hash, process_amount|\n if process_amount =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n hash[$1] = $2\n end\n hash\n end\n\n error \"Usage: heroku ps:scale web=2 worker+1\" if changes.empty?\n\n chan...
[ "0.71599984", "0.6719939", "0.6648999", "0.65706456", "0.64959514", "0.63000065", "0.6083706", "0.60714066", "0.60307807", "0.5999182", "0.59672076", "0.5902492", "0.5813543", "0.57681733", "0.5696201", "0.562424", "0.56133723", "0.5515396", "0.5492279", "0.54920906", "0.5470...
0.85126865
0
ps:workers [QTY] DEPRECATED: use `heroku ps:scale workers=N` scale to QTY background processes if QTY is not specified, display the number of background processes currently running Example: $ heroku ps:dynos 3 Scaling workers... done, now running 3
def workers # deprecation notice added to v2.21.3 on 03/16/12 display("~ `heroku ps:workers QTY` has been deprecated and replaced with `heroku ps:scale workers=QTY`") workers = shift_argument validate_arguments! if workers action("Scaling workers") do new_workers = api.put_workers(ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale\n app = extract_app\n current_process = nil\n changes = args.inject({}) do |hash, process_amount|\n if process_amount =~ /^([a-zA-Z0-9_]+)([=+-]\\d+)$/\n hash[$1] = $2\n end\n hash\n end\n\n error \"Usage: heroku ps:scale web=2 worker+1\" if changes.empty?\n\n chan...
[ "0.75243735", "0.7109988", "0.7030956", "0.68412995", "0.6611573", "0.65560544", "0.6552528", "0.6513395", "0.64037216", "0.6269072", "0.6216943", "0.62060666", "0.6107998", "0.60794353", "0.60278094", "0.5986876", "0.5923211", "0.59193754", "0.58857477", "0.5788496", "0.5770...
0.85246956
0
ps:restart [DYNO] restart an app dyno if DYNO is not specified, restarts all dynos on the app Examples: $ heroku ps:restart web.1 Restarting web.1 dyno... done $ heroku ps:restart web Restarting web dyno... done $ heroku ps:restart Restarting dynos... done
def restart dyno = shift_argument validate_arguments! message, options = case dyno when NilClass ["Restarting dynos", {}] when /.+\..+/ ps = args.first ["Restarting #{ps} dyno", { :ps => ps }] else type = args.first ["Restarting #{type} dynos", { :type => type }] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart\n app = extract_app\n\n opts = case args.first\n when NilClass then\n display \"Restarting processes... \", false\n {}\n when /.+\\..+/\n ps = args.first\n display \"Restarting #{ps} process... \", false\n { :ps => ps }\n else\n type = args.first\n disp...
[ "0.7808233", "0.70183223", "0.6879686", "0.6516336", "0.6363924", "0.60094196", "0.58866405", "0.58373404", "0.5832172", "0.5785113", "0.5772512", "0.57717407", "0.5747413", "0.5747413", "0.5747413", "0.57333165", "0.5728457", "0.57136476", "0.57011676", "0.56873596", "0.5675...
0.8166115
0
ps:stop DYNOS stop an app dyno Examples: $ heroku stop run.3 Stopping run.3 dyno... done $ heroku stop run Stopping run dynos... done
def stop dyno = shift_argument validate_arguments! message, options = case dyno when NilClass error("Usage: heroku ps:stop DYNO\nMust specify DYNO to stop.") when /.+\..+/ ps = args.first ["Stopping #{ps} dyno", { :ps => ps }] else type = args.first ["Stopping #{ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop\n app = extract_app\n opt =\n if (args.first =~ /.+\\..+/)\n ps = args.first\n display \"Stopping #{ps} process... \", false\n {:ps => ps}\n elsif args.first\n type = args.first\n display \"Stopping #{type} processes... \", false\n {:type => type}\...
[ "0.7689535", "0.6727713", "0.66109985", "0.6512392", "0.64470345", "0.6379886", "0.6272218", "0.6232683", "0.6217167", "0.61890554", "0.61530733", "0.60952646", "0.6041457", "0.60395795", "0.6026322", "0.60040057", "0.5992933", "0.59891784", "0.5984854", "0.59835947", "0.5983...
0.8608918
0
ps:type [TYPE | DYNO=TYPE [DYNO=TYPE ...]] manage dyno types called with no arguments shows the current dyno type called with one argument sets the type where type is one of free|hobby|standard1x|standard2x|performance called with 1..n DYNO=TYPE arguments sets the type per dyno
def type requires_preauth app formation = get_formation changes = if args.any?{|arg| arg =~ /=/} args.map do |arg| if arg =~ /^([a-zA-Z0-9_]+)=([\w-]+)$/ type, new_size = $1, $2 current_p = formation.find{|f| f["type"] == type} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dynos\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`\")\n\n dynos = shift_argument\n validate_arguments!\n\n if dynos\n action(\"Scaling dynos\") do\n new_dynos = api.put_dynos(...
[ "0.6452378", "0.6076077", "0.5816268", "0.58134836", "0.562134", "0.5597749", "0.55790997", "0.5565822", "0.55205387", "0.5448634", "0.54452974", "0.5393754", "0.5387079", "0.53657347", "0.5345301", "0.5333334", "0.5332284", "0.53318477", "0.5329026", "0.5329026", "0.5295395"...
0.6811966
0
Builds multiple Populator::Record instances and calls save_records them when :per_query limit option is reached.
def build_records(amount, per_query, &block) amount.times do record = Record.new(@model_class, last_id_in_database + @records.size + 1) @records << record block.call(record) if block save_records if @records.size >= per_query end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def records_for_populate(options = {})\n records_base(options)\n end", "def batch_new\n @records = Array.new(BATCH_SIZE) { record_class.new }\n end", "def populate(amount, options = {}, &block)\n self.class.remember_depth do\n build_records(Populator.interpret_value(amount), options...
[ "0.6347587", "0.6280318", "0.6273725", "0.61053175", "0.6043005", "0.60100335", "0.6005123", "0.58896416", "0.58104354", "0.56245124", "0.5624205", "0.5618063", "0.5584915", "0.5576702", "0.5422031", "0.5382576", "0.5377016", "0.5369153", "0.5334501", "0.5328362", "0.5290196"...
0.7806644
0
Saves the records to the database by calling populate on the current database adapter.
def save_records unless @records.empty? @model_class.connection.populate(@model_class.quoted_table_name, columns_sql, rows_sql_arr, "#{@model_class.name} Populate") @last_id_in_database = @records.last.id @records.clear end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def records_for_populate(options = {})\n records_base(options)\n end", "def save; record.save; end", "def seed_db\n @records.each do |row|\n $db.execute(\n \"INSERT INTO records\n (report_type, patient_name, service_from, service_thru, paid_date, hic_num, gross_reimb, cash_ded...
[ "0.6028996", "0.5786327", "0.5729236", "0.5583682", "0.5581483", "0.5580849", "0.5558667", "0.55084544", "0.5504932", "0.55004543", "0.55002517", "0.5483511", "0.5482774", "0.5481345", "0.54726607", "0.5472178", "0.54720837", "0.5460149", "0.5454292", "0.5440043", "0.5440043"...
0.73466486
0
in the array. The array will never be empty and the numbers will always be positive integers. given an array of integer calculate the average of all numbers numbers are all > 0 iterate over array , sum them and divide by the size of the array
def average(array) return 0 if array.empty? array.sum / array.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average(array)\n sum = 0\n\n if array.empty? || array.index {|x| x > 0} == 1\n puts \"Your array may be empty or contain negative intergers\"\n else\n array.each do |int|\n sum +=int\n end\n sum /= array.size\n end\nend", "def average(array)\n if array.size <= 0\n return 0.0\n en...
[ "0.8515971", "0.80971307", "0.8026708", "0.7913091", "0.78915274", "0.7843364", "0.78430045", "0.78333044", "0.7821757", "0.78204864", "0.776393", "0.775869", "0.7738436", "0.77343947", "0.7728443", "0.7726349", "0.77074075", "0.7706711", "0.77022445", "0.76725954", "0.763962...
0.8112079
1
GET /families/1 GET /families/1.xml
def show @family ||= Family.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @family } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @families = Family.all\n end", "def index\n @families = Family.all\n end", "def index\n @families = Family.all\n end", "def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { re...
[ "0.66391575", "0.66391575", "0.66391575", "0.6602366", "0.6556731", "0.6552282", "0.6541676", "0.6533416", "0.639149", "0.63565314", "0.63284785", "0.6238541", "0.6151105", "0.60792756", "0.60305876", "0.6013372", "0.6001987", "0.5892585", "0.5880879", "0.5880842", "0.5808232...
0.6711528
0
GET /families/new GET /families/new.xml
def new @family = Family.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @family } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end", "def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fami...
[ "0.69727224", "0.6833814", "0.66612226", "0.6651011", "0.6544284", "0.65422297", "0.64651847", "0.6417502", "0.6383113", "0.637568", "0.6369943", "0.63574874", "0.6318974", "0.631751", "0.631751", "0.6314131", "0.6285898", "0.6262994", "0.6224628", "0.62236106", "0.6202178", ...
0.7474895
0
POST /families POST /families.xml
def create @family = Family.new(params[:family]) respond_to do |format| if @family.save flash[:notice] = 'Family was successfully created.' format.html { redirect_to(@family) } format.xml { render :xml => @family, :status => :created, :location => @family } else form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @family = Family.new(params[:family])\n\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n els...
[ "0.60733354", "0.6072399", "0.58886254", "0.58508116", "0.5639434", "0.5605569", "0.5539265", "0.5530745", "0.5517634", "0.5512985", "0.5511537", "0.54106337", "0.53630924", "0.5349675", "0.534874", "0.5343693", "0.5343693", "0.5343693", "0.5334595", "0.53041863", "0.5255488"...
0.60738903
0
PUT /families/1 PUT /families/1.xml
def update @family ||= Family.find(params[:id]) respond_to do |format| if @family.update_attributes(params[:family]) flash[:notice] = 'Family was successfully updated.' format.html { redirect_to(@family) } format.xml { head :ok } else format.html { render :action => "e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @family = Family.find(params[:id])\n\n respond_to do |format|\n if @family.update_attributes(params[:family])\n flash[:notice] = \"Family #{@family.business_name} was successfully updated.\"\n format.html { redirect_to(@family) }\n format.xml { head :ok }\n else\n...
[ "0.61421263", "0.59061885", "0.5898075", "0.58918715", "0.58918715", "0.5859121", "0.5848183", "0.58446854", "0.58446854", "0.5784108", "0.5741172", "0.5739658", "0.57295436", "0.56958514", "0.56777835", "0.5633969", "0.56147975", "0.5611409", "0.558681", "0.55664265", "0.551...
0.621874
0
DELETE /families/1 DELETE /families/1.xml
def destroy @family ||= Family.find(params[:id]) @family.destroy respond_to do |format| format.html { redirect_to(families_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n# @family = Family.find(params[:id])\n# @family.destroy\n#\n# respond_to do |format|\n# format.html { redirect_to(families_url) }\n# format.xml { head :ok }\n# end\n end", "def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\...
[ "0.6905691", "0.6569807", "0.64943194", "0.64396614", "0.6367237", "0.6339901", "0.6333035", "0.6294966", "0.6293467", "0.6292798", "0.6276343", "0.62606055", "0.62497", "0.6212668", "0.6197228", "0.617815", "0.6145188", "0.6105732", "0.61008066", "0.60920554", "0.6083808", ...
0.72651905
0
GET /contact_stores GET /contact_stores.json
def index @contact_stores = ContactStore.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @stores = Store.all\n render json: @stores\n end", "def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end", "def index\n @stores = @commerce.stores\n end", "def index\n @admin_stores = Admin::Store.all\n\n respond_to do |format|\n format.h...
[ "0.6989113", "0.66856945", "0.659619", "0.6567925", "0.65228313", "0.64396065", "0.6334135", "0.6324183", "0.6324067", "0.63140893", "0.62966347", "0.62866545", "0.6275036", "0.6259201", "0.6256949", "0.6251011", "0.6251011", "0.62449163", "0.6203063", "0.6203063", "0.6203063...
0.73882145
0
POST /contact_stores POST /contact_stores.json
def create @contact_store = ContactStore.new(contact_store_params) respond_to do |format| if @contact_store.save format.html { redirect_to @contact_store, notice: 'Contact store was successfully created.' } format.json { render :show, status: :created, location: @contact_store } els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @cakestore = Cakestore.new(cakestore_params)\n\n respond_to do |format|\n if @cakestore.save\n format.html { redirect_to @cakestore, notice: 'Cakestore was successfully created.' }\n format.json { render :show, status: :created, location: @cakestore }\n else\n form...
[ "0.6434339", "0.6414449", "0.636926", "0.6366385", "0.6327758", "0.6300838", "0.6299978", "0.6299978", "0.6260686", "0.6242875", "0.6241692", "0.6225512", "0.62102145", "0.62017196", "0.617447", "0.61275536", "0.610702", "0.6085593", "0.6042473", "0.60225576", "0.60078377", ...
0.73613364
0
PATCH/PUT /contact_stores/1 PATCH/PUT /contact_stores/1.json
def update respond_to do |format| if @contact_store.update(contact_store_params) format.html { redirect_to @contact_store, notice: 'Contact store was successfully updated.' } format.json { render :show, status: :ok, location: @contact_store } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to [:phone, @store], notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sto...
[ "0.63273424", "0.6290714", "0.62886846", "0.62306434", "0.6179664", "0.6154706", "0.6137701", "0.6125984", "0.6125984", "0.6125984", "0.6125984", "0.60858524", "0.6080788", "0.6072238", "0.6065387", "0.6054712", "0.60390294", "0.60240775", "0.6008811", "0.5950208", "0.5942085...
0.69166386
0
DELETE /contact_stores/1 DELETE /contact_stores/1.json
def destroy @contact_store.destroy respond_to do |format| format.html { redirect_to contact_stores_url, notice: 'Contact store was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @cakestore.destroy\n respond_to do |format|\n format.html { redirect_to cakestores_url, notice: 'Cakestore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_t...
[ "0.7212821", "0.7168814", "0.7154229", "0.7154229", "0.7154229", "0.7154229", "0.71260476", "0.71260476", "0.71260476", "0.71260476", "0.71050686", "0.70846194", "0.70506907", "0.7039082", "0.70173824", "0.7004824", "0.69737554", "0.6938925", "0.6929737", "0.6913436", "0.6903...
0.76097816
0
SUPPLEMENTS SUMMARY Total summary
def total_summary products = {} products.store(:item_cost, item_cost) products.store(:extras_cost, extras_cost) supplements = {} supplements.store(:pick_up_place, pickup_place_cost) supplements.store(:return_place, return_place_cost) supplements.store(:time_from...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary\n \n end", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def summary\n end", "def summary\n end", "def summary\n # TODO\n end", "def product_summary\n cell(CardProduct::Cell::Summary, card_product)\n end", "def summary\n {}\n...
[ "0.65217954", "0.64695597", "0.64695597", "0.64695597", "0.64695597", "0.6441944", "0.6441944", "0.641073", "0.62980616", "0.62752295", "0.62259245", "0.6189717", "0.6189717", "0.6167211", "0.6131053", "0.61240464", "0.60512584", "0.60227007", "0.6010383", "0.5976836", "0.596...
0.7099747
0
BOOKING LINES Add a booking line to the reservation == Parameters:: item_id:: The item id quantity:: The quantity
def add_booking_line(item_id, quantity) # Check if the booking includes the item_id product_lines = self.booking_lines.select do |booking_line| booking_line.item_id == item_id end if product_lines.empty? if product = ::Yito::Model::Booking::BookingCategory.get(item_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(item_id)\n self.add_or_create_line_item(item_id)\n end", "def add_or_create_line_item(item_id)\n if line_item = self.line_items.find_by(item_id: item_id)\n line_item.increment\n line_item\n else\n LineItem.new(cart_id: self.id, item_id: item_id)\n end\n end", "def crea...
[ "0.70234257", "0.6709108", "0.6615346", "0.6529793", "0.652385", "0.6486162", "0.6461691", "0.64134544", "0.6339395", "0.63042945", "0.6229814", "0.62192285", "0.61691827", "0.61633277", "0.6157244", "0.61517674", "0.6099156", "0.60345", "0.59978914", "0.5993501", "0.59846437...
0.69256365
1
Destroy a booking line == Parameters:: item_id:: The item line id
def destroy_booking_line(item_id) product_lines = self.booking_lines.select do |booking_line| booking_line.item_id == item_id end if booking_line = product_lines.first transaction do self.item_cost -= booking_line.item_cost self.product_deposit_cost -= book...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @line_item.destroy\n destroy_line_item_response\n end", "def destroy\n @line_item = line_items.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n end\n end", "def destroy\n @item_line = ItemLine.find(params[...
[ "0.75655544", "0.7203878", "0.72035444", "0.71088207", "0.70940477", "0.7078435", "0.7065822", "0.7036312", "0.7036312", "0.7036312", "0.7036312", "0.6995786", "0.69885296", "0.69773275", "0.68693906", "0.68693906", "0.68693906", "0.68693906", "0.68693906", "0.68693906", "0.6...
0.7337309
1
EXTRAS Add a booking extra to the reservation
def add_booking_extra(extra_id, quantity) booking_extras = self.booking_extras.select do |booking_extra| booking_extra.extra_id == extra_id end if booking_extras.empty? if extra = ::Yito::Model::Booking::BookingExtra.get(extra_id) extra_translation = extra.translate(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_extra(extra)\n @extras.merge!(extra)\n end", "def add_extra(key, value)\n @extras[key] = value\n end", "def add_reservation(start_date, end_date)\n @bookings << [start_date, end_date]\n end", "def extra; @extra; end", "def set_reservation\n @extra_reservation = ExtraReservation.f...
[ "0.6635611", "0.59817415", "0.59312916", "0.54091024", "0.5391078", "0.5381175", "0.537835", "0.5361979", "0.53195685", "0.53176796", "0.53095484", "0.52653044", "0.5236827", "0.52123994", "0.5208371", "0.5140492", "0.51366997", "0.5130116", "0.51078737", "0.5099543", "0.5073...
0.6530423
1
BOOKING CHARGE Add a booking charge
def add_booking_charge(date, amount, payment_method_id) transaction do charge = Payments::Charge.new charge.date = date charge.amount = amount charge.payment_method_id = payment_method_id charge.status = :pending charge.currency = SystemConfiguration::Variab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_charge(desc, bond)\n self[:charges] << {\n :desc => desc.to_s.strip,\n :bond => bond.to_s.gsub('$', '').strip.to_i\n \t}\n Log.d(\"Adding charge: #{self[:charges].last[:desc]}, #{self[:charges].last[:bond]}\")\n end", "def book_hotel\r\n # prices in stripe are defined in cents, ...
[ "0.6776659", "0.6752922", "0.6468963", "0.6260624", "0.6252942", "0.6193788", "0.6115227", "0.6086412", "0.6001376", "0.5934734", "0.59116423", "0.59038943", "0.5888044", "0.58800834", "0.5854628", "0.58421224", "0.5821806", "0.57947856", "0.5766759", "0.5712016", "0.57005435...
0.6776325
1
Destroy a booking charge
def destroy_booking_charge(charge_id) if booking_charge = BookingDataSystem::BookingCharge.first(:booking_id => self.id, :charge_id => charge_id) charge = booking_charge.charge transaction do if charge.status == :done...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @booking.destroy\n end", "def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n redirect_to charges_url\n end", "def destroy\n if @accommodation_charge.destroy\n redirect_to company_accommodation_charges_path( @company ), notice: t('notice.destroy', model_name...
[ "0.7612688", "0.756157", "0.73435915", "0.73131484", "0.73122597", "0.725401", "0.7248786", "0.7183744", "0.7160358", "0.71502894", "0.71502894", "0.71502894", "0.71302", "0.7123444", "0.70675886", "0.7038702", "0.70113933", "0.7006071", "0.7005511", "0.69715285", "0.6955649"...
0.7798823
0
Get the category of the reserved items
def category booking_lines and booking_lines.size > 0 ? ::Yito::Model::Booking::BookingCategory.get(booking_lines[0].item_id) : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category_string\n return Item::ITEM_CATEGORIES[self.category_id] if self.category_id\n return \"\"\n end", "def categories_for(item)\n return [] unless @items[item]\n\n @items[item].categories\n end", "def category()\n if (order_in_lines.length == 1)\n cat = order_in_lines[0].book...
[ "0.6429407", "0.6404427", "0.6327857", "0.62652206", "0.6214743", "0.60485834", "0.6032046", "0.59918", "0.5979594", "0.5950983", "0.59153354", "0.5911013", "0.59006417", "0.58686054", "0.58564585", "0.58378357", "0.58368444", "0.58351094", "0.5823416", "0.5814765", "0.581476...
0.6604788
0
Check the payment cadence is allowed
def payment_cadence_allowed? begin config_payment_cadence = SystemConfiguration::Variable.get_value('booking.payment_cadence').to_i _date_from_str = "#{self.date_from.strftime('%Y-%m-%d')}T#{self.time_from}:00#{self.date_from.strftime("%:z")}" _date_from = DateTime.strptime(_da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge_is_allowed?\n\t\tif not customer_has_authorized_payment?\n\t\t\terrors.add :base, I18n.t('views.customer_file.new_charge.you_are_not_authorized')\n\t\t\tfalse\n\t\telsif valid? and charge_amount.present? and authorized_amount and charge_amount.to_i <= authorized_amount\n\t\t\ttrue\n\t\telse\n\t\t\terror...
[ "0.75447243", "0.7347513", "0.7347513", "0.73074293", "0.71527463", "0.71349007", "0.7123488", "0.7101144", "0.70804197", "0.70804197", "0.68784773", "0.6834908", "0.68171525", "0.68162286", "0.6789596", "0.6780398", "0.67728525", "0.67522043", "0.67319894", "0.66976804", "0....
0.8120673
0
Check if the booking deposit can be paid
def can_pay_deposit? conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit'))) if self.status == :pending_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_pay_pending?\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n conf_payment_pending ...
[ "0.77239037", "0.7569773", "0.7422755", "0.73755723", "0.7339481", "0.73014724", "0.72930986", "0.72819316", "0.7277613", "0.7249772", "0.72377115", "0.7196021", "0.71829253", "0.71771604", "0.71770436", "0.7128008", "0.7121361", "0.70882684", "0.7068571", "0.70556414", "0.70...
0.832738
0
Check if the booking pending amout can be paid
def can_pay_pending? conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit'))) conf_payment_pending = System...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paid?\n date_paid_out.present?\n end", "def paid_in_full?\n !payment_outstanding?\n end", "def is_pending?\n generated_at.nil? && !paid_on.nil?\n end", "def can_supply?\n payment_received? || payment_on_account?\n end", "def paid?\n status == PAID\n end", "def can_pay_depo...
[ "0.71702313", "0.71526426", "0.7109992", "0.7084684", "0.70435095", "0.6993429", "0.6967501", "0.696737", "0.6962636", "0.6962589", "0.69588023", "0.69563323", "0.69521564", "0.6946697", "0.69341993", "0.6931443", "0.688302", "0.68753105", "0.6861397", "0.6861395", "0.6832474...
0.7590212
0
Check if the booking total can be paid
def can_pay_total? conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool conf_payment_total = (['total','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit'))) if self.status == :pending_confir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_pay_pending?\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n conf_payment_pending ...
[ "0.7412474", "0.7411622", "0.73245823", "0.7309448", "0.72949857", "0.72554713", "0.7233095", "0.72233987", "0.7153269", "0.7052865", "0.7051206", "0.7038335", "0.69835436", "0.69825155", "0.69233483", "0.6890057", "0.6832605", "0.68203557", "0.6803191", "0.67923677", "0.6786...
0.8055018
0
Get a list of the other people involved in the contract (extracted from resources)
def contract_other_people result = [] booking_line_resources.each do |resource| result << { :name => resource.resource_user_name, :surname => resource.resource_user_surname, :document_id => resource.resource_user_document_id, :phone =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def involved_people\n involved_people_ids.collect{|user_id| User.find(user_id)}\n end", "def involved_people\n # [self.user, self.answerers, self.commenters].flatten.uniq\n [self.user].flatten.uniq\n end", "def my_clients\n self.client_cars.map do |car|\n car.owner\n end\n end", "def g...
[ "0.6893433", "0.6450095", "0.6368445", "0.6293375", "0.62438333", "0.6202781", "0.61728823", "0.6167317", "0.6148839", "0.61203325", "0.6117037", "0.60939777", "0.60792786", "0.6050543", "0.603209", "0.6017737", "0.59924114", "0.59899044", "0.5989361", "0.5986904", "0.5968545...
0.65476793
1
Creates an online charge
def create_online_charge!(charge_payment, charge_payment_method_id) if total_pending > 0 and charge_payment_method = Payments::PaymentMethod.get(charge_payment_method_id.to_sym) and not charge_payment_method.is_a?Payments::OfflinePaymentMethod and !([:deposit, :pending, :to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_charge\n customer = Stripe::Customer.create(\n :email => params[:stripeEmail],\n :card => params[:stripeToken]\n )\n\n charge = Stripe::Charge.create(\n :customer => customer.id,\n :amount => Deal.find(current_consumer.orders.last[:deal_id]).price.to_i * 100,\n ...
[ "0.7203495", "0.71276355", "0.7066049", "0.70205635", "0.6999604", "0.69953424", "0.6966712", "0.68556285", "0.6849291", "0.6794063", "0.67895603", "0.6786372", "0.67256474", "0.6707521", "0.66697544", "0.6664877", "0.66551316", "0.6653614", "0.6647449", "0.6601269", "0.65839...
0.7578193
0
Confirms the booking A booking can only be confirmed if it's pending confirmation and contains a done charge
def confirm if status == :pending_confirmation and not charges.select { |charge| charge.status == :done }.empty? transaction do self.status = :confirmed self.save # Assign available stock assign_available_stock if SystemConfiguration::Variable.get_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirming?\n self.status == 'confirming'\n end", "def confirm!\n self.pending = false\n self.save\n self.createDebts\n end", "def is_confirmed?\n return self.status == Erp::Reservations::Reservation::STATUS_CONFIRMED\n end", "def confirmable?\n status.to_sym.in...
[ "0.7393467", "0.72894025", "0.72890913", "0.7191981", "0.7173776", "0.7113949", "0.70914084", "0.7046285", "0.69909847", "0.6982988", "0.69735354", "0.69726926", "0.6832937", "0.6818922", "0.6803567", "0.6802363", "0.67948097", "0.6790354", "0.67571694", "0.67345583", "0.6699...
0.73184466
1
Confirm the booking without checking the charges
def confirm! if status == :pending_confirmation transaction do update(:status => :confirmed) # Assign available stock assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool # Cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm\n if status == :pending_confirmation and\n not charges.select { |charge| charge.status == :done }.empty?\n transaction do\n self.status = :confirmed\n self.save\n # Assign available stock\n assign_available_stock if SystemConfiguration::Var...
[ "0.76281", "0.7298967", "0.7282391", "0.72769725", "0.72663724", "0.7261435", "0.72515655", "0.72482556", "0.7206465", "0.7116592", "0.7087301", "0.7085152", "0.69981986", "0.69981986", "0.6993488", "0.6960853", "0.69397485", "0.6935702", "0.6929306", "0.68695295", "0.6848645...
0.73611575
1
Cancels a booking A booking can only be cancelled if it isn't already cancelled
def cancel unless status == :cancelled transaction do if total_paid > 0 update(:status => :cancelled, :payment_status => :refunded, :total_paid => 0, :total_pending => total_cost) else update(:status => :cancelled) end # Crea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_booking\n @booking = Booking.find(params[:id])\n if @booking.booking_date > Time.now\n if params[:cancellation_message].strip == \"\" || params[:cancellation_message].nil?\n flash[:danger] = \"Message needs to be specified before cancelling a booking.\"\n redirect_to booking_pat...
[ "0.7473922", "0.72661614", "0.71906024", "0.7122314", "0.7105095", "0.7061529", "0.705622", "0.6979841", "0.6960039", "0.6880848", "0.686187", "0.6853294", "0.6839435", "0.6792208", "0.6786324", "0.6769495", "0.67596406", "0.67408955", "0.6723544", "0.66924024", "0.6688775", ...
0.7310761
1
Gets the payment method instance
def payment_method if payment_method_id.nil? return nil else @payment_method ||= Payments::PaymentMethod.get(payment_method_id.to_sym) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_method\n Zapi::Models::PaymentMethod.new\n end", "def payment_method\n @payment_method ||= Gateway::AdyenHPP.last # find(params[:merchantReturnData])\n end", "def payment_method\n @payment_method ||= PAYMENT_METHOD[mapping_for(:payment_method)]\n end", "def p...
[ "0.79170084", "0.77542", "0.77419406", "0.77419406", "0.7611124", "0.7611124", "0.71781945", "0.7165474", "0.70644796", "0.70008755", "0.6835799", "0.6629894", "0.6629894", "0.6546507", "0.6373272", "0.6281328", "0.6276946", "0.6230121", "0.6199808", "0.6198017", "0.61825365"...
0.7860746
1
Automatic resource assignation Assign available stock to unassigned items
def assign_available_stock stock_detail, category_occupation = BookingDataSystem::Booking.categories_availability(self.rental_location_code, self.date_from, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def review_assigned_stock\n\n automatic_assignation = SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n\n # Search availability\n product_search = ::Yito::Model::Booking::BookingCategory.search(self.rental_location_code,\n ...
[ "0.7266336", "0.63621277", "0.6335894", "0.5972539", "0.59010535", "0.589307", "0.58032095", "0.5785485", "0.57713777", "0.5699437", "0.5645995", "0.5630188", "0.5609678", "0.56092834", "0.5554395", "0.55434406", "0.55139226", "0.55033726", "0.5480936", "0.5475732", "0.546020...
0.7307276
0
Review the assigned stock when the user changes dates
def review_assigned_stock automatic_assignation = SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool # Search availability product_search = ::Yito::Model::Booking::BookingCategory.search(self.rental_location_code, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_change\n\n\t\tprint \"\\n\\n\\t\\tAre You Confirm(y/n)\"\n\t\toption=gets.chomp\n\n\t\tif option==\"y\" or option==\"Y\"\n\t#fetch product id from inline products\n\t\t\tstatement12=@connection.prepare(\"select p_id from inline_products where card_no=?\")\n\t\t\tstatement12.execute(@card_no)\n\n\t\t\twhi...
[ "0.59674954", "0.59114957", "0.5874424", "0.5855901", "0.58518076", "0.5802699", "0.5801529", "0.57877094", "0.5773821", "0.5752372", "0.5711676", "0.56911236", "0.5684132", "0.56174636", "0.56086046", "0.55959946", "0.5590705", "0.5589145", "0.5588578", "0.5571124", "0.55644...
0.59561086
1
Creates a new business event to notify a booking has been created
def create_new_booking_business_event! BusinessEvents::BusinessEvent.fire_event(:new_booking, {:booking_id => id}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_booking(day)\n new_booking = Booking.create(host_id: self.id,day: day)\n puts \"A new booking has been created for #{self.name} on #{day}.\"\n new_booking.assign_waiter\n puts \"#{new_booking.waiter.name} has been assigned to #{self.name}'s booking'.\"\n end", "def new_b...
[ "0.7034003", "0.68559456", "0.673945", "0.6640861", "0.6639718", "0.6595187", "0.65837765", "0.65764546", "0.6536383", "0.64803624", "0.64762026", "0.6461766", "0.64547074", "0.6437413", "0.6420073", "0.6388647", "0.637463", "0.63629454", "0.6360032", "0.6359874", "0.635931",...
0.88472605
0
First octet of the SMSDELIVER PDU
def sms_deliver_first_octet octet = 0 octet |= 0x04 unless @opts[:more_to_send] octet |= 0x80 if @opts[:has_udh] octet.chr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sms_submit_first_octet\n octet = 1\n octet |= 0x80 if @opts[:has_udh]\n octet.chr\n end", "def checksum_char\n packed_orcid[-1]\n end", "def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n end", "def header_udp package_number, file_size...
[ "0.7446263", "0.5782127", "0.5691159", "0.5513082", "0.5322141", "0.5280775", "0.5257198", "0.5247528", "0.52464557", "0.5217796", "0.51832944", "0.5173526", "0.51660067", "0.51660067", "0.51503825", "0.51340896", "0.5132467", "0.5132467", "0.5130073", "0.51197314", "0.510031...
0.8444852
0
First octet of the SMSSUBMIT PDU
def sms_submit_first_octet octet = 1 octet |= 0x80 if @opts[:has_udh] octet.chr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sms_deliver_first_octet\n octet = 0\n octet |= 0x04 unless @opts[:more_to_send]\n octet |= 0x80 if @opts[:has_udh]\n octet.chr\n end", "def checksum_char\n packed_orcid[-1]\n end", "def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n ...
[ "0.77627903", "0.6038064", "0.5575904", "0.53578866", "0.5307828", "0.52707964", "0.5261338", "0.52596617", "0.5253976", "0.52508795", "0.5176297", "0.5164403", "0.5132549", "0.5123281", "0.5093337", "0.506514", "0.5060142", "0.5048549", "0.5047724", "0.50351167", "0.5029047"...
0.8202668
0
Consider the following "magic" 3gon ring, filled with the numbers 1 to 6, and each line adding to nine. (4) \ (3) / \ (1)(2)(6) / (5) Working clockwise, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above...
def solve( n = 16 ) max = 0 (1..10).each do |a| (1..10).each do |b| next if b == a (1..10).each do |c| next if c == b || c == a (1..10).each do |d| next if d == c || d == b || d == a (1..10).each do |e| next if e == d || e == c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_rings\n shortc = (0..9).collect{|i| i unless @longc.include?(i) }.compact\n raise DataError if shortc.nil?\n long = @longc.collect{|i| (0..9).collect{|j| i*10+j } }.flatten\n raise DataError if long.nil?\n @shortc = shortc.dup\n\n word = @full_key.dup\n word.scan(/./) do ...
[ "0.5834196", "0.57636845", "0.5740921", "0.56558305", "0.5580554", "0.53503", "0.53409725", "0.5324064", "0.5303507", "0.5271845", "0.5238958", "0.5226239", "0.51714593", "0.5138234", "0.51071286", "0.50892365", "0.5084717", "0.5080561", "0.5047886", "0.5039495", "0.5011326",...
0.6129414
0
The xpath to the collection that the item belongs to (relative path from the item node)
def collection_xpath "ancestor::#{Ead::Collection.root_xpath}[1]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection_path(path = nil)\n if path.nil?\n @collection_path ||= root_element.to_s.pluralize\n else\n @collection_path = path\n @element_path = \"#{path}/:id\"\n end\n end", "def collection_path(query_options = nil)\n self.element_nam...
[ "0.6477119", "0.6439781", "0.6269458", "0.6230092", "0.6051657", "0.60326385", "0.59166074", "0.59166074", "0.5883368", "0.5876971", "0.58339953", "0.5778686", "0.57173204", "0.57012594", "0.57012594", "0.5697165", "0.56501657", "0.5554814", "0.55504006", "0.55465263", "0.551...
0.8035267
0
Overridden from the Commits::CreateService, to skip some validations we don't need: validate_on_branch! Not needed, the patches are applied on top of HEAD if the branch did not exist validate_branch_existence! Not needed because we continue applying patches on the branch if it already existed, and create it if it did n...
def validate! validate_patches! validate_new_branch_name! if new_branch? validate_permissions! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_patch(repo_path, commit, branch)\n `(cd \"#{repo_path}\" && git format-patch --stdout #{commit}..#{branch})`\n end", "def create_branch\n check_current_repo\n exists = `git branch --list #{branch}`.squish == branch\n if exists\n `git checkout #{branch}`\n else\n `git checkout master` unl...
[ "0.611919", "0.6078425", "0.6057751", "0.59711015", "0.5941705", "0.5710461", "0.56812805", "0.56613743", "0.549618", "0.5488865", "0.5466211", "0.5461446", "0.5394179", "0.53802186", "0.53684247", "0.5359292", "0.530741", "0.527453", "0.52670574", "0.52559674", "0.52417594",...
0.6238832
0
share_folders sets up the shared folder definitions on the VirtualBox VM. The transient parameter determines if we're FORCING transient or not. If this is false, then any shared folders will be shared as nontransient unless they've specifically asked for transient.
def share_folders(machine, folders, transient) defs = [] warn_user_symlink = false folders.each do |id, data| hostpath = data[:hostpath] if !data[:hostpath_exact] hostpath = Vagrant::Util::Platform.cygwin_windows_path(hostpath) end enable_sym...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_folders(prefix, folders)\n folders.each do |type, local_path, remote_path|\n if type == :host\n env[:machine].config.vm.share_folder(\n \"v-#{prefix}-#{self.class.get_and_update_counter(:shared_folder)}\",\n remote_path, local_path, :nfs => c...
[ "0.7165208", "0.71175003", "0.703601", "0.701515", "0.6822502", "0.6428833", "0.64015514", "0.6398474", "0.639077", "0.6074324", "0.59500736", "0.5934675", "0.58135176", "0.5727957", "0.56429344", "0.56343734", "0.5577921", "0.5522186", "0.5503319", "0.5501793", "0.54735935",...
0.78720707
0
GET /corges GET /corges.json
def index @corges = Corge.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end", "def index\n @corridas = Corrida.all\n end", "def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render js...
[ "0.63470995", "0.62195367", "0.617979", "0.6128525", "0.61189437", "0.6065697", "0.60179573", "0.5977875", "0.5962381", "0.5959897", "0.5937151", "0.59276474", "0.59276474", "0.5923053", "0.5845671", "0.5845671", "0.5820548", "0.581278", "0.58037454", "0.5792899", "0.57905966...
0.72953016
0
POST /corges POST /corges.json
def create @corge = Corge.new(corge_params) respond_to do |format| if @corge.save format.html { redirect_to @corge, notice: 'Corge was successfully created.' } format.json { render :show, status: :created, location: @corge } else format.html { render :new } format.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corge_params\n params.require(:corge).permit(:name)\n end", "def create\n @corrida = Corrida.new(corrida_params)\n\n respond_to do |format|\n if @corrida.save\n format.html { redirect_to @corrida, notice: 'Corrida creada satisfactoriamente.' }\n format.json { render :show, st...
[ "0.59962296", "0.59616214", "0.5871873", "0.58151084", "0.575999", "0.57137275", "0.56561214", "0.56377673", "0.5621923", "0.5568752", "0.5567557", "0.55247456", "0.5519409", "0.5519409", "0.5500358", "0.54935706", "0.54596233", "0.54401773", "0.5435543", "0.54309547", "0.541...
0.7052685
0
PATCH/PUT /corges/1 PATCH/PUT /corges/1.json
def update respond_to do |format| if @corge.update(corge_params) format.html { redirect_to @corge, notice: 'Corge was successfully updated.' } format.json { render :show, status: :ok, location: @corge } else format.html { render :edit } format.json { render json: @corge.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch!\n request! :patch\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @co...
[ "0.64154375", "0.6351106", "0.6295332", "0.62868214", "0.62499166", "0.61793506", "0.6168222", "0.61063755", "0.6093066", "0.60413516", "0.60275793", "0.60275793", "0.60257787", "0.6016393", "0.6016393", "0.6005643", "0.5965719", "0.59573233", "0.59201616", "0.5909054", "0.58...
0.6542406
0
Takes the large amount of words from enable.txt and puts them into an array.
def generate_words ret = [] File.open('enable.txt').each do |line| new_line = line # We don't care for the new line character in the game of hangman. new_line = new_line.delete("\n") ret << new_line end return ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_word_array(plaintext_file)\n ary = File.read(plaintext_file).split(\" \").map do |word|\n word.downcase.gsub(/[^a-z]/, '')\n end\n return ary\n end", "def make_word_array\n @word_array = @word.chars.to_a\n end", "def ReadFromFile()\n wordArray = Array.new\n File.open(\"...
[ "0.717489", "0.69008476", "0.6771478", "0.6706544", "0.655736", "0.65365916", "0.64903337", "0.6388426", "0.6384112", "0.62930053", "0.62885255", "0.6285146", "0.6282907", "0.62576824", "0.6254661", "0.62236595", "0.62172484", "0.6209299", "0.61543673", "0.6131502", "0.612953...
0.70223576
1
Converting PDF to PNG
def convert_to_png(input_pdf, output_file) pdf = Magick::ImageList.new(input_pdf) { self.density = 200 } pdf.write(output_file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_png_file\n to_pdf_file do |pdf_path|\n Dir.mktmpdir(ident) do |output_directory|\n png_path = File.join(output_directory, ident + '.png')\n system convert, *CONVERT_OPTIONS, pdf_path, png_path\n raise PNGConversionFailed, self unless File.exist?(png_path)\n\n yield png_pa...
[ "0.7990437", "0.7990437", "0.7455685", "0.73444676", "0.70385474", "0.6745083", "0.66779184", "0.6619678", "0.65929914", "0.6436064", "0.64334553", "0.6424127", "0.6393544", "0.6364619", "0.636226", "0.6321953", "0.63161117", "0.62945926", "0.62856066", "0.62802726", "0.62650...
0.80366373
0
Adding QR and label to the PNG
def embed_info(input_file, qr, label, x_coord, y_coord) img_template = ChunkyPNG::Image.from_file(input_file) img_label = ChunkyPNG::Image.from_file(label) img_template.compose!(qr, x_coord, y_coord) img_template.compose!(img_label, x_coord + 255, y_coord) rename_file = input_file[5..-1] img_template.save("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customQRcode(inputStr) \n qrcode = RQRCode::QRCode.new(inputStr).as_png(fill: 'white', color: 'black', file: 'abc.png')\n avatar = ChunkyPNG::Image.from_file('abc.png')\n\n # alogo.png being the logo file\n badge = ChunkyPNG::Image.from_file('alogo.png')\n\n print(\"height of backgound:\")\n ...
[ "0.6841074", "0.6600583", "0.648238", "0.6459222", "0.6205056", "0.6163537", "0.6123644", "0.6105584", "0.60976434", "0.605441", "0.60269684", "0.600911", "0.59682494", "0.59326553", "0.5844691", "0.5822871", "0.5822212", "0.5819533", "0.5799611", "0.57883227", "0.5639229", ...
0.72884035
0
This method can be used to manually link an asset to an acts_as_asset_box object in tests or otherwise. The object needs to be saved afterward so that the Effective::Attachment is saved (and the association is saved). For example: class User < ActiveRecord::Base acts_as_asset_box :avatar end asset = Effective::Asset.ne...
def add_to_asset_box(box, *items) box = (box.present? ? box.to_s : 'assets') boxes = box.pluralize items = [items].flatten.compact if items.present? && items.any? { |obj| !obj.kind_of?(Effective::Asset) } raise ArgumentError.new('add_to_asset_box expects one or more Effective::Assets, or an Array...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_asset(asset)\n @al_asset_group.addAsset(asset.al_asset)\n end", "def replace_in_asset_box(box, original, overwrite)\n box = (box.present? ? box.to_s : 'assets')\n boxes = box.pluralize\n\n unless original.present? && original.kind_of?(Effective::Asset)\n raise ArgumentError.new(\"se...
[ "0.59958315", "0.591706", "0.5861354", "0.585009", "0.5838892", "0.5830588", "0.58007914", "0.574539", "0.5729792", "0.57199323", "0.57139134", "0.57139134", "0.57139134", "0.57139134", "0.57139134", "0.5713662", "0.5691047", "0.56537646", "0.56528217", "0.56219596", "0.55910...
0.6592163
0
Make sure there are conversation member objects for all users, if there is a converation associated with the availability
def ensure_conversation_members convo = Conversation.where(availability_id: id).first if convo convo.conversation_members.create(user: user, admin: admin) if convo.conversation_members.where(user: user).first.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_members\n conversation_members << conversation_members.new(user_id: owner_id, is_admin: true)\n errors.add(:base, \"Required two members to create a 1 to 1 conversation.\") if !is_group_conversation? && ((new_members || []) + [owner_id]).delete_empty.map(&:to_i).uniq.count < 2\n end", "def matc...
[ "0.729364", "0.6941028", "0.642962", "0.61134404", "0.6092712", "0.5966249", "0.59593415", "0.5949759", "0.58129275", "0.57753706", "0.5758085", "0.57269907", "0.5718913", "0.56717086", "0.5667335", "0.56633604", "0.5657858", "0.56547564", "0.5653306", "0.56416035", "0.563821...
0.81174755
0
Truncated project identifier (shortname & part of the description)
def project_identifier(p, length=26) truncate([p.shortname, p.description].join(" - "), :length => length) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project\n params['project'].gsub('_', '-')\n end", "def project_code\n name[PROJECT_CODE_FORMAT]\n end", "def human_readable_identifier_columns\n { :project => :title }\n end", "def issue_project_key(issue_key)\n issue_key.split('-').length > 1 ? issue_key : [current_project, iss...
[ "0.6781715", "0.67052704", "0.67012584", "0.66370595", "0.6630924", "0.6616949", "0.6499973", "0.6499973", "0.64954233", "0.6383891", "0.63314784", "0.63314784", "0.6283354", "0.62602586", "0.61938053", "0.61930984", "0.61930984", "0.61857486", "0.6175822", "0.61634725", "0.6...
0.8665244
0
Display an edit link if the entry belongs to the logged in user
def display_edit_link(entry) if entry.user == current_user link_to (image_tag 'edit.png'), edit_entry_path(entry) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\tif !current_user || !is_this_user\n\t\t\tredirect_to user_path(params[:id])\n\t\tend\n\tend", "def edit\n redirect_to root_url and return unless current_user\n @user = current_user\n end", "def edit\n @link = Link.find(params[:id])\n if current_user && current_user.id == @link.user_i...
[ "0.7747033", "0.77255124", "0.7623171", "0.75936306", "0.7589883", "0.7566778", "0.7557951", "0.75435805", "0.75338274", "0.7476841", "0.74598885", "0.745371", "0.74381214", "0.74332947", "0.7411412", "0.7408872", "0.7392097", "0.7390147", "0.73885334", "0.73715466", "0.73715...
0.8464309
1
GET /time_entries/new GET /time_entries/new.json
def new @time_entry = TimeEntry.new respond_to do |format| format.html # new.html.erb format.json { render json: @time_entry } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @timeentry = Timeentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timeentry }\n end\n end", "def new\n @breadcrumb = 'create'\n @time_record = TimeRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\...
[ "0.8126846", "0.7353966", "0.7299263", "0.7299263", "0.7299263", "0.7253368", "0.72042024", "0.72020304", "0.7170777", "0.7146488", "0.71185404", "0.7105599", "0.7057156", "0.7050364", "0.70374864", "0.7030023", "0.7016586", "0.69981337", "0.69804966", "0.69349265", "0.693223...
0.81166846
1