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
Given array 'values', converts array to TSV formatted line and appends it to associate file
def <<(values) @file_handle << TSV.to_tsv_line(Array(values)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chart names, values\n normalized_values = values\n normalized_values = values.map {|v| [v] } if (values.count > 0 && (not values[0].is_a?(Array)))\n write_rows('temp', names, normalized_values)\n `open temp.csv`\nend", "def write_rows file_name, names, values\n header = names.join(',') + \"\\n\"\n body...
[ "0.67395586", "0.6707006", "0.63853407", "0.61760926", "0.59918594", "0.5927558", "0.575796", "0.5755622", "0.5755622", "0.5713817", "0.5681538", "0.5595119", "0.5560341", "0.5527646", "0.55266637", "0.550374", "0.5484784", "0.5467603", "0.5415045", "0.54027784", "0.53608805"...
0.7788614
0
Closes the underlying file
def close @file_handle.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close()\n @file.close\n end", "def close\n @file.close\n end", "def close\n @handle.closeFile\n @handle = nil\n end", "def close_file\r\n end", "def close(filename); end", "def close_file\n if is_file_open?\n @file_handle.close\n \n # reset 'flags...
[ "0.799563", "0.79676884", "0.79566514", "0.78106844", "0.7766105", "0.77132213", "0.77123076", "0.7650901", "0.7549108", "0.74268275", "0.72672904", "0.7240549", "0.7220944", "0.71554095", "0.71537477", "0.7137474", "0.7070406", "0.70314974", "0.6874521", "0.6818128", "0.6798...
0.74608433
10
Copy the remote to another place to be cloned
def copied_remote(path) remote = File.expand_path(testpath(path)) remote_copied = tmp_path("remote_copied") FileUtils.cp_r remote, remote_copied remote_copied end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_to_remote(local_file, remote_path)\n\t\t@ssh_session.scp.upload! local_file, remote_path\n\tend", "def clone\n # We do the clone against the target repo using the `--reference` flag so\n # that doing a normal `git pull` on a directory will work.\n git \"clone --reference #{@cache.path} #{@remot...
[ "0.690042", "0.6859551", "0.6848304", "0.6701057", "0.669421", "0.6685878", "0.6683813", "0.66489834", "0.65885776", "0.65328836", "0.6530396", "0.6501967", "0.64854234", "0.6479854", "0.6476666", "0.64616585", "0.6445613", "0.6437351", "0.6413768", "0.63917375", "0.6377141",...
0.75306094
0
Jekyll instance of post file
def jekyll_post_object(path, file) original_stdout = $stdout $stdout = File.new('/tmp/null.txt', 'w') config = Jekyll.configuration({'source' => path}) site = Jekyll::Site.new(config) $stdout = original_stdout Jekyll::Post.new(site, site.source, '', file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(post_name, tags: ['ruby'])\n time = Time.now\n file_name = time.to_date.to_s + '-' + Slugify.(post_name) + '.md'\n\n File.write(POSTS_PATH + file_name, FileContent.(post_name, time, tags))\nend", "def post\n # TODO re-enable blog post creation. Requires a config file.\n #if @args.length > 0...
[ "0.72901946", "0.68021965", "0.6646134", "0.6635708", "0.6616431", "0.6494596", "0.63659436", "0.63179433", "0.6278382", "0.6170018", "0.61646974", "0.61623585", "0.6128489", "0.6128227", "0.6083054", "0.6074135", "0.60700977", "0.60532427", "0.603444", "0.6034214", "0.603214...
0.7751646
0
Use callbacks to share common setup or constraints between actions.
def set_assessment_setting @assessment_setting = AssessmentSetting.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def assessment_setting_params params.require(:assessment_setting).permit(:per_sec, :allowed_attempts, :style, :assessment_id, :enable_start, :confidence_levels, :mode, :is_default, :account_id) 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.7122899", "0.7054107", "0.69478", "0.6902101", "0.67359334", "0.67178756", "0.66889167", "0.6677724", "0.6661157", "0.6555896", "0.6527207", "0.64584696", "0.64517015", "0.6450208", "0.644749", "0.6435074", "0.6413329", "0.6413329", "0.6391818", "0.6380081", "0.6380081", ...
0.0
-1
Expects CSV, a filename, or a URL with triples in it If there is a header in the file, use load(contents, :header => true) so that we can ignore the first line If there are special converters needed for FasterCSV to work, include them in the options as well.
def load(contents, opts={}) table = infer_csv_contents(contents, opts) return nil unless contents table.each do |row| self.add(*row) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv(file, header)\n FasterCSV.read(file, {:header_converters => :symbol, :headers => header } )\nend", "def import_csv_smart\n \n end", "def load_csv(filename)\n CSV::Converters[:blank_to_nil] = lambda do |field|\n field && field.empty? ? nil : field\n end\n CSV.new(File.read(filename), \n ...
[ "0.67875195", "0.64687866", "0.6308278", "0.6229466", "0.62011606", "0.6199591", "0.619842", "0.6191682", "0.61880475", "0.61401373", "0.6102428", "0.60715073", "0.606091", "0.6028206", "0.6021465", "0.60033756", "0.59611595", "0.5928305", "0.5926649", "0.59055454", "0.590212...
0.67732984
1
Just very basic for now
def to_csv self.find.map {|row| row.join(',')}.join("\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main\n\n end", "def main; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def main\n end", "def how_it_works\r\n end", "def standalone; end", "def weber; end", "def run\n end"...
[ "0.6729405", "0.6689251", "0.6650546", "0.6650546", "0.6650546", "0.6650546", "0.6650546", "0.6650546", "0.6650546", "0.6650546", "0.6650546", "0.66111547", "0.6540965", "0.63448536", "0.6338346", "0.63284796", "0.630741", "0.628226", "0.628226", "0.628226", "0.628226", "0....
0.0
-1
Take a list of triples with variables in them, and resolve the constraints of the triples. Usage: query([ ['?company', 'headquarters', 'New York'], ['?company', 'industry', 'Investment Banking'], ])
def query(*triples) bindings = nil triples.each do |triple| binding_position = {} query = [] triple.each_with_index do |e, i| if query_variable?(e) binding_position[e] = i query << nil else query << e end end rows = find(*query...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_constraints(*columns_list)\n raise ArgumentError, \"You must specify at least one column to be used in querying\" if columns_list.empty?\n\n @query_constraints_list = columns_list.map(&:to_s)\n @has_query_constraints = @query_constraints_list\n end", "def query_constraints\n ...
[ "0.58513665", "0.55690014", "0.55621094", "0.54859036", "0.5313081", "0.52929795", "0.52929795", "0.52790177", "0.518228", "0.5101284", "0.5096622", "0.5069635", "0.5022919", "0.50207067", "0.50085807", "0.49606583", "0.49537307", "0.4946634", "0.49384427", "0.49337348", "0.4...
0.6262322
0
Is this thing a variable, or a value? Rigth now, we use "?some_name" to setup the variable in a query.
def query_variable?(obj) begin obj.to_s =~ /^\?/ ? true : false rescue false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is?(var_name, other_value)\n public_send(var_name.to_sym).to_s == other_value.to_s\n end", "def variable?\n any? {|op| op.respond_to?(:variable?) && op.variable?}\n end", "def var_name_ok?(varname)\n svar=varname.to_s\n if @@reserved_words.include?(svar)\n raise ArgumentError, ...
[ "0.6254626", "0.6209948", "0.61977845", "0.6155341", "0.615404", "0.59193426", "0.58807135", "0.57251096", "0.56516963", "0.56275785", "0.5623894", "0.55862284", "0.55862284", "0.5571221", "0.5556014", "0.5534911", "0.55255455", "0.5454169", "0.5451199", "0.5445078", "0.54389...
0.70067215
0
Assuming a trimmed triple entry
def add_to_index(index, a, b, c) begin index[a][b] << c rescue index[a] ||= {} index[a][b] = [c] end # The old, slow way of doing things...the new way is nearly linear at # 0.0005 seconds per transaction at 100 inserts # and 0.000529 seconds per transaction at...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_trim?; end", "def third_line\n \"#{self.state} #{self.postal_code} #{self.country_short_name}\".squeeze(\" \").strip\n end", "def trim\n self.select { |_k, v| v.present? }\n end", "def auto_trim!; end", "def multiple_fields_to_one multfields, prefix=false\n vals = []\n multfields...
[ "0.5600578", "0.5569881", "0.5530892", "0.5483085", "0.54561484", "0.54416764", "0.5401688", "0.5357814", "0.5354809", "0.53536046", "0.53464574", "0.53338546", "0.5332894", "0.5317824", "0.5312244", "0.52961934", "0.52891666", "0.52891254", "0.52729446", "0.5268697", "0.5251...
0.0
-1
A descriptive error message to display when this rule fails.
def error_msg name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def failure_message\n \"validation failed with #{@errors.inspect}, expected no validation errors\"\n end", "def failure_message\n actual = prettify_args(@actual)\n\n if @description\n \"'#{actual}' should #{@description}\"\n else\n \"'#{actual}' should satisfy the r...
[ "0.74930525", "0.72825646", "0.721429", "0.7186554", "0.7138702", "0.71082824", "0.71082824", "0.71082824", "0.71082824", "0.71082824", "0.71082824", "0.71082824", "0.6974859", "0.6951188", "0.6916957", "0.68300307", "0.68004894", "0.6789344", "0.67586184", "0.67034984", "0.6...
0.7004346
12
A name for this rule.
def name self.class.name.demodulize.underscore end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule_name=(value)\n @rule_name = value\n end", "def rule_name\n return @rule_name\n end", "def rule_name\n super\n end", "def rule_name=(rule_name)\n @rule_name = rule_name.to_sym\n end", "def rule_name=(rule_name)\n @rule_name = ...
[ "0.8412272", "0.81507885", "0.7661369", "0.76053476", "0.76053476", "0.7284988", "0.70891994", "0.69729954", "0.68835413", "0.68702817", "0.68048775", "0.67584157", "0.6700663", "0.6676215", "0.6673681", "0.66471076", "0.66469973", "0.6636102", "0.6634752", "0.6634752", "0.66...
0.0
-1
Should this rule notify the user when it is not valid?
def notify? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate!\n # pass\n end", "def invalid; end", "def validate!; end", "def validate!; end", "def validate!; end", "def extra_validations\n success\n end", "def validate\n @invalid=false\n end", "def validate\r\n @invalid=false\r\n end", "def invalid?\n !@va...
[ "0.69252867", "0.6911035", "0.66587585", "0.66587585", "0.66587585", "0.66327053", "0.65961313", "0.6551239", "0.65421927", "0.6542073", "0.6477587", "0.6474858", "0.6474858", "0.6463908", "0.6453923", "0.64477897", "0.64316773", "0.6427105", "0.6401483", "0.63950664", "0.638...
0.0
-1
This rule is required for external users.
def required_for_external? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule\n super\n end", "def rule\n super\n end", "def rule; end", "def rule; end", "def rule; end", "def rule_name\n super\n end", "def default_rule; end", "def cop_rule?; end", "def external_rules\n @external_rules ||= rules.dup.external\n end", "def rules\n @rul...
[ "0.6717875", "0.6717875", "0.61080915", "0.61080915", "0.61080915", "0.6057538", "0.5729395", "0.5724096", "0.5700427", "0.5694591", "0.56868446", "0.56431705", "0.559509", "0.5590913", "0.5546332", "0.5546332", "0.5546332", "0.5514698", "0.54897803", "0.54872197", "0.5466367...
0.5596126
12
Returns `true` if the result of the rule is `true`
def valid? !!result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def true!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 57 )\n\n type = TRUE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 178:8: 'true'\n match( \"true\" )\n\n \n @state.type = t...
[ "0.68816435", "0.6835406", "0.6762078", "0.66956705", "0.66783637", "0.6593223", "0.6566568", "0.65492797", "0.65265906", "0.6513982", "0.65105575", "0.6510433", "0.6461089", "0.6461089", "0.6456099", "0.64487433", "0.64281535", "0.6398384", "0.6377674", "0.6368306", "0.63674...
0.6629673
5
Returns the display_type from the params , otherwise nil
def display_type @params.fetch('type', nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_type\n @params.fetch('type', nil)\n end", "def display_as\n params[:display_as]\n end", "def display_requested_type\n\t\t\t@display_requested_type ||=\n\t\t\tcase requested_type\n\t\t\twhen 1\n\t\t\t\t'Liên hệ'\n\t\t\twhen 2\n\t\t\t\t'Đăng ký sản phẩm'\n\t\t\twhen 3\n\t\t\t\tcase object_typ...
[ "0.8376492", "0.6953984", "0.66334885", "0.6360492", "0.63590026", "0.6354855", "0.6323687", "0.6255071", "0.6204115", "0.60505635", "0.60320693", "0.60150063", "0.59525776", "0.59112257", "0.5904827", "0.5892215", "0.58521783", "0.58521783", "0.5825936", "0.5811582", "0.5802...
0.77460545
1
Returns utf8 encoding of the msg
def force_utf8_encoding(msg) msg.respond_to?(:force_encoding) && msg.encoding.name != 'UTF-8' ? msg.force_encoding('UTF-8') : msg end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def force_utf8_encoding(msg)\n msg.respond_to?(:force_encoding) && msg.encoding.name != 'UTF-8' ? msg.force_encoding('UTF-8') : msg\n rescue StandardError\n nil\n end", "def encoding\n Encoding::UTF_8\n end", "def encoding\n Encoding::UTF_8\n end", "def toutf8; Kconv.toutf8(se...
[ "0.7653545", "0.7015704", "0.7015704", "0.6961225", "0.6958307", "0.69001573", "0.68505585", "0.66880894", "0.65328956", "0.6532787", "0.65233463", "0.6484123", "0.64764017", "0.64612305", "0.6438173", "0.63983285", "0.63958865", "0.6387272", "0.6379904", "0.6370475", "0.6353...
0.75979066
1
Method that checks if we need to display the total downloads
def display_total display_type.present? && display_type == 'total' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_download_count?\n self.class.show_download_count?\n end", "def display_download_all?\n @purl_object.size < 10_737_418_240 &&\n @purl_object.downloadable_files.length > 1 &&\n @purl_object.downloadable_files.length < 3000\n end", "def only_downloadable\n dow...
[ "0.729103", "0.72023493", "0.6477303", "0.64646673", "0.64046735", "0.6373371", "0.63725156", "0.636784", "0.62801015", "0.62110984", "0.6129018", "0.6101332", "0.6028347", "0.6009792", "0.5935261", "0.5894445", "0.5894445", "0.588088", "0.5874469", "0.5846096", "0.58294356",...
0.54415447
43
The prefixes that can be used in metric display
def metric_prefixes %w(k M G T P E Z Y) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metric_prefixes\n %w[k M G T P E Z Y]\n end", "def prefixes; end", "def prefixes; end", "def _prefixes; end", "def prefixes\n @prefixes ||= Hash[namespaces.sort_by { |k, v| k }.uniq { |k, v| v }].invert\n end", "def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end", "def pre...
[ "0.84143424", "0.7713374", "0.7713374", "0.687847", "0.6842461", "0.67181313", "0.67181313", "0.66091675", "0.66091675", "0.6592581", "0.65614164", "0.652922", "0.64533144", "0.6406275", "0.6400989", "0.635063", "0.635063", "0.635063", "0.635063", "0.635063", "0.635063", "0...
0.8220094
1
Dispatches the response either to the final callback or to the block that will use the response and then call the callback
def dispatch_http_response(res, options, &block) callback = options.fetch('callback', nil) (res.blank? && callback.present?) ? callback.call(res) : block.call(res) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_http_response(res, options)\n callback = options.fetch('callback', nil)\n res.blank? && callback.present? ? callback.call(res, nil) : yield(res)\n end", "def on_response request, response, block\n block.call(response.name, response.params)\n end", "def callback\n return respo...
[ "0.74760836", "0.7355191", "0.71242243", "0.68181604", "0.68181604", "0.67707765", "0.67321813", "0.67321813", "0.6696151", "0.6684299", "0.66686547", "0.66437817", "0.66255265", "0.6591105", "0.6589598", "0.6578837", "0.65764636", "0.6561117", "0.65484047", "0.65048933", "0....
0.7734453
0
Returns the metric powers of all metric prefixes . This method is used in metric display of numbers
def metric_power metric_prefixes.map.with_index { |_item, index| (1000**(index + 1)).to_i } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metric_power\n #noinspection RubyYardReturnMatch\n metric_prefixes.map.with_index { |_item, index| (1000**(index + 1)).to_i }\n end", "def metric_prefixes\n %w(k M G T P E Z Y)\nend", "def metric_prefixes\n %w[k M G T P E Z Y]\n end", "def object_of_power; end", "def prefixes; end", "def ...
[ "0.74672157", "0.68630093", "0.6779604", "0.57263017", "0.5587674", "0.5587674", "0.55461866", "0.5544056", "0.548361", "0.5468475", "0.54316586", "0.53986216", "0.5398422", "0.53971004", "0.53722054", "0.5335517", "0.5314343", "0.5296671", "0.5256933", "0.52497864", "0.52382...
0.7609232
0
Method that is used to parse a string as JSON , if it fails will return nil
def parse_json(res) return if res.blank? JSON.parse(res) rescue JSON::ParserError nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_parse(string)\n json_string_to_hash(string)\n # if string.class == String && string == \"null\"\n # nil\n # else\n # JSON.parse(string, {:symbolize_names => true})\n # end\nend", "def parse_json str\n JSON.parse str rescue raise ConfigError, \"Invalid JSON\"\n end", "def parse_st...
[ "0.84034663", "0.79652953", "0.7953034", "0.77128685", "0.764151", "0.7504664", "0.7462443", "0.74591166", "0.73481065", "0.7326206", "0.73079854", "0.726528", "0.72185403", "0.7186753", "0.7133794", "0.7116842", "0.7086454", "0.7075266", "0.70667315", "0.70509434", "0.704396...
0.7557935
5
Method that is used to print to a stream . If the stream is already closed will return nil otherwise will append the response to the stream and close the stream
def print_to_output_buffer(response, output_buffer) return if output_buffer.closed? output_buffer << response output_buffer.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stream\n 10_000_000.times do |i|\n response.stream.write \"This is line#{i}\\n\"\n end\n ensure\n response.stream.close\n end", "def stream(&writer)\n fi = Fiber.new do\n writer.call\n end\n\n Body.new do |msgid, sender|\n begin\n ...
[ "0.69805574", "0.68408495", "0.67054045", "0.66028446", "0.66028446", "0.66028446", "0.66028446", "0.6489484", "0.6472283", "0.64093316", "0.6393468", "0.6370585", "0.6328218", "0.62819", "0.62798923", "0.6263923", "0.62525207", "0.6235015", "0.6187896", "0.61449784", "0.6137...
0.69371283
1
Method that tries to check if the version provided is a valid versin sintactical and semantical. it does not check if the gem actually has that version published or not. if the parsing of the version fails will return nil, otherwise will return the parsed version
def parse_gem_version(gem_version) return if gem_version.blank? || gem_version == 'stable' Versionomy.parse(gem_version) rescue Versionomy::Errors::ParseError return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_gem_version(gem_version)\n return if gem_version.blank? || gem_version == 'stable'\n Versionomy.parse(gem_version)\n rescue Versionomy::Errors::ParseError\n nil\n end", "def valid_version?(arg)\n return true if arg == false || arg == 'latest'\n arg =~ /^[0-9]+\\.[0-9]+\\.[0-9]+...
[ "0.7175887", "0.70608604", "0.7036849", "0.7035726", "0.68966675", "0.68753856", "0.68652916", "0.68595976", "0.67269355", "0.66185224", "0.66092026", "0.65935177", "0.6569719", "0.65667593", "0.65235996", "0.6507186", "0.6452222", "0.6438911", "0.6420523", "0.64175254", "0.6...
0.7398851
0
Given an aray of gem versions , will filter them and return only the stable versions
def stable_gem_versions(http_response) http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\n end", "def available_versions\n return unless @version\n the_gem_line = gem_remote_list_output.scan(/^#{name}\\s.*$/).first\n the_gem_line.scan /\\d+\\.\\d+\\....
[ "0.75638974", "0.68479234", "0.67410237", "0.665627", "0.65927523", "0.6443156", "0.64221656", "0.6406516", "0.6399068", "0.63963383", "0.63872004", "0.63680816", "0.63680816", "0.63680816", "0.63336176", "0.62855375", "0.6257807", "0.623794", "0.62174916", "0.6201149", "0.61...
0.75063616
1
method that will return nil if the array of versions is empty or will return the versions sorted
def sorted_versions(versions) versions.blank? ? [] : versions.map { |val| val['number'] }.version_sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sorted_versions(versions)\n versions.blank? ? [] : versions.map { |val| val['number'] }.version_sort\n end", "def last_version(sorted_versions)\n sorted_versions.blank? ? '' : sorted_versions.last\nend", "def get_all_versions\n []\n end", "def get_all_versions()\n return []\n end", "def so...
[ "0.82042664", "0.6998227", "0.69174296", "0.6847888", "0.67717576", "0.67098504", "0.66467804", "0.66196954", "0.6546698", "0.6435799", "0.63506037", "0.62346625", "0.621095", "0.6207125", "0.6173113", "0.61566406", "0.61549294", "0.60997343", "0.6051651", "0.6023259", "0.600...
0.82126373
0
Method to search for a version number in all gem versions and return the hash object
def find_version(versions, number) number.blank? ? {} : versions.find { |val| val['number'] == number } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_version(versions, number)\n number.blank? ? {} : versions.find { |val| val['number'] == number }\n end", "def available_versions\n return unless @version\n the_gem_line = gem_remote_list_output.scan(/^#{name}\\s.*$/).first\n the_gem_line.scan /\\d+\\.\\d+\\.\\d+/\n end", ...
[ "0.74030024", "0.6912499", "0.6816412", "0.67768675", "0.6727767", "0.6721359", "0.6420797", "0.6383764", "0.63716084", "0.63705426", "0.6326945", "0.6315318", "0.63073933", "0.63032496", "0.6300285", "0.62965477", "0.62945753", "0.62471133", "0.6235131", "0.6197487", "0.6183...
0.7031052
1
Method that is used to return the last item from an array of strings. Will return empty string if array is blank
def last_version(sorted_versions) sorted_versions.blank? ? '' : sorted_versions.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_item(arr)\n\treturn arr[-1]\nend", "def retrieve_last_element_from_array(array)\n return array[-1]\nend", "def retrieve_last_element_from_array(array)\n array[array.length-1]\nend", "def last_element(array)\n taylor_swift = [\"Welcome to New York\", \"Blank Space\", \"Style\", \"Out of The ...
[ "0.7889901", "0.785075", "0.7825902", "0.7785308", "0.7770566", "0.7770566", "0.7720445", "0.7703846", "0.76995033", "0.76758766", "0.76253915", "0.75950927", "0.7592239", "0.7592239", "0.7549326", "0.7498726", "0.7482592", "0.7479654", "0.7474298", "0.744324", "0.74320614", ...
0.0
-1
Method that is used to filter the versions, sort them and find the latest stable version
def get_latest_stable_version_details(http_response) versions = stable_gem_versions(http_response) sorted_versions = sorted_versions(versions) last_version_number = last_version(sorted_versions) find_version(versions, last_version_number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sorted_versions(versions)\n versions.blank? ? [] : versions.map { |val| val['number'] }.version_sort\nend", "def sorted_versions(versions)\n versions.blank? ? [] : versions.map { |val| val['number'] }.version_sort\n end", "def sorted_extension_versions\n # ignore preceding 'V' and ignore 'master' s...
[ "0.6569439", "0.6563101", "0.65475553", "0.65387976", "0.6488335", "0.6487474", "0.6404038", "0.6359273", "0.6328388", "0.6307588", "0.6290684", "0.6257011", "0.6243411", "0.6215258", "0.6210532", "0.62102586", "0.6201451", "0.6193528", "0.61793363", "0.61302835", "0.611525",...
0.6413678
6
Open camera with camera_id, and size. camera_id: '0' to autodetect.
def initialize(camera_id=0) @capture_handler = Highgui.create_camera_capture(camera_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_camera\n @camera = Camera.find(params[:id])\n end", "def set_camera\n @camera = Camera.find(params[:id])\n end", "def create\n @camera = Camera.new(camera_params)\n @camera.user_id = current_user.id\n\n respond_to do |format|\n if @camera.save\n format.html { re...
[ "0.70234925", "0.7011315", "0.6395867", "0.6363101", "0.62024575", "0.5975106", "0.5926586", "0.5926586", "0.5842099", "0.58148557", "0.5794166", "0.5648849", "0.56257415", "0.55971545", "0.5550701", "0.5522953", "0.55161905", "0.55161905", "0.5501624", "0.54858595", "0.54783...
0.63854754
3
Grab a frame from camera and returns IplImage struct. This needs camera still opened.
def grab raise "Camera has'nt be initialized" if @capture_handler.nil? image = Highgui.query(@capture_handler) return Image.new(image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image( capture_frame = self.bounds, size = self.bounds.size )\n begin\n frame_of_view = CGRectMake(capture_frame.origin.x, self.bounds.size.height - capture_frame.size.height, capture_frame.size.width, capture_frame.size.height)\n image_rep = self.bitmapImageRepForCachingDisplayInRect(frame_of_vie...
[ "0.651447", "0.627084", "0.6030375", "0.598755", "0.58840907", "0.5873399", "0.57448643", "0.56744295", "0.56438774", "0.56438774", "0.55629617", "0.5493895", "0.54443467", "0.5392964", "0.53249574", "0.5315795", "0.53053975", "0.53008133", "0.5236235", "0.5230929", "0.522620...
0.7833316
0
Close camera. You need close opened camera for cleaner behavior.
def close Highgui.release_capture(FFI::MemoryPointer.new(:pointer).write_pointer(@capture_handler)) @capture_handler = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @camera = Camera.find(params[:id])\n @camera.destroy\n\n respond_to do |format|\n format.html { redirect_to cameras_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @camera.destroy\n respond_to do |format|\n format.html { redirect_to cameras_ur...
[ "0.6484187", "0.64091426", "0.64091426", "0.62384033", "0.59944916", "0.5805917", "0.5725104", "0.56930083", "0.5534019", "0.55067986", "0.5487374", "0.5471557", "0.54481745", "0.54410124", "0.5424001", "0.5364178", "0.5364074", "0.5349085", "0.5348004", "0.531586", "0.527281...
0.6462348
1
Get resolution mode of camera. return format is written in resolution_mode=(resolution)
def resolution_mode {width: Highgui.get_property(@capture_handler, :width), height: Highgui.get_property(@capture_handler, :height)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolution\n if width >= 3800 || height >= 2100 # close to 3860 x 2160\n \"HQ\"\n elsif width >= 1900 || height >= 1000 # close to 1920 x 1080\n \"1080p\"\n elsif width >= 1200 || height >= 700 # close to 1280 x 720\n \"720p\"\n else\n \"SD\"\n end\n end", "def ...
[ "0.6833314", "0.65200305", "0.6456556", "0.63295704", "0.6216044", "0.6157206", "0.60362196", "0.5981945", "0.58911777", "0.58668697", "0.58400524", "0.5838317", "0.5812223", "0.57983255", "0.57909465", "0.57806826", "0.5767806", "0.5683453", "0.564757", "0.5640074", "0.56304...
0.73552793
0
get size of image. Hash with :width, :height elements.
def size {width: @iplimage_struct.width, height: @iplimage_struct.height} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_size\n {\n width: image_file_width,\n height: image_file_height,\n }\n end", "def image_size\n end", "def getDimensions\r\n @imageheights = @image.length\r\n @imagewidth = @image[0].length\r\n puts \"image dimensions are #{@imagewidth} by...
[ "0.8192372", "0.7942201", "0.76695484", "0.7575409", "0.7547972", "0.7466832", "0.73758364", "0.7350659", "0.7329601", "0.7327817", "0.7258838", "0.7208077", "0.7205047", "0.7190776", "0.7184134", "0.7170754", "0.7111868", "0.7091139", "0.7081288", "0.70795363", "0.7054918", ...
0.8014479
1
get color depth of image.
def color_depth @iplimage_struct.depth end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layers\n pixdem = [image.width, image.height].max\n ((Math.log(pixdem) / Math.log(2)) - (Math.log(96) / Math.log(2))).ceil + 1\n end", "def pixel_bitsize(color_mode, depth = 8)\n samples_per_pixel(color_mode) * depth\n end", "def pixel_bitsize(color_mode, depth = 8)\n sample...
[ "0.66290754", "0.64283425", "0.64283425", "0.6414888", "0.6404349", "0.6404349", "0.6281109", "0.6253241", "0.6074545", "0.60591555", "0.6050998", "0.5885498", "0.58531964", "0.5833153", "0.5792682", "0.5789956", "0.578053", "0.5770039", "0.57505673", "0.5726016", "0.57231504...
0.86314845
0
String of image data
def data self.data_pointer.read_string(self.data_size) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @image.map { |row| row.join }.join(\"\\n\")\n end", "def to_s\n @image.map(&:join).join(\"\\n\")\n end", "def to_s\n image.map { |row| \"#{row.join}\\n\" }.join\n end", "def to_s\n return \"{ image_type: #{image_type},\"\\\n \" image_width: #{self[:image_widt...
[ "0.7366954", "0.7307187", "0.7302509", "0.7253568", "0.704232", "0.68897855", "0.6885971", "0.6777772", "0.6595175", "0.65266025", "0.6437564", "0.6418177", "0.64117014", "0.63902456", "0.6354435", "0.6291211", "0.6278727", "0.6275057", "0.62651455", "0.6224711", "0.62235785"...
0.563203
68
FFI::Pointer to image data
def data_pointer @iplimage_struct.image_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data\n FFI::MemoryPointer.new(:size_t) do |size|\n data = Spotify.image_data(@pointer, size)\n return data.read_bytes(size.read_size_t)\n end\n end", "def picdata\n object.imgdata\n end", "def readimage(path)\n # Feel free to make a pull request if you catch a mistake\n ...
[ "0.720649", "0.6676962", "0.6382189", "0.6129151", "0.6072237", "0.5898804", "0.58041435", "0.5769903", "0.57448757", "0.57299405", "0.5716217", "0.5707875", "0.5588981", "0.5535661", "0.54940724", "0.5481505", "0.5473558", "0.54576427", "0.54422855", "0.53980845", "0.5394649...
0.83072007
0
data size of image
def data_size @iplimage_struct.image_size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n data\n image.filesize\n end", "def size\n @data.bytesize\n end", "def image_size\n end", "def byte_size(); @data.byte_size + 4; end", "def size\n self.data.length + 4\n end", "def get_size(data)\n @horizontal_length = data[0].length\n ...
[ "0.8224607", "0.7821496", "0.78026205", "0.7725126", "0.75200224", "0.75141406", "0.75047946", "0.75047946", "0.74373883", "0.74323857", "0.74323857", "0.7396904", "0.7396904", "0.7396904", "0.7385263", "0.73738706", "0.73627245", "0.73627245", "0.7313687", "0.7302961", "0.72...
0.88283515
0
save the image to "name" incl. extension
def save(name) Highgui.save_image name, @iplimage_struct end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\r\n # Draw a frame.\r\n frame = Draw.new\r\n frame.stroke(\"black\")\r\n frame.stroke_width(2)\r\n frame.fill_opacity(0)\r\n frame.rectangle(0, 0, @image.columns-1, @image.rows-1)\r\n frame.draw(@image)\r\n \r\n @image.write(name + '.png')\r\n...
[ "0.718264", "0.69838935", "0.6941705", "0.6898874", "0.67981756", "0.67898214", "0.67601156", "0.6645235", "0.65724283", "0.65430844", "0.65131736", "0.64849305", "0.64668506", "0.646344", "0.6418915", "0.6369036", "0.636746", "0.63664937", "0.63318807", "0.63183737", "0.6314...
0.7631843
0
When we query for all screenboards or timeboards, we get a JSON document back with a list of the boards, and minimal information about each board. Iterate over the results and download each board into its own file. If a file already exists for that object, skip it.
def download_all_objects(objects, type) subdir = type + 's' puts "Found #{objects.count} #{type}s, downloading..." count = skip_count = 0 objects.each do |info| id = info['id'] if File.exist?(Utils.filepath(id, subdir: subdir)) skip_count += 1 next end send("sav...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boards\n return @boards if @boards\n @boards = Client.get(\"/organizations/#{id}/boards/all\").json_into(Board)\n end", "def download(boards_json, destination, dry_run=false)\n content = @files_and_json.from_file(boards_json)\n email = content[\"leankit\"][\"email\"]\n password = ...
[ "0.6688996", "0.66483945", "0.6245912", "0.6151536", "0.60085255", "0.592654", "0.590869", "0.5862806", "0.5772736", "0.5772736", "0.5725505", "0.5714604", "0.5679675", "0.5679675", "0.5679675", "0.5679675", "0.5679675", "0.5679675", "0.5679675", "0.5678897", "0.5678897", "...
0.0
-1
Wrappers for rails helpers that produce markup. Erector needs to manually emit their result.
def def_simple_rails_helper(method_name) module_eval <<-METHOD_DEF, __FILE__, __LINE__+1 def #{method_name}(*args, &block) text helpers.#{method_name}(*args, &block) end METHOD_DEF end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render\n result, extends = Visitors::Cssize.visit(Visitors::Perform.visit(self))\n result = result.do_extend(extends) unless extends.empty?\n result.to_s\n end", "def to_html; end", "def markup_context; end", "def render\n content = output_capture(@block) do\n instance_e...
[ "0.6348381", "0.6318324", "0.6265241", "0.626313", "0.61959964", "0.61757684", "0.6167892", "0.6167892", "0.6167275", "0.6157045", "0.6147702", "0.6138691", "0.607846", "0.607846", "0.607846", "0.607846", "0.6074793", "0.6074793", "0.6074793", "0.6074793", "0.6064824", "0.6...
0.0
-1
We need to delegate capture to helpers.capture, so that when the captured block is executed, both erector and Rails output from within the block go to the appropriate buffer.
def capture(&block) if helpers.respond_to?(:capture) raw(helpers.capture(&block).to_s) else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capture(&block)\n begin\n original_output = output\n @output = \"\"\n yield\n raw(output.to_s)\n ensure\n @output = original_output\n end\n end", "def _capture(*args, &block)\n @erbout, old_erbout = \"\", @erbout\n block.call(*args)\n return...
[ "0.78155136", "0.77776635", "0.77148294", "0.7649561", "0.75724304", "0.7496583", "0.7492504", "0.7374651", "0.7364039", "0.7364039", "0.7364039", "0.73630804", "0.73510766", "0.7325828", "0.7319416", "0.7308731", "0.7238728", "0.7234862", "0.7234862", "0.7234862", "0.7234862...
0.75932056
4
Wrap Rails' render method, to capture output from partials etc.
def render(*args, &block) captured = helpers.capture do helpers.concat(helpers.render(*args, &block)) helpers.output_buffer.to_s end rawtext(captured) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render\n content = output_capture(@block) do\n instance_exec( *@args, &@block )\n end\n content_wrapped = output_capture() { wrap( content ) }\n output_concat content_wrapped\n end", "def render!\n result\n end", "def render(*args, &block); end", "def render(view, locals, buffer...
[ "0.74869186", "0.73763156", "0.733985", "0.71300787", "0.7103495", "0.7102228", "0.70929813", "0.70885974", "0.7085459", "0.7057609", "0.7038919", "0.70213115", "0.698392", "0.69792724", "0.69792724", "0.69792724", "0.69684494", "0.6967778", "0.6967496", "0.6921333", "0.69202...
0.7279662
3
Rails content_for is output if and only if no block given
def content_for(*args,&block) if block helpers.content_for(*args,&block) else rawtext(helpers.content_for(*args)) '' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_blocklike_show(title, content)\n render('layouts/block', :title => title, :content => content) unless content.blank?\n end", "def block_or_string_content\n content_block ? view_context.capture(self, &content_block) : content_string\n end", "def single_content_for(name, content = nil,...
[ "0.69893956", "0.69513243", "0.67650527", "0.67225873", "0.6721511", "0.67075", "0.6703829", "0.6686893", "0.6686893", "0.6686893", "0.6673773", "0.6622926", "0.65820366", "0.6504358", "0.64408666", "0.63714755", "0.63123935", "0.63076264", "0.6274117", "0.6273954", "0.625769...
0.7347547
0
Delegate to nonmarkup producing helpers via method_missing, returning their result directly.
def method_missing(name, *args, &block) if helpers.respond_to?(name) helpers.send(name, *args, &block) else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method, *args, &block) \n return super unless part(method)\n part(method).render\n end", "def method_missing_with_wrapper(symbol, *args, &block)\n @element.respond_to?(symbol) ? @element.send(symbol, *args, &block) : method_missing_without_wrapper(symbol, *args, &block)\n end", ...
[ "0.63892806", "0.6382999", "0.63441765", "0.61214757", "0.61195487", "0.61195487", "0.6112212", "0.6079899", "0.6071588", "0.60565925", "0.60516644", "0.60309035", "0.6028245", "0.60238993", "0.5998483", "0.5988927", "0.59178436", "0.59059215", "0.59059215", "0.58665895", "0....
0.5791773
28
Since we delegate method_missing to helpers, we need to delegate respond_to? as well.
def respond_to?(name) super || helpers.respond_to?(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def respond_to_missing?(*_args); super; end", "def respond_to_missing? meth, priv\n if @o\n @o.repond_to_missing? meth, priv\n else\n true\n end\n end", "def respond_to_missing?(method, include_private = false)\n object.respond_to?(method) || super\n end", "def respond_to_missing?...
[ "0.78794503", "0.7754587", "0.7737889", "0.7737889", "0.7599376", "0.7594051", "0.7586582", "0.75823486", "0.75228035", "0.74979335", "0.74834085", "0.74030507", "0.73318833", "0.73306084", "0.73284006", "0.73254955", "0.7324262", "0.7282512", "0.7256527", "0.72496164", "0.72...
0.73415893
12
1. position ist a) leerverkauf bei durchquerrung von upper von oben nach unten b) kauf bei durchquerung von lower von unten oder oben
def run! @money = @start_money @position = nil prev = nil @before = nil @transaction_index = 0 @fail_trades_count = 0 @crunch.unpacked.each do |pup| puts_pupple(pup) if @verbose if prev case @position when :short # \ # from above through lower => W...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos() end", "def pos() end", "def pos() end", "def pos() end", "def pos=(pos); end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; e...
[ "0.71248597", "0.71248597", "0.71248597", "0.71248597", "0.6900673", "0.68308246", "0.68308246", "0.68308246", "0.68308246", "0.68308246", "0.68308246", "0.68022686", "0.68022686", "0.68022686", "0.68022686", "0.68022686", "0.68022686", "0.68022686", "0.68022686", "0.6437154", ...
0.0
-1
GET /services GET /services.json
def index @services = Service.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n endpoint(get(services_url).body)\n end", "def services\n params = { command: 'account_services' }\n get('/json.php', params)\n end", "def list_services\n response = @http_client.get(prefix_path('services'))\n Response.new(response)\n end", "def services\n ...
[ "0.7777552", "0.777449", "0.7438209", "0.73864925", "0.7264791", "0.7223465", "0.7217482", "0.70817554", "0.69659567", "0.6894663", "0.6884723", "0.6880644", "0.6869151", "0.68193513", "0.679946", "0.6788263", "0.6788263", "0.6788263", "0.67320096", "0.6664671", "0.6650039", ...
0.65679055
30
GET /services/1 GET /services/1.json
def show; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n endpoint(get(services_url).body)\n end", "def service(id)\n request :get, \"/services/#{id}\"\n end", "def show\n @service = Service.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n ...
[ "0.752634", "0.7478596", "0.71907216", "0.71030205", "0.7100615", "0.7100615", "0.7100615", "0.70959747", "0.6959775", "0.69514024", "0.69310844", "0.6864667", "0.6854117", "0.6835318", "0.6785512", "0.67785096", "0.6685469", "0.66338307", "0.6587902", "0.65437746", "0.654373...
0.0
-1
POST /services POST /services.json
def create @service = Service.new(service_params) respond_to do |format| if @service.save format.html { redirect_to services_url, notice: 'Service was successfully created.' } format.json { render :show, status: :created, location: @service } else format.html { render :new }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_service(service={})\n request :post, '/services', service\n end", "def create\n @service = Service.new(service_params)\n if @service.save\n render json: @service, status: :created, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n e...
[ "0.7435853", "0.7211795", "0.6790206", "0.66696", "0.6628953", "0.6628953", "0.65936494", "0.65936494", "0.65936494", "0.65936494", "0.65936494", "0.65936494", "0.65925246", "0.65513784", "0.65001976", "0.646277", "0.64596283", "0.6454777", "0.64523786", "0.64300454", "0.6426...
0.66864383
3
POST /services/requested POST /services/requested.json
def requested requested_params = { external_code: params[:id], company_id: params[:company][:id], company_name: params[:company][:name], recruiter_id: params[:recruiter][:id], recruiter_name: params[:recruiter][:name], applicant_id: params[:applicant][:id], applicant_name: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @request_service = RequestService.new(request_service_params)\n\n respond_to do |format|\n if @request_service.save\n format.html { redirect_to requests_path, notice: 'Request service was successfully created.' }\n format.json { render :show, status: :created, location: @reque...
[ "0.64173543", "0.6337078", "0.6320221", "0.6173875", "0.6092082", "0.6010571", "0.5970376", "0.59255296", "0.58998775", "0.5865306", "0.5850012", "0.58330107", "0.58316106", "0.5824237", "0.58044547", "0.5796963", "0.57699907", "0.5748353", "0.57414615", "0.5740496", "0.57208...
0.71287566
0
PATCH/PUT /services/1 PATCH/PUT /services/1.json
def update respond_to do |format| if @service.update(service_params) format.html { redirect_to services_url, notice: 'Service was successfully updated.' } format.json { render :show, status: :ok, location: @service } else format.html { render :edit } format.json { render ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n service.update(service_params)\n\n respond_with(service)\n end", "def update\n if @service.update(service_params)\n render json: @service, status: :ok, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end", "def update\n ...
[ "0.66538817", "0.66364264", "0.64951855", "0.6430243", "0.6430243", "0.6420679", "0.63971573", "0.634458", "0.624995", "0.62463903", "0.62463903", "0.62332493", "0.62237364", "0.62227684", "0.621156", "0.62053", "0.6173149", "0.6173149", "0.6173149", "0.6173149", "0.6173149",...
0.62118673
14
DELETE /services/1 DELETE /services/1.json
def destroy @service.destroy respond_to do |format| format.html { redirect_to services_url, notice: 'Service was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :ok }\n end\n end", "def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n ...
[ "0.74456525", "0.7405946", "0.7405946", "0.7405946", "0.74020797", "0.73604804", "0.73403794", "0.7338663", "0.71768314", "0.71215385", "0.711112", "0.70894676", "0.70894676", "0.70894676", "0.7085928", "0.70785636", "0.7075804", "0.7058152", "0.7011624", "0.7002001", "0.6973...
0.71122694
21
Use callbacks to share common setup or constraints between actions.
def set_service @service = Service.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def service_params params.require(:service).permit(:external_code, :company_name, :recruiter_name, :applicant_name, :job_id, :job_title)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980244", "0.6782812", "0.6745103", "0.6741142", "0.6733961", "0.65925", "0.6503602", "0.64967257", "0.64822173", "0.64796996", "0.6456357", "0.6439594", "0.63803256", "0.6376499", "0.63644457", "0.6319286", "0.6299465", "0.6298051", "0.62935406", "0.62923044", "0.6291212"...
0.0
-1
GET /stacks GET /stacks.json
def index @stacks = Stack.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stacks\n response = OpenStack::Heat::Connection.heat_conn.req('GET', '/stacks')\n stacks_hash = JSON.parse(response.body)[\"stacks\"]\n stacks_hash.inject([]){|res, current| res << OpenStack::Heat::Stack.new(current); res}\n end", "def list_stacks\n client.describe_st...
[ "0.861252", "0.8236595", "0.7900171", "0.77256125", "0.73866075", "0.71597195", "0.70003265", "0.6984898", "0.6977903", "0.68187326", "0.67853874", "0.6702185", "0.66566384", "0.6585495", "0.6552075", "0.62417203", "0.6221254", "0.6215276", "0.6134425", "0.61044914", "0.60802...
0.7464895
4
GET /stacks/1 GET /stacks/1.json
def show @tags = @stack.tags @tools = @stack.tools end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stacks\n response = OpenStack::Heat::Connection.heat_conn.req('GET', '/stacks')\n stacks_hash = JSON.parse(response.body)[\"stacks\"]\n stacks_hash.inject([]){|res, current| res << OpenStack::Heat::Stack.new(current); res}\n end", "def index\n @stacks = Stack.all\n\n r...
[ "0.8069101", "0.7785197", "0.7553012", "0.7511833", "0.7350027", "0.7312057", "0.72951055", "0.7141659", "0.7012335", "0.6727302", "0.66039884", "0.6452901", "0.6411791", "0.6359371", "0.6352093", "0.6243233", "0.6153994", "0.61520547", "0.60925823", "0.60778797", "0.6019673"...
0.55559134
50
POST /stacks POST /stacks.json
def create @stack = Stack.new(stack_params) respond_to do |format| if @stack.save format.html { redirect_to @stack, notice: 'Stack was successfully created.' } format.json { render :show, status: :created, location: @stack } else format.html { render :new } format.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @stack = Stack.new(stack_params)\n\n if @stack.save\n render json: @stack, status: :created, location: @stack\n else\n render json: @stack.errors, status: :unprocessable_entity\n end\n end", "def create\n @container_stack = ContainerStack.new(params[:container_stack])\n\n ...
[ "0.7720851", "0.7179213", "0.70337343", "0.6900082", "0.6660358", "0.6552301", "0.65460116", "0.64740133", "0.63987637", "0.63925105", "0.634022", "0.6312253", "0.6208427", "0.6174244", "0.616454", "0.6118951", "0.60339135", "0.59867734", "0.59568465", "0.59567964", "0.594940...
0.73853266
1
PATCH/PUT /stacks/1 PATCH/PUT /stacks/1.json
def update respond_to do |format| if @stack.update(stack_params) format.html { redirect_to @stack, notice: 'Stack was successfully updated.' } format.json { render :show, status: :ok, location: @stack } else format.html { render :edit } format.json { render json: @stack.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_stacks(stack_id, name, description, tangle_alias)\n payload = {\n 'name' => name,\n 'description' => description,\n 'tangle_alias' => tangle_alias\n }\n @conn.put(\"/api/v1/stacks/#{stack_id}\", payload.to_json)\n end", "def update\n @stack = Stack.find(params[:...
[ "0.7409612", "0.72579145", "0.72353953", "0.7121185", "0.6872129", "0.61958885", "0.610185", "0.59773606", "0.5725369", "0.56704384", "0.56654924", "0.560241", "0.5548618", "0.5530456", "0.5530456", "0.5527859", "0.54818416", "0.54776907", "0.5472193", "0.54500264", "0.543982...
0.7032827
4
DELETE /stacks/1 DELETE /stacks/1.json
def destroy @stack.destroy respond_to do |format| format.html { redirect_to stacks_url, notice: 'Stack was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @stack = Stack.find(params[:id])\n @stack.destroy\n\n respond_to do |format|\n format.html { redirect_to stacks_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete_stack(:stack_name => name)\n nil\n end", "def destroy\n @...
[ "0.7978722", "0.7976464", "0.7925255", "0.74934775", "0.7426675", "0.7349022", "0.7269006", "0.7166039", "0.71087086", "0.6979608", "0.6890743", "0.66998345", "0.6665969", "0.6505356", "0.6494062", "0.6453595", "0.64445233", "0.64371413", "0.6410829", "0.6381946", "0.63630086...
0.7645695
3
Use callbacks to share common setup or constraints between actions.
def set_stack @stack = Stack.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def stack_params params.require(:stack).permit(:api_id, :name, :slug, :popularity) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Returns true if a 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 if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n return false\n end\n end", "def logged_in?\n ...
[ "0.912376", "0.8711178", "0.8677896", "0.86721563", "0.8648799", "0.86360526", "0.8632266", "0.8531534", "0.85197866", "0.8513928", "0.8513207", "0.8498719", "0.84958726", "0.8483778", "0.8483778", "0.8457914", "0.84271604", "0.8417971", "0.8406068", "0.84035206", "0.8400863"...
0.0
-1
Logs out the current user.
def log_out session.delete(:user_id) @current_user = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_out\n reset_session\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user ...
[ "0.85847217", "0.8553567", "0.8553567", "0.8553567", "0.8553567", "0.8553567", "0.85448325", "0.85448325", "0.85448325", "0.85448325", "0.85447145", "0.8513818", "0.85132295", "0.85004026", "0.8490199", "0.84505224", "0.84501094", "0.84357476", "0.843385", "0.843385", "0.8433...
0.8409856
41
Logs in the given manager
def log_in_manager session[:manager_id] = "manager" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n make_login_call\n end", "def run()\n login()\n end", "def manager_user\n redirect_to(root_url) unless current_user.manager?\n end", "def login\n self.login\n end", "def login(user=:joerg)\r\n login_as(user)\r\n end", "def manager_user\n redirect_to(r...
[ "0.669754", "0.6458394", "0.638691", "0.6351097", "0.63244134", "0.62988305", "0.6298125", "0.62785447", "0.6260343", "0.6229299", "0.6210897", "0.6198381", "0.61774164", "0.6168708", "0.6114693", "0.6103522", "0.60758615", "0.60743433", "0.60743433", "0.60743433", "0.6074343...
0.76193243
0
Returns true if a manager is logged in, false otherwise.
def manager_logged_in? !session[:manager_id].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_logged_in_manager?\n @is_logged_in_manager == 1\n end", "def logged_manager?\n !current_manager.nil?\n end", "def manager?\n return ( self.user_type == User::USER_TYPE_MANAGER or self.user_type == User::USER_TYPE_ADMIN )\n end", "def is_manager?\n user_type == \"manager\"\n e...
[ "0.9154734", "0.8558285", "0.7953379", "0.7872445", "0.7766454", "0.7750455", "0.7748777", "0.768397", "0.76254237", "0.75961083", "0.7592477", "0.75819653", "0.75762916", "0.75541025", "0.7545611", "0.75170565", "0.74936396", "0.74936396", "0.74847883", "0.7481005", "0.74682...
0.89902765
1
Logs out the current user.
def log_out_manager session.delete(:manager_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_out\n reset_session\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user ...
[ "0.85847217", "0.8553567", "0.8553567", "0.8553567", "0.8553567", "0.8553567", "0.85448325", "0.85448325", "0.85448325", "0.85448325", "0.85447145", "0.8513818", "0.85132295", "0.85004026", "0.8490199", "0.84505224", "0.84501094", "0.84357476", "0.843385", "0.843385", "0.8433...
0.0
-1
GET /conpanies GET /conpanies.json
def index @conpanies = Conpany.all @conpany = Conpany.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @congties = Congty.all\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def listCon\n @opportunities = Opportunity.where(\"status = ?\", \"Publish\")\n rend...
[ "0.6630363", "0.6249577", "0.6219897", "0.6169184", "0.6098677", "0.6048384", "0.6016325", "0.59289765", "0.59289765", "0.5914991", "0.5907984", "0.58839655", "0.5871123", "0.5850413", "0.58406526", "0.58367306", "0.5834394", "0.57895", "0.5776525", "0.5754864", "0.5745398", ...
0.6576197
1
GET /conpanies/1 GET /conpanies/1.json
def show @complaint = Complaint.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @conpanies = Conpany.all\n @conpany = Conpany.new\n end", "def index\n @congties = Congty.all\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def index\...
[ "0.6753663", "0.64689857", "0.61685437", "0.60291195", "0.6022031", "0.60001427", "0.59789824", "0.59711754", "0.5934171", "0.5932693", "0.5904626", "0.5858106", "0.5790252", "0.57872134", "0.57872134", "0.5762144", "0.5762144", "0.5762144", "0.5762144", "0.5746063", "0.57432...
0.0
-1
POST /conpanies POST /conpanies.json
def create @conpany = Conpany.new(conpany_params) respond_to do |format| if @conpany.save format.html { redirect_to @conpany, notice: 'Conpany was successfully created.' } format.json { render :show, status: :created, location: @conpany } format.js else format.html ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @conpanies = Conpany.all\n @conpany = Conpany.new\n end", "def create\n @congty = Congty.new(congty_params)\n\n respond_to do |format|\n if @congty.save\n format.html { redirect_to admin_congties_url, notice: 'Congty was successfully created.' }\n format.json { render ...
[ "0.5785981", "0.55479616", "0.55016863", "0.5447886", "0.5436491", "0.53557515", "0.5355504", "0.5350672", "0.531513", "0.531513", "0.53052425", "0.52662843", "0.5261702", "0.52526623", "0.5217159", "0.52089345", "0.5192057", "0.5177426", "0.5174226", "0.5143599", "0.51342356...
0.5583391
1
PATCH/PUT /conpanies/1 PATCH/PUT /conpanies/1.json
def update respond_to do |format| if @conpany.update(conpany_params) format.html { redirect_to conpanies_path , notice: 'Conpany was successfully updated.' } format.json { render :show, status: :ok, location: @conpany } else format.html { render :edit } format.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chor...
[ "0.60238", "0.58675104", "0.5771288", "0.5751062", "0.5731122", "0.569", "0.56891793", "0.5666484", "0.56507236", "0.56507236", "0.56134343", "0.56073046", "0.5600259", "0.55532426", "0.5535673", "0.5526824", "0.5522499", "0.5511666", "0.5502735", "0.5502023", "0.54962736", ...
0.6480846
0
DELETE /conpanies/1 DELETE /conpanies/1.json
def destroy @conpany.destroy respond_to do |format| format.html { redirect_to conpanies_url, notice: 'Conpany was successfully destroyed.' } format.json { head :no_content } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @con...
[ "0.69242346", "0.6693708", "0.66273534", "0.65723026", "0.65689576", "0.6567646", "0.6498399", "0.6498399", "0.6498399", "0.64971316", "0.6477914", "0.6475243", "0.6417148", "0.63922334", "0.6385602", "0.6381256", "0.6374688", "0.636728", "0.63490057", "0.633308", "0.6331688"...
0.654925
6
Use callbacks to share common setup or constraints between actions.
def set_conpany @conpany = Conpany.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def conpany_params params.require(:conpany).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Lazy check of help param
def process_argument(arg) if arg arg == '--help' ? help : get_ips(arg) else get_ips end exit(0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_help?\n help.present?\n end", "def show_help?\n args_def.show_help?\n end", "def check_and_set_helpvalue\n if(@parameters.keys.last != nil)\n # help in context to a parameter\n @parameters[:help] = @parameters.keys.last\n @unflagged_argume...
[ "0.750647", "0.7449714", "0.74063563", "0.7281545", "0.7259476", "0.72561437", "0.72559536", "0.71851856", "0.71286273", "0.7046306", "0.7043782", "0.68807787", "0.6867044", "0.6847891", "0.6804317", "0.6804317", "0.6796989", "0.6790698", "0.6786399", "0.67797637", "0.6744675...
0.0
-1
The ISO 31661 alpha2 country code.
def code @info.code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country_code_alpha2\n country_code == 'EL' ? 'GR' : country_code\n end", "def country_code\n cc = carmen_country\n\n cc ? \"#{cc.code.upcase}\" : nil\n end", "def iso3166_alpha2_code_from_name(orig_country_name)\n country_name = orig_country_name&.strip\n\n return \"US\" if ACCEPTA...
[ "0.8141604", "0.7537338", "0.75165164", "0.7486258", "0.7418019", "0.7359602", "0.7352043", "0.7352043", "0.73066884", "0.72509474", "0.72037685", "0.7149056", "0.7149056", "0.70754987", "0.70312244", "0.70054775", "0.69799644", "0.6918684", "0.68609613", "0.68514484", "0.684...
0.0
-1
The name of the country.
def name @info.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country_name\n country = ISO3166::Country[country_code]\n # country.translations[I18n.locale.to_s] || country.name\n # country.name\n end", "def country_name\n country = ISO3166::Country[country_code]\n country.translations[I18n.locale.to_s] || country.name\n end", "def country_name\n c...
[ "0.86089206", "0.8547552", "0.8547552", "0.8547552", "0.85161036", "0.8500907", "0.8446439", "0.8407325", "0.8379458", "0.82746935", "0.7939144", "0.7917239", "0.7915322", "0.7682733", "0.76419955", "0.7615197", "0.7599545", "0.7599545", "0.75063837", "0.7426367", "0.73977077...
0.0
-1
Returns internal object state as a programmerreadable string.
def inspect "#<#{self.class}: #{@info.code}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n \"#{name}#{state}\"\n end", "def to_pretty_s\n \"#{type}:#{name} is #{state}\"\n end", "def to_s\n \"state: #{@state}, line: #{@line_counter}, file: #{@file_name}\"\n end", "def inspect\n \"#{name}=#{state.inspect} #{location}\"\n end", "def inspect; to_s; end...
[ "0.72272044", "0.7102299", "0.6986669", "0.69722795", "0.69205236", "0.69205236", "0.69205236", "0.69205236", "0.69205236", "0.6782744", "0.6781884", "0.6717852", "0.6717852", "0.6693693", "0.6672083", "0.66672283", "0.66560626", "0.66560626", "0.66560626", "0.66560626", "0.6...
0.0
-1
Returns a frozen array of all the zone identifiers for the country. These are in an order that 1. makes some geographical sense, and 2. puts the most populous zones first, where that does not contradict 1. Returned zone identifiers may refer to cities and regions outside of the country. This will occur if the zone cove...
def zone_identifiers @info.zone_identifiers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zone_ids\n @@zone_ids\n end", "def zone_identifiers\n # Thread-safey: It is possible that the value of @zone_identifiers may be \n # calculated multiple times in concurrently executing threads. It is not \n # worth the overhead of locking to ensure that @zone_identifiers is only \n...
[ "0.69000345", "0.68793505", "0.6854669", "0.68028885", "0.6726398", "0.66706", "0.6635819", "0.65404516", "0.65214115", "0.64814425", "0.6412143", "0.64113486", "0.62863183", "0.62047863", "0.61426175", "0.6141525", "0.61006016", "0.61006016", "0.6073241", "0.60607237", "0.60...
0.656299
7
An array of all the Timezones for this country. Returns TimezoneProxy objects to avoid the overhead of loading Timezone definitions until a conversion is actually required. The Timezones are returned in an order that 1. makes some geographical sense, and 2. puts the most populous zones first, where that does not contra...
def zones zone_identifiers.collect {|id| Timezone.get_proxy(id) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezones\n @timezones.freeze\n end", "def get_timezones(opts = {})\n data, _status_code, _headers = get_timezones_with_http_info(opts)\n data\n end", "def all\n @zones ||= zones_map.values.sort\n end", "def timezones\n response = @client.get 'scans/timezones'\n ...
[ "0.7341051", "0.70848495", "0.69448173", "0.6833324", "0.66720676", "0.6578465", "0.64566064", "0.63803595", "0.6330935", "0.62803936", "0.6255244", "0.6223184", "0.6177644", "0.6115886", "0.6106161", "0.6098775", "0.6094741", "0.6052735", "0.60380405", "0.5920877", "0.589739...
0.72430825
1
Returns a frozen array of all the timezones for the for the country as CountryTimezone instances (containing extra information about each zone). These are in an order that 1. makes some geographical sense, and 2. puts the most populous zones first, where that does not contradict 1. Identifiers and descriptions of the z...
def zone_info @info.zones end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezones\n @timezones.freeze\n end", "def timezone_enum\n TZInfo::Country.get('US').zones.map{|tz|tz.name}\n end", "def zones_for(country_name)\r\n\t\t\tcountries = Country.find_all_by_name(country_name)\r\n\t\t\tif countries.nil? or countries.empty?\r\n\t\t\t\t[default_zone]\r\n\t\t\telse...
[ "0.70348805", "0.6966844", "0.6659815", "0.66215634", "0.64727646", "0.6468866", "0.6384543", "0.63731253", "0.6325239", "0.63251597", "0.6300148", "0.623469", "0.6230303", "0.6195285", "0.61943436", "0.60983306", "0.6026734", "0.5989367", "0.5940409", "0.5881191", "0.5866813...
0.5658183
28
Compare two Countries based on their code. Returns 1 if c is less than self, 0 if c is equal to self and +1 if c is greater than self. Returns nil if c is not comparable with Country instances.
def <=>(c) return nil unless c.is_a?(Country) code <=> c.code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country\n if(@country_code.to_i == 280)\n IsoCountryCodes.find(276) #since 1990 we use 176 for whole germany, 280 was for \"west germany\" WTF\n else\n IsoCountryCodes.find(@country_code)\n end\n end", "def priority_compare(other)\n pc = simplified <=> other.simplified\n\...
[ "0.548966", "0.54733366", "0.5445087", "0.5329347", "0.521449", "0.5151384", "0.51138264", "0.5064296", "0.50577873", "0.5024412", "0.50051373", "0.49892893", "0.49850008", "0.4963753", "0.49374828", "0.4936838", "0.49359235", "0.49292228", "0.4922563", "0.49218035", "0.49011...
0.75121677
0
Returns true if and only if the code of c is equal to the code of this Country.
def eql?(c) self == c end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(ct)\n ct.kind_of?(CountryTimezone) &&\n identifier == ct.identifier && latitude == ct.latitude &&\n longitude == ct.longitude && description == ct.description \n end", "def same_country?\n @same_country\n end", "def contains?(loc)\n return loc.country == self.na...
[ "0.66802186", "0.664823", "0.62051034", "0.6051111", "0.6037923", "0.58694255", "0.58250964", "0.5800264", "0.57981855", "0.5715813", "0.55907625", "0.55279887", "0.5472065", "0.5418242", "0.54102063", "0.5408756", "0.5370172", "0.53469044", "0.53455526", "0.5289901", "0.5284...
0.6183619
3
Returns a hash value for this Country.
def hash code.hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country_code\n decode hash[\"CountryCode\"]\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n @hash ||=...
[ "0.68721086", "0.68312305", "0.68312305", "0.6789245", "0.67565894", "0.67319053", "0.6625762", "0.6595337", "0.65241116", "0.6516239", "0.6494589", "0.64235", "0.6399174", "0.6383017", "0.6367262", "0.6357052", "0.6357052", "0.6348684", "0.63404024", "0.6295751", "0.6295751"...
0.62476015
33
Dumps this Country for marshalling.
def _dump(limit) code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marshal_dump\n dump\n end", "def dump!\n @dump = true\n end", "def dump() end", "def dump\n do_dump(0)\n end", "def to_s\r\n dump\r\n end", "def marshall_dump\n end", "def _dump() end", "def marshall_dump\n end", "def inspect\n ...
[ "0.67982537", "0.6544618", "0.6490882", "0.63907725", "0.63471514", "0.62888575", "0.62885344", "0.62471807", "0.6185057", "0.6175592", "0.6157827", "0.608378", "0.60576385", "0.605628", "0.604922", "0.59994435", "0.5986863", "0.5962162", "0.593746", "0.5915496", "0.5915496",...
0.0
-1
Called by Country.new to initialize a new Country instance. The info parameter is a CountryInfo that defines the country.
def setup(info) @info = info end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(info)\n @info = info\n end", "def initialize info\n\t\t@info = info\n\tend", "def set_countryinfo\n @countryinfo = Countryinfo.find(params[:id])\n end", "def new\n\t @country = Country.new\n\tend", "def initialize country_code, city, region=nil, latitude=nil, longitude=n...
[ "0.6674308", "0.6354505", "0.61363226", "0.6044541", "0.59891015", "0.5986757", "0.59515226", "0.59012884", "0.5901088", "0.5852805", "0.58285373", "0.5815552", "0.58147484", "0.5806094", "0.5806094", "0.5771283", "0.5770893", "0.5749124", "0.57254136", "0.56598186", "0.56593...
0.53915626
30
register method = view
def create @user = User.new(user_params) if @user.save session[:user_id] = @user.id flash[:success] = "Successfully registered " + @user.email redirect_to login_form_path else flash[:error] = @user.errors.full_messages redirect_to action: 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view; end", "def _view; end", "def view\n end", "def method_missing(method, *args, &block)\n view.send(method, *args, &block)\n end", "def add_view\n super\n end", "def method_missing(*args, &block)\n @_view.send(*args, &block)\n end", "def view\n @_view\n end",...
[ "0.72900647", "0.7113174", "0.70751756", "0.7010634", "0.6839863", "0.66175777", "0.6599533", "0.6532512", "0.6521654", "0.65173084", "0.6488497", "0.6488497", "0.6488497", "0.6469859", "0.6429409", "0.64030474", "0.63249403", "0.63229495", "0.6279305", "0.6269109", "0.619706...
0.0
-1
delete edit = controller
def destroy reset_session flash[:success] = "Account has been deleted." User.find(params[:id]).destroy redirect_to(new_user_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @session.request(:delete, @edit_url, :header => {\"If-Match\" => \"*\"})\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n...
[ "0.74589956", "0.7431519", "0.7405726", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7364453", "0.7357048", "0.7357048", "0.7357048", "0.7357048", ...
0.0
-1
expecting to be called from within a transaction expecting to be passed a hash with the video_id as the key and for new records that key will contain unique number like object_id
def create_and_update_from_collection(collection={ '2' => {:rating => '1'}, '70273152471280' => {:rating => '3', :video_id => '5'} }) collection.each do |review_id, params| create_or_update_review(review_id, params) unless params[:rating].blank? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_record!(hash, inventory_object)\n record = inventory_collection.model_class.create!(hash.except(:id))\n inventory_collection.store_created_records(record)\n\n inventory_object.id = record.id\n end", "def hash\n object_id\n end", "def add_movie_to_database(hash)\n movie...
[ "0.62304866", "0.5909962", "0.5863818", "0.584511", "0.56423455", "0.5614211", "0.55873597", "0.5516948", "0.5460208", "0.54419965", "0.54103595", "0.5355001", "0.5355001", "0.5355001", "0.53533643", "0.53533643", "0.53446823", "0.5333909", "0.5329111", "0.5305163", "0.530065...
0.0
-1
GET /suppliers/1 GET /suppliers/1.xml
def show @supplier = Supplier.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @supplier } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @catalogs_supply = Catalogs::Supply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalogs_supply }\n end\n end", "def show\n @warehouse_supplier = WarehouseSupplier.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.6661791", "0.66293323", "0.6600005", "0.6547385", "0.6440835", "0.63670397", "0.6343119", "0.6325836", "0.6307414", "0.62475604", "0.62263876", "0.62263876", "0.62263876", "0.6176407", "0.6172926", "0.61599475", "0.6146069", "0.6108928", "0.61079293", "0.6096242", "0.60954...
0.71382135
0
Compare by date. Since terms may have different sorts of dates available (start, end, estimated start, estimated end), use some logic to try to make a sensible comparison of which term is "older" or prior to the other.
def <=>(other) self_start = self.start_date other_start = other.start_date self_end = self.end_date other_end = other.end_date return self_start <=> other_start if self_start && other_start return self_end <=> other_end if self_end && other_end return self_start <=> other_end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_by_date(term)\n search_data = term.split(DATE_SEARCH_SEPARATOR)\n comparison_date = load_comparison_date(search_data.last)\n return \"[#{comparison_date.xmlschema} TO *]\" if search_data.first == DATE_SEARCH_TERMS.last\n return \"[* TO #{comparison_date.xmlschema}]\" if search_data.first == ...
[ "0.56683606", "0.5666448", "0.5533869", "0.5518177", "0.5401429", "0.53944314", "0.53557247", "0.5311427", "0.5284845", "0.5255123", "0.52469075", "0.5222403", "0.517532", "0.5172751", "0.5151378", "0.5142734", "0.51149416", "0.5049965", "0.5006997", "0.50035", "0.49858296", ...
0.5061353
17
String reporting the start & end dates
def dates start_s = start_date ? start_date.to_s : '?' end_s = end_date ? end_date.to_s : '?' "#{start_s} to #{end_s}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enrollment_dates\n if start_date\n \"#{start_date_formatted} - #{end_date_formatted}\"\n end\n end", "def to_s\n \"#{start_date_as_string}-#{end_date_as_string}\"\n end", "def aoc_dates\n \"#{start_date.strftime('%d de %b')} al #{end_date.strftime('%d de %b')} de #{end_date.strftime('%Y...
[ "0.784835", "0.7663681", "0.7472462", "0.7358022", "0.7003398", "0.69931954", "0.69903797", "0.693996", "0.684767", "0.68457514", "0.6845251", "0.6735827", "0.67101395", "0.6695001", "0.66933155", "0.6691886", "0.66740346", "0.6665932", "0.66065484", "0.6586279", "0.65774506"...
0.8053211
0
Use callbacks to share common setup or constraints between actions.
def set_contact @comment = Comment.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Only allow a trusted parameter "white list" through.
def comment_params params.require(:comment).permit(:text, :user_id, :event_id, :flagged) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
GET /dreams def index
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@dreams = Dream.all\n\tend", "def index\n @dianosaurs = Dianosaur.all\n end", "def index\n\t\tif (params[:data] != nil)\n\t\t\t@show = Show.new\n\t\t\t@search = Tmdb::Search.new\n\t\t\t@search.resource('tv') # determines type of resource\n\t\t\t@search.query(params[:data]) # the query to sea...
[ "0.8092461", "0.7093166", "0.7084057", "0.69782794", "0.68242306", "0.6802044", "0.6779293", "0.67738324", "0.676317", "0.67293465", "0.67293465", "0.6711572", "0.67114365", "0.67114365", "0.67114365", "0.67114365", "0.67114365", "0.67114365", "0.67114365", "0.67114365", "0.6...
0.0
-1
POST /registrants/:id/standard_skill_routines/ Creates a new standard skill routine, if necessary. and redirects the user to that routine entry
def create @routine = @registrant.standard_skill_routine if @routine.present? skip_authorization else @routine = @registrant.build_standard_skill_routine authorize @routine @routine.save! flash[:notice] = 'Standard Skill Routine Successfully Started.' end redirect_to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n # set_user\n @routine = Routine.new(routine_params)\n if @user.routines << @routine\n redirect_to user_routines_path, notice: 'Routine was successfully created.' \n else\n format.html { render :new }\n format.json { render json: @routine.errors, status: :unprocessa...
[ "0.6056703", "0.5917076", "0.5905419", "0.58873355", "0.585558", "0.5840626", "0.5828749", "0.5784692", "0.5739313", "0.56876844", "0.5668262", "0.5624982", "0.5618929", "0.56166863", "0.56166863", "0.56166834", "0.56094587", "0.5591043", "0.55786914", "0.5545772", "0.5540846...
0.78935736
0
A wrapper around the actual +Statsd+, which checks whether the gem is enabled or disabled before calling +Statsd+.
def statsd(operation, *args, **opts, &block) if @enabled raise ArgumentError, 'statsd is not configured, please set it before recording events' unless @statsd self.send(operation, *args, **opts, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disabled?\n super || !gemfile.exist?\n end", "def method_missing(method_name, *args, &blk)\n enabled = enabled_value(method_name)\n\n return super if enabled.nil?\n\n enabled\n end", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name....
[ "0.6311545", "0.5957118", "0.5911642", "0.58897483", "0.58897483", "0.58863056", "0.58863056", "0.58863056", "0.5868408", "0.5839949", "0.5833386", "0.5754256", "0.5748852", "0.5661082", "0.56513494", "0.56158024", "0.56092453", "0.5603649", "0.5592474", "0.5592474", "0.55924...
0.0
-1
collect the oldfashioned serial way
def collect1 pages id = 'joshuabaer' results = [] 1.upto pages do |page| results += http_get id, page end results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect; end", "def collect\n end", "def\tcollect\n\t\ta = []\n\t\tself.each{|v| a << v}\n\t\ta\n\tend", "def collect_preserve\n\t\tcopy = @arr.clone[0...@last]\n\tend", "def _reduce_584(val, _values, result)\n _, (id, line) = val\n\n name = id.to_sym\n ...
[ "0.6251732", "0.5918414", "0.57305956", "0.56588215", "0.56422657", "0.56213707", "0.56213707", "0.5598001", "0.5598001", "0.5594169", "0.5561319", "0.5556491", "0.5556491", "0.55025065", "0.54889005", "0.5469043", "0.5450833", "0.5406882", "0.5406069", "0.5406069", "0.540107...
0.0
-1
collect with concurrency using the BackgroundTasks directory
def collect2 pages id = 'joshuabaer' results = [] tasks = [] 1.upto pages do |page| puts "queueing page #{page}" task = BackgroundTask.new do http_get id, page end tasks << task task.run end tasks.each do |task| puts "task retrieved" results += task.result end results ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect3 pages\n id = 'barackobama'\n results = []\n tasks = TaskCollection.new( 50 )\n 1.upto pages do |page|\n puts \"queueing page #{page}\"\n task = BackgroundTask.new do \n http_get id, page\n end\n tasks << task\n end\n i=0\n loop do\n i+=1\n puts \"getting next task...\"\n ...
[ "0.6621768", "0.64772725", "0.6195489", "0.6158762", "0.6138155", "0.5913319", "0.5824802", "0.5824802", "0.5712323", "0.56778276", "0.5664968", "0.5644227", "0.5617189", "0.55857545", "0.5579602", "0.55652785", "0.5515921", "0.5491737", "0.5491737", "0.5490716", "0.54900134"...
0.68118733
0