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
Use this method in DSL methods to add a file pattern to config
def add_file_pattern(name, pattern_string) if name.to_s !~ FILE_PATTERN_NAME_REGEX raise ArgumentError.new("A file pattern name must match this regex: #{ FILE_PATTERN_NAME_REGEX.inspect }") end @file_patterns[name.to_sym] = pattern_string.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_pattern( pattern )\n self.class_eval { @file_pattern = pattern }\n end", "def file_pattern(name)\n if name.to_s !~ FILE_PATTERN_NAME_REGEX\n raise ArgumentError.new(\"A file pattern name must match this regex: #{ FILE_PATTERN_NAME_REGEX.inspect }\")\n end\n get_...
[ "0.743196", "0.6343401", "0.6074771", "0.60525686", "0.60164654", "0.60104054", "0.59868294", "0.5922678", "0.5912519", "0.58953154", "0.5893319", "0.5879828", "0.5864538", "0.58395886", "0.581435", "0.58139163", "0.57998145", "0.57668275", "0.5756211", "0.57376087", "0.56720...
0.65437317
1
Use this method in DSL methods to add a kramdown converter method to config
def add_kramdown_converter_method(name, method_name) @kramdown_converter_methods[name.to_sym] = method_name.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kramdown_converter_method(name)\n get_config_val(@kramdown_converter_methods, name)\n end", "def kramdown_conversion_method_name\n :to_kramdown_repositext\n end", "def add_kramdown_parser(name, class_name)\n @kramdown_parsers[name.to_sym] = Object.const_get(class_name)\n ...
[ "0.73307276", "0.6454526", "0.59406716", "0.5802251", "0.57538885", "0.5658694", "0.55258095", "0.55220056", "0.52579296", "0.52572477", "0.5236103", "0.521867", "0.5200783", "0.5179824", "0.5065934", "0.50557727", "0.50371003", "0.50331336", "0.49899033", "0.49649683", "0.49...
0.7367091
0
Use this method in DSL methods to add a parser to config
def add_kramdown_parser(name, class_name) @kramdown_parsers[name.to_sym] = Object.const_get(class_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_parser; end", "def configure!(parser); end", "def register(parser)\n parsers.push parser\n end", "def configure_parser\n @parsers = {}\n (@block_parsers + @span_parsers).each do |name|\n if self.class.has_parser?(name)\n @parsers[name] = self.class....
[ "0.74966013", "0.7271308", "0.71893173", "0.6958163", "0.682901", "0.681609", "0.68063974", "0.6682747", "0.66206163", "0.6335149", "0.63130647", "0.63072616", "0.6296398", "0.62479156", "0.62479156", "0.606188", "0.6056076", "0.6037529", "0.5955688", "0.5954962", "0.5939584"...
0.5971253
18
Use this method in DSL methods to add a setting.
def add_setting(setting_key, setting_val) @settings[setting_key.to_sym] = setting_val end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setting( name, **options, &block )\n\t\tself.log.debug \" adding %s setting to %p\" % [ name, self.target ]\n\t\tself.add_setting_accessors( name, options, &block )\n\t\tself.add_default( name, options )\n\tend", "def call\n setting_item = build_setting_item(name, type, default)\n register_set...
[ "0.70662206", "0.69325036", "0.68566453", "0.66347617", "0.6503639", "0.6453362", "0.63327265", "0.6226986", "0.61455745", "0.6099344", "0.6091122", "0.6054648", "0.60166407", "0.6010771", "0.59484315", "0.594761", "0.5946499", "0.59159046", "0.5907157", "0.5868665", "0.58633...
0.69175285
2
Retrieve a base dir
def base_dir(name) if name.to_s !~ BASE_DIR_NAME_REGEX raise ArgumentError.new("A base dir name must match this regex: #{ BASE_DIR_NAME_REGEX.inspect }") end get_config_val(@base_dirs, name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_base\n # See if we need to extend the base_dir\n if @config['base']\n extended_base = File.expand_path(File.join(@real_base, @config['base']))\n if File.directory? extended_base\n @base_dir = extended_base\n else\n puts \"Your base directory doesn't exist: #...
[ "0.8489582", "0.8058562", "0.8003713", "0.78825825", "0.7850955", "0.7819864", "0.78078544", "0.77831304", "0.76998025", "0.76998025", "0.76998025", "0.76998025", "0.76998025", "0.76998025", "0.76998025", "0.7691979", "0.7611461", "0.74767613", "0.74043685", "0.73923194", "0....
0.7120885
39
Retrieve a file pattern
def file_pattern(name) if name.to_s !~ FILE_PATTERN_NAME_REGEX raise ArgumentError.new("A file pattern name must match this regex: #{ FILE_PATTERN_NAME_REGEX.inspect }") end get_config_val(@file_patterns, name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFilePattern(filePattern)\n return if filePattern.nil?\n File.split(filePattern).inject do |memo, obj| \n File.join(memo, obj.split(/\\./).join('*.'))\n end\nend", "def path_string\n pattern\n end", "def file_pattern( pattern )\n self.class_eval { @file_pattern = pattern }\n ...
[ "0.719839", "0.7163418", "0.7132732", "0.69784707", "0.6878548", "0.6826527", "0.68226665", "0.6787364", "0.6787364", "0.674601", "0.66648155", "0.6624798", "0.6620429", "0.66068107", "0.6529265", "0.6515542", "0.6511495", "0.6439983", "0.6439983", "0.6439983", "0.6415678", ...
0.70174617
3
Retrieve a kramdown converter method
def kramdown_converter_method(name) get_config_val(@kramdown_converter_methods, name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kramdown_conversion_method_name\n :to_kramdown_repositext\n end", "def add_kramdown_converter_method(name, method_name)\n @kramdown_converter_methods[name.to_sym] = method_name.to_sym\n end", "def html_converter_class\n ::Kramdown::Converter::Html\n end", "def converte...
[ "0.7986022", "0.67469233", "0.6563834", "0.6379176", "0.6267418", "0.6179751", "0.5775949", "0.5773782", "0.575055", "0.5741612", "0.5649745", "0.55886316", "0.55401486", "0.5426026", "0.5426026", "0.5426026", "0.53737456", "0.53737456", "0.533407", "0.53124577", "0.5285807",...
0.7484731
1
Retrieve a kramdown parser
def kramdown_parser(name) get_config_val(@kramdown_parsers, name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_kramdown(content)\n ::Kramdown::Document.new content, :input => 'QuickStartParser' \n end", "def parse_kramdown(file)\n ::Kramdown::Document.new File.readlines(file).join, :input => 'QuickStartParser' \n end", "def add_kramdown_parser(name, class_name)\n @kramdo...
[ "0.7837217", "0.71642923", "0.64176196", "0.63126767", "0.6300437", "0.6168566", "0.60934526", "0.60860515", "0.60860515", "0.60860515", "0.60860515", "0.59642935", "0.59642935", "0.59109116", "0.5871536", "0.5861769", "0.5845905", "0.5800201", "0.5770351", "0.5768634", "0.57...
0.6997973
2
Computes a glob pattern from file spec
def compute_glob_pattern(file_spec) segments = file_spec.split(Repositext::Cli::FILE_SPEC_DELIMITER) r = '' if segments.all? { |e| e =~ BASE_DIR_NAME_REGEX || e =~ FILE_PATTERN_NAME_REGEX } # file_spec consists of named base_dir and/or file_pattern bd = segments.detect { |e| e =~ BASE_DIR_NAME_REGEX } # e.g., 'content_dir' fp = segments.detect { |e| e =~ FILE_PATTERN_NAME_REGEX } # e.g., 'at_files' r << base_dir(bd) if bd r << file_pattern(fp) if fp else # interpret file_spec as glob pattern, either an absolute path, or # a relative path, based on current working directory. # NOTE: this doesn't necessarily have to contain '*'. It could be the # path to a single file. if '/' == file_spec[0] # absolute path, use as is r = file_spec else # relative path, based on current working directory # Note: we could use just the file_spec since relative paths are # based on pwd by default. I just wanted to make the behavior obvious. r = File.expand_path(file_spec, Dir.pwd) end end r end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def glob pattern\n Dir[File.join(@originals,pattern)].collect do |f|\n File.basename(f)\n end\n end", "def glob(*pat, &blk)\n regexes = pat.flatten.map {|pat| Bun.convert_glob(pat) }\n enum = self.class.new(@collection) do |yielder|\n self.each do |fname|\n #...
[ "0.73991126", "0.73890775", "0.73805094", "0.73424846", "0.7341463", "0.7321767", "0.7315161", "0.71776307", "0.7175369", "0.71287674", "0.7073747", "0.7070709", "0.6996914", "0.69651437", "0.69538486", "0.69528484", "0.6923822", "0.6908099", "0.6908099", "0.6870214", "0.6870...
0.84700894
0
Computes a hash with validation file specs from input_file_specs
def compute_validation_file_specs(input_file_specs) input_file_specs.inject({}) { |m,(fs_name, fs_string)| base_dir, file_pattern = fs_string.split(Repositext::Cli::FILE_SPEC_DELIMITER).compact if base_dir.nil? || file_pattern.nil? raise ArgumentError.new("file_spec requires both base_dir and file_pattern: #{ fs_string.inspect } in #{ input_file_specs.inspect }") end if base_dir !~ BASE_DIR_NAME_REGEX raise ArgumentError.new("base_dir is not valid: #{ base_dir.inspect }") end if file_pattern !~ FILE_PATTERN_NAME_REGEX raise ArgumentError.new("file_pattern is not valid: #{ file_pattern.inspect }") end m[fs_name] = [base_dir(base_dir), file_pattern(file_pattern)] m } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_digest_byte_tests\n FILES.each do |path, hashlen|\n name = File.basename(path).split('.')[0]\n\n f = File.new(\"sha3_digest_#{hashlen}_spec.rb\", 'w')\n f.puts(REQUIRED)\n f.puts(\n SPEC\n .gsub(/HASH_LEN/, hashlen.to_s)\n .gsub(/NAME/, name)\n )\n\n contents = File.read(p...
[ "0.6164329", "0.61465913", "0.6007509", "0.5970157", "0.5961918", "0.592387", "0.5775693", "0.5747631", "0.57236147", "0.5667557", "0.5638504", "0.5620693", "0.56157726", "0.5602275", "0.5580187", "0.55777556", "0.557338", "0.55539995", "0.5546367", "0.5531555", "0.5529126", ...
0.7514599
0
Returns the absolute path of primary_repo with a guaranteed trailing slash at the end
def primary_repo_base_dir File.expand_path( setting(:relative_path_to_primary_repo), base_dir(:rtfile_dir) ).sub(/\/?\z/, '') + '/' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repo_path\n @config.get_value('GIT_REPO_ROOT')\n end", "def abspath\n \"#{repo_base_path}/#{self.git_repo_path}\"\n end", "def repository_root\n File.expand_path(@repo.path + \"/../\")\n end", "def absolute_repository_path\n File.join(\n OpenProject::Revisions::Git...
[ "0.6840974", "0.68346095", "0.6793713", "0.6643713", "0.65871274", "0.6514559", "0.65050054", "0.6468484", "0.63940626", "0.6347272", "0.6298935", "0.6293408", "0.62834775", "0.626672", "0.6258216", "0.625578", "0.6234172", "0.6213185", "0.61406183", "0.61352944", "0.612355",...
0.7727887
0
Returns a key's value from container. Raises if an unknown key is requested.
def get_config_val(container, key, raise_on_unknown_key = true) key = key.to_sym if raise_on_unknown_key && !container.keys.include?(key) raise RtfileError.new("You requested an unknown key: #{ key.inspect }") end container[key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end", "def get_value(key)\n self[key]\n end", "def [](key)\n find_value(key)\n end", "def get_value(collection, key)\n @data[collection][key]\n end", "def get(key...
[ "0.73172235", "0.7229446", "0.7085598", "0.7029533", "0.6913697", "0.69006", "0.68984866", "0.68797725", "0.68726885", "0.68641365", "0.6853405", "0.6795311", "0.6770131", "0.6765758", "0.6765758", "0.6765758", "0.6765758", "0.67622083", "0.6749583", "0.6721235", "0.6697227",...
0.74965435
0
An interesting number is one with at least 3 digits, in which the digits are either incrementing or decrementing. Examples: interesting_number(789) => true interesting_number(321) => true interesting_number(798) => false interesting_number(6) => false interesting_number(23) => false When the digits are incrementing, 0 comes after 9: interesting_number(7890) => true When the digits are decrementing, 0 comes after 1: interesting_number(3210) => true
def interesting_number(number) numbers = number.digits.reverse puts false if numbers.length < 3 i = 0 # Descending if numbers[0] > numbers[1] numbers.each - 1 do |num| numbers[i] == numbers[i+1] - 1 ? i+1 : false end puts true # Ascending elsif numbers[0] < numbers[1] numbers.each do |num| numbers[i] == numbers[i+1] + 1 ? i+1 : false end puts true else puts false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interesting_number(number)\n #check if the length is greater than 3 digits\n number_in_array = number.digits.reverse\n return false if number_in_array.length < 3\n increasing_numbers?(number_in_array)\n decreasing_numbers?(number_in_array)\nend", "def interesting_number(number)\n return false if numb...
[ "0.81279975", "0.7818596", "0.7320155", "0.72942543", "0.72748494", "0.7254767", "0.71150404", "0.7036127", "0.7027086", "0.69152486", "0.68839055", "0.68709856", "0.68706834", "0.6832939", "0.6827781", "0.6803171", "0.67964226", "0.6785351", "0.6769284", "0.67564064", "0.674...
0.6809825
15
Update function in the future letting users add text ingredients and directions for nonparsable recipes
def destroy @recipe.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n #@recipe.ingredients = params[:recipe_ingredients].map {|k, v|\n #ingredient = @recipe.ingredients.find(k) || @recipe.ingredients.build\n #ingredient.update_attributes(:item => Food.find(v[:item_id]), :quantity => v[:quantity]) unless v[:item_id].blank?\n #ingredient\n #}.compac...
[ "0.6748412", "0.6662905", "0.6610343", "0.64455575", "0.6413762", "0.62204766", "0.6166567", "0.61380947", "0.60759425", "0.60725015", "0.6050936", "0.60441715", "0.5994077", "0.5986222", "0.59794575", "0.5963098", "0.59533465", "0.59493", "0.59084475", "0.58980036", "0.58615...
0.0
-1
name of fields that must be present, e.g. %(name description)
def test_invalid_with_blank_attributes offer = Offer.new assert !offer.valid? assert !offer.errors.invalid?(:saleman_id) assert offer.errors.invalid?(:name) assert !offer.errors.invalid?(:name_normalized) assert offer.errors.invalid?(:amount) assert offer.errors.invalid?(:deal_date) assert offer.errors.invalid?(:customer_id) assert !offer.errors.invalid?(:description) assert offer.errors.invalid?(:status_id) assert !offer.errors.invalid?(:weight) assert !offer.errors.invalid?(:description_normalized) assert !offer.errors.invalid?(:delta) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_fields\n fields = %w{ipaper_id ipaper_access_key}.inject([]){|stack, f| stack << \"#{name}##{f}\" unless column_names.include?(f); stack}\n raise ScribdFuError, \"These fields are missing: #{fields.to_sentence}\" if fields.size > 0\n end", "def validate_fields\n # TODO: Define o...
[ "0.71336955", "0.66586727", "0.66270304", "0.66270304", "0.65094274", "0.6503744", "0.64102864", "0.6398512", "0.63885766", "0.6387416", "0.631098", "0.6305874", "0.62998", "0.62989205", "0.6263291", "0.62580913", "0.62535125", "0.6251391", "0.62501246", "0.6244178", "0.62365...
0.0
-1
overriding the superclass instance method
def print_reservations puts "We do not share our clients info!" puts "At least for free...." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overrides; end", "def super_method; end", "def superclass() end", "def inherited(base); end", "def proxy\n super\n end", "def super_class; end", "def super_class; end", "def special\n override\n end", "def base; self; end", "def tag; raise 'Override this method'; end", "def priv...
[ "0.75096357", "0.7497163", "0.7304779", "0.72871774", "0.72701025", "0.72106117", "0.72106117", "0.71107566", "0.7070498", "0.7052114", "0.7013441", "0.69445276", "0.69445276", "0.69426984", "0.69426984", "0.6940613", "0.69190264", "0.69080067", "0.6890726", "0.6879407", "0.6...
0.0
-1
Receive and process user input
def receive_input input = '' controls = %w(a s d w) until controls.include?(input) input = STDIN.getch abort 'escaped' if input == "\e" end input end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive_input\n STDIN.gets.strip\n end", "def user_input_capture\n print \">>: \"\n response = gets.chomp\n response\n end", "def input_handler\n STDIN.read.split(\"\\n\").each do |line|\n process_line(line)\n end\n end", "def user_input\n\tgets\nend", "def r...
[ "0.7497733", "0.7290198", "0.72226727", "0.7126107", "0.70062643", "0.69866526", "0.6969855", "0.69353086", "0.6918222", "0.690071", "0.6894507", "0.68760574", "0.683526", "0.6815398", "0.68057424", "0.6783606", "0.67599434", "0.67415124", "0.6709307", "0.6697223", "0.6680646...
0.7004477
5
Creates a new line after the user enters a direction
def shift_left(line) new_line = [] line.each { |line| new_line << line unless line.zero? } new_line << 0 until new_line.size == 4 new_line end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_from_entrance\n prompt = TTY::Prompt.new\n @direction = prompt.select(\"You look around the room and you see a chest to your left, an enchantment table in front, and a bookcase to your right.\", %w(Move_to_locked_chest))\n line_break\n end", "def drive_north(direction)\n if d...
[ "0.6246486", "0.59883565", "0.5887853", "0.58739907", "0.58614314", "0.5860599", "0.5846479", "0.574541", "0.574541", "0.5697722", "0.5667974", "0.5637402", "0.5620091", "0.56145984", "0.56060076", "0.5598454", "0.5581754", "0.5549809", "0.55481017", "0.55470496", "0.5472775"...
0.0
-1
Moves tiles to the left
def move_left new_board = Marshal.load(Marshal.dump(@board)) (0..3).each do |i| (0..3).each do |j| (j..2).each do |k| if @board[i][k + 1] == 0 next elsif @board[i][j] == @board[i][k + 1] @board[i][j] = @board[i][j] * 2 @board[i][k + 1] = 0 end break end end @board[i] = shift_left(@board[i]) end @board == new_board ? false : true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_left\n left_tile = C[@location.first, @location.second - 1]\n move_to(left_tile)\n end", "def move_left\n left_tile = Couple.new(@location.first, @location.second - 1)\n move_to(left_tile)\n end", "def move_left\n\t\tmove([-1,0])\n\tend", "def move_left\n @memory_position -= 1...
[ "0.8088165", "0.80409986", "0.7658829", "0.72163093", "0.71768", "0.70870376", "0.7029332", "0.7027329", "0.7026737", "0.69884384", "0.69884384", "0.69884384", "0.6923451", "0.691203", "0.6904729", "0.6904729", "0.6894849", "0.688175", "0.6867787", "0.68534744", "0.68352103",...
0.7405657
3
Move tiles to the right
def move_right @board.each(&:reverse!) action = move_left @board.each(&:reverse!) action end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_right\n right_tile = Couple.new(@location.first, @location.second + 1)\n move_to(right_tile)\n end", "def move_right\n right_tile = C[@location.first, @location.second + 1]\n move_to(right_tile)\n end", "def move_right\n\t\tmove([1,0])\n\tend", "def moveRight\n if (@x + @size)...
[ "0.78697455", "0.78144246", "0.7533906", "0.698691", "0.6902781", "0.6862442", "0.6805925", "0.67873347", "0.66700876", "0.6650515", "0.6629897", "0.66275644", "0.661956", "0.6593448", "0.6579017", "0.65310425", "0.6487519", "0.64660144", "0.64547515", "0.63985586", "0.639460...
0.7543078
2
If a player reaches the final tile, 16384, they win
def win_checker @board.flatten.max == 16_384 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def over?\n self.player.points == self.board.total_points\n end", "def check_for_win(player)\n\tif ($grid_hash[\"tl\"] == player) && ($grid_hash[\"tc\"] == player) && ($grid_hash[\"tr\"] == player)\n\t\twin(player)\n\telsif ($grid_hash[\"cl\"] == player) && ($grid_hash[\"cc\"] == player) && ($grid_hash[\"cr\...
[ "0.6755356", "0.66747755", "0.66217077", "0.6621283", "0.6563", "0.655895", "0.6528054", "0.64842206", "0.6444673", "0.6426896", "0.6423936", "0.6421323", "0.6419945", "0.63718295", "0.6364941", "0.6361717", "0.63540435", "0.6348064", "0.63429266", "0.6327487", "0.63223755", ...
0.64569956
8
Checks which direction the player can move
def loss_checker new_board = Marshal.load(Marshal.dump(@board)) option = move_right || move_left || move_up || move_down unless option @board = Marshal.load(Marshal.dump(new_board)) return true end @board = Marshal.load(Marshal.dump(new_board)) false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrong_direction?(player_number)\n case player_number\n when 1\n distance_for_player(player_number) < 0\n when 2\n distance_for_player(player_number) > 0\n else\n true\n end\n end", "def check_move(direction)\n\n if direction == 0 #up\n if @y < 1\n ...
[ "0.74024445", "0.7332658", "0.724085", "0.71682894", "0.7045401", "0.6987203", "0.6961299", "0.68895847", "0.6882734", "0.6856465", "0.68360025", "0.67973495", "0.6769293", "0.6747672", "0.67243177", "0.6720989", "0.66853917", "0.66672814", "0.66530913", "0.6631125", "0.65807...
0.0
-1
Event Sequence for every game
def play greeting get_tiles move_sequence end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_loop\n end", "def game_loop\n end", "def gameflow\n \n end", "def game_setup\n end", "def perform\n\tgame_menu\n\tgameplay\nend", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "d...
[ "0.68009317", "0.66973954", "0.6611504", "0.64784753", "0.6466699", "0.64578646", "0.64578646", "0.64578646", "0.64578646", "0.64578646", "0.64578646", "0.64578646", "0.64578646", "0.63661695", "0.6310187", "0.6296134", "0.62755257", "0.6265301", "0.6264616", "0.62592226", "0...
0.57864386
72
The sequences of events for a game
def play_cycle play earn_achievements end_game end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_events\n @arpeggiators.each do |arpeggiator|\n arpeggiator.sequencer.event.stop << proc { @clock.stop }\n end\n @clock.event.tick << proc do\n @arpeggiators.map do |arpeggiator|\n arpeggiator.sequencer.exec(arpeggiator.sequence)\n arpeggiator\n e...
[ "0.6392648", "0.6280229", "0.62515795", "0.62205553", "0.62205553", "0.62205553", "0.62205553", "0.62205553", "0.62205553", "0.62205553", "0.62205553", "0.6159653", "0.6150635", "0.5977741", "0.5910575", "0.587556", "0.5860652", "0.58297104", "0.58297104", "0.57829034", "0.57...
0.5350765
76
Always allow user creation
def create? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creatable_without_user\n false\n end", "def auth_create_filter\n if not self.class.allowed_to_create\n false\n else\n true\n end\n end", "def create?\n #everyone who is loggedin can do this action\n true\n end", "def can_create?\n allows_current_user_access_t...
[ "0.76265603", "0.76195645", "0.75778466", "0.75608957", "0.74747884", "0.7452297", "0.7419917", "0.73087966", "0.73028094", "0.7291874", "0.7263189", "0.7262738", "0.7262738", "0.7262738", "0.7188688", "0.7188688", "0.718685", "0.71514255", "0.70988667", "0.70968986", "0.7070...
0.0
-1
Write a method that determines and returns the ASCII string value of a string that is passed in as an argument. The ASCII string value is the sum of the ASCII values of every character in the string. (You may use Stringord to determine the ASCII value of a character.)
def ascii_value(string) value = 0 string.chars { |c| value += c.ord } value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ascii_value(string)\n sum = 0\n string.each_char { |x| sum += x.ord }\n sum\nend", "def ascii_value(string)\n sum = 0\n string.chars.each do |char|\n sum += char.ord\n p char.ord.chr # Further Exploration\n end\n sum\nend", "def ascii_value(str)\n ascii_sum = 0\n\n str.each_char { |char| asc...
[ "0.8914419", "0.8901723", "0.8899416", "0.88920915", "0.88920915", "0.888891", "0.88865125", "0.88840854", "0.8883947", "0.8879799", "0.88775134", "0.887349", "0.8863588", "0.8804207", "0.8775223", "0.8768086", "0.8764711", "0.87321717", "0.8720412", "0.87056446", "0.8691511"...
0.87450993
17
Metodo para escolher com qual perfil logar
def escolher_perfil(perfil) @perfil = perfil case @perfil when "pessoa fisica" pessoa_fisica_div.click when "pessoa juridica" pessoa_juridica_div.click when "area restrita" visit "/restrito" else puts "Erro na selecao do perfil para acesso ao Portal CFM" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_file; end", "def log_file\n end", "def logged?; false end", "def logged?; false end", "def auth_log\n return './auth.log' if @cfg['run_mode'] == 'full_debug'\n\n AUTH_LOG_FILES.each { |log_file| return log_file if File.exists?(log_file) }\n\n return nil\n end", "def rea...
[ "0.6218747", "0.60744625", "0.60131115", "0.60131115", "0.5852771", "0.579949", "0.57956535", "0.5786507", "0.5786507", "0.5786507", "0.5786507", "0.5786507", "0.5786507", "0.5786507", "0.5786507", "0.57705", "0.5732644", "0.57291436", "0.5722923", "0.5645564", "0.56273174", ...
0.5316611
61
Metodos para realizar login como pessoa juridica
def realizar_login_pj(crm, uf, prestador, senha) @crm = crm @uf = uf @prestador = prestador @senha = senha numero_crm_pj_input.set(@crm) sleep(1) uf_crm_pj_select.click.find(@uf).click sleep(1) continuar_pj_button.click prestador_pj_select.click.find(@prestador).click sleep(1) senha_pj_input.set(@senha) sleep(1) entrar_pj_button.click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login; end", "def default_login\n login(\"rohitsjce@gmail.com\",\"codetheoryio\")\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n ...
[ "0.7506705", "0.73283744", "0.73107433", "0.73032063", "0.73032063", "0.73032063", "0.73032063", "0.73032063", "0.73032063", "0.73032063", "0.73032063", "0.73032063", "0.72707826", "0.720714", "0.7205281", "0.7191762", "0.7191762", "0.7189113", "0.7100891", "0.7067156", "0.70...
0.6614409
51
Metodos para realizar login como pessoa fisica
def realizar_login_pf(crm, uf, senha) @crm = crm @uf = uf @senha = senha numero_crm_pf_input.set(@crm) sleep(1) uf_crm_pf_select.click.find(@uf).click sleep(1) continuar_pf_button.click senha_pf_input.set(@senha) sleep(1) entrar_pf_button.click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login; end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n\tend", "def login\n\n end", "def login\n\n end", "def...
[ "0.7652421", "0.7520069", "0.75048745", "0.75048745", "0.75048745", "0.75048745", "0.75048745", "0.75048745", "0.75048745", "0.75048745", "0.75048745", "0.73963344", "0.7394635", "0.7394635", "0.72874403", "0.72636026", "0.72303563", "0.7230311", "0.7157076", "0.7149116", "0....
0.6516246
93
Metodos para realizar login na area restrita
def realizar_login_restrito(usuario, senha) @usuario = usuario @senha = senha usuario_restrito_input.set(@usuario) sleep(1) senha_restrito_input.set(@senha) sleep(1) acessar_restrito_button.click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login; end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n\tend", "def login\n\n end", "def login\n\n end", "def...
[ "0.7718233", "0.7577508", "0.7577508", "0.7577508", "0.7577508", "0.7577508", "0.7577508", "0.7577508", "0.7577508", "0.7577508", "0.7574145", "0.7502535", "0.7481933", "0.7481933", "0.737448", "0.71794415", "0.71751475", "0.71466017", "0.71287227", "0.7099171", "0.7068331", ...
0.0
-1
Metodo para realizar login para testar demais funcionalidades do sistema
def realizar_login (perfil_usuario) @perfil = perfil_usuario case @perfil when "pessoa fisica" escolher_perfil(@perfil) realizar_login_pf("41906", "#ufCrm > option:nth-child(19)", "123") when "pessoa juridica" visit "/" sleep(1) escolher_perfil(@perfil) realizar_login_pj("36172", "#ufCrmPJ > option:nth-child(19)", "'#prestador > option:nth-child(3)'", "cn&n77&9") when "area restrita" escolher_perfil(@perfil) sleep(1) realizar_login_restrito("ODANIELE", "123") else puts "Erro na selecao de perfil" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login; end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n\n end", "def login\n\n end", "def login_as_testuser\n ...
[ "0.7997518", "0.7956257", "0.7907817", "0.7907817", "0.7907817", "0.7907817", "0.7907817", "0.7907817", "0.7907817", "0.7907817", "0.7907817", "0.77671444", "0.77671444", "0.7720095", "0.7706728", "0.75596905", "0.74841994", "0.74057114", "0.73311746", "0.7310184", "0.7281682...
0.0
-1
discount is a percentage
def initialize(requirement_price:, discount:) @requirement_price = requirement_price @discount = discount end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentage_discount\n ((1 - (sale_price / original_price)) * 100).round.to_i\n end", "def apply_discount\n if @discount != 0\n @discount = @discount.to_f / 100 # discount is 20%, so must convert to float before dividing by 100 to get percent\n self.total = (@total * (1 - @discount)).to_i # c...
[ "0.832946", "0.8245818", "0.8070645", "0.8051627", "0.8033003", "0.7979177", "0.79433745", "0.79122525", "0.79077387", "0.7884595", "0.7873957", "0.7830416", "0.782277", "0.78132063", "0.7792186", "0.7756587", "0.7746739", "0.7715817", "0.7681166", "0.7663572", "0.7651927", ...
0.0
-1
Returns a comma separated string of the current category titles.
def categories_as_string categories.map(&:title).sort.join(', ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category\n categories.collect(&:title).join(',')\n end", "def categories_as_string\n categories.map(&:title).sort.join(', ')\n\n end", "def categories_as_string\n categories.map(&:title).sort.join(', ')\n end", "def categories_as_string\n categories.map(&:title).sort.join(',')\...
[ "0.8224363", "0.8134241", "0.80120856", "0.79779804", "0.78914976", "0.7738105", "0.7533746", "0.741994", "0.730062", "0.72704375", "0.7236375", "0.7058555", "0.69943845", "0.69729817", "0.69081104", "0.67374206", "0.6704726", "0.6644644", "0.65887654", "0.65695983", "0.65388...
0.7681256
6
Given a comma separated string of category titles, reset the categories for this tweet to the categories in the string.
def categories_as_string= (new_categories) categories.clear new_categories.split(/\s*,\s*/).each do |title| cat = Category.where('LOWER(title) = ?', title.downcase).first categories << cat if !cat.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories_as_strings= (new_categories)\n categories.clear\n\n new_categories.split(/\\s*, \\s*/).each do |title|\n cat =Category.where('LOWER(title) = ?', title.downcase).first\n categories << cat if !cat.nil?\n end\n end", "def category_names=(list)\n list = list.is_a?(Array) ? list ...
[ "0.69549704", "0.69243455", "0.67097646", "0.66300946", "0.6519889", "0.64701647", "0.60764104", "0.6049881", "0.5900281", "0.58600694", "0.5831608", "0.5716712", "0.56877077", "0.56314504", "0.56175077", "0.55974466", "0.5462894", "0.54461884", "0.54330766", "0.5419876", "0....
0.6752916
2
title:legend: xAxis: yAxis: tooltip: credits: :plotOptions
def defaults_options self.title({ :text=>"example test title from highcharts gem"}) self.legend({ :layout=>"vertical", :style=>{} }) self.xAxis({}) self.yAxis({ :title=> {:text=> nil}, :labels=>{} }) self.tooltip({ :enabled=>true }) self.credits({ :enabled => false}) self.plotOptions({ :areaspline => { } }) self.chart({ :defaultSeriesType=>"areaspline" , :renderTo => nil}) self.subtitle({}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def defaults_options\n self.title({:text => nil})\n self.legend({:layout => \"vertical\", :style => {}})\n self.xAxis({})\n self.yAxis({:title => {:text => nil}, :labels => {}})\n self.tooltip({:enabled => true})\n self.credits({:enabled => false})\n self.plotOptions({:areaspline...
[ "0.6519339", "0.6435553", "0.6315414", "0.6166688", "0.61170375", "0.61118585", "0.60911965", "0.6042981", "0.5959802", "0.5945858", "0.5863141", "0.58454424", "0.5831566", "0.58306175", "0.5789699", "0.5780289", "0.5719986", "0.5702264", "0.5658842", "0.56321466", "0.5618909...
0.68676376
0
Pass other methods through to the javascript high_chart object. For instance: high_chart.grid(:color => "699")
def method_missing(meth, opts = {}) merge_options meth, opts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n javascript_tag \"$(function(){\" +\n \"new Highcharts.Chart({\" +\n to_json +\n \"})\" +\n \"});\"\n end", "def basic_chart\n \n end", "def show\n @chart = Chart.find(params[:id])\n @chartnodes = @chart.chartnodes\n data = @chart.chartnodes.map {|node| [node.xaxi...
[ "0.6293538", "0.6261295", "0.6100825", "0.59735274", "0.5960883", "0.58906347", "0.5813535", "0.5801103", "0.58000493", "0.5768363", "0.57550055", "0.57334316", "0.56388223", "0.5571125", "0.5556048", "0.5494882", "0.54695845", "0.5468506", "0.54363924", "0.5411419", "0.53513...
0.0
-1
Add a simple series to the graph: data = [[0,5], [1,5], [2,5]]
def series(opts = {}) @data ||= [] if opts.blank? @data << series_options.merge(:name => label, :data => d) else @data << opts.merge(:name => opts[:name], :data => opts[:data]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_series(series)\n if (@data[0]) then\n # Require that all column names are identical\n raise \"Column names do not match!\" unless ((@data[0].xlabel == series.xlabel) && (@data[0].ylabel == series.ylabel))\n end\n @data.push(series)\n end", "def add_series(plot, opts={})\n plo...
[ "0.66957986", "0.65119624", "0.65119624", "0.6344792", "0.6328301", "0.6260133", "0.59435666", "0.59323615", "0.5903344", "0.5747088", "0.57343537", "0.5729264", "0.56942457", "0.56280476", "0.55120796", "0.5499946", "0.5490214", "0.53849816", "0.5332435", "0.53242993", "0.52...
0.5917182
8
This method will generate the options as a string suitable for straight use. This is required because of the addition of the datetime capability put in. The dates need to be formatted in a JS specific way.
def options_string options_collection = [] options.keys.each do |key| k = key.to_s.camelize.gsub!(/\b\w/) { $&.downcase } options_collection << "\"#{k}\": #{options[key].to_json}" end # This check is put in to catch for those graphs that are time series charts. In that event the # data needs to be reformated rather than just a blind JSON conversion if data.first[:data].first.class == Array and (data.first[:data].first.first.instance_of? DateTime or data.first[:data].first.first.instance_of? Date) series_string = "\"series\": [" data.each do |single_series| series_string << "{\"name\":\"#{single_series[:name]}\", \"data\":[" single_series[:data].each do |single_data| series_string << "[#{single_data[0].strftime('%s').to_i * 1000},#{single_data[1]}]" series_string << "," unless single_data == single_series[:data].last end series_string << "]}" series_string << "," unless single_series == data.last end series_string << "]" options_collection << series_string else # If this isn't a time series chart then just convert the data to JSON directly options_collection << "series: #{data.to_json}" end return "{#{options_collection.join(',')}}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_format_options\n DATE_FORMATS.collect {|f| [\"#{Date.today.strftime(f)} - #{f}\", f]}\n end", "def to_s\n @options.join \" \"\n end", "def to_s\n \"<#{options.inspect}>\"\n end", "def date(options = {})\n res = \"\"\n res += \"#{I18n.localize(self.starts_at, :format...
[ "0.7026954", "0.6607382", "0.65895784", "0.65024924", "0.6455781", "0.64212936", "0.63766897", "0.637559", "0.6292775", "0.6292775", "0.62664443", "0.6252394", "0.617951", "0.6178819", "0.6174106", "0.61636543", "0.61605626", "0.6149303", "0.6121917", "0.610379", "0.61020166"...
0.69654065
1
I worked on this challenge [by myself, with Mason]. Your Solution Below def factorial(number) while number != 1 number (number 1) return number number = 1 break end end def factorial(number) while number >= 1 number = 1 minus = number 1 number minus return number end end factorial(0)
def factorial(number) result = 1 while number > 0 result = result * number number -= 1 end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial(number)\n if number == 0\n return 1\n \n elsif number == 1\n return 1\n \n elsif\n x = number\n while x != 1\n x = (x - 1)\n number = (number * x)\n end\n return number\n end\nend", "def factorial(number)\n if number == 0\n return 1\n else\n i = number-1\n...
[ "0.9020384", "0.8904798", "0.8904798", "0.8891379", "0.88627976", "0.88343716", "0.8827523", "0.88164127", "0.8792207", "0.875952", "0.87535053", "0.8743511", "0.87191296", "0.8686371", "0.8678662", "0.86458254", "0.86436015", "0.862632", "0.86213857", "0.8616079", "0.8612202...
0.8618105
19
Generates a test which tests authorization code. It assumes a method called access_denied? on the test case. The access_denied? method should return true when access is denied (ie. a 403 status code) and false in other cases. Example: should.allow.get :index
def allow Test::Spec::Rails::Macros::Authorization::TestGenerator.new(test_case, :access_denied?, false, 'Expected access to be allowed' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_index_authorized\n authorize @valid_user\n get :index\n assert_response :success\n assert_template \"index\"\n end", "def test_auth_only\n make_controller :auth_only\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_protected\n end", "def test_a...
[ "0.6475531", "0.6461225", "0.631084", "0.628509", "0.61865973", "0.6093812", "0.59790725", "0.58264005", "0.58198", "0.5784285", "0.57606477", "0.57557863", "0.57557863", "0.5750277", "0.5736917", "0.57228917", "0.5657903", "0.56317997", "0.5629605", "0.5628198", "0.56252605"...
0.8330039
0
Generates a test which tests authorization code. It assumes a method called access_denied? on the test case. The login_required? method should return true when the visitor was asked for credentials (ie. a 401 status code or a redirect to a login page) and false in other cases. Example: should.require_login.get :index
def require_login Test::Spec::Rails::Macros::Authorization::TestGenerator.new(test_case, :login_required?, true, 'Expected login to be required' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow\n Test::Spec::Rails::Macros::Authorization::TestGenerator.new(test_case,\n :access_denied?, false,\n 'Expected access to be allowed'\n )\n end", "def test_auth_only\n make_controller :auth_only\n get :index\n assert_response :success\n get :secret_ferret...
[ "0.7289826", "0.6315427", "0.622207", "0.619686", "0.60465807", "0.5963903", "0.59197307", "0.59197307", "0.59197307", "0.5904193", "0.58407605", "0.582522", "0.5821838", "0.575604", "0.57368356", "0.5714388", "0.5705717", "0.5691622", "0.56840664", "0.5645945", "0.5645802", ...
0.72369117
1
GET /games GET /games.json
def index @games = Game.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def index\n @games = Game.all\n render json: @games\n end", "def index\n @games = current_user.games\n \n respond_to do |format|...
[ "0.801388", "0.7969819", "0.7854131", "0.7795904", "0.77952725", "0.77952725", "0.77952725", "0.7618289", "0.75276613", "0.74230546", "0.74158394", "0.7390365", "0.73540944", "0.7318076", "0.72921306", "0.7247407", "0.7209582", "0.7190768", "0.7177297", "0.7177297", "0.717729...
0.69501257
57
GET /games/1 GET /games/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @game = Game.find(params[:id])\n render json: @game, status: 200\n end", "def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def index\n @games = Game.all\n render json: @...
[ "0.77774805", "0.77492905", "0.77341574", "0.75965285", "0.75962996", "0.75962996", "0.75962996", "0.7543047", "0.74719816", "0.74719816", "0.74719816", "0.74719816", "0.74719816", "0.74719816", "0.74719816", "0.7428268", "0.74045074", "0.7395587", "0.73370796", "0.733467", "...
0.0
-1
POST /games POST /games.json
def create @game = Game.new(game_params) respond_to do |format| if @game.save format.html { redirect_to @game, notice: 'Game was successfully created.' } format.json { render :show, status: :created, location: @game } else format.html { render :new } format.json { render json: @game.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @game = current_or_guest_user.games.create\n render json: @game, status: 201\n end", "def create\n game = @current_user.games.create!(game_params)\n render json: { game: game }\n end", "def create\n @new_game = Game.create(game_params)\n render json: @new_game\n\n end", "def...
[ "0.7666801", "0.75520563", "0.7413892", "0.70869124", "0.7075019", "0.70485115", "0.70426613", "0.7039214", "0.702803", "0.702508", "0.702508", "0.702508", "0.702508", "0.702508", "0.6992957", "0.69471335", "0.6937076", "0.69172454", "0.6881612", "0.6872458", "0.68417835", ...
0.6903971
26
PATCH/PUT /games/1 PATCH/PUT /games/1.json
def update respond_to do |format| if @game.update(game_params) format.html { redirect_to @game, notice: 'Game was successfully updated.' } format.json { render :show, status: :ok, location: @game } else format.html { render :edit } format.json { render json: @game.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n #if game exists, pass here to update state\n @game = Game.find_by(id: params[:id])\n @game.update(game_params)\n render json: @game, status: 201\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n ...
[ "0.71581805", "0.7029499", "0.702402", "0.7022699", "0.7022369", "0.7022369", "0.7022369", "0.7022369", "0.7022369", "0.7022369", "0.7022369", "0.69909966", "0.69796234", "0.6944543", "0.6894693", "0.6848518", "0.6848518", "0.6848518", "0.6823052", "0.681519", "0.68048114", ...
0.667649
52
DELETE /games/1 DELETE /games/1.json
def destroy @game.destroy respond_to do |format| format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.get(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "d...
[ "0.7732339", "0.7712217", "0.7657307", "0.76516914", "0.76516914", "0.76474565", "0.76474565", "0.76474565", "0.76474565", "0.76474565", "0.76474565", "0.76474565", "0.76474565", "0.76474565", "0.76474565", "0.76474565", "0.76474565", "0.75758624", "0.75758624", "0.75758624", ...
0.7275179
64
Use callbacks to share common setup or constraints between actions.
def set_game @game = Game.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 game_params params.require(:game).permit(:map_id, :room_size, :integer, :state, :string) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Editing options available to pictureables by default, may be overridden on a class by class basis.
def picture_options {purpose: nil, variant: nil} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_real_picture\n end", "def card_avatar options={}\n (is_viewer? && !@decorator.imgdata(false).present?) ?\n super + collectible_editpic_button(@decorator, 'lg', label: 'Get a Picture', class: 'upload-button') :\n super\n end", "def edit_particular_image\n \n end", "def non_htm...
[ "0.6677112", "0.61707014", "0.6066759", "0.6056141", "0.5975273", "0.5891041", "0.581656", "0.5789203", "0.5769411", "0.5763507", "0.5735035", "0.5722455", "0.5656235", "0.55947286", "0.55710685", "0.5568592", "0.5568592", "0.55612564", "0.5541599", "0.5508511", "0.550413", ...
0.6118333
2
Retrieve all champions, v1.1
def get perform_request(api_url("champion"))["champions"].map {|c| Champion.new(c)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all\n get(resource_path, @version).champions.map do |champion|\n RiotGamesApi::LOL::Model::Champion::Champion.new champion\n end\n end", "def index\n @champions = Champion.all\n end", "def index\n @ches = Ch.all\n end", "def index\n @chitters = Chitter.all\n...
[ "0.69962007", "0.6849798", "0.68175745", "0.66379714", "0.6508881", "0.64422816", "0.64127004", "0.6386475", "0.63640076", "0.6362937", "0.6172406", "0.613745", "0.6065645", "0.6059269", "0.59582025", "0.5948984", "0.5925127", "0.58815324", "0.58815324", "0.5877014", "0.58764...
0.6659281
3
Evaluate the ERB template in +file+ and returns the result as a string. Use with +render+: render erb(:muffin)
def erb(file) path = File.join(@root, "views", file.to_s) ERB.new(File.read("#{path}.erb")).result(binding) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render\n template = ERB.new File.new(@template_path).read, nil, \"%\"\n template.result(binding)\n end", "def render_erb\n require 'erb'\n\n renderer = ERB.new(template_content, trim_mode: '-')\n renderer.filename = @template_file\n renderer.result(bin...
[ "0.73885167", "0.7379999", "0.7313286", "0.7293423", "0.7273247", "0.72723466", "0.72723466", "0.72586757", "0.71918637", "0.719027", "0.71467716", "0.71028024", "0.70671463", "0.70646524", "0.7013945", "0.6979676", "0.68916166", "0.6866717", "0.6813862", "0.6725856", "0.6724...
0.7170457
10
Build a class object using a Flat scope so we can pass through variables Then pass it as an object to setup_privileges
def objbuilder(user, type="", group="", password="") # user becomes group when adding / deleting groups # objbuilder("#{@thmgroupname}", "addgroup") designobj = Class.new do attr_reader :type, :group, :password define_method :initialize do instance_variable_set("@type", "#{type}") instance_variable_set("@group", "#{group}") instance_variable_set("@password", "#{password}") end end setup_privileges("#{user}", designobj) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(user)\n define_global_privileges\n define_user_privileges(user) if user\n define_admin_privileges(user) if user and user.admin?\n end", "def initialize(scope, user, params, &block)\n @scope = scope\n @params = params.dup\n @user = user\n\n instance_ev...
[ "0.6345937", "0.5929545", "0.5720007", "0.5630158", "0.5619377", "0.55986136", "0.55954444", "0.5595042", "0.5594009", "0.5542252", "0.554117", "0.5527415", "0.55245847", "0.54903954", "0.54378486", "0.5411845", "0.53952074", "0.5372943", "0.5342187", "0.5330649", "0.53270376...
0.603767
1
Use callbacks to share common setup or constraints between actions.
def set_student @student = Student.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def student_params params.require(:student).permit(:name, :teacher_id, user_attributes: [:id, :email, :password, :password_confirmation, :student_id] ) 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
Enables the WebAudio domain and starts sending context lifetime events.
def enable { method: "WebAudio.enable" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable\n\t\t\t@last_request = nil\n\t\t\tBase.instance.add_observer(self)\n\t\tend", "def active_support_timers_start(env); end", "def main_audio ; end", "def enable_audio(on: true)\n\n # Set the flag\n @audio_handler.audio = on\n\n # Update the icon\n @audio_sprite.path =\n ...
[ "0.52226603", "0.5178497", "0.51085854", "0.50974566", "0.5092195", "0.5063775", "0.5046831", "0.5042426", "0.50311345", "0.50112045", "0.50009376", "0.494665", "0.49414673", "0.49284717", "0.4923882", "0.49152082", "0.49092498", "0.48973376", "0.48753217", "0.48735997", "0.4...
0.67978
0
Disables the WebAudio domain.
def disable { method: "WebAudio.disable" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsilence\n lightstreamer_subscription.unsilence\n end", "def disable_subscription(name)\n typed_exec(\"ALTER SUBSCRIPTION #{connection.quote_ident(name)} DISABLE\")\n end", "def disable_private_who_is(domain)\n validate_list([ [\"Domain\", domain, :domain_format] ])\n opt...
[ "0.62375414", "0.6026919", "0.5863623", "0.5857022", "0.584489", "0.58150816", "0.5790704", "0.5787989", "0.5761655", "0.57405245", "0.5713707", "0.5685493", "0.5660492", "0.5630568", "0.55931056", "0.554675", "0.55461794", "0.5489659", "0.5480845", "0.5475446", "0.54735994",...
0.79204506
0
Fetch the realtime data from the registered contexts.
def get_realtime_data(context_id:) { method: "WebAudio.getRealtimeData", params: { contextId: context_id }.compact } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_context\n synchronize do\n # The URL to get the context list from sesame\n dir = \"#{@options[\"host\"]}:#{@options[\"port\"]}/openrdf-sesame/repositories/#{@options[\"repo\"]}/contexts\"\n\n # Asks for the context list\n RestClient.get dir, :content_type=>'application/spar...
[ "0.64655477", "0.61454755", "0.59322417", "0.5926333", "0.57833904", "0.5738207", "0.5692313", "0.5625469", "0.56071573", "0.5576035", "0.55699784", "0.5557334", "0.55421406", "0.54988605", "0.5480596", "0.54701126", "0.5451086", "0.54372704", "0.54148805", "0.54106694", "0.5...
0.65922636
0
Creating a new order is handled by the Stripe ChargesController
def checkout @user = User.find(session[:user_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @order = Order.new(params[:order])\n end", "def create_order\n @order = Order.create\n end", "def create\n\n # Remember to change this to your live secret key in production\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n\n # Get the credit card details submitted by the form\n toke...
[ "0.8045561", "0.79558164", "0.7946343", "0.7864079", "0.78072095", "0.7766064", "0.77429366", "0.77403486", "0.7728683", "0.7719493", "0.7719493", "0.7719493", "0.7719493", "0.7716423", "0.7716423", "0.77149415", "0.77149415", "0.77149415", "0.77149415", "0.77149415", "0.7714...
0.0
-1
successfully finds: blogspot pages, vbulletin, microtik routers, ning sites, also identifies stuff like various types of 404s, virtual directory listings not allowed, apache default expect some noise. 100 matched too much, 1000 matched too litte. 500 is ok
def passive if @body.size > 4 hash=Digest::MD5.hexdigest(@body[0..500]) [{:name=>"hash",:string=>hash}] else [] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(pages)\n robot = Robots.new USER_AGENT\n until pages.nil? or pages.empty?\n newfound_pages = []\n pages.each { |page|\n begin\n if add_to_index?(page) then\n uri = URI.parse(page)\n host = &quot;#{uri.scheme}://#{uri.host}&quot;\n open(page, &quot;User-Agent&quot; =&gt; USER_AGENT) { |s|\n (Hpricot(s)/...
[ "0.62940407", "0.61513144", "0.60866755", "0.5989479", "0.59825987", "0.58607256", "0.5754765", "0.5718583", "0.56773067", "0.5640277", "0.5631777", "0.5624514", "0.56178576", "0.5604908", "0.5587801", "0.55495423", "0.55492294", "0.5548418", "0.551061", "0.550915", "0.547166...
0.0
-1
find the cookie for this app deserialize the cookie into a hash
def initialize(cookie) @cookie = cookie @now = cookie[FLASH_KEY] || {} reset end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode cookie\n data = cookie[@name].to_s\n return empty_hash if data.empty?\n\n sig, str = data.split '/', 2\n return empty_hash unless str\n\n h = nil\n digest = nil\n begin\n sig = decode64 sig\n digest = @dss.digest str\n if @dsa.sysverify(digest, sig...
[ "0.73880845", "0.7199041", "0.693789", "0.69199616", "0.6871762", "0.6716877", "0.6615971", "0.66148853", "0.64481163", "0.6434833", "0.6415685", "0.6415685", "0.6410395", "0.6297952", "0.6282913", "0.6208957", "0.6205864", "0.6199352", "0.61971503", "0.6185585", "0.61666894"...
0.0
-1
Creates a Video object set to work on the +file+ given. It will attempt to transcode the video into one defined by +target_geometry+ which is a "WxH"style string. +format+ should be specified. Video transcoding will raise no errors unless +whiny+ is true (which it is, by default. If +convert_options+ is set, the options will be appended to the convert command upon video transcoding.
def initialize file, options = {}, attachment = nil @convert_options = { :input => {}, :output => {} } unless options[:convert_options].nil? || options[:convert_options].class != Hash unless options[:convert_options][:input].nil? || options[:convert_options][:input].class != Hash @convert_options[:input].reverse_merge! options[:convert_options][:input] end unless options[:convert_options][:output].nil? || options[:convert_options][:output].class != Hash @convert_options[:output].reverse_merge! options[:convert_options][:output] end end @file = file @whiny = options[:whiny].nil? ? true : options[:whiny] @format = options[:format] @time = options[:time].nil? ? 3 : options[:time] @current_format = File.extname(@file.path) @basename = File.basename(@file.path, @current_format) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize file, target_geometry, format = nil, convert_options = nil, whiny_thumbnails = true\n @file = file\n @crop = target_geometry[-1,1] == '#'\n @target_geometry = Geometry.parse target_geometry\n @current_geometry = Geometry.from_file file\n @convert_opt...
[ "0.64386", "0.5399262", "0.52418005", "0.509675", "0.5071222", "0.49909717", "0.49622345", "0.49142376", "0.48898482", "0.48708323", "0.48601314", "0.4829371", "0.47956696", "0.47826734", "0.47809377", "0.47781214", "0.47545224", "0.4665213", "0.46629882", "0.46584943", "0.46...
0.46732193
17
Performs the transcoding of the +file+ into a thumbnail/video. Returns the Tempfile that contains the new image/video.
def make src = @file dst = Tempfile.new([@basename, @format ? ".#{@format}" : '']) dst.binmode parameters = [] # Add source parameters << @convert_options[:input].map { |k,v| "-#{k.to_s} #{v} "} parameters << "-f --quiet :source" parameters << @convert_options[:output].map { |k,v| "-#{k.to_s} #{v} "} parameters << ":dest" parameters = parameters.flatten.compact.join(" ").strip.squeeze(" ") Paperclip.log("[lame] #{parameters}") begin success = Paperclip.run("lame", parameters, :source => "#{File.expand_path(src.path)}", :dest => File.expand_path(dst.path)) rescue Cocaine::ExitStatusError => e raise PaperclipError, "error while processing video for #{@basename}: #{e}" if @whiny end dst end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smart_video_preview\n vp = Tempfile.new([\"video-preview\", \".png\"], binmode: true)\n\n # https://ffmpeg.org/ffmpeg.html#Main-options\n # https://ffmpeg.org/ffmpeg-filters.html#thumbnail\n output = shell!(\"ffmpeg -i #{file.path.shellescape} -vf thumbnail=300 -frames:v 1 -y #{vp.path.shellescape}...
[ "0.66065586", "0.66065586", "0.65499616", "0.64945865", "0.6106258", "0.6044804", "0.5969813", "0.5949358", "0.5918212", "0.589946", "0.57592237", "0.57361066", "0.5728526", "0.5641925", "0.56212693", "0.5603243", "0.55834115", "0.5563469", "0.5561464", "0.5549072", "0.554177...
0.5985842
6
Defaults to target type and id.
def display_name "#{Target.type_of(self).titleize} #{id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_type=(value)\n @target_type = value\n end", "def target\n get_or_make_reference(@data['target_type'], @data, 'target_id')\n end", "def target_id=(value)\n @target_id = value\n end", "def set_target\n @target = Target.find(params[:id]...
[ "0.7058479", "0.7026978", "0.701764", "0.69035727", "0.6849382", "0.67725694", "0.67681766", "0.6684628", "0.667665", "0.66498345", "0.66367394", "0.66367394", "0.66229665", "0.6605385", "0.6546946", "0.6546946", "0.6462322", "0.6462322", "0.6462322", "0.6462322", "0.6462322"...
0.5810347
61
Returns the inspection of the type without fetched data.
def inspect_not_fetched "#<#{self.class} id=\"#{id}\" is_fetched?=false>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type; nil end", "def type; nil end", "def type\n nil\n end", "def type\n nil\n end", "def notable_type_data\n notable_type\n end", "def type\n return @type if @type != \"unknown\"\n info\n @type\n end", "def type\n ''\n end", "def type\n _type ...
[ "0.63976306", "0.63976306", "0.62295747", "0.62245804", "0.6186242", "0.59081644", "0.58745974", "0.584129", "0.5786812", "0.5681511", "0.56400836", "0.5622492", "0.56177527", "0.56148255", "0.5599104", "0.5594335", "0.5585912", "0.55679476", "0.5564008", "0.55547225", "0.555...
0.5921615
5
Returns the inspection of the type with fetched data.
def inspect_fetched "#<#{self.class} id=\"#{id}\" is_fetched?=true>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type\n return @type if @type != \"unknown\"\n info\n @type\n end", "def get_type\n\n end", "def type\n @data['type']\n end", "def get_by_type(type)\r\n facts2typerule = {:methodcall => [:cant_access, :can_access],\r\n :inheritance =...
[ "0.58993053", "0.57753056", "0.57223517", "0.5717632", "0.5712089", "0.56816196", "0.5655481", "0.56455487", "0.5642565", "0.5641809", "0.56303185", "0.56269944", "0.5620288", "0.5573142", "0.555371", "0.555273", "0.554894", "0.5547935", "0.5541684", "0.55293965", "0.55293065...
0.5417332
48
Parse a single line of CSV data Parameters line [String] A single line of CSV data without any line terminators
def parse(line) @io.rewind @io.truncate(0) @io << line @io.rewind @csv.shift end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_parse(validated_line)\n return unless validated_line\n row = validated_line.split(',')\n return unless row.any?\n if @headers.empty?\n @headers = row\n else\n @data_hash.merge!(row_to_hsh(row))\n @valid_rows << @data_hash\n end\n end", "def parse_lin...
[ "0.7076647", "0.7044287", "0.7040002", "0.67581344", "0.6651798", "0.6603432", "0.65326625", "0.6532377", "0.65091497", "0.64363515", "0.63538975", "0.633257", "0.6325488", "0.62858653", "0.61814755", "0.6142592", "0.61063075", "0.60993636", "0.60749173", "0.6049596", "0.6035...
0.67853737
3
Return the supplied array as a single line CSV string
def to_csv(array) @io.rewind @io.truncate(0) @csv << array @io.rewind @io.string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv(array)\n nilfix = array.map { |s| blank(s) ? \"\" : s }\n quoted = nilfix.map { |s| '\"' + s.gsub('\"',\"'\") + '\"' }\n return quoted.join(',')\nend", "def csv(rows)\n rows.map { |r| r.join(';') }.join(\"\\n\")\n end", "def save_as_csv(array)\n final_array = array\n CSV.open(\"emails94.csv\...
[ "0.7749197", "0.75764453", "0.7026806", "0.68263113", "0.67877656", "0.67877656", "0.67139345", "0.66098017", "0.66019064", "0.6571392", "0.650231", "0.64866585", "0.6443145", "0.6411524", "0.63872844", "0.6382767", "0.635947", "0.63576275", "0.6352149", "0.63205427", "0.6306...
0.7778386
0
Compiles a TypeScript file to JavaScript.
def compile_file(filepath, options={}) options = options.clone if options[:output] output_filename = options[:output] elsif options[:output_dir] filename = File.basename(filepath).gsub(/[.]ts$/, '.js') output_filename = File.join(options[:output_dir], filename) else output_filename = filepath.gsub(/[.]ts$/, '.js') end args = [filepath] + flatten_options(options) stdout, stderr, wait_thr = node_compile(*args) if wait_thr.nil? success = stdout.empty? and stderr.empty? else success = wait_thr.value == 0 end if success result = { :js => output_filename, :stdout => stdout, } if options[:source_map] result[:source_map] = output_filename + '.map' end return result else raise TypeScript::Error, ( stderr.empty? ? stdout : stderr ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compileTS ( file )\n puts \"Compiling #{file}\"\n result = TypeScript::Node.compile_file( file )\n fail result.stderr if result.exit_status != 0\n result.js\n end", "def compile(source, *tsc_options)\n js_file = Tempfile.new(%w(typescript-node .ts))\n begin\n ...
[ "0.8419428", "0.7679755", "0.73445517", "0.708651", "0.6729183", "0.6598666", "0.65209705", "0.6261103", "0.60851264", "0.6068642", "0.5991296", "0.59836286", "0.59097636", "0.5909609", "0.5902206", "0.5898093", "0.5832379", "0.58244824", "0.5816169", "0.5814589", "0.5757938"...
0.7481742
2
GET /offers GET /offers.json
def index @offers = Offer.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def get_offers\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n get('offer')\n end", "def index\n @offers = Offer.all\n\n respond...
[ "0.8171875", "0.7944721", "0.79157716", "0.79029083", "0.7764754", "0.76819086", "0.7671478", "0.7586528", "0.7481807", "0.7481807", "0.7466798", "0.74593174", "0.7443136", "0.7368404", "0.73248607", "0.7323364", "0.727816", "0.7111794", "0.70934635", "0.70629996", "0.7034231...
0.73937756
14
GET /offers/1 GET /offers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n form...
[ "0.7893452", "0.7734393", "0.76324385", "0.7481251", "0.7394545", "0.7394545", "0.73184246", "0.7309764", "0.72893107", "0.72650313", "0.7260039", "0.72340804", "0.7228739", "0.72237456", "0.71911067", "0.71911067", "0.71911067", "0.71911067", "0.71791774", "0.7166139", "0.70...
0.0
-1
Crawl Method which will hit the provided service and fetch the offers. This method will filter out the merchants and offers from the set of links fetched. A merchant is created with its respective offer.
def crawl Offer.fetch_offers redirect_to offers_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_offers_for(item)\n return [] unless valid_offers_url?(item.more_offers_url)\n root = Nokogiri::HTML(get_more_offers_page(item.more_offers_url))\n scraped_offers = scrape_offers(root)\n publish(:on_offers_scrapped_for, item, scraped_offers)\n scraped_offers\n end", "def parse_offers(loc...
[ "0.6432751", "0.6138299", "0.5883554", "0.5861007", "0.57116294", "0.5688116", "0.56359416", "0.55497795", "0.5473344", "0.544266", "0.5442365", "0.538268", "0.53784615", "0.53584105", "0.53509974", "0.53274655", "0.53165084", "0.5311219", "0.5311219", "0.5311219", "0.5311219...
0.70724845
0
Use callbacks to share common setup or constraints between actions.
def set_offer @offer = Offer.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def offer_params params.require(:offer).permit(:merchant_id, :title, :description, :url, :expires_at) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
GET /instances GET /instances.json
def index respond_to do |format| format.html format.json { render json: InstancesDatatable.new(view_context) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "def index\n @instances = Instance.all\n render json...
[ "0.8298414", "0.7888994", "0.7575153", "0.7551725", "0.7366865", "0.7276911", "0.72706306", "0.7262274", "0.71395165", "0.70884764", "0.70884764", "0.7082083", "0.6975288", "0.69422376", "0.69419104", "0.68218666", "0.67669797", "0.67655206", "0.6760263", "0.67555255", "0.673...
0.0
-1
General handler utility functions This is a template method that is used to escape results values (returned in execute) that would cause the XML to be invalid. This method is not necessary if values do not contain character that have special meaning in XML (&, ", ), however it is a good practice to use it for all return variable results in case the value could include one of those characters in the future. This method can be copied and reused between handlers.
def escape(string) # Globally replace characters based on the ESCAPE_CHARACTERS constant string.to_s.gsub(/[&"><]/) { |special| ESCAPE_CHARACTERS[special] } if string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_escape(input); end", "def escape_xml(value)\n value.to_s.gsub(/[&<>\"']/) { |s| ESCAPE_TABLE[s] } # or /[&<>\"']/\n end", "def xml_escape(input)\n return input.to_s.to_xs\n end", "def escape(val)\n return val\n end", "def escape_xml(string) \n string.gsub(/...
[ "0.6585935", "0.63006413", "0.61464334", "0.60993546", "0.60156065", "0.59818316", "0.59091586", "0.5875468", "0.5798132", "0.5761985", "0.5635786", "0.5635254", "0.56275445", "0.5520037", "0.55145216", "0.54980874", "0.5495125", "0.54699206", "0.5469752", "0.5449368", "0.543...
0.0
-1
TODO: cleanup unnecessary error stuffs
def matches?(block) old_to = @stream.dup # Obtain a filehandle to replace (works with Readline) @stream.reopen File.open(File.join(Dir.tmpdir, "should_output_#{$$}"), "w+") # Execute block.call # Restore out = @stream.dup @stream.reopen old_to # Grab the data out.rewind @data = out.read # Match up case @expected when Regexp @data.should =~ @expected else @data.should == @expected end # Clean up ensure out.close if out and !out.closed? # STDIO redirection will break else begin @stream.seek 0, IO::SEEK_END rescue Errno::ESPIPE, Errno::EPIPE # Ignore end FileUtils.rm out.path if out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def original_error; end", "def original_error; end", "def recover_from(_error); end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def load_error; end", "def continued_exception; end", "d...
[ "0.67001045", "0.6503747", "0.6503747", "0.6468239", "0.641984", "0.641984", "0.641984", "0.641984", "0.641984", "0.641984", "0.641984", "0.6285848", "0.6181625", "0.6128032", "0.6105435", "0.6058286", "0.6023351", "0.5987944", "0.5981237", "0.5981237", "0.5981237", "0.5972...
0.0
-1
TODO support multiple viewports
def initialize(vk, viewport: { }, scissor: { }) @vk = vk @shader_stages = [] @layouts = [] @constant_ranges = [] @descriptors = [] @input = { topology: :triangles, primitive_restart: false } @viewport = { left: 0, top: 0, width: 640, height: 480, min_depth: 0, max_depth: 1 }.merge(viewport) @scissor = { left: 0, top: 0, width: 0xffffffff, height: 0xffffffff }.merge(scissor) @rasterizer = { depth_clamp: false, discard_all: false, polygon_mode: :fill, line_width: 1.0, cull_mode: :back, front_face: :counter_clockwise, depth_bias: false, depth_bias_clamp: 0, depth_bias_constant: 0, depth_bias_slope: 0 } @multisampling = { sample_shading: false, samples: 1, min_sample_shading: 0.2, sample_mask: nil, alpha_to_coverage: false, alpha_to_one: false } @blending = { enabled: true, color_writes: [ :red, :green, :blue, :alpha ], src_color: :src_alpha, dst_color: :one_minus_src_alpha, src_alpha: :one, dst_alpha: :zero, color_op: :add, alpha_op: :add } @binding_descriptions = [] @attribute_descriptions = [] @dynamic_states = [] @specialization_constants = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_viewport\r\n # Make viewports\r\n @viewport1 = Viewport.new(0, 0, 640, 320)\r\n @viewport2 = Viewport.new(0, 0, 640, 480)\r\n @viewport3 = Viewport.new(0, 0, 640, 480)\r\n @viewport4 = Viewport.new(0, 0, 640, 480)\r\n @viewport2.z = 101\r\n @viewport3.z = 200\r\n @viewport4.z = 500...
[ "0.6157205", "0.61425483", "0.61122954", "0.6106212", "0.6054225", "0.602673", "0.59762543", "0.59537005", "0.5639804", "0.5616005", "0.55986047", "0.5592303", "0.55392796", "0.55323905", "0.55320287", "0.5519079", "0.55111146", "0.5454252", "0.5451369", "0.5429732", "0.54147...
0.0
-1
Supported callback functions connection_established connected pose periodic Under working unlock lock active_change
def start EM.run do @__conn = EventMachine::WebSocketClient.connect(@__socket_url) @__callbacks[:connection_established] && @__conn.callback do instance_exec(&@__callbacks[:connection_established]) end @__callbacks[:error] && @__conn.errback do |e| instance_exec(e, &@__callbacks[:error]) end @__conn.stream do |msg| @__conn.close_connection if msg.data == "done" event = JSON.parse(msg.data)[1] case event['type'] when 'paired' @__event_pool[:paired] = event when 'connected' break unless @__callbacks[:connected] instance_exec(&@__callbacks[:connected]) @__event_pool[:connected] = event when 'arm_synced' @__event_pool[:arm_synced] = event when 'unlocked' puts("unlocked!") @__event_pool[:unlocked] ||= false @__event_pool[:unlocked] = true when 'pose' break unless @__callbacks[:pose] pose = event['pose'] puts "this is pose: " + pose #instance_exec(@__event_pool[:pose][:pose], :off, &@__callbacks[:pose]) if @__event_pool[:pose][:pose] instance_exec(pose, :on, &@__callbacks[:pose]) @__event_pool[:pose] = event when 'orientation' break unless @__callbacks[:periodic] e = OpenStruct.new({ :accel => OpenStruct.new({ :x => event['accelerometer'][0], :y => event['accelerometer'][1], :z => event['accelerometer'][2] }), :gyro => OpenStruct.new({ :x => event['gyroscope'][0], :y => event['gyroscope'][1], :z => event['gyroscope'][2] }), :orientation => OpenStruct.new(event['orientation']) }) @__event_pool[:orientation] = e instance_exec(e, &@__callbacks[:periodic]) end end @__conn.disconnect do EM::stop_event_loop end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_connected\n end", "def on_connected\n\t\t\t\t@@connected = true\n\t\t\t\twhile not @@ensure.empty?\n\t\t\t\t\tfunc = @@ensure.shift\n\t\t\t\t\tensured func[0], *func[1]\t# func[0] == function name, func[1] == arguments\n\t\t\t\tend\n\t\t\t\tpublish('zk_connected')\n\t\t\tend", "def connection_completed...
[ "0.6536326", "0.6221397", "0.6164967", "0.61196315", "0.5916015", "0.5872544", "0.586732", "0.5853808", "0.5849928", "0.5830136", "0.5830136", "0.5830136", "0.57994324", "0.5795651", "0.5764433", "0.5759912", "0.5759912", "0.5692927", "0.5678233", "0.56694436", "0.56567425", ...
0.5656224
21
GET /medidas GET /medidas.json
def index @medidas = Medida.all respond_to do |format| format.html # index.html.erb format.json { render json: @medidas } #format.pdf do # pdf = MedidasPdf.new(@medidas, view_context) # send_data pdf.render, filename: "medidas.pdf", # type: "application/pdf", # disposition: "inline" #end format.pdf {reporte_medidas(@medidas)} format.xls {send_data @medidas.to_xls, :filename => 'reporte.xls' } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @medida = Medida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medida }\n end\n end", "def show\n @unidade_medida = UnidadeMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.7509045", "0.7208597", "0.70045656", "0.69494563", "0.6893356", "0.68416566", "0.6809274", "0.6748922", "0.666699", "0.66198754", "0.6587202", "0.6565434", "0.65458614", "0.65069896", "0.6498332", "0.64963955", "0.6482404", "0.6448348", "0.64417076", "0.6404297", "0.640129...
0.0
-1
GET /medidas/1 GET /medidas/1.json
def show @medida = Medida.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @medida } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @unidade_medida = UnidadeMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_medida }\n end\n end", "def show\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n...
[ "0.7510774", "0.740872", "0.72993684", "0.72367114", "0.7225734", "0.7225199", "0.7131402", "0.7000157", "0.6958874", "0.6956784", "0.69363207", "0.6844287", "0.6825304", "0.677263", "0.66992515", "0.66816735", "0.66404593", "0.66384715", "0.6624641", "0.6611369", "0.6602949"...
0.7767065
0
GET /medidas/new GET /medidas/new.json
def new @medida = Medida.new respond_to do |format| format.html # new.html.erb format.json { render json: @medida } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @unidade_medida = UnidadeMedida.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unidade_medida }\n end\n end", "def new\n @medicamento = Medicamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { ...
[ "0.7673849", "0.76505196", "0.7626473", "0.7541467", "0.746644", "0.74476576", "0.74274206", "0.74026173", "0.73853487", "0.736431", "0.7359774", "0.7297636", "0.7295517", "0.72739285", "0.7269561", "0.7235112", "0.7203534", "0.71738094", "0.71652657", "0.71181333", "0.711339...
0.7999669
0
POST /medidas POST /medidas.json
def create @medida = Medida.new(params[:medida]) respond_to do |format| if @medida.save format.html { redirect_to @medida, notice: 'Medida se ha creado con éxito.' } format.json { render json: @medida, status: :created, location: @medida } else format.html { render action: "new" } format.json { render json: @medida.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @medalha = Medalha.new(medalha_params)\n\n respond_to do |format|\n if @medalha.save\n format.html { redirect_to @medalha, notice: 'Medalha was successfully created.' }\n format.json { render :show, status: :created, location: @medalha }\n else\n format.html { rend...
[ "0.67229056", "0.66952366", "0.6500264", "0.64886737", "0.6481001", "0.6388687", "0.6354134", "0.63438195", "0.63438195", "0.6328977", "0.63096803", "0.62992144", "0.62935644", "0.6271856", "0.6208299", "0.6199227", "0.616915", "0.61403954", "0.61023295", "0.60560876", "0.604...
0.69736016
0
PUT /medidas/1 PUT /medidas/1.json
def update @medida = Medida.find(params[:id]) respond_to do |format| if @medida.update_attributes(params[:medida]) format.html { redirect_to @medida, notice: 'Medida se ha actualizado correctamente.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @medida.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @medida.update(medida_params)\n format.html { redirect_to @medida, notice: 'Unidad medida was successfully updated.' }\n format.json { render :show, status: :ok, location: @medida }\n else\n format.html { render :edit }\n format.json...
[ "0.6921429", "0.6847556", "0.67260194", "0.6720236", "0.6683383", "0.6668607", "0.665465", "0.6643562", "0.66112393", "0.66082436", "0.65730864", "0.65675664", "0.65178573", "0.6512114", "0.64614624", "0.6389441", "0.6381887", "0.6380272", "0.6359773", "0.6358228", "0.6305697...
0.7033592
0
DELETE /medidas/1 DELETE /medidas/1.json
def destroy @medida = Medida.find(params[:id]) if @medida.destroy message = "Medida eliminada correctamente" else message = "Medida No eliminada, contiene dependencias" end respond_to do |format| format.html { redirect_to medidas_url, :notice => message } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @unidade_medida = UnidadeMedida.find(params[:id])\n @unidade_medida.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_medidas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medida.destroy\n respond_to do |format|\n forma...
[ "0.75034916", "0.739012", "0.73766834", "0.7351802", "0.7329697", "0.7324184", "0.73103684", "0.73030835", "0.72956884", "0.72857183", "0.72289306", "0.721111", "0.7198863", "0.7190818", "0.71822226", "0.7154424", "0.71383643", "0.7127287", "0.71202946", "0.7090932", "0.70885...
0.71317786
17
Use callbacks to share common setup or constraints between actions.
def set_mood @mood = Mood.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Only allow a trusted parameter "white list" through.
def mood_params params.require(:mood).permit(:status, :time, :reason, :user_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.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
Retrieve keys from file/stdin
def get_keys_from_commandline(filename=nil) ARGV << filename unless filename.nil? return_keys = [] ARGF.each do |line| return_keys << line.chomp! end ARGV << '-' # close ARGF return_keys.each { |key| verify_key(key) } return_keys end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_keys_file(path)\n return [] unless File.exists?(path)\n File.readlines(path).map! { |l| l.chomp.strip }\n end", "def read_key_file_for_add(file)\n if file.nil?\n if $stdin.tty?\n info \"Paste a public key, then hit <ctrl+d> twice.\"\n key = Dotgpg::Key.read($st...
[ "0.7070969", "0.6890355", "0.64317423", "0.6419398", "0.6386319", "0.63223076", "0.62945116", "0.6243742", "0.61785877", "0.6175719", "0.6165203", "0.61060333", "0.6092908", "0.6077547", "0.60535413", "0.5995376", "0.5968735", "0.5958796", "0.5922167", "0.58999497", "0.587430...
0.7374161
0
if user is logged in, return current_user, else return guest_user
def current_or_guest_user if current_user if session[:guest_user_id] && session[:guest_user_id] != current_user.id logging_in session[:guest_user_id] = nil end current_user else guest_user end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_or_guest_user\n if current_user\n transfer_session_to_logged_in_user if session[:guest_user_id].present?\n current_user\n else\n guest_user\n end\n end", "def current_or_guest_user\n if user_signed_in? then current_user else guest_user end\n end", "def current_or_gu...
[ "0.8972537", "0.89303094", "0.88523144", "0.8651935", "0.853423", "0.853423", "0.85133153", "0.84569985", "0.8417819", "0.84024686", "0.8402046", "0.8398895", "0.8398895", "0.83985436", "0.83967316", "0.83779323", "0.8376421", "0.8368573", "0.83656144", "0.83558625", "0.83558...
0.8694018
3
find guest_user object associated with the current session, creating one as needed
def guest_user(with_retry = true) # Cache the value the first time it's gotten. @cached_guest_user ||= User.find(session[:guest_user_id] ||= create_guest_user.id) rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid session[:guest_user_id] = nil guest_user if with_retry end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guest_user\n User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user\n end", "def guest_user\n User.find(session[:guest_user_id].nil? ? session[:guest_user_id] = creat...
[ "0.8470449", "0.8451743", "0.84341997", "0.83501446", "0.82567453", "0.82224774", "0.82224774", "0.82161653", "0.81839544", "0.81606865", "0.8078032", "0.80538064", "0.8025579", "0.801468", "0.79474324", "0.79386055", "0.7862031", "0.7785836", "0.77789694", "0.77545303", "0.7...
0.7612736
28
called (once) when the user logs in, insert any code your application needs to hand off from guest_user to current_user.
def logging_in current_user.absorb_from(guest_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logging_in\n logger.debug \"ApplicationController:logging_in >>> \"\n current_user.transfer_data(guest_user)\n end", "def logging_in\n\t\tguest_comments = guest_user.comments.all\n\t\tguest_comments.each do |comment|\n\t\t\tcomment.user_id = current_user.id\n\t\t\tcomment.save!\n\t\tend\n\t\tguest_not...
[ "0.76545906", "0.7417004", "0.70993006", "0.7069182", "0.69960326", "0.69612724", "0.6960114", "0.6960114", "0.6960114", "0.6960114", "0.69566405", "0.6956096", "0.69517374", "0.6908953", "0.68947226", "0.68411946", "0.67875904", "0.6775122", "0.67685986", "0.6762087", "0.672...
0.7561395
1
Redirect to the requested page after signing in
def after_sign_in_path_for(resource) session["user_return_to"] || root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signed_in_user\n unless signed_in?\n store_location #record url of intended page before redirect\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def redirect_to_login_page\n query_params = request.query_parameters\n query_params.merge!(return_to: request.path)\n\n ...
[ "0.77445614", "0.77366", "0.7609968", "0.7609968", "0.75382936", "0.74867225", "0.7486445", "0.74856937", "0.7472128", "0.7458721", "0.74527425", "0.74393165", "0.7435305", "0.743511", "0.7415627", "0.73916644", "0.7382576", "0.7370469", "0.7355671", "0.73350877", "0.7327652"...
0.0
-1
w konstruktorze wstrzykuejmy tutaj instancje Operations
def Calculate(x,y) do #to mam nam zwrocic dwa stringi latexowe, tablica whatever gotowe do druku end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operations; end", "def operations; end", "def operation; end", "def operation(*_)\n raise 'not implemented'\n end", "def initialize(*arguments)\n @arguments = arguments\n @operations = []\n end", "def create_op\n\t\t\tring = current_ring\n\t\t\top = (self.respond_to?(:op) && ...
[ "0.7389176", "0.7389176", "0.7280533", "0.6439976", "0.6423605", "0.637093", "0.63459337", "0.6324426", "0.63140833", "0.6234913", "0.6197272", "0.6165209", "0.61507326", "0.60896325", "0.6044825", "0.60376865", "0.60286343", "0.5997621", "0.5967049", "0.5941537", "0.59336364...
0.0
-1
If you need authentication logic, assign a Proc to Garage.docs.configuration.docs_authorization_method. Example: Garage.docs.configuration.docs_authorization_method do |args| if name.start_with?("admin_") args[:user].admin? else true end end
def visible_to?(user) if method = Garage.configuration.docs.docs_authorization_method method.call(document: self, user: user) else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorization(*args, &block); end", "def authorize(verb); send_or_default(\"authorize_#{verb}\",true) ; end", "def authenticate_active_admin_user\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n send(active_admin_n...
[ "0.6274595", "0.6235718", "0.604033", "0.5928822", "0.5925991", "0.5876786", "0.58731234", "0.585014", "0.58410597", "0.5792424", "0.5775368", "0.5748071", "0.5746015", "0.5719865", "0.5708999", "0.5708999", "0.5708038", "0.56924105", "0.5685736", "0.5685736", "0.5641049", ...
0.5662296
20
validate :origin_complete validate :destination_complete
def build_email_content txt = I18n.t("estimate_request.fltk.email_content", :origin => self.origin_port.name, :destination => destination_port.name, :count => self.estimate_items.first.number_of_items, :description => self.estimate_items.first.description) txt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validation_origin_destination\n errors.add(:base,\"Origin and Destination must be different\") if locale_origin_id == locale_destination_id # Rails3 slightly different?\n end", "def ensure_valid_origin_and_destination(player)\n reset_origin_and_destination\n ensure_valid_origin(player) until !@o...
[ "0.75685304", "0.68077946", "0.6605376", "0.64060026", "0.63521993", "0.6302603", "0.6248893", "0.6248893", "0.6084031", "0.6061894", "0.60558015", "0.60010695", "0.5970524", "0.5942762", "0.5834744", "0.58254266", "0.5791098", "0.57865226", "0.57853246", "0.5780166", "0.5756...
0.0
-1
POST request to change show to watched
def watched_tvshow @watch = Watchlist.find_by(show_watched: false, user_id: params[:user_id], tv_show_id: params[:tv_show_id]) if @watch @watch.update(show_watched: true) render json: @watch else render json: { error: "Something went wrong" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_show\n server_id = params[:server]\n user_id = @current_user.id\n show = params[:show]\n\n if server_id.nil? || show.nil?\n render :json => {error:'please enter correct params'}\n return\n end\n\n up = UserPermission.where(user_id:user_id, server_id:server_id).first\n\n un...
[ "0.61067456", "0.60135585", "0.5896506", "0.5805469", "0.57810664", "0.5769888", "0.5765345", "0.5715358", "0.5691228", "0.5686285", "0.5686265", "0.5648426", "0.5613828", "0.5613828", "0.56109285", "0.56007516", "0.55607694", "0.55492556", "0.55348974", "0.552976", "0.552976...
0.73290175
0
DLEETE request to remove wathclist
def remove_tvshow @watch = Watchlist.find_by(show_watched: false, user_id: params[:user_id], tv_show_id: params[:tv_show_id]) if @watch @watch.destroy render json: @watch else render json: { error: "Something went wrong" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove list\n list_action list, \"remove\"\n end", "def destroy\n @wellist.destroy\n\n head :no_content\n end", "def remove list\n remove = @watch.objects.find { |obj| obj.name == \"remove\" }\n\n obix = OBIX::Builder.new do |obix|\n obix.obj is: \"obix:WatchIn\" do |obix|\n...
[ "0.6507535", "0.63298684", "0.6244101", "0.6075164", "0.60540617", "0.5910465", "0.5884319", "0.5847864", "0.5842659", "0.5833158", "0.58221096", "0.5803351", "0.5802323", "0.57687587", "0.5757693", "0.57446635", "0.5727193", "0.5726542", "0.572249", "0.572249", "0.572249", ...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:user_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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Only allow a trusted parameter "white list" through.
def watchlist_params params.require(:watchlist).permit(:user_id, :tv_show_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.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 /leaf_spot_imm_searches GET /leaf_spot_imm_searches.json
def index @leaf_spot_imm_searches = LeafSpotImmSearch.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_leaf_spot_imm_search\n @leaf_spot_imm_search = LeafSpotImmSearch.find(params[:id])\n end", "def leaf_spot_imm_search_params\n params.require(:leaf_spot_imm_search).permit(:search_id, :leaf_spot_imm_id)\n end", "def index\n @search = WordRoot.ransack(params[:q])\n @word_roots = @...
[ "0.7002329", "0.6680524", "0.6360336", "0.6002374", "0.594759", "0.5936186", "0.59035736", "0.58770686", "0.5854715", "0.5835244", "0.5832496", "0.5823618", "0.57928723", "0.57237566", "0.5723646", "0.5707511", "0.57050204", "0.5703179", "0.5700361", "0.56868213", "0.5672963"...
0.7771079
0
GET /leaf_spot_imm_searches/1 GET /leaf_spot_imm_searches/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @leaf_spot_imm_searches = LeafSpotImmSearch.all\n end", "def set_leaf_spot_imm_search\n @leaf_spot_imm_search = LeafSpotImmSearch.find(params[:id])\n end", "def leaf_spot_imm_search_params\n params.require(:leaf_spot_imm_search).permit(:search_id, :leaf_spot_imm_id)\n end", "d...
[ "0.75964737", "0.7059821", "0.6557024", "0.6318823", "0.62202275", "0.6103193", "0.607459", "0.60558397", "0.59986216", "0.5993699", "0.5937954", "0.59330165", "0.5929788", "0.59000385", "0.5876035", "0.5869741", "0.5867246", "0.5847813", "0.5796441", "0.5792615", "0.57847506...
0.0
-1