query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
necessary getter for the radio buttons
def borrower end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radiobuttons; end", "def radio_button; end", "def radio_button(object_name, method, tag_value, options = T.unsafe(nil)); end", "def radio_button(method, tag_value, options = T.unsafe(nil)); end", "def collection_radio_buttons(method, collection, value_method, text_method, options = T.unsafe(nil), html_...
[ "0.83914614", "0.8014382", "0.6766986", "0.6760082", "0.67335355", "0.6712733", "0.66098076", "0.66051704", "0.6577272", "0.6430425", "0.6430097", "0.6373808", "0.6356547", "0.62865835", "0.6267724", "0.6267724", "0.6267133", "0.62625295", "0.6249636", "0.6224736", "0.6175902...
0.0
-1
Serializes this object as a Hash.
def to_json(*a) for_json.to_json(*a) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize\n JSON.dump(@hash)\n end", "def to_hash\n @hash\n end", "def to_hash\n @_hash_\n end", "def to_hash\n @hash\n end", "def to_hash\n @hash\n end", "def serialize\n self.to_hash.to_json\n end", "def hash\n [self.class, to_h].ha...
[ "0.8143122", "0.7843768", "0.78376937", "0.7739802", "0.7739802", "0.76604396", "0.74428993", "0.74428993", "0.74428993", "0.7425706", "0.74125624", "0.7374227", "0.73587763", "0.73444766", "0.7341943", "0.73182124", "0.7257018", "0.7251492", "0.7248919", "0.7186984", "0.7160...
0.0
-1
Returns the object as a Ruby Hash.
def for_json to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n object\n end", "def as_hash\n @hash\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n ...
[ "0.87105083", "0.8023544", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.8008057", "0.78191125", "0.78191125", "0.77513814", "0.77116704", "0.76922274...
0.69612736
81
Replaces the EncryptedMash content from a Mash.
def update_from!(enc_hs) unless self.class.exist?(enc_hs) fail UnacceptableEncryptedAttributeFormat, 'Trying to construct invalid encrypted attribute. Maybe it is '\ 'not encrypted?' end enc_hs = enc_hs.dup enc_hs.delete(JSON_CLASS) enc_hs.delete(CHEF_TYPE) update(enc_hs) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smash!(options = {})\n\t\tself.replace(smash, options)\n\tend", "def unsmash!(options = {})\n\t\tself.replace(unsmash, options)\n\tend", "def load(enc_hs, key = nil)\n enc_attr = EncryptedMash.json_create(enc_hs)\n decrypted = enc_attr.decrypt(key || local_key)\n decrypted['content'] # TODO:...
[ "0.57387614", "0.51090866", "0.50619745", "0.5040187", "0.4986725", "0.49550542", "0.4949966", "0.49420065", "0.488828", "0.48176295", "0.48025507", "0.47657114", "0.47573495", "0.4753787", "0.47106388", "0.47038677", "0.4667922", "0.46611553", "0.4555571", "0.45511618", "0.4...
0.5090861
2
Returns a Hash containing Distribution Name, Version and Kernel Information
def get_sysinfo system_data = {} kernel_version = cmd_exec("uname -a") version = read_file("/etc/release").split("\n")[0].strip system_data[:version] = version system_data[:kernel] = kernel_version system_data[:hostname] = kernel_version.split(" ")[1] host_info = { :host => rhost, :os_name => 'Solaris', :name => system_data[:hostname] } # Test cases for these can be found here: # http://rubular.com/r/MsGuhp89F0 # http://rubular.com/r/DWKG0jpPCk # http://rubular.com/r/EjiIa1RFxB if /(?<OS>(?<!Open|Oracle )Solaris).+s2?(?<major>\d?\d)[x|s]?(_u)(?<minor>\d?\d)/ =~ system_data[:version] host_info[:os_flavor] = "#{major}.#{minor}" elsif /(?<OS>Oracle Solaris) (?<major>\d\d)\.(?<minor>\d?\d)/ =~ system_data[:version] host_info[:os_flavor] = "#{major}.#{minor}" elsif /(?<OS>OpenSolaris|OpenIndiana [\w]+) (?<major>\d\d\d\d)\.(?<minor>\d\d)/ =~ system_data[:version] host_info[:os_flavor] = "#{major}.#{minor}" end report_host(host_info) return system_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [dep_mgr_name, name, version, license].hash\n end", "def hash\n name.hash ^ version.hash\n end", "def version_guid\n \"#{digest_type}:#{checksum}\"\n end", "def get_sysinfo\n\t\tsystem_data = {}\n\t\tkernel_version = cmd_exec(\"uname -a\")\n\t\tversion = read_file(\"/etc/re...
[ "0.6991506", "0.63416886", "0.6200847", "0.6155625", "0.59976983", "0.5906311", "0.58583885", "0.583535", "0.58306557", "0.5816876", "0.5804739", "0.57393765", "0.57159054", "0.57159054", "0.57159054", "0.5714627", "0.56883645", "0.56633514", "0.5660797", "0.5626226", "0.5587...
0.0
-1
Gathers all SUID files on the filesystem. NOTE: This uses the Linux `find` command. It will most likely take a while to get all files. Consider specifying a more narrow find path.
def get_suid_files(findpath = '/') out = cmd_exec("find #{findpath} -perm -4000 -print -xdev").to_s.split("\n") out.delete_if {|i| i.include?'Permission denied'} rescue raise "Could not retrieve all SUID files" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_userids\n users = {}\n cmd = \"find /data/log/ctr -name 'ctr*.gz' -mtime -2 | xargs zcat\" \n IO.popen(cmd) do |io|\n while line = io.gets\n r = get_uid(line)\n #users[r[0]] = true # from cookie\n users[r[1]] = true # from sifi param\n end \n end\n users\nend", "def find_user...
[ "0.6082695", "0.57558644", "0.55705637", "0.55314434", "0.5421457", "0.5356688", "0.52883613", "0.5228072", "0.52095103", "0.52057964", "0.51609313", "0.512262", "0.5097915", "0.50941455", "0.5073934", "0.50667554", "0.5034347", "0.5031181", "0.50072306", "0.4981764", "0.4950...
0.83055615
0
Gets the $PATH environment variable
def get_path cmd_exec('echo $PATH').to_s rescue raise "Unable to determine path" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_path_var(env)\n rbenv_root = exec_rbenv_root\n return env['PATH'] if rbenv_root.empty?\n\n re = /^#{Regexp.escape rbenv_root}\\/(versions|plugins|libexec)\\b/\n paths = env['PATH'].split(':')\n paths.reject! { |p| p =~ re }\n\n paths.join(':')\n end", "def path\n env[PATH] ||= (en...
[ "0.7101202", "0.70070887", "0.67989606", "0.67771655", "0.6703497", "0.66674143", "0.6550341", "0.64144075", "0.6339099", "0.6237718", "0.6217244", "0.6168637", "0.6070638", "0.60572153", "0.60111403", "0.59795606", "0.5973434", "0.5973434", "0.59421605", "0.5909177", "0.5827...
0.82716256
0
Gets basic information about the system's CPU.
def get_cpu_info info = {} orig = cmd_exec('kstat -m cpu_info -p').to_s cpuinfo = orig.split("\n") # This is probably a more platform independent way to parse the results (compared to splitting and assigning preset indices to values) cpuinfo.each do |l| info[:speed_mhz] = l.split(':')[3].split("\t")[1].to_i if l.include? 'clock_MHz' info[:product] = l.split(':')[3].split("\t")[1] if l.include? 'brand' info[:vendor] = l.split(':')[3].split("\t")[1] if l.include? 'vendor_id' info[:cores] = l.split(':')[3].split("\t")[1].to_i if l.include? 'ncore_per_chip' end return info rescue raise "Could not get CPU information" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_cpu\n cpu = @info[:cpu] = {}\n\n lscpu = @shell.query('LSCPU', 'lscpu')\n if lscpu.empty?\n cpuinfo = @shell.query('cat /proc/cpuinfo')\n count = cpuinfo.lines.select { |l| l =~ /^processor\\s*: [0-9]/}\n speed = cpuinfo.lines.select { |l| l =~ /MHz/ }\n cpu...
[ "0.7519168", "0.72466415", "0.7089104", "0.7073947", "0.6744511", "0.6706922", "0.6333959", "0.6313814", "0.6310907", "0.6248376", "0.6239721", "0.6182063", "0.61208576", "0.61103016", "0.6098367", "0.609471", "0.60383815", "0.60382193", "0.6033082", "0.6023092", "0.6023092",...
0.75133777
1
Gets the hostname of the system
def get_hostname cmd_exec('uname -n').to_s rescue raise 'Unable to retrieve hostname' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hostname\n Socket.gethostname.split('.').first.strip\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n Socket.gethostname\n end", "def hostname\n @hostname ||= `hostname`.chomp\n end", "def hostname\n @hostname ||= `hostname`.strip\n end", "def...
[ "0.8791849", "0.87028164", "0.87028164", "0.86304224", "0.85603344", "0.839518", "0.8388354", "0.83784455", "0.82942593", "0.8264876", "0.82406425", "0.82050395", "0.81789535", "0.816788", "0.815623", "0.81482977", "0.81193405", "0.8034673", "0.79684794", "0.7946779", "0.7839...
0.85924137
4
Gets the name of the current shell
def get_shell_name psout = cmd_exec('ps -p $$').to_s psout.split("\n").last.split(' ')[3] rescue raise 'Unable to gather shell name' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n Properties[self.class] ||= {}\n return Properties[self.class][:name] || 'shell'\n end", "def get_process_name\n processes = client.sys.process.get_processes\n current_pid = session.sys.process.getpid\n processes.each do |proc|\n return proc['name'] if proc['pid'] == current_pid\n ...
[ "0.72370744", "0.6906481", "0.68936324", "0.65863883", "0.65237373", "0.6522782", "0.65006346", "0.6498106", "0.6464274", "0.6419625", "0.63739026", "0.63712424", "0.6367275", "0.63608986", "0.6319558", "0.621626", "0.61929476", "0.6175266", "0.6167081", "0.6152103", "0.61424...
0.832079
0
Checks if the system has gcc installed
def has_gcc? # /usr/sfw/bin - default gcc path on some systems # /opt/sfw/bin - default gcc path for gcc package # /opt/csw/bin - default gcc path for OpenCSW gcc package command_exists?('gcc') || command_exists?('/usr/sfw/bin/gcc') || command_exists?('/opt/sfw/bin/gcc') || command_exists?('/opt/csw/bin/gcc') rescue raise 'Unable to check for gcc' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gcc?\n linux? && present?('g++')\n end", "def using_gcc?\n # Match gcc, /usr/local/bin/gcc-4.2, etc. (Clang is \"xcrun cc\")\n File.basename(RbConfig::MAKEFILE_CONFIG[\"CC\"]).match(/\\Agcc\\b/)\nend", "def pcre_installed?\n system \"gcc -c #{EXT_ROOT}/findpcre.c -o /dev/null\"\n $?...
[ "0.819661", "0.7846204", "0.676155", "0.6450926", "0.6345437", "0.6286643", "0.62439203", "0.62247175", "0.61630124", "0.6060956", "0.6060956", "0.59924734", "0.5931231", "0.5891041", "0.56633824", "0.5659704", "0.5656536", "0.5656536", "0.5656341", "0.56477183", "0.5638353",...
0.887949
0
Gets the process id(s) of `program`
def pidof(program) pids = [] full = cmd_exec('ps -elf').to_s full.split("\n").each do |pid| pids << pid.split(' ')[3].to_i if pid.include? program end pids end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_program_ids(programs)\n program_ids = []\n if programs.nil? == false and programs.size > 0\n programs.each do |program|\n program_ids << DataUtility.get_program_id(program[:id])\n end\n end\n program_ids\n end", "def id(prog); @progs[prog]; end", "def process_id\n\n\t\t::P...
[ "0.72035366", "0.6330516", "0.62985456", "0.6144303", "0.6144303", "0.61362445", "0.60492164", "0.5996735", "0.59454226", "0.5928698", "0.5863361", "0.58618927", "0.5778512", "0.5705211", "0.57017833", "0.5688187", "0.56577253", "0.5657268", "0.56316763", "0.56316763", "0.561...
0.84276634
0
Gets the mount point of `filepath`
def get_mount_path(filepath) cmd_exec("df \"#{filepath}\" | tail -1").split(' ')[0] rescue raise "Unable to get mount path of #{filepath}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mount_point\n Pathname.new(self['MountPoint'])\n end", "def get_device_mount_point( incoming_path )\n mount_lines = `mount`\n raise EBSRemoteExecException.new(nil,$?,mount_lines) if $? != 0\n path = File.ftype(incoming_path) != 'directory'? File.dirname(incoming_path) : incoming_path\n...
[ "0.70802486", "0.67563653", "0.6539895", "0.6422908", "0.6267049", "0.62258035", "0.6208673", "0.61134756", "0.61134756", "0.5970742", "0.59243244", "0.59220165", "0.5905492", "0.5860373", "0.5841094", "0.57916665", "0.5734063", "0.5572467", "0.5486297", "0.53928685", "0.5391...
0.8231767
0
Get products in a specific taxon.
def get_products_in_taxon(taxon_id) options = { params: { id: taxon_id } } response = get "/api/taxons/products", options response.products.each do |product| sanitize_product!(product) end response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_products_by_taxons(taxons)\n Spree::Product.joins(:taxons).includes(:taxons).where(spree_taxons: { name: taxons }).where('available_on <= ?', DateTime.now)\n end", "def get_product_category_taxon\n self.taxons.find_by_taxonomy_id(Spree::Taxonomy.find_by_name(\"Categories\").id)\n end", "def or...
[ "0.7565959", "0.6834647", "0.6769192", "0.6493209", "0.6113821", "0.60058004", "0.59514195", "0.59165967", "0.57837796", "0.57439804", "0.57216215", "0.5541461", "0.54991585", "0.54991585", "0.54958147", "0.54932564", "0.54932564", "0.54831344", "0.5481815", "0.5480813", "0.5...
0.79287386
0
Return a taxon based on the permalink
def get_taxons_by_permalink(permalink) taxonomies = get_taxonomies.taxonomies taxons = [] taxonomies.each do |taxonomy| taxons += taxonomy.root.taxons.select { |taxon| taxon.permalink == permalink } end taxons end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tax_1\n get_or_build_tax_for_key(\"tax_1\")\n end", "def taxon_link taxon_or_id\n return \"\" unless taxon_or_id\n \"{#{Taxt::TAX_TAG} #{taxon_or_id.try(:id) || taxon_or_id}}\"\n end", "def get_taxon(taxonomy_id, taxon_id)\n get \"/api/taxonomies/#{taxonomy_id}/taxons/#{taxon_id}\"\n ...
[ "0.6558592", "0.6426248", "0.6386777", "0.6218877", "0.620309", "0.612679", "0.61162174", "0.61162174", "0.6109678", "0.60729635", "0.6002877", "0.59534204", "0.59260577", "0.59235704", "0.59124535", "0.5905469", "0.5811088", "0.57974416", "0.57931846", "0.5768512", "0.576840...
0.67758566
0
Get a list of taxonomies and taxons.
def get_taxonomies(options = {}) get "/api/taxonomies", options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_taxons_by_permalink(permalink)\n taxonomies = get_taxonomies.taxonomies\n taxons = []\n taxonomies.each do |taxonomy|\n taxons += taxonomy.root.taxons.select { |taxon| taxon.permalink == permalink }\n end\n taxons\n end", "def taxonomies_json\n @taxons_json = []\...
[ "0.7147532", "0.70279413", "0.6913561", "0.68462586", "0.66592586", "0.66062456", "0.6571839", "0.64836895", "0.63647336", "0.63563854", "0.6254584", "0.6200998", "0.6197771", "0.61929446", "0.6018506", "0.5950181", "0.58305687", "0.5755905", "0.5720318", "0.57190406", "0.567...
0.7584246
0
Get a specifix taxon.
def get_taxon(taxonomy_id, taxon_id) get "/api/taxonomies/#{taxonomy_id}/taxons/#{taxon_id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tax_1\n get_or_build_tax_for_key(\"tax_1\")\n end", "def find_taxon\n @taxon=Spree::Taxon.find(session[:compare_taxon])\n end", "def tax\n Tax.find(self.tax_id)\n end", "def tax\n price_as_price.tax\n end", "def tax_2\n get_or_build_tax_for_key(\"tax_2\")\n end", "def set_taxo...
[ "0.68794453", "0.6532125", "0.65083456", "0.6488667", "0.63429576", "0.6307431", "0.6307431", "0.62399065", "0.6225989", "0.60611075", "0.6007905", "0.59555244", "0.5947518", "0.59420377", "0.588193", "0.58182037", "0.58182037", "0.58143127", "0.57865065", "0.57825446", "0.57...
0.7087787
0
Clean up HTML in known sections where HTML markup is being inserted in Spree.
def sanitize_product!(product) product.cms_text = sanitize_html(product.cms_text) product.description = sanitize_html(product.description) product.product_properties.each do |pp| pp.value = sanitize_html(pp.value) end unless product.product_properties.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_up_contents()\n # very minimal\n # elements = ['p', 'b', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], attributes={})\n\n if self.contents?\n html = self.contents\n email_regex = /<p>Email:\\s+((\\w|\\-|\\_|\\.)+\\@((\\w|\\-|\\_)+\\.)+[a-zA-Z]{2,})/i\n\n html.gsub! /\\[endif\\]--/ , ''\n ...
[ "0.702479", "0.6774088", "0.63800704", "0.63800704", "0.63800704", "0.6287682", "0.62601763", "0.6236579", "0.6221673", "0.6205227", "0.61815196", "0.61813575", "0.6148732", "0.61436856", "0.61384994", "0.61250603", "0.61157906", "0.61157906", "0.61074084", "0.605277", "0.599...
0.0
-1
want to populate everything using one powershell command here and spit it out as json
def iis_vdir(path, application_name) site_app = application_name.split('/', 2) command = "Import-Module WebAdministration; Get-WebVirtualDirectory -Site \"#{site_app[0]}\"" command = "#{command.dup} -Application \"#{site_app[1]}\"" if site_app.length > 1 command = "#{command.dup} -Name \"#{path}\" | Select-Object path, physicalPath, userName, password, logonMethod, allowSubDirConfig, PSPath, ItemXPath | ConvertTo-Json" cmd = @inspec.command(command) begin vdir = JSON.parse(cmd.stdout) Log.info(vdir) rescue JSON::ParserError => _e return {} end # map our values to a hash table { application_name: application_name, path: path, physical_path: vdir['physicalPath'], username: vdir['userName'], password: vdir['password'], logon_method: vdir['logonMethod'], allow_sub_dir_config: vdir['allowSubDirConfig'], } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def knife_output_as_hash(sub_cmd)\n sub_cmd = [sub_cmd, '-F json'].join(' ')\n output_lines = execute(knife_cmd(sub_cmd)).split(/\\n/)\n output_lines = output_lines.reject { |line| KNIFE_JSON_OUTPUT_IGNORE.include? line }\n json = JSON.parse output_lines.join(' ')\nrescue StandardError => e\n puts \"ERROR: #{...
[ "0.61520904", "0.61173016", "0.5987634", "0.5965868", "0.59136724", "0.58879733", "0.58752596", "0.58231634", "0.57993525", "0.578164", "0.56806684", "0.56792516", "0.56624824", "0.5651637", "0.5611203", "0.5591224", "0.5572775", "0.5564885", "0.55449986", "0.5503715", "0.549...
0.0
-1
characters, write a method that returns that string with all of the nonalphabetic characters replaced by spaces. If one or more nonalphabetic characters occur in a row, you should only have one space in the result (the result should never have consecutive spaces).
def cleanup(string) string = string.gsub(/[^a-z]/i, ' ') until !string.include?(' ') string.gsub!(' ', ' ') end string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(string)\n array = string.chars\n output = \"\"\n i = 0\n for i in (i..array.length-1)\n if array[i] =~ /[A-Za-z]/\n output << array[i]\n else\n output << \" \"\n end\n output.gsub!(\" \", \" \")\n i += 1\n end\n output\nend", "def cleanup str\n str2 = str.gsub(/[^A-Za...
[ "0.7109298", "0.7062241", "0.70535636", "0.6876455", "0.68307376", "0.68158585", "0.6774041", "0.6737191", "0.6724318", "0.67062885", "0.6705499", "0.6695956", "0.665612", "0.6640509", "0.6630239", "0.6606641", "0.6589809", "0.65805054", "0.6577825", "0.65706843", "0.65540206...
0.66618794
12
ok, that args is actually pointless, we can just do this
def print_two_again(arg1, arg2) puts "arg1: #{arg1}, arg2: #{arg2}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def args(*) end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args;...
[ "0.8080968", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "0.7881413", "...
0.0
-1
this just takes one argument
def print_one(arg1) puts "arg1: #{arg1}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arg; end", "def args(*) end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; ...
[ "0.711403", "0.6990473", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0.6869382", "0...
0.0
-1
this one takes no arguments
def print_none() puts "I got nothin'." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def standalone=(_arg0); end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def probers=(_arg0); end", "def specie; end", "def specie; end", "def specie; end", "def specie; end...
[ "0.70385003", "0.683592", "0.6830644", "0.6830644", "0.6830644", "0.6830644", "0.6830644", "0.6830644", "0.6830644", "0.6830644", "0.6783281", "0.67819315", "0.67819315", "0.67819315", "0.67819315", "0.6707968", "0.6707968", "0.6679858", "0.6657659", "0.6657659", "0.6657659",...
0.0
-1
GET /order_status_types GET /order_status_types.xml
def index @roles = Role.paginate :page => params[:page], :per_page => 15, :order => sort_order('name') respond_to do |format| format.html # index.html.erb format.xml { render :xml => @roles } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @order_types }\n end\n end", "def show\n @order_types = OrderType.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @order_type }\n ...
[ "0.70336145", "0.68544906", "0.66799915", "0.6591747", "0.65060097", "0.6441565", "0.6415242", "0.6332344", "0.63256156", "0.6278724", "0.62723476", "0.6207276", "0.6200506", "0.6169947", "0.616894", "0.61662066", "0.6153333", "0.6122272", "0.6079037", "0.6045941", "0.6041785...
0.0
-1
POST /order_status_types POST /order_status_types.xml
def create @roles = Role.paginate :page => params[:page], :per_page => 15, :order => sort_order('name') @role= Role.new(params[:role]) respond_to do |format| if @role.save format.html { redirect_to(roles_url, :notice => 'New User role successfully added.') } format.xml { render :xml => @role, :status => :created, :location => @role } else format.html { render :action => "index" } format.xml { render :xml => @role.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def typeofstatus_params\n params.require(:typeofstatus).permit(:name, :priority)\n end", "def create\n authorize_action_for OrderType, at: current_store\n @order_type = current_store.order_types.build(order_type_params.merge(priority: current_store.order_types.count))\n\n respond_to do |format|\...
[ "0.6338347", "0.61215466", "0.61203134", "0.6066311", "0.6003768", "0.5943251", "0.592846", "0.592846", "0.588517", "0.5865142", "0.58424914", "0.58275896", "0.58153063", "0.5811378", "0.57805115", "0.5771059", "0.5765555", "0.5747408", "0.5745378", "0.57387", "0.57241356", ...
0.0
-1
DELETE /order_status_types/1 DELETE /order_status_types/1.xml
def destroy @role = Role.find_by_id(params[:id]) @role.destroy respond_to do |format| format.html { redirect_to(roles_url, :notice => "User role removed.") } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @order_status = OrderStatus.find(params[:id])\n @order_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(order_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @order_type.destroy\n\n respond_to do |format|\n format.html...
[ "0.7220668", "0.7186241", "0.71575886", "0.64790344", "0.6439661", "0.64065266", "0.64049125", "0.6392924", "0.63883555", "0.63873225", "0.6369804", "0.6346834", "0.6291473", "0.6279771", "0.6276046", "0.6275893", "0.624154", "0.6231229", "0.62254584", "0.62229854", "0.622230...
0.0
-1
Gets a value that indicates whether the object is unsubscribed.
def unsubscribed? @gate.synchronize do return @unsubscribed end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribed?\n self.type == :unsubscribed\n end", "def unsubscribed?\n unsubscribed_at.present?\n end", "def unsubscribed?\n @subscription.nil?\n end", "def unsubscribed\n @attributes[:unsubscribed]\n end", "def unsubscribed?\n preminum? ? false : true\n ...
[ "0.7952759", "0.7435321", "0.72709674", "0.7159593", "0.7141492", "0.6917259", "0.65380806", "0.6328623", "0.62633026", "0.62488055", "0.622909", "0.6219532", "0.6219532", "0.61241204", "0.59932023", "0.595289", "0.59098136", "0.5904371", "0.5865497", "0.5842502", "0.5836696"...
0.8008665
0
Gets the underlying subscription.
def subscription @current end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscription\n ensure_connection\n @consumers.find(&:subscription)\n end", "def current_subscription\n self.subscriptions.current.first\n end", "def subscription\n subscriptions.last\n end", "def subscription\n @gate.synchronize do \n if @subscription\n ...
[ "0.7483471", "0.727232", "0.7198934", "0.7014974", "0.6956387", "0.6869844", "0.68170184", "0.6815747", "0.66478366", "0.6590118", "0.65757513", "0.6515196", "0.6515196", "0.64380795", "0.6390343", "0.6356584", "0.6287703", "0.6201974", "0.6163837", "0.61085284", "0.6088624",...
0.74414533
1
Sets the underlying subscription.
def subscription=(new_subscription) should_unsubscribe = false old = nil @gate.synchronize do should_unsubscribe = @unsubscribed unless should_unsubscribe old = @current @current = new_subscription end end old.unsubscribe if old new_subscription.unsubscribe if should_unsubscribe && !new_subscription.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = ::Pushar::Core::Subscription.unscoped.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_sub...
[ "0.7406613", "0.73707825", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.72688055", "0.6926206", "0.6926206", "0.6926206", "0.69242436", ...
0.6556399
21
Unsubscribes the current underlying subscription and all future subscriptions.
def unsubscribe old = nil @gate.synchronize do unless @unsubscribed @unsubscribed = true old = @current @current = nil end end old.unsubscribe if old end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end", "def unsubscribe\n subscription = nil\n @gate.synchronize do\n if @subscription\n unless @primary_unsubscribed\n @primary_unsubscribed = true\n\n ...
[ "0.8113381", "0.78965265", "0.77759033", "0.75114673", "0.7470134", "0.74228996", "0.74228996", "0.73986304", "0.73522776", "0.7348027", "0.7202257", "0.7197127", "0.717268", "0.7132533", "0.7132533", "0.708175", "0.707425", "0.70656997", "0.69502664", "0.6914717", "0.6890115...
0.77309746
3
i = 0 my_arr = [] array.each do |ele| new_ele = (ele ele) my_arr << new_ele i += 1 end return my_arr end
def square_array(array) array.map! { |ele| ele ** 2 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buy_fruit(arr)\n new_arr = []\n\n arr.each { |element| element[1].times { |_| new_arr << element[0] } }\n p new_arr\nend", "def build_new_array_from(array)\n\tb = []\n\n\tarray.each_index do |i|\n\t\tb.push(array[i]+array[i-1])\n\t\tif i == 0\n\t\t\tb.push(array[i])\n\t\telsif i == array.length - 1\n\t\t\...
[ "0.7431839", "0.69093895", "0.68651587", "0.6844818", "0.6742839", "0.67023003", "0.6678866", "0.66740996", "0.66721845", "0.6611219", "0.65736306", "0.6566631", "0.65568084", "0.6551933", "0.65451527", "0.65379965", "0.6527625", "0.65093654", "0.64938986", "0.64792204", "0.6...
0.0
-1
run runs a command in the root directory and raises an error if something goes wrong.
def run(command) raise "non-zero exit status: `#{command}`" if !system("cd #{$root} && #{command}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end", "def run\n raise Error, \"Unknown command `#{command_name}`\"\n end", "def run(cmd)\n Dir.chdir @target\n\n log \"Running: #{cmd}\"\n `#{cmd}`\n # if $?.exitstatus != 0\n # raise IOError, %{...
[ "0.7160926", "0.6916616", "0.6854776", "0.6741716", "0.6741716", "0.6652711", "0.6557698", "0.6514812", "0.6514812", "0.6416711", "0.6396064", "0.63657427", "0.63151395", "0.63151395", "0.6296271", "0.6289675", "0.6179085", "0.6157897", "0.6130445", "0.6115237", "0.61110884",...
0.7541924
0
vendored_package_name provides an import package name for the given package that is specific to this project.
def vendored_package_name(package) File.join($package_name, 'vendor/src', package) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_name\n @version ? \"#{@name}-#{@version}\" : @name\n end", "def non_vendored_import_path(package)\n return if package.nil?\n parts = vendored_path_parts(package)\n return parts[:import_path] if parts\n\n # if a package isn't vendored, return the packages \"ImportPa...
[ "0.645248", "0.6402365", "0.60660344", "0.6005605", "0.59851736", "0.5956886", "0.59118694", "0.5837364", "0.5834388", "0.5703108", "0.56522626", "0.56450534", "0.5581635", "0.5540225", "0.5533058", "0.55181426", "0.54995126", "0.549633", "0.5475787", "0.5448599", "0.54085153...
0.7856733
0
vendored_package_path the absolute path to the vendored version of the given package.
def vendored_package_path(package) File.join($root, 'vendor/src', package) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vendored_package_name(package)\n\tFile.join($package_name, 'vendor/src', package)\nend", "def non_vendored_import_path(package)\n return if package.nil?\n parts = vendored_path_parts(package)\n return parts[:import_path] if parts\n\n # if a package isn't vendored, return the packa...
[ "0.704255", "0.6848314", "0.6802434", "0.6144082", "0.5951823", "0.5811335", "0.5775998", "0.57408994", "0.57363564", "0.5574246", "0.5486475", "0.54577637", "0.54470164", "0.54443085", "0.5419492", "0.53827953", "0.53827953", "0.5374878", "0.5311107", "0.52841467", "0.528030...
0.8171666
0
GET /photos GET /photos.json
def index @photos = @allbum.photos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BAS...
[ "0.81924915", "0.8085244", "0.78220874", "0.76636654", "0.7616759", "0.75987357", "0.7567614", "0.75618", "0.754158", "0.7503534", "0.7497691", "0.73612726", "0.7276418", "0.72243077", "0.7204244", "0.71334463", "0.71282655", "0.7125025", "0.7121085", "0.70611507", "0.7055207...
0.669823
97
GET /photos/1 GET /photos/1.json
def show @photo = @allbum.photos.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @photo } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @ph...
[ "0.84857714", "0.77772933", "0.75676143", "0.75088036", "0.7428611", "0.73778826", "0.7342772", "0.7340126", "0.7332814", "0.73010397", "0.72803766", "0.7259777", "0.72592527", "0.7214319", "0.71965903", "0.71965903", "0.71965903", "0.71965903", "0.71965903", "0.71965903", "0...
0.7483433
4
GET /photos/new GET /photos/new.json
def new @photo = @allbum.photos.new respond_to do |format| format.html # new.html.erb format.json { render json: @photo } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @photo = Photo.new\n\n render json: @photo\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # n...
[ "0.7923384", "0.7876151", "0.78760743", "0.78760743", "0.78760743", "0.78760743", "0.78760743", "0.78760743", "0.78760743", "0.78760743", "0.78760743", "0.78760743", "0.78760743", "0.78760743", "0.7799791", "0.7799791", "0.7632736", "0.7413779", "0.7397921", "0.7396593", "0.7...
0.80598164
0
POST /photos POST /photos.json
def create @photo = @allbum.photos.new(params[:photo]) respond_to do |format| if @photo.save format.html { redirect_to new_allbum_photo_path, notice:"Saved,You can add more images..." } format.json { render json: @photo, status: :created, location: @photo } else format.html { render action: "new" } format.json { render json: @photo.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n if @...
[ "0.7361035", "0.7185209", "0.6947464", "0.6922178", "0.6897456", "0.6851186", "0.66842484", "0.6675465", "0.66148436", "0.66095084", "0.6601552", "0.65587986", "0.6548897", "0.6548897", "0.6548897", "0.6548897", "0.6548897", "0.6544014", "0.64769965", "0.6464411", "0.6464411"...
0.63618827
35
PUT /photos/1 PUT /photos/1.json
def update @photo = @allbum.photos.find(params[:id]) # respond_to do |format| if @photo.update_attributes(params[:photo]) format.html { redirect_to edit_allbum_photos_path(@allbum,@photo), notice: 'Photo was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @photo.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successful...
[ "0.687525", "0.6765923", "0.6534715", "0.6527499", "0.65207165", "0.6433517", "0.6427403", "0.6425231", "0.6405349", "0.6405349", "0.6405349", "0.6405349", "0.63972455", "0.6393584", "0.63843805", "0.6380401", "0.63711715", "0.63711715", "0.63711715", "0.63711715", "0.6371171...
0.6285707
34
DELETE /photos/1 DELETE /photos/1.json
def destroy @photo = @allbum.photos.find(params[:id]) @photo.destroy respond_to do |format| format.html { redirect_to allbum_photos_path } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.ht...
[ "0.77425593", "0.77425593", "0.77425593", "0.77425593", "0.77425593", "0.77425593", "0.7713864", "0.7713864", "0.7713864", "0.7713864", "0.7713864", "0.7702978", "0.76829326", "0.7665429", "0.7663324", "0.7663324", "0.765082", "0.765082", "0.7636184", "0.75878364", "0.7573296...
0.75896794
19
do slovniku zahrne vsechny soubory z daneho adresare, ktere maji danou priponu, typicky .am slovnik pouzivam pro rychle vkladani hypertext. odkazu ve vimwiki (kazdy odkaz je reprezentovan souborem s priponou 'am')
def check_usage unless ARGV.length == 2 puts "Usage: gen_vimwiki_dict.rb wiki_folder dict_filename" exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize text\n SANITIZE_THIS.each { |s| text = text.gsub(/#{s}/,'') }\n\n #római számok kiegészítés\n text = text.gsub(/\\W*(#{ROMAISZAMOK.keys.join('|')})\\.\\W*(\\w+)/) do \n ROMAISZAMOK[$1] ? ( ROMAISZAMOK[$1] + ' ' + $2 ) : $&\n end\n \n #századok\n text = text.gsub(/(\\W*)(#{(1..21).to_a.join(...
[ "0.5865821", "0.56533694", "0.5045951", "0.50011814", "0.49896345", "0.49731836", "0.49357578", "0.49354348", "0.49354348", "0.48794815", "0.48726824", "0.4868615", "0.48667604", "0.4817632", "0.48141396", "0.4788364", "0.47868416", "0.47722763", "0.476632", "0.47596493", "0....
0.0
-1
Prints statistics to the console
def output print_headings line_order.each do |line_name| stats = statistics[line_name] arr = [line_headings[line_name]] + column_order.collect {|col| stats[col]} print_line(arr) end print_separator print_summary end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_stat\n \t\tputs \"=============Statistics============\"\n \t\tputs \"Score: #{get_score}\"\n \t\tputs \"Total time: \" + \"%0.2f\" %(@end_time - @start_time + @save_time) + \" seconds\"\n \t\tputs \"Number of sets found: #{@number_of_correct}\"\n \t\tputs \"#{@number_of_hint}/#{@total_hint} hints us...
[ "0.7945954", "0.78689224", "0.7791268", "0.7355354", "0.72600216", "0.72312814", "0.70917654", "0.7085043", "0.70831186", "0.70654374", "0.70102465", "0.6950058", "0.69483036", "0.6933712", "0.6925249", "0.69235545", "0.69135046", "0.6844638", "0.6803342", "0.6785559", "0.675...
0.7177255
6
Prints a headings line based on column_order
def print_headings puts print_separator columns = ["Name"]; column_order.each {|heading| columns.push(column_headings[heading])} print_line(columns) print_separator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_row_col_headers(option = nil)\n if option.nil?\n @print_headers = 1\n else\n @print_headers = option\n end\n end", "def display_header\n puts \" 1 2 3 4 5 6 7 8 9 10\"\n puts \" -----------------------------------------\"\n end", "def output\n p...
[ "0.71806914", "0.7172009", "0.7114608", "0.6967641", "0.69094664", "0.6758766", "0.6747544", "0.66876096", "0.66750264", "0.66686684", "0.665597", "0.66459054", "0.6643557", "0.66384673", "0.6614087", "0.6595851", "0.65948814", "0.6557081", "0.6547728", "0.6541728", "0.653660...
0.81003886
0
Prints a summary line with total LOC
def print_summary stats = [statistics[:total_code_loc], statistics[:total_spec_loc]] stats.push(stats[1].to_f / stats[0].to_f) puts " Code LOC: %s Test LOC: %s Code to Test Ratio: 1:%1.1f" % stats puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def puts_summary(io)\n io.puts(\"\\n#{[coverage_text, successful_text, failed_text, total_text].join(' ')}\")\n end", "def print_summary\n puts \"\\n\\nScore : # Instances\\n\" << (\"=\" * 19)\n @summary_totals.each_with_index { |value, index| puts \" %5d:%8d\\n\" % [index, value] unless v...
[ "0.6556767", "0.65531445", "0.63397264", "0.63001704", "0.62373376", "0.62002045", "0.61085147", "0.61085147", "0.61085147", "0.61085147", "0.60744685", "0.6070202", "0.6055484", "0.60329217", "0.60286844", "0.5991621", "0.59807533", "0.5980078", "0.5970245", "0.5970245", "0....
0.7526754
0
Prints a separator line
def print_separator str = "+" + "-" * (title_width + 2) column_order.length.times do str += "+" + "-" * (column_width + 2) end puts str + '+' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_sep(title=nil); print \"\\n#{title} ----\\n\\n\"; end", "def line_sep(title=nil); print \"\\n#{title} ----\\n\\n\"; end", "def separator\n puts \" \"\n puts pastel.bright_magenta(\"======================================================\")\n ...
[ "0.81492394", "0.81492394", "0.7919536", "0.7919536", "0.7919536", "0.76492745", "0.75534153", "0.7475231", "0.74695677", "0.7432085", "0.73914194", "0.7188479", "0.7187288", "0.7124156", "0.705563", "0.69879186", "0.6805005", "0.678925", "0.66617393", "0.6631128", "0.6609878...
0.76709163
5
Prints an array of string as a line
def print_line(line_elements) str = "| " line_elements.each_with_index do |element, index| if index == 0 str += element.to_s.ljust(title_width) + " | " else str += element.to_s.rjust(column_width) + " | " end end puts str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def puts_array(array)\n array.each {|item| puts item}\n end", "def print_array(array)\n puts '[' + array.join(',') + ']'\nend", "def printarray(array)\n print'{'\n array.each_index do |i|\n print \"#{array[i]}\"\n if i < array.length - 1\n print ', '\n end\n end\n p...
[ "0.7178831", "0.7175743", "0.7159768", "0.69153696", "0.6881712", "0.6874608", "0.6862223", "0.68153775", "0.6735893", "0.66982394", "0.6673173", "0.66691625", "0.6590163", "0.6590163", "0.6590163", "0.6590163", "0.65562814", "0.6540244", "0.6513344", "0.6497713", "0.64910126...
0.65047795
19
Calculates the width of the first column. Elements will be padded to this width
def title_width line_headings.values.collect {|l| l.to_s.length}.max + 8 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width\n @column_widths.inject(0) { |s,r| s + r }\n end", "def width\n return 0 if columns.empty?\n\n columns.size\n end", "def column_width\n column_headings.values.collect {|l| l.to_s.length}.max + 2\n end", "def natural_width\n renderer.column_widths.inject(0, &...
[ "0.7905229", "0.7460314", "0.7223476", "0.71869284", "0.7019315", "0.6786219", "0.674521", "0.6709662", "0.664678", "0.66458315", "0.6599881", "0.6583085", "0.65648323", "0.65476614", "0.6500155", "0.6500155", "0.6461139", "0.6441172", "0.64181435", "0.6396536", "0.6396", "...
0.0
-1
Calculates the width of all columns but the first. Elements will be padded to this width
def column_width column_headings.values.collect {|l| l.to_s.length}.max + 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width\n @column_widths.inject(0) { |s,r| s + r }\n end", "def width\n return 0 if columns.empty?\n\n columns.size\n end", "def natural_width\n renderer.column_widths.inject(0, &:+) + border_size + padding_size\n end", "def width\n begin\n (@num_cols.to_i) * (...
[ "0.7863517", "0.7293473", "0.7117823", "0.6885439", "0.67779833", "0.67627853", "0.67538077", "0.67538077", "0.67232937", "0.6707105", "0.67055273", "0.6683161", "0.66794187", "0.66408384", "0.661735", "0.66099066", "0.6567257", "0.6549888", "0.6539589", "0.64622045", "0.6394...
0.6933957
3
The statistics columns to show, in order
def column_order [:line_count, :loc_count, :file_count, :class_length] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def columns\n @columns ||= @stats.values.flatten.map { |a| a.column_name }\n end", "def get_columns_name\r\n columns = []\r\n if @columns != nil\r\n @columns.each do |column|\r\n columns.push column\r\n end\r\n end\r\n \r\n if @stats != nil and @stats.length > ...
[ "0.79235005", "0.7275591", "0.70243955", "0.6897938", "0.68594664", "0.6794157", "0.67794955", "0.6710947", "0.66816235", "0.66481465", "0.6647714", "0.6633231", "0.65658075", "0.656256", "0.65588117", "0.6524031", "0.6524031", "0.651553", "0.6460899", "0.64559305", "0.644934...
0.6667244
9
The lines to show, in order
def line_order [:controller_files, :model_files, :view_files, :lib_files, :controller_specs, :model_specs, :view_specs] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lines\n old_order_lines\n end", "def lines\n self\n end", "def lines; end", "def lines; end", "def lines\n @lines ||= build_lines\n end", "def lines\n load_data unless @lines\n @lines\n end", "def visible\n lines.map { |line| line[ox...(ox + bordered_width)] ...
[ "0.764046", "0.6866077", "0.6759005", "0.6759005", "0.6712531", "0.65877193", "0.6578559", "0.64465266", "0.64273417", "0.6382559", "0.62797123", "0.6269456", "0.62686557", "0.626042", "0.6250395", "0.6204322", "0.61997604", "0.6197681", "0.6192519", "0.6154506", "0.61064285"...
0.58951926
32
The arrays to use when calculating totals for project LOC etc
def project_code_arrays [:controller_files, :model_files, :view_files, :lib_files] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def totals\n Array.new(dimensions.size) + report[\"data\"][\"totals\"][0][\"values\"]\n end", "def project_totals(from=7.days.ago, to=Date.today)\n @pt = []\n projects.each do |p|\n hrs = total_project_hours(p.id, from, to)\n @pt << [p.name, hrs] if hrs > 0\n end\n @pt\n...
[ "0.65012956", "0.6337057", "0.62368286", "0.6230207", "0.614741", "0.6008286", "0.59929705", "0.5992026", "0.59899926", "0.59899926", "0.5965045", "0.5893825", "0.5891905", "0.5866014", "0.58654374", "0.58452433", "0.5826459", "0.5821962", "0.5782137", "0.5769267", "0.5767814...
0.0
-1
The arrays to use when calculating totals for project spec LOC etc
def project_spec_arrays [:controller_specs, :model_specs, :view_specs] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def totals\n Array.new(dimensions.size) + report[\"data\"][\"totals\"][0][\"values\"]\n end", "def results\n# not_observed, no_relation, shows_progress, meets_standard, exceeds_standard\n# For Plan, Presentation, Activity, Assessment, Climate\n results = [[0,0,0,0,0],[0,0,0,0,0],[0,0,...
[ "0.653563", "0.64084053", "0.6092087", "0.60518205", "0.59610707", "0.59610707", "0.5902483", "0.58987737", "0.58892936", "0.58663917", "0.58539057", "0.5837111", "0.57941747", "0.5774151", "0.5752518", "0.5702371", "0.5698211", "0.569456", "0.567882", "0.5657617", "0.5655654...
0.0
-1
Mappings between method and human names for line headings
def line_headings { :controller_files => "Controllers", :model_files => "Models", :view_files => "Views", :lib_files => "Libraries", :plugin_files => "Plugins", :controller_specs => "Controller Specs", :model_specs => "Model Specs", :view_specs => "View Specs" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method)\n header_name = method.id2name\n header_words = header_name.split('_')\n header_words.each do |word|\n word.capitalize!\n end\n header_name = header_words.join('-')\n if @headers.has_key?(header_name)\n # TODO: Add some color to help visually separate output. ...
[ "0.66006696", "0.6272808", "0.6272808", "0.6272808", "0.6272808", "0.6272808", "0.6272808", "0.6272808", "0.6272808", "0.6272808", "0.6272808", "0.6272808", "0.6272808", "0.6239683", "0.6239683", "0.62307227", "0.6170014", "0.61673903", "0.6152697", "0.6113631", "0.60729474",...
0.6391072
1
Mappings between method and human names for column headings
def column_headings { :line_count => "Lines", :loc_count => "LOC", :file_count => "Classes", :method_count => "Methods", :average_methods => "M/C", :method_length => "LOC/M", :class_length => "LOC/C" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_with_headings n, method = :value\n column n, method, headings_with_rows\n end", "def columns_title\n self.columns.collect{|c|c.label}\n end", "def method_missing(method)\n header_name = method.id2name\n header_words = header_name.split('_')\n header_words.each do |word|\n ...
[ "0.67518526", "0.6619503", "0.65984315", "0.6551625", "0.6520998", "0.64073706", "0.6331803", "0.62728435", "0.62317777", "0.6162556", "0.61203", "0.610029", "0.6095939", "0.6089942", "0.60515434", "0.6048408", "0.60422283", "0.60409635", "0.60399914", "0.59683675", "0.596274...
0.75622207
0
calculates aggregated statistics for an array of files
def array_statistics(files_array) file_count = 0; line_count = 0; loc_count = 0; files_array.collect {|f| file_statistics(f)}.each do |stats| file_count += 1 line_count += stats[:line_count] loc_count += stats[:loc_count] end { :file_count => file_count, :line_count => line_count, :loc_count => loc_count, :class_length => file_count == 0 ? 0 : loc_count / file_count } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average\n files_present? ? (sum / count).round : 0\n end", "def genenate_average_files\n puts 'genenate_average_files'\n @data.each do |e|\n final = get_avg(e)\n puts \"#{e[0]} #{final}\"\n File.open(e[0].to_s, 'w') do |file|\n file.puts(\"#{e[0]}, #{final}\")\n end\n...
[ "0.6846052", "0.6554301", "0.64867055", "0.64642674", "0.6352762", "0.6280475", "0.6277532", "0.625305", "0.62179774", "0.6198126", "0.61759984", "0.61691076", "0.61576456", "0.59775746", "0.59156007", "0.5796529", "0.57829946", "0.57817453", "0.5740171", "0.5711749", "0.5709...
0.75896907
0
calculates statistics on a given file
def file_statistics(filename) line_count = 0; loc_count = 0; File.new(filename, 'r').each_line do |line| line.strip! line_count += 1 # don't count blank lines or comment lines in LOC loc_count += 1 if line.gsub(/[\/\*\s]/i, "").length > 1 && line.match(/^\/\//).nil? end {:line_count => line_count, :loc_count => loc_count} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summarize_file(path); end", "def file_stats\n\t\ttest_parser = PbfParser.new(file)\n\t\tunless test_parser.nodes.empty?\n\t\t\t@n_count+= test_parser.nodes.size\n\t\tend\n\t\tunless test_parser.ways.empty?\n\t\t\t@w_count+= test_parser.ways.size\n\t\tend\n\t\tunless test_parser.relations.empty?\n\t\t\t@r_cou...
[ "0.73069316", "0.71954924", "0.70909375", "0.6947913", "0.6666406", "0.6666406", "0.66606325", "0.66085213", "0.6588331", "0.64718723", "0.6438741", "0.63923246", "0.63830596", "0.6315454", "0.6302343", "0.6235014", "0.62176985", "0.6217", "0.6185375", "0.6164366", "0.6147148...
0.68515146
4
how_many_times_slower Traps $stdout into a StringIO object to extract how many times slower a method is in an IPS comparison.
def how_many_times_slower benchmark = StringIO.new original_stdout = $stdout $stdout = benchmark yield $stdout = original_stdout benchmark.string.scan(/(?<=- )[\d.]+(?=x\s+slower)/).first.to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bench(descr)\n start = Time.now\n yield\n puts \"#{descr} : #{Time.now-start} seconds\"\nend", "def expected_runtime_seconds(report_count:)\n runs = report_count * options[:lines_multipliers].length\n warmup_time_seconds = runs * options[:benchmark_warmup]\n bench_time_seconds = runs * opti...
[ "0.5920504", "0.5871042", "0.5869954", "0.5543725", "0.55092824", "0.55000365", "0.5432435", "0.5419898", "0.5411519", "0.54057723", "0.5356752", "0.53511477", "0.53313553", "0.53219616", "0.532051", "0.52642274", "0.5243821", "0.52040875", "0.5199929", "0.51990837", "0.51981...
0.817536
0
average_exec_time Calculate average execution time for a given block.
def average_exec_time(&block) (0...1000).sum do Benchmark.measure(&block).real end / 1000 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timed(&block)\n @@start_time = Time.now\n Thread.new(&block).join\n @@elapsed_time = Time.now - @@start_time\n @@average_times.push(@@elapsed_time) \n end", "def average_runtime(days=30)\n latest_executions(days).average(:runtime)&.to_f\n end", "def average_response_time\n return sum...
[ "0.65612864", "0.63962615", "0.62390983", "0.6160289", "0.5743701", "0.5742865", "0.5728631", "0.56718916", "0.5640217", "0.55458826", "0.5448861", "0.53757477", "0.5375499", "0.53613657", "0.53576344", "0.5355028", "0.53243816", "0.53213394", "0.52896243", "0.52820724", "0.5...
0.8070074
0
Define presentationspecific methods here. Helpers are accessed through `helpers` (aka `h`). You can override attributes, for example: def created_at helpers.content_tag :span, class: 'time' do source.created_at.strftime("%a %m/%d/%y") end end
def border_class orderable.border_class end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_at_tag\n\t\th.content_tag :span, class: \"time\" do\n\t\t\th.record_time(self.created_at)\n\t\tend\n\tend", "def helpers; end", "def helpers; end", "def helpers; end", "def time_to_show\n \n end", "def helper_attr(*attrs); end", "def tag(_helper, **_props)\n raise NotImplementedError...
[ "0.56559396", "0.55763304", "0.55763304", "0.55763304", "0.5567264", "0.5546923", "0.5497589", "0.54834026", "0.54722977", "0.5463635", "0.53632724", "0.52926826", "0.52910364", "0.5280546", "0.52794015", "0.5261238", "0.5234939", "0.52160835", "0.51893127", "0.51744246", "0....
0.0
-1
Adds the action and keeps a strong reference to the Proc object.
def set_target_and_action target, action self.target = target self.action = 'sugarcube_handle_action:' @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_action(a)\n $LOG.debug(\"Adding action #{a.type} to #{seq_name}\")\n \n @actions.push a\n \n a.apply_to(self)\n \n return a\n \n end", "def action(&block)\n @actions << block\n end", "def add_action(action)\n types = [\"Sieve::Action\", \"Si...
[ "0.66566133", "0.66554254", "0.6502387", "0.64431053", "0.6325377", "0.62659913", "0.62479585", "0.61707425", "0.6166715", "0.61003244", "0.60028017", "0.59992415", "0.59992415", "0.59992415", "0.5958267", "0.5955411", "0.5947481", "0.59212756", "0.5911797", "0.58832467", "0....
0.53862774
69
The user guessed correctly, return "You got it!" The guess was too high, return "Guess was too high!" The guess was too low, return "Guess was too low!"
def guess_number guess number = 25 if number == guess puts "You got it!" elsif number > guess puts "Guess was too high!" else number < guess puts "Guess was too low!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_number guess\n number = 25\n if guess == number\n return \"You got it!\"\n elsif guess > number\n return \"Guess was too high!\"\n else\n return \"Guess was too low!\"\n end\nend", "def high_or_low(guess, answer)\n if guess > answer\n puts \"Your guess was too high!\"\n else\n put...
[ "0.7525312", "0.7515902", "0.73335505", "0.73086536", "0.7260211", "0.7240951", "0.71725786", "0.714061", "0.71027696", "0.7078413", "0.7075687", "0.7066505", "0.704294", "0.7042513", "0.70056546", "0.69872326", "0.69153386", "0.6904787", "0.68904287", "0.68692166", "0.685920...
0.6852978
22
Executes provided query and returns the first value of the first row as a scalar value.
def select_value(query, cast = nil) r=query(query)[0]['f0_'] r.send(cast) if cast && r.respond_to?(cast) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_first_value( sql, *bind_vars )\n execute( sql, *bind_vars ) { |row| return row[0] }\n nil\n end", "def query_return_first_value(sql, *binds)\n mysql.fetch(sql, *binds).single_value\n end", "def fetch_value(sql)\n # Get the row\n row = fetch_row(sql)\n\n #...
[ "0.856267", "0.84146386", "0.7907922", "0.7808586", "0.77250564", "0.7632828", "0.7537237", "0.7501183", "0.7313448", "0.7197651", "0.7196668", "0.71909523", "0.71763015", "0.7141796", "0.70981985", "0.7077529", "0.6961582", "0.69293654", "0.69270384", "0.6909436", "0.6855227...
0.5502736
96
GET /flsa_results/1 GET /flsa_results/1.json
def show @flsa_result = FlsaResult.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @flsa_result } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @flsa_result = FlsaResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flsa_result }\n end\n end", "def index\n @am_results = AmResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render js...
[ "0.6837876", "0.6405474", "0.6385524", "0.63661855", "0.62762564", "0.61600983", "0.61187947", "0.6095547", "0.6086297", "0.6080127", "0.6068361", "0.6052126", "0.60424644", "0.60292757", "0.60292757", "0.6009139", "0.5992122", "0.5979427", "0.59782916", "0.59757286", "0.5967...
0.7496523
0
GET /flsa_results/new GET /flsa_results/new.json
def new @flsa_result = FlsaResult.new respond_to do |format| format.html # new.html.erb format.json { render json: @flsa_result } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @result = Result.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n e...
[ "0.7109682", "0.70462596", "0.70462596", "0.70462596", "0.70462596", "0.6884767", "0.67786163", "0.6762899", "0.6762466", "0.67028075", "0.6702803", "0.66969806", "0.6687705", "0.66626763", "0.6653454", "0.6635597", "0.6634366", "0.66324466", "0.6599785", "0.65954477", "0.659...
0.7809401
0
POST /flsa_results POST /flsa_results.json
def create @flsa_result = FlsaResult.new(params[:flsa_result]) respond_to do |format| if @flsa_result.save format.html { redirect_to @flsa_result, notice: 'Flsa result was successfully created.' } format.json { render json: @flsa_result, status: :created, location: @flsa_result } else format.html { render action: "new" } format.json { render json: @flsa_result.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def new\n @flsa_result = FlsaResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flsa_resu...
[ "0.6752914", "0.6388571", "0.634567", "0.5823759", "0.57252586", "0.571579", "0.56608707", "0.5584446", "0.5533573", "0.552362", "0.55158746", "0.5514108", "0.55118734", "0.5511568", "0.55024403", "0.54665685", "0.54660165", "0.54323685", "0.5427527", "0.5424247", "0.5421137"...
0.6874381
0
PUT /flsa_results/1 PUT /flsa_results/1.json
def update @flsa_result = FlsaResult.find(params[:id]) respond_to do |format| if @flsa_result.update_attributes(params[:flsa_result]) format.html { redirect_to @flsa_result, notice: 'Flsa result was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @flsa_result.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @flsa_result = FlsaResult.new(params[:flsa_result])\n\n respond_to do |format|\n if @flsa_result.save\n format.html { redirect_to @flsa_result, notice: 'Flsa result was successfully created.' }\n format.json { render json: @flsa_result, status: :created, location: @flsa_result...
[ "0.6263547", "0.6013093", "0.6013093", "0.5882988", "0.5857877", "0.58116144", "0.57670635", "0.572493", "0.56553406", "0.5609686", "0.5609686", "0.5609686", "0.558804", "0.5587191", "0.55339926", "0.5525975", "0.5525975", "0.55224186", "0.5515962", "0.548313", "0.548313", ...
0.7006509
0
DELETE /flsa_results/1 DELETE /flsa_results/1.json
def destroy @flsa_result = FlsaResult.find(params[:id]) @flsa_result.destroy respond_to do |format| format.html { redirect_to flsa_results_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/trac...
[ "0.6624826", "0.65870935", "0.65101725", "0.6489801", "0.64528763", "0.64330846", "0.6426723", "0.63946456", "0.6371836", "0.6369199", "0.63384336", "0.6333692", "0.63238347", "0.63238347", "0.6303304", "0.62993556", "0.62764436", "0.6265046", "0.6258394", "0.62354463", "0.62...
0.7256129
0
The new listing notifier should be sent to both a suppliers' inviter and a shared network.
def listing_notifier(user, supplier, listing) @user = user @supplier = supplier @listing = listing @login_url = "http://www.mylmp.herokuapp.com/signin" mail(:to => user.email, :subject => "#{supplier.first_name} just listed a new #{listing}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def old_notify_user (listing, sender, receiver)\n send_as :notification\n from sender.facebook_session.user \n recipients receiver.facebook_session.user\n #fbml \"<a href='#{FB_APP_HOME_URL}/listings/#{listing.id}'><b>#{listing.title}</b></a> has been approved.\"\n fbml \"Your listing: <a href='#...
[ "0.6432973", "0.6087925", "0.6010003", "0.5995035", "0.5871306", "0.5831053", "0.5740147", "0.57339954", "0.5649819", "0.5637294", "0.5538858", "0.547449", "0.5473866", "0.54396904", "0.5432219", "0.5382594", "0.53813964", "0.53803515", "0.53508073", "0.5318685", "0.5252183",...
0.71838975
0
Contact notifier will let users send an email to suppliers incase they happen to have interest in a listing
def contact_notifier(supplier, user, contact, listing) @supplier = supplier @user = user @contact = contact @listing = listing mail(:to => supplier.email, :subject => "#{user.first_name} posted an inquiry on #{listing}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listing_notifier(user, supplier, listing)\n\t @user = user\n\t @supplier = supplier\n\t @listing = listing\n\t @login_url = \"http://www.mylmp.herokuapp.com/signin\"\n\t mail(:to => user.email,\n\t :subject => \"#{supplier.first_name} just listed a new #{listing}\")\n end", "def report_notifier(s...
[ "0.7927704", "0.75133955", "0.72764266", "0.7177429", "0.71663475", "0.7079908", "0.7014437", "0.695679", "0.6948707", "0.6767731", "0.675505", "0.67495465", "0.6741356", "0.6739609", "0.672729", "0.669705", "0.66887087", "0.668545", "0.66840607", "0.6671609", "0.6666384", ...
0.82834274
0
Recommendation notifier will let users send out an email recommending their own suppliers to other users incase a product alert has been posted by another user.
def recommendation_notifier(recommended_user, recommender, recommended) @recommendation = recommended_user @recommender = recommender @recommended = recommended mail(:to => recommended_user.email, :subject => "#{recommender.first_name} just recommended you to their supplier #{recommended.first_name} on mylmp.com") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_reviewers\n PushService.new.send_notification(Channel::REVIEWER_CHANNEL, ADMIN_APP, {\n category: 'offer_delivery',\n message: delivery_notify_message,\n offer_id: offer.id,\n author_id: offer.created_by_id\n })\n end", "def item_recommendations_email(user, item_count)\n ...
[ "0.72918606", "0.6869803", "0.6862883", "0.68249345", "0.6625509", "0.65966165", "0.63665247", "0.63327175", "0.6318511", "0.63147813", "0.6223576", "0.620806", "0.6115717", "0.61028427", "0.60681677", "0.60678226", "0.6038337", "0.60324895", "0.6015254", "0.601493", "0.60113...
0.7726427
0
Report notifier lets site admin look into report cases against supplier
def report_notifier(supplier) @supplier = supplier mail(:to => supplier.email, :subject => "#{supplier.first_name} you just recieved a report on your local market-place") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reporting\n # STUB\n end", "def contact_notifier(supplier, user, contact, listing)\n\t @supplier = supplier\n\t @user = user\n\t @contact = contact\n\t @listing = listing\n\t mail(:to => supplier.email,\n\t :subject => \"#{user.first_name} posted an inquiry on #{listing}\")\n end", "def rep...
[ "0.6431298", "0.62788373", "0.62402445", "0.61199844", "0.6086613", "0.6086613", "0.6086613", "0.6086613", "0.6086613", "0.6077232", "0.60463566", "0.60463566", "0.60463566", "0.60463566", "0.60463566", "0.601243", "0.5984592", "0.59581107", "0.59547204", "0.5926606", "0.5908...
0.765968
0
TODO Security lack man kann boxen von anderen seiten sortieren
def update_positions params["edit_template_area_#{params[:id]}"].each_with_index do |id, position| TemplateBox.update(id, :position => position) end init_template_areas #render :layout => false, # :partial => "template_area", # :object => @template_areas.find{|a| a.id == params[:id].to_i} #TODO Dry it flash[:notice] = "Reihenfolge gespeichert" render :update do |page| page.reload end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boxes_with_consistent_order\n boxes.sort { |b1, b2| b1.schema_id <=> b2.schema_id }\n end", "def arrange\n\t\t\n\tend", "def order; end", "def order; end", "def boxes\n @pz.group_by.each_with_index { |val, n| box_id(n) }\n end", "def selection_sort(tabla_hash)\n ordenados = tabla_hash....
[ "0.67439073", "0.5966715", "0.59046113", "0.59046113", "0.5845622", "0.557359", "0.5571613", "0.55475426", "0.5525747", "0.5523047", "0.5455716", "0.545512", "0.5411461", "0.5405059", "0.5404222", "0.5388257", "0.53564245", "0.5354256", "0.5337043", "0.5324366", "0.5302663", ...
0.0
-1
not used anymore del?
def get_area template_area = TemplateArea.find :first, :conditions => ["template_id = ? AND template_areas.id = ? AND tempalte_boxes.site_id = ?", current_site.template_id, params[:id], current_site.id ], :include => [ :template_boxes => :template_box_type ], :order => "template_areas.position, template_boxes.position" render :layout => false, :partial => "template_area", :object => template_area end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def del(*args); end", "def remove!; end", "def delete(obj) ; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup!; end", "def cleanup!; end", "def del\n delete\n...
[ "0.7611053", "0.7611053", "0.7611053", "0.7611053", "0.7587028", "0.7477535", "0.7027853", "0.6986713", "0.6986713", "0.6986713", "0.6986713", "0.694197", "0.694197", "0.6895452", "0.68496466", "0.66835433", "0.6661697", "0.6661697", "0.6608284", "0.6608284", "0.6608284", "...
0.0
-1
Returns the current loggedin user (if any).
def current_user @current_user ||= User.find_by(id: session[:user_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end", "def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end", "def current_user\n return unless session[:user_id...
[ "0.85960984", "0.8593657", "0.855797", "0.8545853", "0.8534344", "0.8497545", "0.847914", "0.8460573", "0.8457271", "0.84556973", "0.84472865", "0.8442264", "0.8441092", "0.84366953", "0.8400402", "0.83765614", "0.8368829", "0.8337418", "0.8337418", "0.8314651", "0.8311652", ...
0.0
-1
Returns true if the user is logged in, false otherwise.
def logged_in? !current_user.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end", "def logged_in?\n user._logged_in?\n end", "def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n r...
[ "0.9081667", "0.8762485", "0.8754561", "0.87175107", "0.8688178", "0.8648743", "0.8644832", "0.86362267", "0.8629921", "0.86265844", "0.86265844", "0.858108", "0.85652345", "0.85596925", "0.85596925", "0.854966", "0.8547523", "0.85425967", "0.8539434", "0.8538127", "0.8515774...
0.0
-1
Forces generators to produce coffeescript instead of javascript.
def coffeescript! @coffeescript = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def javascript!\n @coffeescript = false\n end", "def js_generator\n Apotomo.js_generator\n end", "def app_generators; end", "def coffeescript_file?; end", "def coffeescript_file?; end", "def coffee2js(code)\n\trnd= ('a'..'z').to_a.shuffle[0,8].join\n\t#`rm /tmp/coffee_#{rnd}`\n\t`touc...
[ "0.62432396", "0.60151404", "0.5966445", "0.59546745", "0.59546745", "0.5914115", "0.5793089", "0.57306755", "0.56756973", "0.56756973", "0.55895084", "0.5491638", "0.5491638", "0.5488011", "0.54865026", "0.5474006", "0.54240686", "0.541766", "0.5381194", "0.5314149", "0.5299...
0.6812528
0
Forces generators to produce javascript instead of coffeescript.
def javascript! @coffeescript = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def js_generator\n Apotomo.js_generator\n end", "def coffeescript!\n @coffeescript = true\n end", "def app_generators; end", "def generators; end", "def generators; end", "def coffee2js(code)\n\trnd= ('a'..'z').to_a.shuffle[0,8].join\n\t#`rm /tmp/coffee_#{rnd}`\n\t`touch /tmp/coffee_#...
[ "0.6322607", "0.6304279", "0.5945712", "0.58776295", "0.58776295", "0.58532864", "0.57779276", "0.56646276", "0.5603195", "0.55876595", "0.5496912", "0.5496912", "0.5448181", "0.5448181", "0.5445146", "0.5445146", "0.5401973", "0.5397295", "0.53891385", "0.538815", "0.538815"...
0.63695973
0
Sets `BackboneRails` to produce CoffeeScript if the `coffeescript` gem is available, JavaScript otherwise.
def detect_script! @coffeescript = coffeescript_available? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def javascript!\n @coffeescript = false\n end", "def coffeescript!\n @coffeescript = true\n end", "def generate_coffee\n if options.coffee?\n directory \"app/assets/javascripts/kublog\"\n end\n end", "def initialize_engine\n require_template_library 'haml_co...
[ "0.61222976", "0.60457736", "0.5660141", "0.5394899", "0.5389943", "0.52004385", "0.51746815", "0.51516587", "0.50791603", "0.5070248", "0.5069944", "0.50398237", "0.50398237", "0.50331855", "0.50022024", "0.4998204", "0.49629977", "0.49113706", "0.4894134", "0.48816505", "0....
0.55503595
3
Returns true if the `coffeescript` gem is available.
def coffeescript_available? defined?(CoffeeScript) || require('coffee-script') true rescue LoadError false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_script!\n @coffeescript = coffeescript_available?\n end", "def ruby?\n exist? 'Gemfile'\n end", "def python?\n exist? 'requirements.txt'\n end", "def coffeescript_file?\n extname == \".coffee\"\n end", "def installed?\n File.exist?(swiftlint_path)\n end", "d...
[ "0.7427563", "0.674019", "0.664843", "0.652481", "0.6436901", "0.6409199", "0.62647295", "0.6147708", "0.61240786", "0.6113721", "0.60526645", "0.6001608", "0.60009116", "0.59947866", "0.595675", "0.595675", "0.595224", "0.5938993", "0.59316254", "0.59274894", "0.59274894", ...
0.8531224
0
Lookup an attribute from the body if hash, otherwise behave like array index. Convert any key to string before calling.
def [](key) if self.body.is_a?(Array) self.body[key] else self.body.send(:"#{key}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def [](key)\n @attributes = Array.new if @attributes.nil?\n attributes_downcase =@attributes.map(&:downcase)\n key.downcase!\n if attributes_downcase.include? key\n return get(key)\n else\n raise 'El atributo no ha sido encontrado en el objecto '+ key\n end\nend", "def [](symbol_or_string)\n attri...
[ "0.6510873", "0.6476307", "0.63829374", "0.63330543", "0.62167025", "0.61828506", "0.6157091", "0.6110539", "0.6078671", "0.6069346", "0.6069346", "0.6061769", "0.6043903", "0.5996765", "0.59822655", "0.59712356", "0.59712356", "0.59712356", "0.59299976", "0.5928996", "0.5923...
0.66098654
0
Return response body as string
def to_s body.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def body\n response&.body.to_s\n end", "def body\n response.body.to_s\n end", "def raw_body\n @response.body.to_s\n end", "def body\n response.body || ''\n end", "def to_s\n @response.body\n end", "def response_body\n @response[:body]\n...
[ "0.83218855", "0.8266823", "0.8177715", "0.80644864", "0.80377513", "0.7844112", "0.78076804", "0.76942724", "0.7681168", "0.76336014", "0.76336014", "0.7628375", "0.75973666", "0.75973666", "0.7465172", "0.74421984", "0.7405616", "0.7300964", "0.71831155", "0.7159326", "0.71...
0.7332816
17
Convert the ResponseWrapper into a Hash
def to_hash body.to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toHash\n raise ResponseError, \"Response body doesnot exist\" if @_responseBody.nil? || @_responseBody.empty?\n JSON.parse(@_responseBody) \n end", "def to_hash\n @hash ||= apply_response_pattern original_hash\n end", "def response2hash(http)\n if http.response_data.length...
[ "0.7594226", "0.71751386", "0.6948374", "0.69215935", "0.6913482", "0.6872197", "0.67758995", "0.6748645", "0.67253506", "0.67253506", "0.672151", "0.6673638", "0.66696835", "0.65577877", "0.6538663", "0.6527291", "0.65028775", "0.6443883", "0.6412123", "0.6408871", "0.639420...
0.66356164
13
Convert the ResponseWrapper into an Array
def to_ary body.to_ary end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_response(response)\n response = response.values if unprocessable_hash?(response)\n Array([response]).flatten\n end", "def to_a\n [status.to_i, headers.to_h, body.to_s]\n end", "def upgrade_array_body!(response)\n response.body.map! do |body_elem|\n body_elem...
[ "0.76449627", "0.714888", "0.7108336", "0.708529", "0.70020986", "0.6922989", "0.68823516", "0.6851205", "0.6689429", "0.6605645", "0.64400727", "0.63485515", "0.63078165", "0.63027614", "0.62917465", "0.62817216", "0.62580603", "0.6242431", "0.62385523", "0.61923575", "0.618...
0.6094937
26
Iterate over each resource inside the body
def each body_parts = self.body.respond_to?(:each) ? self.body : [self.body] return body_parts.to_enum unless block_given? body_parts.each { |part| yield(part) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources\n body && [*body]\n end", "def each\n @body.each do |block|\n yield @resource.send(@encoder, @resource.send(@charsetter, block.to_s))\n end\n end", "def resources\n @resources ||= process_data(decoded_body[resources_key])\n end", "def all\n setup_req...
[ "0.7001044", "0.6795294", "0.65472245", "0.6502466", "0.64077777", "0.6391842", "0.6370774", "0.6306053", "0.6242194", "0.612207", "0.6117523", "0.6098579", "0.60973424", "0.60960627", "0.6080737", "0.60159105", "0.6002097", "0.59729326", "0.5970654", "0.58999467", "0.5888417...
0.5712529
28
Check if body has an attribute
def has_key?(key) self.body.is_a?(Hash) && self.body.has_key?(key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attribute?\n node_type == ATTRIBUTE_NODE\n end", "def has_body?\n @body\n end", "def has_attribute (attname)\n\n attname = OpenWFE::symbol_to_name(attname) if attname.is_a?(Symbol)\n\n (@attributes[attname] != nil)\n end", "def on_the_page?\n dom_reader.has_attrs?(se...
[ "0.6665091", "0.6641779", "0.6507372", "0.646814", "0.6443886", "0.6384969", "0.6382652", "0.637266", "0.6354774", "0.6309564", "0.6308854", "0.6269279", "0.6263269", "0.6244813", "0.6235033", "0.62271714", "0.6223642", "0.62213606", "0.61929107", "0.6191004", "0.6147862", ...
0.56797844
67
Coerce any method calls for body attributes
def method_missing(method_name, *args, &block) if self.has_key?(method_name.to_s) self.[](method_name, &block) else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_method_body(body, zclass, name, classes)\n\n\t# Transform the method definition first.\n\n\tbody = body.sub(/#{zclass.name}\\s*::\\s*#{name}\\s*\\(\\s*/,\n\t \"#{zclass.name}__#{name}(#{zclass.name} *self, \")\n\n\t# Fields must have self-> preceding them.\n\n\tzclass.fields.each_pair ...
[ "0.5978603", "0.5957847", "0.5710102", "0.5646537", "0.5623131", "0.5623131", "0.5609629", "0.5589261", "0.55547696", "0.55495995", "0.55445683", "0.55445683", "0.53835", "0.5375412", "0.5361408", "0.5357715", "0.5325641", "0.53256315", "0.5311758", "0.53072447", "0.52405614"...
0.0
-1
Check if method is defined on the body
def respond_to?(method_name, include_all = false) if self.has_key?(method_name.to_s) true else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def must_have_body?\n Methods[@method].must_have_body\n end", "def can_have_body?\n Methods[@method].can_have_body\n end", "def method?\n type == TYPE_METHOD\n end", "def method?\n type == TYPE_METHOD\n end", "def method_defined?(p0) end", "def body?\n HTTY::Req...
[ "0.8656884", "0.8251961", "0.73638356", "0.73638356", "0.7348799", "0.7275566", "0.72371954", "0.70972204", "0.70865273", "0.69214827", "0.69176656", "0.6767595", "0.6747928", "0.67256284", "0.6702826", "0.67002237", "0.6651248", "0.66337913", "0.66262287", "0.66261494", "0.6...
0.0
-1
Print only response body
def inspect "#<#{self.class.name} @body=\"#{self.body}\">" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def body\n response&.body.to_s\n end", "def body\n response.body || ''\n end", "def response_body\n @response[:body]\n end", "def raw_body\n @response.body.to_s\n end", "def body\n @response.body if success?\n end", "def response_body; end", "def response...
[ "0.7062865", "0.7061221", "0.699858", "0.6997169", "0.6990448", "0.6964997", "0.6964997", "0.68708086", "0.68694836", "0.6860856", "0.68344617", "0.68344617", "0.68310213", "0.6807857", "0.6774142", "0.67474234", "0.67376", "0.669449", "0.6571854", "0.64966005", "0.6462924", ...
0.0
-1
Compare the wrapper with other wrapper for equality
def ==(other) return false unless other.is_a?(self.class) return false unless (other.respond_to?(:env) && other.respond_to?(:body)) self.env == other.env && self.body == other.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n if other.respond_to? :unwrap\n unwrap == other.unwrap\n else\n super\n end\n end", "def == other\n return @hash == other.hash if other.class <= Blobject\n return @hash == other if other.class <= Hash\n super\n end", "def eql?(other)\n super\n ...
[ "0.7198838", "0.6825804", "0.6780466", "0.6780466", "0.6773003", "0.6773003", "0.6714384", "0.6698955", "0.6698955", "0.6675958", "0.665078", "0.6626066", "0.66252434", "0.6623232", "0.6611991", "0.66065806", "0.6606327", "0.6597407", "0.65899426", "0.65812933", "0.65812933",...
0.0
-1
does the river have a name
def test_river_has_name assert_equal("Amazon", @river.name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_name?\n true\n end", "def knows?(name)\n false\n end", "def name?\n !@name.nil?\n end", "def name_is?(name)\n @location.name_is?(name)\n end", "def roomexists(rname)\n if @cname.has_key?(rname) == true\n return true\n else...
[ "0.70533836", "0.6836176", "0.67574674", "0.67437226", "0.6740904", "0.67274433", "0.65519416", "0.6548146", "0.65105844", "0.64855045", "0.64703393", "0.6437948", "0.64303184", "0.6403532", "0.63235986", "0.6305836", "0.62775457", "0.62278616", "0.62105983", "0.62063676", "0...
0.0
-1
river loses fish to bear
def test_river_loses_fish @river.remove_fish assert_equal(2, @river.count_fish_in_river) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loose_fish_when_bear_takes_it()\n @bear.add_to_stomach(@fish1)\n @river.loose_fish(@fish1)\n assert_equal(0,@river.fish_count())\n end", "def loose_fish_when_bear_takes_it(fish)\n\n end", "def eat_fish_from_river(fish, river)\n @stomach.push(fish)\n river.lose_fish(fish)\n end", ...
[ "0.7923238", "0.7282996", "0.7056406", "0.68452984", "0.6814162", "0.68026286", "0.67937094", "0.66951287", "0.66951287", "0.66951287", "0.6637295", "0.6585491", "0.6539618", "0.6464454", "0.64248836", "0.63605213", "0.63375425", "0.629056", "0.6258532", "0.62480897", "0.6187...
0.0
-1
Overrides default initializer for compliance with form_for method in views
def initialize(attributes = {}) attributes.each do |name, value| public_send("#{name}=", value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(form)\n @form = form\n end", "def initialize(form_object)\n @form_object = form_object\n end", "def default_form_builder; end", "def setup_form\n build_form\n super\n end", "def form_setup\n\tend", "def form; end", "def initialize(form, field, type)\n @klass = form....
[ "0.6890269", "0.68587977", "0.67062956", "0.65663487", "0.63258046", "0.6245693", "0.6177149", "0.61199266", "0.6065742", "0.6064773", "0.60387784", "0.6028453", "0.60260344", "0.6013577", "0.5996415", "0.5988852", "0.5968058", "0.5961076", "0.5924376", "0.5901185", "0.588450...
0.0
-1
Used in search vrn view and should return nil when the object is not persisted.
def to_key nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persisted?; end", "def persisted?; end", "def object\n nil\n end", "def persisted?; false; end", "def model\n nil\n end", "def model\n nil\n end", "def find\n super.first\n end", "def object\n nil\n end", "def persisted? ; false ; end", "def null_re...
[ "0.66122526", "0.66122526", "0.6270613", "0.60831964", "0.60136133", "0.60136133", "0.59913963", "0.59876287", "0.58737016", "0.5794401", "0.57687587", "0.5687803", "0.5681932", "0.566763", "0.5654717", "0.56441253", "0.5633139", "0.56299573", "0.5622353", "0.56180656", "0.55...
0.0
-1
If you adjust the start of the counter, you have to adjust it's range max For every debit, there needs to be a credit
def get_next(counter) product = 1 (counter..(counter+@digit_size - 1)).each do |num| next if num == 0 product = product * @all_ints[num].to_i end product end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credits; end", "def max_money(aid_amount, with_amount, rebel_rate, rebel_limit)\n max_with_amount = 0 \n while rebel_rate < rebel_limit && aid_amount > 0 \n aid_amount -= with_amount\n rebel_rate = rebel_rate * 2 \n max_with_amount += with_amount\n end\n max_with_amount\nend", "def debit_amoun...
[ "0.6140338", "0.61109024", "0.60904676", "0.60448974", "0.5994663", "0.59890115", "0.5896263", "0.58875865", "0.5877248", "0.5818447", "0.5756371", "0.57443166", "0.57254946", "0.5723307", "0.57091314", "0.5699124", "0.56844807", "0.56602585", "0.5654589", "0.5652769", "0.563...
0.0
-1
[0,1,1,2,3,5] find a way to add the last two numbers of an array together and keep doing that for a number of sequences need to use .next fib(6) [0,1,1,2,3,5] 4.next + 3.next = 2 add 0 + 1 then ad again but with a new addition method 0.next + 1 def fib(num) counter = 0 while counter <= num counter + 1 counter = counter + 1 end end
def fibonacci( n ) fib_nums = [] return n if n <= 1 fib_nums << fibonacci( n - 1 ) fib_nums << fibonacci( n - 2 ) p "#{fib_nums}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fib(num)\n array = [0, 1]\n index = 0\n until index == num.to_i - 2\n next_number = array[-1] + array[-2]\n array.push(next_number)\n index +=1\n end\n array\nend", "def fibs(num)\n arr = [0, 1]\n\n (2..num).each do |_i|\n arr << arr[-1] + arr[-2]\n end\n\n arr.last\nend", "d...
[ "0.8390621", "0.8364786", "0.83096945", "0.8260598", "0.8238728", "0.8231289", "0.819665", "0.8181448", "0.8179741", "0.8143973", "0.8127057", "0.8122505", "0.8113843", "0.8113712", "0.8111893", "0.81101626", "0.80450577", "0.80450577", "0.80415213", "0.8031213", "0.80302286"...
0.0
-1
currently we are using Rails.application.routes.url_helpers without including the namespace because it runs into an exception work around since calling data.preview(options) returns "/images/" which isnt the url
def preview(attachment, options) Rails.application.routes.url_helpers.rails_representation_path(attachment.preview(options), only_path: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview_url(opts={})\n url(opts)\n end", "def generate_preview_url\n GlobalConstant::Base.root_url + @params['path'] + '?ts=' + @params['ts'].to_s\n end", "def url_preview\n parsed_url = Domainatrix.parse(self.url)\n return \"#{parsed_url.domain}.#{parsed_url.public_suffix}\"\n end", "...
[ "0.7076969", "0.6680212", "0.6602785", "0.65279317", "0.6445614", "0.6430949", "0.6412274", "0.6412274", "0.63092166", "0.62449795", "0.62449795", "0.6232956", "0.62196755", "0.61750185", "0.61439705", "0.61349154", "0.6110915", "0.60825455", "0.60687816", "0.60687816", "0.60...
0.73164344
0
contiguous sequence with the largest sum. Example: Input: [2, 8, 3, 2, 4, 10] Output: 5 (i.e., [4,2,4])
def contiguous_sequence(array) max_sum = array.first array.each_with_index do |num, idx| current_sum = num array[(idx+1)..-1].each do |num| current_sum += num max_sum = current_sum if current_sum > max_sum end end max_sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_contiguous_subsum(list)\r\n max_val = 0 #8\r\n current_sum = 0 #8\r\n list.each do |num|\r\n current_sum = [0, current_sum + num].max\r\n max_val = [max_val, current_sum].max\r\n end\r\n return max_val\r\nend", "def largest_contiguous_sum2(array)\n sum = array.first\n m...
[ "0.8193369", "0.81381077", "0.813679", "0.81259567", "0.80957997", "0.807333", "0.80585194", "0.8056242", "0.80521417", "0.80409276", "0.8040258", "0.803487", "0.8027012", "0.80200046", "0.80187666", "0.80077815", "0.80036175", "0.8002717", "0.7992157", "0.7979703", "0.797612...
0.77111137
63
Use callbacks to share common setup or constraints between actions.
def set_books @student_library = StudentLibrary.find(params[:student_library_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def book_params params.require(:book).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7122858", "0.70540553", "0.69476545", "0.6902004", "0.6735809", "0.671776", "0.668886", "0.66776645", "0.66611695", "0.6555913", "0.6527077", "0.64584446", "0.64516115", "0.64500964", "0.64474493", "0.6435065", "0.6413185", "0.6413185", "0.6391701", "0.6380101", "0.6380101...
0.0
-1
Define display_board that accepts a board and prints out the current state.
def display_board(board) puts " #{board[0]} | #{board[1]} | #{board[2]} \n-------------\n #{board[3]} | #{board[4]} | #{board[5]} \n-------------\n #{board[6]} | #{board[7]} | #{board[8]} \n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\n end", "def display_board(board)\n puts \" #{board[0]} | #{boar...
[ "0.8280391", "0.8280391", "0.82586133", "0.8189535", "0.8148112", "0.8121695", "0.810553", "0.8104123", "0.8104123", "0.8076271", "0.80670273", "0.8063301", "0.80535764", "0.80535764", "0.80535764", "0.80535764", "0.80535764", "0.80535764", "0.80535764", "0.80535764", "0.8053...
0.7817678
88